rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
return cmp(l1, l2) | return l1==l2 | def lists_eq(l1, l2): """ compare two lists """ l1.sort(); l2.sort() return cmp(l1, l2) |
print value | def unwrapValueFromHTML(value): """Remove the html stuff around the body """ # get the body text print value result = RE_BODY.search(value) if result: body = result.group(1) else: raise ValueError('%s is not a html string' % value) | |
member = mTool.getMemberById(newUser) | member = mTool.getMemberById(newUser.split(' ')[-1]) | def getDocumentComparisons(self, max=10, filterComment=0): """ """ mTool = getToolByName(self, 'portal_membership') histories = self.getHistories() if max > len(histories): max = len(histories) |
domains=self.getUser().getDomains() | user=self.getUser() if user is None: return () domains=user.getDomains() | def getDomains(self): """Return the list of domain restrictions for a user""" domains=() try: domains=self.getUser().getDomains() except TypeError: if self.getUser().domains is None: self.getUser().domains=() domains=self.getUser().getDomains() return domains |
return folder.getUser(path[-1]).__of__(folder) | u=folder.getUser(path[-1]) if u is None: return u return u.__of__(folder) | def _pathToUser(self, path): if not path: return None folder = self.getPhysicalRoot() for p in path[:-1]: folder = getattr(folder, p) return folder.getUser(path[-1]).__of__(folder) |
for s in ['resolved', 'resigned', 'created', 'rejected', 'defered', 'accepted', 'pending']: | for s in ['resolved', 'resigned', 'created', 'rejected', 'defered', 'accepted', 'pending', 'wont_fix']: | def setupPcng_issue_workflow(wf): "..." wf.setProperties(title='Workflow for PloneCollectorNG issues') for s in ['resolved', 'resigned', 'created', 'rejected', 'defered', 'accepted', 'pending']: wf.states.addState(s) for t in ['defer', 'resolve', 'reject', 'resign', 'accept', 'reaccept', 'assign', 'pending']: wf.trans... |
for t in ['defer', 'resolve', 'reject', 'resign', 'accept', 'reaccept', 'assign', 'pending']: | for t in ['defer', 'resolve', 'reject', 'resign', 'accept', 'reaccept', 'assign', 'pending', 'wont_fix']: | def setupPcng_issue_workflow(wf): "..." wf.setProperties(title='Workflow for PloneCollectorNG issues') for s in ['resolved', 'resigned', 'created', 'rejected', 'defered', 'accepted', 'pending']: wf.states.addState(s) for t in ['defer', 'resolve', 'reject', 'resign', 'accept', 'reaccept', 'assign', 'pending']: wf.trans... |
transitions=('assign', 'defer', 'reject', 'resign', 'resolve')) | transitions=('assign', 'defer', 'reject', 'resign', 'resolve', 'wont_fix')) | sdef = wf.states['accepted'] |
transitions=('accept', 'defer', 'reject', 'resign', 'resolve')) | transitions=('accept', 'defer', 'reject', 'resign', 'resolve', 'wont_fix')) | sdef = wf.states['pending'] |
msg = 'No such issue with id %s' % R.issue_id | msg = 'No such issue with id "%s"' % R.issue_id | def keys(self): return self._k |
transcript = issue.getTranscript() transcript.addComment(u'Issue submitted through email') | def keys(self): return self._k | |
if R.description: transcript.addComment(R.description) | if R.description: issue.getTranscript().addComment(R.description, user=member_id) issue._last_action = 'Comment' | def keys(self): return self._k |
msg = '/plfng_view?portal_status_message='\ + destpath + ' deleted.' RESPONSE.redirect(REQUEST['URL2']+ msg) | msg = '?portal_status_message='+destpath+' deleted.' RESPONSE.redirect(redir_dest + msg) | def __call__(self, REQUEST=None, RESPONSE=None, *args, **kw): #zLOG.LOG('PLFNG', zLOG.INFO , "__call__() :: REQUEST = %s" % REQUEST) |
msg = '/plfng_view?portal_status_message='\ + destpath + ' NOT deleted.' RESPONSE.redirect(REQUEST['URL2']+ msg) | msg = '?portal_status_message='+destpath+' NOT deleted.' RESPONSE.redirect(redir_dest + msg) | def __call__(self, REQUEST=None, RESPONSE=None, *args, **kw): #zLOG.LOG('PLFNG', zLOG.INFO , "__call__() :: REQUEST = %s" % REQUEST) |
url = '/' + os.path.join(self.absolute_url(1), rel_dir, dirname) +\ '/plfng_view?portal_status_message=Directory created' REQUEST.RESPONSE.redirect(url) security.declareProtected('View', 'getProperties') | redir_dest = make_url(self, 'plfng_view') msg = '?portal_status_message='+destpath+' created.' REQUEST.RESPONSE.redirect(redir_dest + msg) return security.declareProtected('View', 'getProperties') | def create_directory(self, dirname, REQUEST): """ create a sub-directory """ dirname = dirname.replace('\\','/') if dirname.startswith('/') or dirname.find('..') > -1 or \ dirname.find(':') > -1: msg="create directory aborted: illegal directory name: " + dirname zLOG.LOG('PloneLocalFolderNG', zLOG.INFO , msg ) REQUEST.... |
print msgid, text, as_unicode, repr(v), type(v) | def translate(self, msgid, text, target_language=None, as_unicode=0, **kw): """ ATT: this code is subject to change """ | |
security.declareProtected(ManageCollector, 'migrate_issue_workflow') | security.declareProtected(ManageCollector, 'migrate_issue_workflow_histories') | def register_issue_uids(self, RESPONSE=None): """ Issues imported through a .zexp file don't have UIDs anymore. They must be re-registered with the reference_catalog of AT. """ |
try: self.portal_properties.navtree_properties.metaTypesNotToList=list(self.portal_properties.navtree_properties.metaTypesNotToList) self.portal_properties.navtree_properties.metaTypesNotToList.index(COMPO_TYPE) except ValueError: list(self.portal_properties.navtree_properties.metaTypesNotToList).append(COMPO_TYPE) exc... | metaTypesNotToList=list(self.portal_properties.navtree_properties.metaTypesNotToList) if not COMPO_TYPE in metaTypesNotToList: metaTypesNotToList.append(COMPO_TYPE) self.portal_properties.navtree_properties.metaTypesNotToList = metaTypesNotToList | def set_hidden_type_from_navtree(self, out): try: self.portal_properties.navtree_properties.metaTypesNotToList=list(self.portal_properties.navtree_properties.metaTypesNotToList) self.portal_properties.navtree_properties.metaTypesNotToList.index(COMPO_TYPE) except ValueError: list(self.portal_properties.navtree_properti... |
try: self.portal_properties.navtree_properties.metaTypesNotToList=list(self.portal_properties.navtree_properties.metaTypesNotToList) self.portal_properties.navtree_properties.metaTypesNotToList.remove(COMPO_TYPE) except ValueError: pass except: raise | metaTypesNotToList=list(self.portal_properties.navtree_properties.metaTypesNotToList) if COMPO_TYPE in metaTypesNotToList: metaTypesNotToList.remove(COMPO_TYPE) self.portal_properties.navtree_properties.metaTypesNotToList = metaTypesNotToList | def unset_hidden_type_from_navtree(self, out): try: self.portal_properties.navtree_properties.metaTypesNotToList=list(self.portal_properties.navtree_properties.metaTypesNotToList) self.portal_properties.navtree_properties.metaTypesNotToList.remove(COMPO_TYPE) except ValueError: pass except: raise out.write("CMF Composi... |
hide_type_from_navtree(self, out) | set_hidden_type_from_navtree(self, out) | def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) hide_type_from_navtree(self, out) install_subskin(self, out, GLOBALS) install_tool(self, out) install_kupu_resource(self, out) out.write("Successfully installed %s." % PROJECTNAME) return out.getvalue() |
if not isinstance(buf, basestring): | if type(buf) in (UnicodeType, StringType): | def __init__(self, buf = ''): # Force self.buf to be a string or unicode if not isinstance(buf, basestring): buf = str(buf) self.buf = [] self.buf.append(buf) self.len = len(buf) self.linepos = 0 self.closed = 0 |
def base_edit(self, RESPONSE): | def base_edit(self, RESPONSE=None): | def base_edit(self, RESPONSE): """ redirect to our own edit method """ RESPONSE.redirect('pcng_base_edit') |
RESPONSE.redirect('pcng_base_edit') | if RESPONSE: RESPONSE.redirect('pcng_base_edit') | def base_edit(self, RESPONSE): """ redirect to our own edit method """ RESPONSE.redirect('pcng_base_edit') |
folderContext = self.aq_parent | folderContext = aq_parent(aq_inner(self)) | def getPanelObject(self, objectPath): """get panel object by path. |
return getattr(portal, self.default_portrait) | return default_portrait | def getPersonalPortrait(self, member_id=None, verifyPermission=0): """Returns the Portait for a member_id""" portal = getToolByName(self, 'portal_url').getPortalObject() if not member_id: return getattr(portal, self.default_portrait) |
return None return member.getPortrait() | return default_portrait portrait = member.getPortrait() if portrait: return portrait | def getPersonalPortrait(self, member_id=None, verifyPermission=0): """Returns the Portait for a member_id""" portal = getToolByName(self, 'portal_url').getPortalObject() if not member_id: return getattr(portal, self.default_portrait) |
member = getattr(portal, self.default_portrait) return member | pass return default_portrait | def getPersonalPortrait(self, member_id=None, verifyPermission=0): """Returns the Portait for a member_id""" portal = getToolByName(self, 'portal_url').getPortalObject() if not member_id: return getattr(portal, self.default_portrait) |
states = getattr(self.portal_workflow, IssueWorkflowName).states._mapping.keys() | wftool = getToolByName(self, 'portal_workflow') states = wftool[IssueWorkflowName].states._mapping.keys() | def issue_states(self): """ return a list of all related issue workflow states """ states = getattr(self.portal_workflow, IssueWorkflowName).states._mapping.keys() states.sort() return states |
if smtpserver.has_extn('starttls'): | if smtpserver.has_extn('starttls') and ssl_support: | def send(self, debug=False): """Send email to the SMTP server """ kw = self.kwargs userid = kw.get('userid', None) password = kw.get('password', None) forceTLS = kw.get('forctls', False) message = self.message.as_string() # connect smtpserver = smtplib.SMTP(self.host, self.port) if debug: smtpserver.set_debuglevel(... |
raise MailHostError, 'Invalid email address: %s' % addr | raise MailHostError, 'Invalid email address: %s' % mfrom | def secureSend(self, message, mto, mfrom, subject='[No Subject]', mcc=None, mbcc=None, subtype='plain', charset='us-ascii', debug=False, **kwargs): """A more secure way to send a message message: The plain message text without any headers or an email.Message.Message based instance mto: To: field (string or list) mfrom... |
return '%s/%s' % (utool(), url) | return '%s/%s' % (utool(), remote) | def getRemoteUrl(self): """returns the remote URL of the Link """ # need to check why this is different than PortalLink utool = getToolByName(self, 'portal_url') remote = self._getRemoteUrl() if remote: if remote.startswith('/'): remote = remote[1:] return '%s/%s' % (utool(), url) else: return utool() |
wf = getToolByName(self, CollectorWorkflow) wf.notifyCreated(self) | wf = getToolByName(self, CollectorWorkflow, None) if wf: wf.notifyCreated(self) | def manage_afterAdd(self, item, container): """ perform post-creation actions """ Base.manage_afterAdd(self, item, container) self.initializeArchetype() self.post_creation_actions() |
wftool = getToolByName(self, CollectorWorkflow) users = list(wftool.getInfoFor(self, 'assigned_to', ()) or ()) if sorted: users.sort() return users | wftool = getToolByName(self, CollectorWorkflow, None) if wftool: users = list(wftool.getInfoFor(self, 'assigned_to', ()) or ()) if sorted: users.sort() return users else: return () | def assigned_to(self, sorted=0): """ return assigned users according to the workflow """ wftool = getToolByName(self, CollectorWorkflow) users = list(wftool.getInfoFor(self, 'assigned_to', ()) or ()) if sorted: users.sort() return users |
wftool = getToolByName(self, CollectorWorkflow) return wftool.getInfoFor(self, 'confidential', 0) | wftool = getToolByName(self, CollectorWorkflow, None) if wftool: return wftool.getInfoFor(self, 'confidential', 0) return 0 | def is_confidential(self): """ return if the issue is confidential according to the workflow """ wftool = getToolByName(self, CollectorWorkflow) return wftool.getInfoFor(self, 'confidential', 0) |
wftool = getToolByName(self, CollectorWorkflow) return wftool.getInfoFor(self, 'state', 'pending') | wftool = getToolByName(self, CollectorWorkflow, None) if wftool: return wftool.getInfoFor(self, 'state', 'pending') else: return 'pending' | def status(self): """ return workflow state """ wftool = getToolByName(self, CollectorWorkflow) return wftool.getInfoFor(self, 'state', 'pending') |
wftool = getToolByName(self, CollectorWorkflow) actions = wftool.getTransitionsFor(self) return [entry['name'] for entry in actions] | wftool = getToolByName(self, CollectorWorkflow, None) if wftool: actions = wftool.getTransitionsFor(self) return [entry['name'] for entry in actions] return [] | def validActions(self): """ return valid transitions for issue 'pcng_issue_workflow' """ wftool = getToolByName(self, CollectorWorkflow) actions = wftool.getTransitionsFor(self) return [entry['name'] for entry in actions] |
return None | return | def doTidy(value, field, request, cleanup=0): """Tidy the data in 'value' for the field in the current request Optional cleanup: * removes header/footer of the output data * Removes warnings from the error data Return None for 'nothing done' else return (nerrors, nwarnings, outputdata, errordata) """ # we can't use t... |
return 1 | return | def doTidy(value, field, request, cleanup=0): """Tidy the data in 'value' for the field in the current request Optional cleanup: * removes header/footer of the output data * Removes warnings from the error data Return None for 'nothing done' else return (nerrors, nwarnings, outputdata, errordata) """ # we can't use t... |
if self._isGroup(): | if self._isGroup: | def authenticate(self, password, request): # We prevent groups from authenticating if self._isGroup(): return None return self.__underlying__.authenticate(password, request) |
print 'reindexing' | def manage_afterClone(self, item): self.reindex_issues() print 'reindexing' | |
'Use secureSend instead!' % self.absulute_url(0)) | 'Use secureSend instead!' % self.absolute_url(0)) | def sendTemplate(trueself, self, messageTemplate, statusTemplate=None, mto=None, mfrom=None, encode=None, REQUEST=None): """render a mail template, then send it... """ #raise MailHostError, 'sendTemplate is disabled' if not hasattr(self,'_v_sendtemplate'): LOG('SecureMailHost', WARNING, 'Deprecation warning: ' 'The usa... |
'Use secureSend instead!' % self.absulute_url(0)) | 'Use secureSend instead!' % self.absolute_url(0)) | def send(self, messageText, mto=None, mfrom=None, subject=None, encode=None): """Send email """ #raise MailHostError, 'send is disabled' if not hasattr(self,'_v_send'): LOG('SecureMailHost', WARNING, 'Deprecation warning: ' 'The usage of send() in %s is deprecated. ' 'Use secureSend instead!' % self.absulute_url(0)) se... |
portal_status_message='New issue created', | portal_status_message=self.translate('new_issue_created', 'New issue created'), | def add_issue(self, REQUEST=None, RESPONSE=None): """ create a new issue """ self._num_issues += 1 id = str(self._num_issues) self.invokeFactory('PloneIssueNG', id) issue = aq_base(self._getOb(id)) |
Log(LOG_DEBUG, "Scanning roles for", name, roles, ) | def _mangleRoles(self, name, roles): """ Return role_dns for this user """ # Local groups => the easiest part if self._local_groups: return roles # We have to transform roles into group dns: transform them as a dict role_dns = [] all_groups = self.getGroups() all_roles = self.valid_roles() groups = {} for g in all_gro... | |
role_dns.append(r) | else: role_dns.append(r) | def _mangleRoles(self, name, roles): """ Return role_dns for this user """ # Local groups => the easiest part if self._local_groups: return roles # We have to transform roles into group dns: transform them as a dict role_dns = [] all_groups = self.getGroups() all_roles = self.valid_roles() groups = {} for g in all_gro... |
Log(LOG_DEBUG, name, role_dns) | def _mangleRoles(self, name, roles): """ Return role_dns for this user """ # Local groups => the easiest part if self._local_groups: return roles # We have to transform roles into group dns: transform them as a dict role_dns = [] all_groups = self.getGroups() all_roles = self.valid_roles() groups = {} for g in all_gro... | |
print 'text', text | def break_longlines(text): print 'text', text l = [] for line in text.split('\n'): if len(line) > 100: l.append(dowrap(line)) else: l.append(line) print l return '\n'.join(l) | |
print l | def break_longlines(text): print 'text', text l = [] for line in text.split('\n'): if len(line) > 100: l.append(dowrap(line)) else: l.append(line) print l return '\n'.join(l) | |
definition(html_quote(issue.description)) | definition(html_quote(getFieldValue(issue, 'description'))) | def toUnicode(text): if not isinstance(text, UnicodeType): return unicode(text, collector.getSiteEncoding()) return text |
definition(html_quote(issue.solution)) | definition(html_quote(getFieldValue(issue, 'solution'))) | def toUnicode(text): if not isinstance(text, UnicodeType): return unicode(text, collector.getSiteEncoding()) return text |
definition('\n'.join(l)) | definition(u'\n'.join(l)) | def toUnicode(text): if not isinstance(text, UnicodeType): return unicode(text, collector.getSiteEncoding()) return text |
canvas.drawString(inch, 0.75 * inch, "Page %d" % doc.page) | canvas.drawString(inch, 0.75 * inch, doc.collector.translate('page_number', "Page $num", num=doc.page)) | def myLaterPages(canvas, doc): #canvas.drawImage("snkanim.gif", 36, 36) canvas.saveState() canvas.setStrokeColorRGB(1,0,0) canvas.setLineWidth(5) canvas.line(50,45,50,PAGE_HEIGHT-45) canvas.line(50,PAGE_HEIGHT-70, 555, PAGE_HEIGHT-70) canvas.setFont(NORMAL_FONT,15) canvas.drawString(inch, PAGE_HEIGHT-62, utf8(doc.colle... |
l.append('<b>%s</b>: %s ' % (translate(field.widget.label_msgid, field.widget.Label(issue), as_unicode=1), v)) | label = translate(field.widget.label_msgid, field.widget.Label(issue), as_unicode=1) l.append(u'<b>%s</b>: %s ' % (toUnicode(label), toUnicode(v))) | def getFieldValue(issue, field): v = issue.Schema()[field].get(issue) if isinstance(v, StringType): return unicode(v, collector.getSiteEncoding()) return v |
comment = html_quote(ev.comment) | comment = ev.comment | def getFieldValue(issue, field): v = issue.Schema()[field].get(issue) if isinstance(v, StringType): return unicode(v, collector.getSiteEncoding()) return v |
if comment: self._transcript.addComment(comment) | assignees_changed = 1 if comment: self._transcript.addComment(comment) if action == 'comment' and assignees_changed: action = 'assign' | def issue_followup(self, action, comment='', assignees=[], RESPONSE=None): """ issue followup handling """ |
def assigned_to(self): | def assigned_to(self, sorted=0): | def assigned_to(self): """ return assigned users according to the workflow """ wftool = getToolByName(self, 'portal_workflow') return wftool.getInfoFor(self, 'assigned_to', ()) or () |
return wftool.getInfoFor(self, 'assigned_to', ()) or () | users = wftool.getInfoFor(self, 'assigned_to', ())or () if sorted: users = list(users); users.sort() return users | def assigned_to(self): """ return assigned users according to the workflow """ wftool = getToolByName(self, 'portal_workflow') return wftool.getInfoFor(self, 'assigned_to', ()) or () |
security.declareProtected(CMFCorePermissions.View, 'getWorkflow') def getWorkflow(self): """ return the workflow history. ATT: DEBUG ONLY """ | security.declareProtected(CMFCorePermissions.View, 'getWorkflowHistory') def getWorkflowHistory(self): """ return the workflow history """ | def validActions(self): """ return valid transitions for issue 'pcng_issue_workflow' """ pa = getToolByName(self, 'portal_actions', None) allactions = pa.listFilteredActionsFor(self) return [entry['name'] for entry in allactions.get(IssueWorkflowName, [])] |
assert isinstance(old, (list, tuple)) and isinstance(new, (list, tuple)) | def addIncrementalChange(self, field, old, new): | |
result = list() | result = [] | def getEventsGrouped(self, reverse=1): """ return all events grouped by their timestamp """ |
result[-1].append(event) | result[-1].insert(0, event) | def getEventsGrouped(self, reverse=1): """ return all events grouped by their timestamp """ |
checkValidIdResult = checkValidId(zitem) if checkValidIdResult != 1: zLOG.LOG('PloneLocalFolderNG', zLOG.INFO , \ "upzipFile() :: checkValidId(%s) failed:: %s" \ % (zitem,checkValidIdResult) ) else: if not zitem.endswith('/'): | if not zitem.endswith('/'): checkValidIdResult = checkValidId(os.path.basename(zitem)) if checkValidIdResult != 1: zLOG.LOG('PloneLocalFolderNG', zLOG.INFO , \ "upzipFile() :: checkValidId(%s) failed:: %s" \ % (zitem,checkValidIdResult) ) else: | def upzipFile(FSfilename, FSBackupFolderBase=None): # this method does the same thing as the following system call: # SYSCALL_UNZIP = "c:\\plone-utils\\unzip -o -d" # syscall = "%s %s %s" % (SYSCALL_UNZIP,todir,syscall_filename) # result = os.system(syscall) FSfilename = fixDOSPathName(FSfilename) todir = os.path.dirn... |
print err, sys.exc_type, sys.exc_value | def getInstallMethod(self,productname): ''' returns the installer method ''' | |
if old != new: print old,new, type(old), type(new) | if str(old) != str(new): | def pre_validate(self, REQUEST, errors): """ Hook to perform pre-validation actions. We use this hook to log changed properties to the transcript. """ |
self.roles = () | self.roles = ('Member',) | def __init__(self, userid): BaseContent.__init__(self, userid) self.id = str(userid) self._userInfo = None self.password = '' self.roles = () self.domains = () |
if (u.getUserName().lower().find(name) == -1) and (user.fullname.lower().find(name) == -1): | if (u.getUserName().lower().find(name) == -1) and \ ((not user.fullname) or user.fullname.lower().find(name) == -1): | def searchForMembers( self, REQUEST=None, **kw ): """ """ if REQUEST: dict = REQUEST else: dict = kw name = dict.get('name', None) email = dict.get('email', None) roles = dict.get('roles', None) last_login_time = dict.get('last_login_time', None) is_manager = self.checkPermission('Manage portal', self) if name: name ... |
if user.email.lower().find(email) == -1: | if (not user.email) or user.email.lower().find(email) == -1: | def searchForMembers( self, REQUEST=None, **kw ): """ """ if REQUEST: dict = REQUEST else: dict = kw name = dict.get('name', None) email = dict.get('email', None) roles = dict.get('roles', None) last_login_time = dict.get('last_login_time', None) is_manager = self.checkPermission('Manage portal', self) if name: name ... |
self.addReference(issue, reference.comment) | self.addReference(issue, IssueRelationship(issue.absolute_url(1), reference.comment)) | def add_reference(self, reference, RESPONSE=None): """ add a new reference (record object) """ |
print fullname | def viewfile(self, REQUEST): """ view file """ | |
elif pts.meta_type.find('Broken') > -1: self._v_have_pts = None return self._v_have_pts | try: self._v_have_pts.translate return self._v_have_pts except: return None | def _getPTS(self): """ return PTS instance """ |
if viewletPath: | if (panelObject is not None) and viewletPath: | def getPanel(self, objectPath, panelSkin, viewletId): """ get a panel """ panelObject = self.getPanelObject(objectPath) |
newv = REQUEST.get('force_instance_version', self.getInstanceVersion()) | if REQUEST is not None: newv = REQUEST.get('force_instance_version', self.getInstanceVersion()) else: newv = self.getInstanceVersion() | def upgrade(self, REQUEST=None, dry_run=None, swallow_errors=1): """ perform the upgrade """ |
security.declareProtected(ManageCollector, 'schema_getWholeSchema') | security.declareProtected(CMFCorePermissions.View, 'schema_getWholeSchema') | def schema_init(self, schema): self._schemata_names = [] # list of schemata names self._schemas = OOBTree() # map schemata name to schemata |
return unicode(r, self._getPloneEncoding()) | if isinstance(r, UnicodeType): return r else: return unicode(r, self._getPloneEncoding()) | def translate(self, msgid, text, target_language=None, as_unicode=0, **kw): """ ATT: this code is subject to change """ |
definition(html_quote(getFieldValue(issue, 'solution'))) | definition(html_quote(getFieldValue(issue, 'solution')), PreStyle) | def getFieldValue(issue, field): v = issue.Schema()[field].get(issue) if isinstance(v, StringType) or isinstance(v, UnicodeType): v = v.replace(chr(13), '') if isinstance(v, StringType): return unicode(v, collector.getSiteEncoding()) return v |
r.append((i,self.available_langs[i])) | r.append((i,self.AVAILABLE_LANGUAGES[i])) | def listSupportedLanguages(self): r = [] for i in self.supported_langs: r.append((i,self.available_langs[i])) return r |
ObjectField('visible_ids', | BooleanField('visible_ids', | def modify_fti(fti): # fix up the factory type information generated by archetypes fti['global_allow'] = 0 # only allow Members to be added where explicitly allowed |
action = self.restrictedTraverse(action.action(self)) | url=action.action(createExprContext(self.aq_parent,getToolByName(self,'portal_url').getPortalObject(),self)) path=urllib.splithost(urllib.splittype(url)[1])[1] action = self.restrictedTraverse(path) | def view(self, **kwargs): """View action""" #XXX CMF1.4 compatibility try: actions = self.getTypeInfo().getActions() for action in actions: if action.get('id', None) == 'view': if _verifyActionPermissions(self, action): action = self.restrictedTraverse(action['action']) if action is not None: return action(**kwargs) ex... |
roles=self.getUser().getRoles() | user=self.getUser() if hasattr(user,'getUserRoles'): roles=user.getUserRoles() else: roles=user.getRoles() | def getRoles(self): """Return the list of roles assigned to a user.""" roles=() try: roles=self.getUser().getRoles() except TypeError: #XXX The user is not in this acl_users so we get None if self.getUser().roles is None: self.getUser().roles=('Member',) roles=self.getUser().getRoles() return roles |
return roles | allowed = self.valid_roles() return tuple([r for r in roles if r in allowed]) | def getRoles(self): """Return the list of roles assigned to a user.""" roles=() try: roles=self.getUser().getRoles() except TypeError: #XXX The user is not in this acl_users so we get None if self.getUser().roles is None: self.getUser().roles=('Member',) roles=self.getUser().getRoles() return roles |
security.declarePrivate('setGroups') def setGroups(self,groups): '''assigns the groups to the user using GroupUserFolder''' acl_users=getToolByName(self,'acl_users') groups=self._stringToList(groups) if not hasattr(acl_users,'getGroupPrefix'): return pref=acl_users.getGroupPrefix() roles=tuple([r for r in self.getR... | def getPortalSkin(self): try: skins_tool = getToolByName(self, 'portal_skins') if self.portal_skin in skins_tool.getSkinSelections(): return self.portal_skin else: return skins_tool.getDefaultSkin() except AttributeError: return self.portal_skin | |
valid = self.valid_roles() + ('Authenticated',) | valid = self.valid_roles() + ('Authenticated',) + tuple(self.getRawGroups()) | def validate_roles(self, roles): roles = self._stringToList(roles) valid = self.valid_roles() + ('Authenticated',) for r in roles: if r not in valid: return '%s is not a valid role.' % (r) return None |
import sys sys.stdout.write('isValid, errors = %s\n' % (str(errors))) | def isValid(self): """ Check to make sure a Member object's fields satisfy schema constraints""" errors = {} # make sure object has required data and metadata self.Schema().validate(self, None, errors, 1, 1) if errors: | |
return s | return [o for o in s if o] | def _stringToList(self, s): if s is None: return [] if isinstance(s, types.StringType): # split on , or \n and ignore \r s = s.replace('\r',',') s = s.replace('\n',',') s = s.split(',') s= [v.strip() for v in s if v.strip()] s = filter(None, s) return s |
security.declareProtected(ManageCollector, 'schema_getSchema') | security.declareProtected(CMFCorePermissions.View, 'schema_getSchema') | def schema_getNames(self): """ return names of all schematas """ return self._schemata_names |
print "hidefields",hidefields | def get_mail_body(self, prepend='', append='', hidefields=[], **kwargs): ''' returns the mail-body with footer ''' if kwargs.has_key('request'): request = kwargs['request'] else: request = self.REQUEST | |
if self.isGroup(): return "%s%s" % (GRUFFolder.GRUFGroups._group_prefix, self._original_id, ) return self._original_id | if self.isGroup() and self._original_name[:len(GRUFFolder.GRUFGroups._group_prefix)] != GRUFFolder.GRUFGroups._group_prefix: return "%s%s" % (GRUFFolder.GRUFGroups._group_prefix, self._original_name, ) return self._original_name | def getId(self): """Get the ID of the user. The ID can be used, at least from Python, to get the user from the user's UserDatabase""" # $$$ OUT TO DATE |
setDefaultRoles(EditCollectorIssue, ('Manager', 'TrackerAdmin')) setDefaultRoles(AddCollectorIssue, ('Manager', 'TrackerAdmin')) setDefaultRoles(AddCollectorIssueFollowup, ('Manager', 'TrackerAdmin')) setDefaultRoles(ManageCollector, ('Manager', 'TrackerAdmin')) | def manage_afterAdd(self, item, container): """ post creation actions """ self._transcript = Transcript() self._transcript.addComment('Tracker created') | |
target_roles = target_roles + ('Authenticated', ) | target_roles += ('Authenticated', ) | def _adjust_participation_mode(self): """Set role privileges according to participation mode.""" |
target_roles = target_roles + ('Authenticated', 'Anonymous') | target_roles += ('Authenticated', 'Anonymous') | def _adjust_participation_mode(self): """Set role privileges according to participation mode.""" |
print self.participation_mode | def _adjust_view_mode(self): """Set role privileges according to view mode.""" | |
target_roles = target_roles + ('Authenticated', ) | target_roles += ('Authenticated', ) | def _adjust_view_mode(self): """Set role privileges according to view mode.""" |
target_roles = target_roles + ('Authenticated', 'Anonymous') print 'adjusting', target_roles | target_roles += ('Authenticated', 'Anonymous') | def _adjust_view_mode(self): """Set role privileges according to view mode.""" |
ATDocumentSchema = ATContentTypeSchema + Schema(( | ATDocumentSchema = ATContentTypeSchema.copy() + Schema(( | def __init__(self, prefix='', archive=False): pass |
ATEventBaseSchema = ATContentTypeSchema.copy() ATEventBaseSchema['description'].primary = True ATEventSchema = ATEventBaseSchema + Schema(( | ATEventSchema = ATContentTypeSchema.copy + Schema(( | def __init__(self, prefix='', archive=False): pass |
ATFavoriteSchema = ATContentTypeSchema + Schema(( | ATFavoriteSchema = ATContentTypeSchema.copy() + Schema(( | def __init__(self, prefix='', archive=False): pass |
ATFileSchema = ATContentTypeSchema + Schema(( | ATFileSchema = ATContentTypeSchema.copy() + Schema(( | def __init__(self, prefix='', archive=False): pass |
ATFolderSchema = ATContentTypeSchema ATBTreeFolderSchema = ATContentTypeSchema | ATFolderSchema = ATContentTypeSchema.copy() ATBTreeFolderSchema = ATContentTypeSchema.copy() | def __init__(self, prefix='', archive=False): pass |
ATImageSchema = ATContentTypeSchema + Schema(( | ATImageSchema = ATContentTypeSchema.copy() + Schema(( | def __init__(self, prefix='', archive=False): pass |
ATLinkSchema = ATContentTypeSchema + Schema(( | ATLinkSchema = ATContentTypeSchema.copy() + Schema(( | def __init__(self, prefix='', archive=False): pass |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.