rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
err.append('Title is required') | err.append('Workgroup name is required') | def admin_addworkgroup(self, title='', location='', role='', REQUEST=None): """ """ err = [] if title=='': err.append('Title is required') if location=='': err.append('Location is required') else: try: #check for a valid location ob = self.unrestrictedTraverse(location) except: err.append('Invalid location') else: #che... |
for t in self.utConvertToList(roles): role, location = t.split('||') if location == '/': location = '' loc = self.unrestrictedTraverse(location) if location != '': res = self.utListDifference( loc.get_local_roles_for_userid(name), [role]) if len(res): loc.manage_setLocalRoles(name, res) else: loc.manage_delLocalRoles([... | auth_tool = self.getAuthenticationTool() for location in self.utConvertToList(roles): auth_tool.manage_revokeUserRole(name, location, REQUEST) if REQUEST is not None: | def admin_revokeuserroles(self, name='', roles=[], REQUEST=None): """ Revoke roles from an user. """ redirect_url = REQUEST.environ.get('HTTP_REFERER', '%s/admin_userroles_html?name=%s' % (self.absolute_url(), name)) if len(roles) == 0: if REQUEST is not None: self.setSessionErrorsTrans("No role(s) selected") return RE... |
return '<%(cls)s %(fname)r (%(mime)s, %(size)d bytes)>' % { | return '<%(cls)s %(fname)r (%(mime)s, %(size)r bytes)>' % { | def __repr__(self): return '<%(cls)s %(fname)r (%(mime)s, %(size)d bytes)>' % { 'cls': self.__class__.__name__, 'fname': self.filename, 'mime': self.content_type, 'size': self.size, } |
sortorder=prop.order, | sortorder=int(prop.order) + 300, | def _update(self, portal): """ Check all dynamic properties and create an equivalent widget in SchemaTool. After deleting/adding widgets. |
return sorted(ret, key=lambda user: str(user['name']).lower()) | return sorted(ret, key=lambda user: user['name'].lower()) | def get_local_usernames(self): local_users = self.user_names() ret = [{'name': self.getUserFullName(self.getUser(user_id)), 'uid': user_id} for user_id in local_users] return sorted(ret, key=lambda user: str(user['name']).lower()) |
def search_directory(self, search_string=u''): | def search_directory(self, search_string=u'', sort_by=''): | def search_directory(self, search_string=u''): """ """ search_string = search_string.lower() local_users_list = self.search_local_users(search_string) external_users_list = self.search_external_users(search_string) user_list = local_users_list + external_users_list return self.user_list_html(search_string=search_string... |
full_name = user.firstname + ' ' + user.lastname if search_string in full_name.lower(): | if search_string in user.name.lower(): | def search_local_users(self, search_string=u''): ret = [] portal = self.getSite() acl_tool = portal.getAuthenticationTool() local_users = acl_tool.getUsers() for user in local_users: full_name = user.firstname + ' ' + user.lastname if search_string in full_name.lower(): ret.append(self.get_local_user_info(user)) return... |
if name[0] not in 'oict': | if not(name and name[0] in 'oict'): | def __getattr__(self, name): """ Called when an attribute lookup has not found the attribute in the usual places. @param name: the attribute name @return: should return the attribute value or raise an I{AttributeError} exception. """ # this is for performance reasons # it should be updated if/when adding new computed a... |
return gloss_elem[0].get_translation_by_language(lang_name) | return gloss_elem[0].getObject().get_translation_by_language(lang_name) | def getLanguagesGlossaryTrans(self, p_id, lang_name): try: gloss_elem = self.getLanguagesGlossary().cu_search_catalog_by_id(p_id) return gloss_elem[0].get_translation_by_language(lang_name) except: return '' |
results.extend(self.query_objects_ex(meta_type, query, self.gl_get_selected_language(), path=self.absolute_url(1), approved=1)) | results.extend(self.query_objects_ex(meta_type, query, self.gl_get_selected_language(), path=REQUEST.get('path', ''), approved=1)) | def search(self, REQUEST): """ folder search """ results = [] query = REQUEST.get('query', '') meta_type = self.get_meta_types() if query: results = [] results.extend(self.query_objects_ex(meta_type, query, self.gl_get_selected_language(), path=self.absolute_url(1), approved=1)) results = self.utEliminateDuplicatesByUR... |
security.declarePublic('styleselect') | security.declarePublic('styleselect_text') | def includeLibs(self, lang=None): """ Returns HTML code that includes required JavaScript libraries. Parameters: `lang` **Not used** """ return '<script language="JavaScript" \ |
css_url = '/'.join(self.getPhysicalPath()) + '/styleselect' | css_url = '/'.join(self.getPhysicalPath()) + '/styleselect_text' | def _add_styleselect_to_cfg(self, cfg): """ Adds a style select box to the front of the first row of buttons if it can find the styles file it needs if not it does nothing |
exf = NaayaTestCase.load_test_file('test.txt', globals()) | from os import path from StringIO import StringIO f=open(path.join(path.dirname(__file__), 'test.txt'), 'rb') exf = StringIO(f.read()) f.close() exf.filename = 'test.txt' | def test_main_exfile(self): """ Test the simple consultation exfile functionality """ addNySimpleConsultation(self.test_folder, id='scs') scs = self.test_folder._getOb('scs') |
for uid in meeting_ob.participants.uids: | for uid in meeting_ob.participants.attendees.keys(): | def jstree_participants(self): """ """ jstree, participants = [], {} site = self.getSite() meeting_config = meeting_module.get_config() meeting_obs = site.getCatalogedObjectsCheckView(meta_type=meeting_config['meta_type'], approved=1) |
for uid in meeting.participants.uids: | for uid in meeting.participants.attendees.keys(): | def jstree_organisations(self): """ """ jstree, organisations = [], {} site = self.getSite() meeting_config = meeting_module.get_config() meeting_obs = site.getCatalogedObjectsCheckView(meta_type=meeting_config['meta_type'], approved=1) |
if answer_id or not self.allow_multiple_answers: | if answer_id is not None: | def addSurveyAnswer(self, REQUEST=None, notify_respondent=False, **kwargs): """Add someone's answer""" try: if self.expired(): raise SurveyQuestionnaireException("The survey has expired") except SurveyQuestionnaireException, ex: if REQUEST: self.setSessionErrorsTrans(str(ex)) return REQUEST.RESPONSE.redirect('%s/index_... |
'Deleted previous answer %s' % (old_answer.absolute_url())) | 'Deleted previous answer %s' % old_answer.absolute_url()) | def addSurveyAnswer(self, REQUEST=None, notify_respondent=False, **kwargs): """Add someone's answer""" try: if self.expired(): raise SurveyQuestionnaireException("The survey has expired") except SurveyQuestionnaireException, ex: if REQUEST: self.setSessionErrorsTrans(str(ex)) return REQUEST.RESPONSE.redirect('%s/index_... |
auth_logger.debug('start sending emails for group %s', group) def db_callback(): return site._p_jar._db | def start_sending_emails(site, group, userids, roles, loc, location): """ start the thread to send the emails the thread gets the db, the path to the current site and all the other arguments required to send each email """ site_path = ofs_path(site) db = site._p_jar._db t = threading.Thread(target=send_emails, args=(db... | |
db = site._p_jar._db t = threading.Thread(target=send_emails, args=(db, site_path, group, userids, roles, loc, location)) t.start() | add_job(db_callback, site_path, group, userids, roles, loc, location) | def start_sending_emails(site, group, userids, roles, loc, location): """ start the thread to send the emails the thread gets the db, the path to the current site and all the other arguments required to send each email """ site_path = ofs_path(site) db = site._p_jar._db t = threading.Thread(target=send_emails, args=(db... |
elif re.search('^' + pt_start, tal) is None: | elif re.search('^' + pt_start, tal) is not None: | def _update(self, portal): t = '%(info)s folder: <a href="%(url)s/manage_main">%(text)s</a>' pt_start = '<metal:block metal:define-macro="page" metal:extend-macro="here/standard_template_macro">' old_meta_slot = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" ?/>' meta_slot_start = '<metal:block fil... |
if skey not in ('news_date', ): skey = 'news_date' | def getNewsListing(self, query='', languages=[], nt='', nd='', nc='', skey='', rkey='', ps_start='', p_context=None, **kwargs): """ Returns a list of news Use memcache if available. | |
if query == '' and et == '' and gz and es == '' and sd == '' and ed == '': | if query == '' and et == '' and not gz and es == '' and sd == '' and ed == '': | def getEventsListing(self, query='', languages=[], et='', gz='', es='', skey='', rkey=0, sd='', ed='', p_context=None, ps_start='', **kwargs): """ Returns a list of events """ if gz != '' and not isinstance(gz, list): gz = [gz] try: ps_start = int(ps_start) except: ps_start = 0 if skey not in ('start_date', ): skey ... |
return get_node_title('event_types', id) | return self.get_node_title('event_types', id) | def getEventTypeTitle(self, id): """ Return the title of an item for the selection list for event types. """ return get_node_title('event_types', id) |
if REQUEST.REQUEST_METHOD == 'POST': uids = REQUEST.form.get('uids', []) assert isinstance(uids, list) for uid in uids: self._set_attendee(uid, role) | uids = REQUEST.form.get('uids', []) assert isinstance(uids, list) for uid in uids: self._set_attendee(uid, role) | def setAttendees(self, role, REQUEST): """ """ if REQUEST.REQUEST_METHOD == 'POST': uids = REQUEST.form.get('uids', []) assert isinstance(uids, list) for uid in uids: self._set_attendee(uid, role) return REQUEST.RESPONSE.redirect(self.absolute_url()) |
if REQUEST.REQUEST_METHOD == 'POST': uids = REQUEST.form.get('uids', []) assert isinstance(uids, list) for uid in uids: self._del_attendee(uid) | uids = REQUEST.form.get('uids', []) assert isinstance(uids, list) for uid in uids: self._del_attendee(uid) | def delAttendees(self, REQUEST): """ """ if REQUEST.REQUEST_METHOD == 'POST': uids = REQUEST.form.get('uids', []) assert isinstance(uids, list) for uid in uids: self._del_attendee(uid) return REQUEST.RESPONSE.redirect(self.absolute_url()) |
if REQUEST.REQUEST_METHOD == 'POST': if 'del_attendees' in REQUEST.form: return self.delAttendees(REQUEST) elif 'set_administrators' in REQUEST.form: return self.setAttendees('Administrator', REQUEST) elif 'set_participants' in REQUEST.form: return self.setAttendees(PARTICIPANT_ROLE, REQUEST) | if 'del_attendees' in REQUEST.form: return self.delAttendees(REQUEST) elif 'set_administrators' in REQUEST.form: return self.setAttendees('Administrator', REQUEST) elif 'set_participants' in REQUEST.form: return self.setAttendees(PARTICIPANT_ROLE, REQUEST) | def onAttendees(self, REQUEST): """ """ if REQUEST.REQUEST_METHOD == 'POST': if 'del_attendees' in REQUEST.form: return self.delAttendees(REQUEST) elif 'set_administrators' in REQUEST.form: return self.setAttendees('Administrator', REQUEST) elif 'set_participants' in REQUEST.form: return self.setAttendees(PARTICIPANT_R... |
if not is_valid_email(email): errors['email'] = True if not organisation: errors['organisation'] = True | def subscribe(self, REQUEST, notif_type, lang=None): """ Add a new subscribtion. First to a temporary list, then after confirmation to the correct container """ email = REQUEST.get('email', '') organisation = REQUEST.get('organisation', '') sector = REQUEST.get('sector', '') country = REQUEST.get('country', '') errors... | |
notificationTool = self.getSite().portal_anonymous_notification notificationTool.add_email_subscription( email, organisation, sector, country, notif_type, lang, str(self.absolute_url()) + '/confirm' ) except ValueError, e: if is_valid_email(email): errors['email_exists'] = True | if 'Anonymous User' != REQUEST.AUTHENTICATED_USER.getUserName(): errors['message'] = 'Only non-registered users can submit this form' else: notificationTool = self.getSite().portal_anonymous_notification notificationTool.add_email_subscription( email, organisation, sector, country, notif_type, lang, str(self.absolute_u... | def subscribe(self, REQUEST, notif_type, lang=None): """ Add a new subscribtion. First to a temporary list, then after confirmation to the correct container """ email = REQUEST.get('email', '') organisation = REQUEST.get('organisation', '') sector = REQUEST.get('sector', '') country = REQUEST.get('country', '') errors... |
contacts = search(meta_type=['Naaya Contact'], path=location) | path = physical_path(self) if location not in ('', '/'): if not location.startswith('/'): location = '/' + location path += location contacts = search(meta_type=['Naaya Contact'], path=path) | def sendMailToContacts(self, subject='', content='', location='', REQUEST=None): """ """ search = self.getCatalogedObjectsCheckView contacts = search(meta_type=['Naaya Contact'], path=location) addresses = [contact.email for contact in contacts] |
forms_list_tmp.append(form_id) | if form_id not in forms_list_tmp: forms_list_tmp.append(form_id) | def get_report(self, forms, all_forms=False, portals='', p_action='', REQUEST=None): if not REQUEST.has_key('show_report'): # TODO: remove this return |
return self.getFormsTool().getContent({'here': self}, 'site_admin_linkslist') | permission_names = self.get_naaya_permissions_in_site() sorted_perm = sorted((permission_names[zope_perm], zope_perm) for zope_perm in permission_names) tmpl = self.getFormsTool().getForm('site_admin_linkslist').__of__(self) options = {'sorted_perm': sorted_perm} return tmpl(REQUEST, **options) | def admin_linkslist_html(self, REQUEST=None, RESPONSE=None): """ """ return self.getFormsTool().getContent({'here': self}, 'site_admin_linkslist') |
self.setSessionInfo([MESSAGE_SAVEDCHANGES % self.utGetTodayDate()]) | self.setSessionInfoTrans(MESSAGE_SAVEDCHANGES, date=self.utGetTodayDate()) | def saveProperties(self, title='', description='', sortorder='', start_date='', end_date='', public_registration='', allow_file='', line_comments='', file='', lang='', REQUEST=None): """ """ |
self.setSessionInfo([MESSAGE_SAVEDCHANGES % self.utGetTodayDate()]) | self.setSessionInfoTrans(MESSAGE_SAVEDCHANGES, date=self.utGetTodayDate()) | def admin_deleteratelist(self, ids=[], REQUEST=None): """ """ self.manage_delObjects(self.utConvertToList(ids)) if REQUEST: self.setSessionInfo([MESSAGE_SAVEDCHANGES % self.utGetTodayDate()]) REQUEST.RESPONSE.redirect('%s/admin_ratelists_html' % self.absolute_url()) |
self.setSessionInfo([MESSAGE_SAVEDCHANGES % self.utGetTodayDate()]) | self.setSessionInfoTrans(MESSAGE_SAVEDCHANGES, date=self.utGetTodayDate()) | def admin_addratelist(self, id='', title='', description='', REQUEST=None): """ """ self.manage_addRateList(id, title, description) if REQUEST: self.setSessionInfo([MESSAGE_SAVEDCHANGES % self.utGetTodayDate()]) REQUEST.RESPONSE.redirect('%s/admin_ratelists_html' % self.absolute_url()) |
self.setSessionInfo([MESSAGE_SAVEDCHANGES % self.utGetTodayDate()]) | self.setSessionInfoTrans(MESSAGE_SAVEDCHANGES, date=self.utGetTodayDate()) | def admin_editratelist(self, id='', title='', description='', REQUEST=None): """ """ ob = self.getRateListById(id) if ob is not None: ob.manageProperties(title, description) if REQUEST: self.setSessionInfo([MESSAGE_SAVEDCHANGES % self.utGetTodayDate()]) REQUEST.RESPONSE.redirect('%s/admin_ratelist_html?id=%s' % (self.a... |
self.setSessionInfo([MESSAGE_SAVEDCHANGES % self.utGetTodayDate()]) | self.setSessionInfoTrans(MESSAGE_SAVEDCHANGES, date=self.utGetTodayDate()) | def admin_deleteitems(self, id='', ids=[], REQUEST=None): """ """ ob = self.getRateListById(id) if ob is not None: ob.manage_delete_items(self.utConvertToList(ids)) if REQUEST: self.setSessionInfo([MESSAGE_SAVEDCHANGES % self.utGetTodayDate()]) REQUEST.RESPONSE.redirect('%s/admin_ratelist_html?id=%s' % (self.absolute_u... |
self.setSessionInfo([MESSAGE_SAVEDCHANGES % self.utGetTodayDate()]) | self.setSessionInfoTrans(MESSAGE_SAVEDCHANGES, date=self.utGetTodayDate()) | def admin_additem(self, id='', item='', title='', REQUEST=None): """ """ ob = self.getRateListById(id) if ob is not None: ob.manage_add_item(item, title) if REQUEST: self.setSessionInfo([MESSAGE_SAVEDCHANGES % self.utGetTodayDate()]) REQUEST.RESPONSE.redirect('%s/admin_ratelist_html?id=%s' % (self.absolute_url(), id)) |
self.setSessionInfo([MESSAGE_SAVEDCHANGES % self.utGetTodayDate()]) | self.setSessionInfoTrans(MESSAGE_SAVEDCHANGES, date=self.utGetTodayDate()) | def saveProperties(self, REQUEST=None, **kwargs): """ """ if not self.checkPermissionEditObject(): raise EXCEPTION_NOTAUTHORIZED, EXCEPTION_NOTAUTHORIZED_MSG |
self.setSessionInfo([MESSAGE_SAVEDCHANGES % self.utGetTodayDate()]) | self.setSessionInfoTrans(MESSAGE_SAVEDCHANGES, date=self.utGetTodayDate()) | def saveUpload(self, source='file', file='', url='', lang=None, REQUEST=None): """ """ if REQUEST: username = REQUEST.AUTHENTICATED_USER.getUserName() else: username = self.REQUEST.AUTHENTICATED_USER.getUserName() |
brains_by_day[day] = catalog({'meta_type': meta_type, interval_idx: date}) | brains_by_day[day].extend(catalog({'meta_type': meta_type, interval_idx: date})) | def hasEventsByDay(self, year, month): """Returns if there are any events for each date in this month """ brains_by_day = {} catalog = self.unrestrictedTraverse(self.catalog) |
options = {'sorted_perm': sorted_perm} | options = {'permission_names': permission_names, 'sorted_perm': sorted_perm} | def admin_linkslist_html(self, REQUEST=None, RESPONSE=None): """ """ permission_names = self.get_naaya_permissions_in_site() sorted_perm = sorted((permission_names[zope_perm], zope_perm) for zope_perm in permission_names) |
convert = lambda value: unicode(value) getter = getter_factory(prop_name, subname, convert) | getter = getter_factory(prop_name, subname, simple_convert) | def getter(ob): try: ob_property = getattr(ob, prop_name) |
res = s.split(separator) | res = [x for x in s.split(separator) if x.strip() != ''] | def splitToList(self, s, separator=','): """Gets a comma separated string and returns a list""" res = [] if s!='': res = s.split(separator) return res |
def get_tree_json_data(self, REQUEST): | def get_tree_json_data(self): | def get_tree_json_data(self, REQUEST): """ """ REQUEST.RESPONSE.setHeader('Content-type', 'application/json') return json.dumps(self.get_tree_data()) |
REQUEST.RESPONSE.setHeader('Content-type', 'application/json') | def get_tree_json_data(self, REQUEST): """ """ REQUEST.RESPONSE.setHeader('Content-type', 'application/json') return json.dumps(self.get_tree_data()) | |
def search_rdf(self, REQUEST=None, RESPONSE=None): | def search_rdf(self, REQUEST=None, **kwargs): | def search_rdf(self, REQUEST=None, RESPONSE=None): """ """ search_mapping = RDF_SEARCH_MAPPING search_query_mapping = RDF_SEARCH_QUERY_MAPPING |
form = REQUEST.form | if REQUEST.form: form = dict(REQUEST.form) else: form = dict(kwargs) | def search_rdf(self, REQUEST=None, RESPONSE=None): """ """ search_mapping = RDF_SEARCH_MAPPING search_query_mapping = RDF_SEARCH_QUERY_MAPPING |
gz = kwargs.get('gz', []) | gz = kwargs.get('gz', []) if not isinstance(gz, list): gz = [gz] | def getNewsListing(self, query='', languages=[], nt='', nd='', nc='', skey='', rkey='', ps_start='', p_context=None, **kwargs): """ Returns a list of news Use memcache if available. |
if query == '' and et == '' and gz == '' and es == '' and sd == '' and ed == '': | if query == '' and et == '' and gz and es == '' and sd == '' and ed == '': | def getEventsListing(self, query='', languages=[], et='', gz='', es='', skey='', rkey=0, sd='', ed='', p_context=None, ps_start='', **kwargs): """ Returns a list of events """ try: ps_start = int(ps_start) except: ps_start = 0 if skey not in ('start_date', ): skey = 'start_date' catalog_tool = self.getCatalogTool() ... |
self.update_portlet(portal, 'portlet_mainsections') | self.update_portlet(portal, 'portlet_maincategories') | def _update(self, portal): self.update_portlet(portal, 'portlet_mainsections') self.update_images(portal, ['ep_expand.gif', 'ep_collapse.gif']) return True |
for node in nodes: node.children = self.get_node_children(node.id) | def get_tree(self): """ Get tree as a list of dictionaries ordered by weight """ nodes = self.get_tree_nodes() data = [] for node in nodes: node.children = self.get_node_children(node.id) | |
ret_dict[node] = map(recurse_get_tree, node.children) | ret_dict[node] = map(recurse_get_tree, self.get_node_children(node.id)) | def recurse_get_tree(node): if node.id not in visited: if node.parent == None or node.parent in visited: visited.append(node.id) ret_dict = {} ret_dict[node] = [] if hasattr(node, 'children'): ret_dict[node] = map(recurse_get_tree, node.children) return ret_dict |
if REQUEST and not self.getParentNode().checkPermissionPublishObjects(): | if REQUEST and not self.getParentNode().checkPermissionView(): | def do_export(self, REQUEST=None): """ """ if REQUEST and not self.getParentNode().checkPermissionPublishObjects(): raise Unauthorized |
if self.user_has_view_permission(obj): | if self.is_exportable(obj): | def do_export(self, REQUEST=None): """ """ if REQUEST and not self.getParentNode().checkPermissionPublishObjects(): raise Unauthorized |
security.declareProtected(PERMISSION_PUBLISH_OBJECTS, 'admin_editrole_html') | def admin_deleteusers(self, names=[], REQUEST=None): """ """ self.getAuthenticationTool().manage_delUsers(names) if REQUEST: self.setSessionInfoTrans(MESSAGE_SAVEDCHANGES, date=self.utGetTodayDate()) REQUEST.RESPONSE.redirect(REQUEST.environ.get('HTTP_REFERER', '%s/admin_users_html' % self.absolute_url())) | |
'permission_names': permission_names, | 'sorted_perm': sorted_perm, | def admin_editrole_html(self, role, REQUEST): """ """ permission_names = self.get_naaya_permissions_in_site() zope_perm_for_role = {} for zope_perm in permission_names: p = Permission(zope_perm, (), self) zope_perm_for_role[zope_perm] = bool(role in p.getRoles()) |
'jquery-ui.js':ImageFile('www/js/jquery-1.4.2.min.js', globals()), | 'jquery-ui.js':ImageFile('www/js/jquery-ui-1.8.1.custom.min.js', globals()), | def initialize(context): """ """ #register classes context.registerClass( NySite.NySite, permission = PERMISSION_ADD_SITE, constructors = ( NySite.manage_addNySite_html, NySite.manage_addNySite, ), icon = 'www/Site.gif', ) context.registerClass( NyFolder.NyFolder, permission = PERMISSION_ADD_FOLDER, constructors = ( Ny... |
security.declareProtected(PERMISSION_EDIT_OBJECTS, 'upload_file') | security.declareProtected(PERMISSION_ADD_OBJECT, 'upload_file') | def __init__(self, id): self.id = id |
def search_geo_clusters(self, meta_types=None, lat_min=None, lat_max=None, lon_min=None, lon_max=None, zoom_level=None, path='', geo_types=None, query='', approved=True, lat_center=None, lon_center=None, | def search_geo_clusters(self, meta_types=None, lat_min=None, lat_max=None, lon_min=None, lon_max=None, path='', geo_types=None, query='', approved=True, | def search_geo_clusters(self, meta_types=None, lat_min=None, lat_max=None, lon_min=None, lon_max=None, zoom_level=None, path='', geo_types=None, query='', approved=True, lat_center=None, lon_center=None, landscape_type=[], administrative_level=[], languages=None): """ Returns all the clusters that match the specified c... |
if zoom_level is None: zoom_level = 0 | def search_geo_clusters(self, meta_types=None, lat_min=None, lat_max=None, lon_min=None, lon_max=None, zoom_level=None, path='', geo_types=None, query='', approved=True, lat_center=None, lon_center=None, landscape_type=[], administrative_level=[], languages=None): """ Returns all the clusters that match the specified c... | |
if lat_center is None or lat_center == '': lat_center = 0. if lon_center is None or lon_center == '': lon_center = 0. zoom_level = int(zoom_level) | def search_geo_clusters(self, meta_types=None, lat_min=None, lat_max=None, lon_min=None, lon_max=None, zoom_level=None, path='', geo_types=None, query='', approved=True, lat_center=None, lon_center=None, landscape_type=[], administrative_level=[], languages=None): """ Returns all the clusters that match the specified c... | |
lat_center, lon_center = float(lat_center), float(lon_center) if float(lon_min) > float(lon_max): lon_min, lon_max = lon_max, lon_min if float(lon_min) < float(lon_center) < float(lon_max): | if float(lon_min) < float(lon_max): | def search_geo_clusters(self, meta_types=None, lat_min=None, lat_max=None, lon_min=None, lon_max=None, zoom_level=None, path='', geo_types=None, query='', approved=True, lat_center=None, lon_center=None, landscape_type=[], administrative_level=[], languages=None): """ Returns all the clusters that match the specified c... |
filters = self.build_geo_filters(path=path, meta_types=meta_types, | filters1 = self.build_geo_filters(path=path, meta_types=meta_types, | def search_geo_clusters(self, meta_types=None, lat_min=None, lat_max=None, lon_min=None, lon_max=None, zoom_level=None, path='', geo_types=None, query='', approved=True, lat_center=None, lon_center=None, landscape_type=[], administrative_level=[], languages=None): """ Returns all the clusters that match the specified c... |
lat_min=lat_min, lat_max=lat_max, lon_min=lon_max, lon_max=180., | lat_min=lat_min, lat_max=lat_max, lon_min=lon_min, lon_max=180., | def search_geo_clusters(self, meta_types=None, lat_min=None, lat_max=None, lon_min=None, lon_max=None, zoom_level=None, path='', geo_types=None, query='', approved=True, lat_center=None, lon_center=None, landscape_type=[], administrative_level=[], languages=None): """ Returns all the clusters that match the specified c... |
lat_min=lat_min, lat_max=lat_max, lon_min=-180., lon_max=lon_min, | lat_min=lat_min, lat_max=lat_max, lon_min=-180., lon_max=lon_max, | def search_geo_clusters(self, meta_types=None, lat_min=None, lat_max=None, lon_min=None, lon_max=None, zoom_level=None, path='', geo_types=None, query='', approved=True, lat_center=None, lon_center=None, landscape_type=[], administrative_level=[], languages=None): """ Returns all the clusters that match the specified c... |
filters.extend(filters2) cluster_obs, single_obs = self._search_geo_clusters(filters) | cluster_obs_2, single_obs_2 = self._search_geo_clusters(filters2) cluster_obs = cluster_obs_1 + cluster_obs_2 single_obs = single_obs_1 + single_obs_2 | def search_geo_clusters(self, meta_types=None, lat_min=None, lat_max=None, lon_min=None, lon_max=None, zoom_level=None, path='', geo_types=None, query='', approved=True, lat_center=None, lon_center=None, landscape_type=[], administrative_level=[], languages=None): """ Returns all the clusters that match the specified c... |
cluster_obs, single_obs = self.search_geo_clusters(path=path, geo_types=geo_types, query=geo_query, zoom_level=zoom_level, lat_min=lat_min, lat_max=lat_max, lon_min=lon_min, lon_max=lon_max, lat_center=lat_center, lon_center=lon_center) | cluster_obs, single_obs = self.search_geo_clusters( path=path, geo_types=geo_types, query=geo_query, lat_min=lat_min, lat_max=lat_max, lon_min=lon_min, lon_max=lon_max) | def xrjs_getGeoClusters(self, REQUEST, path='', geo_types=None, geo_query=None, zoom_level=0, lat_min=-90., lat_max=90., lon_min=-180., lon_max=180., lat_center=0., lon_center=0.): """ """ r = [] cluster_obs, single_obs = self.search_geo_clusters(path=path, geo_types=geo_types, query=geo_query, zoom_level=zoom_level, l... |
<tal:block content="structure python:here.portal_map.render_object_map(here.geo_location)"/> | <tal:block condition="python:here.prop_details('geo_location')['show']" content="structure python:here.portal_map.render_object_map(here.geo_location)"/> | def render_object_map(self, geo_location): """ Returns all the script and html required to display a map corresponding to the map engine selected in the administration area. |
ob_dict['geo_location.lat'] = str(self.cluster_pos[0] + ((-1)**(i%2)) * (i*0.0001)) ob_dict['geo_location.lon'] = str(self.cluster_pos[1] + ((-1)**(i%2)) * (i*0.0001)) | ob_dict['geo_location.lat'] = str(self.cluster_pos[0] + ((-1)**(i%2)) * (i*0.00001)) ob_dict['geo_location.lon'] = str(self.cluster_pos[1] + ((-1)**(i%2)) * (i*0.00001)) | def test_clusters_close_to_map_bounds(self): # scene setup folder = self.portal.geo_clusters_test self.ob_dicts=[] for i in range(self.cluster_count): ob_dict=dict() ob_dict['id'] = 'id2_%s' % i ob_dict['title'] = 'Title for point in cluster %s' % i ob_dict['description'] = 'Description for point in cluster %s' % i # a... |
org_name = c['organisation'] if type(c['email']) == type([]): emails = c['email'] | org_name = c.get('organisation', '') if type(c.get('email', [])) == type([]): emails = c.get('email', []) | def dump_points_of_contact_report(context, db_statement): gen = gen_metadata(db_statement) metadatas = [m for m in gen if m['isTemplate'] == 'n'] organisations = {} organisations2 = {} for m in metadatas: id = str(m['id']) data = m['data'].encode('utf-8') title = get_title(data) contacts = get_points_of_contact(data) f... |
emails = [c['email']] | emails = [c.get('email', '')] | def dump_points_of_contact_report(context, db_statement): gen = gen_metadata(db_statement) metadatas = [m for m in gen if m['isTemplate'] == 'n'] organisations = {} organisations2 = {} for m in metadatas: id = str(m['id']) data = m['data'].encode('utf-8') title = get_title(data) contacts = get_points_of_contact(data) f... |
self.assertTrue('On Waiting List' in html) | self.assertTrue('Waiting List' in html) | def test_add_participants(self): self.assertTrue(hasattr(self.portal.info, 'mymeeting')) self.assertTrue(PARTICIPANT_ROLE in self.portal.getAuthenticationTool().list_all_roles()) |
'contributor':None, | 'contributor':'contributor', | def test_metadata(self): """ Test Simple Consultation metadata """ releasedate = DateTime() #add Consultation with full fields fields = {'id':'scs_meta', 'title':'Simple consultation metadata test', 'description':'This is a simple consultation object', 'sortorder':'100', 'start_date':'11/11/1111', 'end_date':'12/12/121... |
self.failUnlessEqual(bool(fields['contributor']), bool(cns.__dict__['contributor'])) | self.failUnlessEqual(fields['contributor'], cns.__dict__['contributor']) | def test_metadata(self): """ Test Simple Consultation metadata """ releasedate = DateTime() #add Consultation with full fields fields = {'id':'scs_meta', 'title':'Simple consultation metadata test', 'description':'This is a simple consultation object', 'sortorder':'100', 'start_date':'11/11/1111', 'end_date':'12/12/121... |
'title': answer.get('w_name-assessment'), | 'title': answer.get('w_assessment-name'), | def extract_survey_answer_data(answer): attrs = { 'id': answer.getId(), 'title': answer.get('w_name-assessment'), 'geo_location': answer.get('w_location'), 'uploader': answer.get('w_15-information-about-data-uploader'), 'geo_type': extract_geo_type(answer), 'description': "", 'target_path': path_in_site(answer), } if ... |
errors.add(captcha_errors) | errors.append(captcha_errors) | def addSurveyAnswer(self, REQUEST=None, notify_respondent=False, **kwargs): """Add someone's answer""" try: if self.expired(): raise SurveyQuestionnaireException("The survey has expired") except SurveyQuestionnaireException, ex: if REQUEST: self.setSessionErrorsTrans(str(ex)) return REQUEST.RESPONSE.redirect('%s/index_... |
for group, v in groups_data: | for group, v in groups_data.items(): | def downloadUsersCsv(self, REQUEST=None, RESPONSE=None): """ Return a csv file as a session response. """ if not (REQUEST and RESPONSE): return "" |
raise ValueError('Could not convert value %s' % repr(value)) | return u'ERROR: no symbol with id %s' % repr(value) | def convert_to_user_string(self, value): """ Convert a database value to a user-readable string """ if value == '': return u'' geo_map_tool = self.getSite().getGeoMapTool() for symbol in geo_map_tool.getSymbolsList(): if value == symbol.id: return symbol.title raise ValueError('Could not convert value %s' % repr(value)... |
'objmap_height_px', 'objmap_width_px'): | 'objmap_height_px', 'objmap_width_px', 'objmap_zoom'): | def manageProperties(self, REQUEST): """ """ for key in ('initial_address', 'map_height_px', 'objmap_height_px', 'objmap_width_px'): setattr(self, key, REQUEST.form[key]) |
tal = re.sub(old_meta_slot, meta_slot, tal) | tal = re.sub(old_meta_slot, meta_slot, tal, count=1) tal = re.sub(old_meta_slot, '', tal) | def _update(self, portal): t = '%(info)s folder: <a href="%(url)s/manage_main">%(text)s</a>' pt_start = '<metal:block metal:define-macro="page" metal:extend-macro="here/standard_template_macro">' old_meta_slot = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" ?/>' meta_slot_start = '<metal:block fil... |
if auth_plugin.getUserFolder().getUser(user.getId()) is user: | user_of_plugin = auth_plugin.getUserFolder().getUser(user.getId()) if user_of_plugin is not None: | def user_in_group_factory(self, user): """ Returns a function that checks whether `user` is part of the specified group. |
self.context.add_pin(lat, lon, '', '', type, rating, REQUEST) | self.submit_pin(lat, lon, '', '', type, rating, REQUEST) | def add_random_pins(self, num, REQUEST): num = int(num) for i in range(num): lat = randint(-89*100, 89*100)/100. lon = randint(-179*100, 179*100)/100. type = choice(TYPE_VALUES) rating = choice(RATING_VALUES) self.context.add_pin(lat, lon, '', '', type, rating, REQUEST) |
assert (layout.diskpath_prefix is not None, "Please set a `diskpath_prefix` attribute on " "the <layout> tag") | assert layout.diskpath_prefix is not None, ("Please set a " "`diskpath_prefix` attribute on the <layout> tag") | def layout_diskpath_prefix(): assert (layout.diskpath_prefix is not None, "Please set a `diskpath_prefix` attribute on " "the <layout> tag") return layout.diskpath_prefix |
self.contributor = contributor self.questions = {} | def __init__(self, id, title, description, sortorder, start_date, end_date, public_registration, allow_file, line_comments, contributor, releasedate, lang): """ """ self.id = id self.contributor = contributor self.questions = {} NyValidation.__dict__['__init__'](self) NyCheckControl.__dict__['__init__'](self) NyContain... | |
for key in self._get_schema().listPropNames(): self.setSession(key, REQUEST_form.get(key, '')) | for name in self._get_schema().listPropNames(): for key in REQUEST_form: if key == name or key.startswith(name+'.'): self.setSession(key, REQUEST_form[key]) | def _prepare_error_response(self, REQUEST, form_errors, REQUEST_form): self.setSessionErrorsTrans('The form contains errors. Please correct them and try again.') for key, value in form_errors.iteritems(): if value: self.setSession('%s-errors' % key, '; '.join(value)) for key in self._get_schema().listPropNames(): self.... |
self.selenium.open("/portal/admin_users_html", True) | self.selenium.open("/portal/admin_local_users_html", True) | def test_delete_user(self): self.selenium.open("/portal/admin_users_html", True) #Check the last user checkbox self.selenium.click( "//div[@class='datatable']/table/tbody/tr[last()]/td/input") username = self.selenium.get_text( "//div[@class='datatable']/table/tbody/tr[last()]/td[2]") self.selenium.click("//input[@valu... |
self.selenium.open("/portal/admin_roles_html?section=assign_roles", True) | self.selenium.open("/portal/admin_assignroles_html", True) | def test_assign_role(self): "Assign a role" self.selenium.open("/portal/admin_roles_html?section=assign_roles", True) self.selenium.add_selection("names", "label=user3") self.selenium.add_selection("//select[@name='roles']", 'Manager') self.selenium.click("//input[@value='Pick']") |
assert self.selenium.get_text( "//table[@class='datatable']/tbody/tr[last()]") ==\ u'user3 Contributor Entire portal Manager Information' def test_revoke_role(self): self.selenium.open("/portal/admin_roles_html?section=users", True) self.selenium.click("css=.datatable>tbody>tr:last-child td input") role_row_text = sel... | last_row = "//div[@class='datatable']/table/tbody/tr[last()]" assert self.selenium.get_text('%s/td[2]' % last_row) == u'user3' assert self.selenium.get_text("%s/td/div[@class='user-role'][1]" % last_row) == u'Contributor in portal' assert self.selenium.get_text("%s/td/div[@class='user-role'][2]" % last_row) == u'Manage... | def test_assign_role(self): "Assign a role" self.selenium.open("/portal/admin_roles_html?section=assign_roles", True) self.selenium.add_selection("names", "label=user3") self.selenium.add_selection("//select[@name='roles']", 'Manager') self.selenium.click("//input[@value='Pick']") |
key=lambda obj: getattr(obj, p_attr, None), | key=val, | def utSortObjsListByAttr(self, p_list, p_attr, p_desc=1): """Sort a list of objects by an attribute values""" return sorted(p_list, key=lambda obj: getattr(obj, p_attr, None), reverse=bool(p_desc)) |
return sorted(ret, key=lambda user: user['name'].lower()) | return sorted(ret, key=lambda user: str(user['name']).lower()) | def get_local_usernames(self): local_users = self.user_names() ret = [{'name': self.getUserFullName(self.getUser(user_id)), 'uid': user_id} for user_id in local_users] return sorted(ret, key=lambda user: user['name'].lower()) |
l_result = [l_parent] while l_parent.getParentNode().meta_type != self.meta_type: | l_result = [] while l_parent.meta_type != self.meta_type: l_result.append(l_parent) | def getAllParents(self, p_folder): """ Returns all parents of a folder, without aquisition. @param p_folder: a folder object @type p_folder: NyFolder @return: a list of NyFolder objects """ l_parent = p_folder l_result = [l_parent] while l_parent.getParentNode().meta_type != self.meta_type: l_parent = l_parent.getParen... |
l_result.append(l_parent) | def getAllParents(self, p_folder): """ Returns all parents of a folder, without aquisition. @param p_folder: a folder object @type p_folder: NyFolder @return: a list of NyFolder objects """ l_parent = p_folder l_result = [l_parent] while l_parent.getParentNode().meta_type != self.meta_type: l_parent = l_parent.getParen... | |
if search_param == 'cn': return search_term in cn return False | elif search_param == 'cn': return search_term.encode('utf-8') in cn else: return False | def userMatched(uid, cn): if search_param == 'uid': return search_term in uid if search_param == 'cn': return search_term in cn return False |
value = self.getUserFullName(user, self.getUserFolder()) self.setUserCanonicalName(value) | user_object = self._get_user_by_uid(user, self.getUserFolder()) value = unicode(user_object.get('cn', ''), 'iso-8859-1') self.setUserCanonicalName(user, value) | def getUserCanonicalName(self, user): value = self.canonical_name.get(user, '-') if value == '-': try: value = self.getUserFullName(user, self.getUserFolder()) self.setUserCanonicalName(value) except Exception, e: logging.debug("Could not get user's full name for user %s : %s", user, str(e)) return self.decode_cn(value... |
base_filter['geo_type'] = geo_types | if geo_types is not None: base_filter['geo_type'] = geo_types | def build_geo_filters(self, path='', meta_types=None, geo_types=[], approved=True, landscape_type=[], administrative_level=[], lat_min=-90., lat_max=90., lon_min=-180., lon_max=180., query='', country='', languages=None, first_letter=None): base_filter = {} |
security.declareProtected(view_management_screens, 'iter_assessments') | security.declareProtected(view, 'iter_assessments') | def wrap_answer(self, answer): if Globals.DevelopmentMode: reload(shadow) |
security.declareProtected(view_management_screens, 'list_all_roles') | def delRole(self, roles=[], REQUEST=None): """ delete role""" if not roles: raise Exception, 'You must specify a role name' roles = self.utConvertToList(roles) self._delRole(roles) if REQUEST is not None: return REQUEST.RESPONSE.redirect('manage_roles_html') | |
self.publicinterface = schema_raw_data.pop('publicinterface', 0) self.createPublicInterface() | self.custom_index = schema_raw_data.pop('custom_index', '') | def manageProperties(self, REQUEST=None, **kwargs): """ """ if not self.checkPermissionEditObject(): raise EXCEPTION_NOTAUTHORIZED, EXCEPTION_NOTAUTHORIZED_MSG |
security.declarePrivate('createPublicInterface') def createPublicInterface(self): pt_id = 'index' if self.publicinterface and self._getOb(pt_id, None) is None: pt_content = self.getFormsTool().getForm('meeting_index').document_src() manage_addPageTemplate(self, id=pt_id, title='Custom index for this meeting', text='') ... | def saveProperties(self, REQUEST=None, **kwargs): """ """ if not self.checkPermissionEditObject(): raise EXCEPTION_NOTAUTHORIZED, EXCEPTION_NOTAUTHORIZED_MSG | |
if self.publicinterface: l_index = self._getOb('index', None) if l_index is not None: return l_index() return self.getFormsTool().getContent({'here': self}, 'meeting_index') | tmpl = self.get_custom_index_template() if tmpl is None: tmpl = self.getFormsTool()['meeting_index'].aq_base.__of__(self) return tmpl(REQUEST) | def index_html(self, REQUEST): """ """ if self.survey_required and self.checkPermissionParticipateInMeeting() and self.isParticipant(): site = self.getSite() path = str(self.survey_pointer) survey_ob = site.unrestrictedTraverse(path, None) if survey_ob is not None and survey_ob.meta_type == 'Naaya Mega Survey': answers... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.