rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if username in self.getUserNames():
if username in map(lambda x: x.getId(), self.getUsers()):
def manage_workspace(self, REQUEST): """ manage_workspace(self, REQUEST) => Overrided to allow direct user or group traversal via the left tree view. """ path = string.split(REQUEST.PATH_INFO, '/')[:-1] username = path[-1]
un = self.getUserNames()
un = map(lambda x: x.getId(), self.getUsers())
def __bobo_traverse__(self, request, name): """ Looks for the name of a user or a group. This applies only if users list is not huge. """ # Check if it's an attribute if hasattr(self, name, ): return getattr(self, name) # It's not an attribute, maybe it's a user/group # (this feature is used for the tree) if name.star...
un = self.getPureUserNames()
un = map(lambda x: x.getId(), self.getPureUsers())
def listUsersBatches(self,): """ listUsersBatches(self,) => return a list of (start, end) tuples. Return None if batching is not necessary """ # Time-consuming stuff ! un = self.getPureUserNames() if len(un) <= MAX_USERS_PER_PAGE: return None un.sort()
un = self.getPureUserNames()
un = map(lambda x: x.getId(), self.getPureUsers())
def getUsersBatch(self, start): """ getUsersBatch(self, start) => user list """ # Rebuild the list if necessary if not self._v_batch_users: un = self.getPureUserNames() self._v_batch_users = un
out.write(ICS_HEADER % ({ 'prodid' : PRODID, 'dtstamp' : DateTime().strftime(DATEZ), 'created' : DateTime(self.CreationDate()).strftime(DATEZ), 'uid' : self.UID(), 'modified' : DateTime(self.ModificationDate()).strftime(DATEZ), 'summary' : self.Title(), 'startdate' : DateTime(self.start()).strftime(DATE...
map = { 'prodid' : PRODID, 'dtstamp' : DateTime().strftime(DATE), 'created' : DateTime(self.CreationDate()).strftime(DATE), 'uid' : self.UID(), 'modified' : DateTime(self.ModificationDate()).strftime(DATE), 'summary' : self.Title(), 'startdate' : self.start().strftime(DATE), 'enddate' : self.end().str...
def ics(self, REQUEST, RESPONSE): """iCalendar output """ RESPONSE.setHeader('Content-Type', 'text/calendar') RESPONSE.setHeader('Content-Disposition', 'attachment; filename="%s.ics"' % self.getId()) out = StringIO() out.write(ICS_HEADER % ({ 'prodid' : PRODID, 'dtstamp' : DateTime().strftime(DATEZ), 'created' :...
return out.getvalue()
return n2rn(out.getvalue())
def ics(self, REQUEST, RESPONSE): """iCalendar output """ RESPONSE.setHeader('Content-Type', 'text/calendar') RESPONSE.setHeader('Content-Disposition', 'attachment; filename="%s.ics"' % self.getId()) out = StringIO() out.write(ICS_HEADER % ({ 'prodid' : PRODID, 'dtstamp' : DateTime().strftime(DATEZ), 'created' :...
out.write(VCS_HEADER % ({ 'prodid' : PRODID, }) )
map = { 'prodid' : PRODID, 'dtstamp' : DateTime().strftime(DATE), 'created' : DateTime(self.CreationDate()).strftime(DATE), 'uid' : self.UID(), 'modified' : DateTime(self.ModificationDate()).strftime(DATE), 'summary' : self.Title(), 'startdate' : self.start().strftime(DATE), 'enddate' : self.end().str...
def vcs(self, REQUEST, RESPONSE): """vCalendar output """ RESPONSE.setHeader('Content-Type', 'text/x-vCalendar') RESPONSE.setHeader('Content-Disposition', 'attachment; filename="%s.vcs"' % self.getId()) out = StringIO() out.write(VCS_HEADER % ({ 'prodid' : PRODID, }) ) # XXX todo out.write(VCS_FOOTER) return out.get...
return out.getvalue()
return n2rn(out.getvalue())
def vcs(self, REQUEST, RESPONSE): """vCalendar output """ RESPONSE.setHeader('Content-Type', 'text/x-vCalendar') RESPONSE.setHeader('Content-Disposition', 'attachment; filename="%s.vcs"' % self.getId()) out = StringIO() out.write(VCS_HEADER % ({ 'prodid' : PRODID, }) ) # XXX todo out.write(VCS_FOOTER) return out.get...
self.acl_users.getDefaultUserSource().userFolderEditUser(id, None, user.getRoles()+tuple(groups), user.getDomains())
self.acl_users._updateUser( name = id, groups = tuple(groups), )
def addMember(self, id): """ Add the existing member with the given id to the group"""
self.acl_users.getDefaultUserSource().userFolderEditUser(id, None, user.getUserRoles()+groups, user.getDomains())
self.acl_users._updateUser( name = id, groups = tuple(groups), )
def removeMember(self, id): """ Remove the member with the provided id from the group """ user = self.acl_users.getUser(id) prefix = self.acl_users.getGroupPrefix()
for i in LangCodes:
for i in langCodes:
def removeSupportedLanguages(self, langCodes): alist = self.supported_langs[:] for i in LangCodes: alist.remove(i) self.supported_langs = alist
res = field.validate(value, instance=instance, field=field, REQUEST=REQUEST)
try: res = field.validate(value, instance=instance, field=field, REQUEST=REQUEST) except: res = field.validate(value, instance=instance, REQUEST=REQUEST)
def validate(self, instance, REQUEST=None, errors=None, data=None, metadata=None): """Validate the state of the entire object.
index=('member_catalog/ZCTIndex|FieldIndex|TextIndex:brains', 'FieldIndex|TextIndex:brains'),
index=('member_catalog/FieldIndex:brains', 'FieldIndex:brains'),
def addMember(self, id, **kwargs): o = Member(id) self._setObject(id, o) o = getattr(self, id) o.initializeArchetype(**kwargs) o.getUser() o._setPassword(o._generatePassword())
index=('member_catalog/ZCTIndex|FieldIndex|TextIndex:brains', 'ZCTIndex|FieldIndex|TextIndex:brains'),
index=('member_catalog/ZCTextIndex,lexicon_id=member_lexicon,index_type=Cosine Measure|TextIndex:brains', 'ZCTextIndex|TextIndex:brains'),
def addMember(self, id, **kwargs): o = Member(id) self._setObject(id, o) o = getattr(self, id) o.initializeArchetype(**kwargs) o.getUser() o._setPassword(o._generatePassword())
index='member_catalog/KeywordIndex|TextIndex:brains',
index='member_catalog/KeywordIndex:brains',
def addMember(self, id, **kwargs): o = Member(id) self._setObject(id, o) o = getattr(self, id) o.initializeArchetype(**kwargs) o.getUser() o._setPassword(o._generatePassword())
index='member_catalog/DateIndex|FieldIndex:brains',
index='member_catalog/DateIndex:brains',
def addMember(self, id, **kwargs): o = Member(id) self._setObject(id, o) o = getattr(self, id) o.initializeArchetype(**kwargs) o.getUser() o._setPassword(o._generatePassword())
security.declareProtected(VIEW_PUBLIC_PERMISSION, 'getFullName') def getFullName(self): return self.fullname security.declareProtected(VIEW_PUBLIC_PERMISSION, 'getEmail') def getFullName(self): return self.email security.declareProtected(VIEW_OTHER_PERMISSION, 'getLastLoginTime') def getLastLoginTime(self): return se...
def getUserName(self): """Return the username of a user""" return self.getUser().getUserName()
date = DateTime().strftime('%Y%m%d%H%M%S') rand = randint(100000, 999999) host = socket.gethostname() message['Message-Id'] = '<%s.%d@%s>' % (date, rand, host)
fqdn = socket.getfqdn() message['Message-Id'] = email.Utils.make_msgid(fqdn)
def __init__(self, mfrom, mto, message, smtp_host='localhost', smtp_port=25, **kwargs): self.mfrom = mfrom self.mto = mto # message must be email.Message.Message based assert(isinstance(message, email.Message.Message)) # Add some important headers if not message.has_key('Date'): message['Date'] = DateTime().rfc822() if...
security.declareProtected(CMFCorePermissions.ModifyPortalContent, 'getRawTitle') def getRawTitle(self): """Get the raw title of the improvement proposal - no """ return self.getField('title').get(self)
def Title(self): """Return the title as "#${id}: ${title}".
security.declareProtected(CMFCorePermissions.ModifyPortalContent, 'CookedBody')
security.declareProtected(CMFCorePermissions.ModifyPortalContent, 'EditableBody')
def CookedBody(self, stx_level='ignored'): """CMF compatibility method """ return self.getText()
raise TypeError(self.translate('atse_empty_name', default='Empty ID given'))
raise SchemaEditorError(self.translate('atse_empty_name', default='Empty ID given'))
def atse_addSchemata(self, name, RESPONSE=None): """ add a new schemata """ if not name: raise TypeError(self.translate('atse_empty_name', default='Empty ID given'))
raise ValueError(self.translate('atse_exists', {schemata:name},
raise SchemaEditorError(self.translate('atse_exists', {schemata:name},
def atse_addSchemata(self, name, RESPONSE=None): """ add a new schemata """ if not name: raise TypeError(self.translate('atse_empty_name', default='Empty ID given'))
raise ValueError(self.translate('atse_invalid_id_for_schemata', {'schemata':name},
raise SchemaEditorError(self.translate('atse_invalid_id_for_schemata', {'schemata':name},
def atse_addSchemata(self, name, RESPONSE=None): """ add a new schemata """ if not name: raise TypeError(self.translate('atse_empty_name', default='Empty ID given'))
raise RuntimeError(self.translate('atse_can_not_remove_schema',
raise SchemaEditorError(self.translate('atse_can_not_remove_schema',
def atse_delSchemata(self, name, RESPONSE=None): """ delete a schemata """
if len(self._ms.getSchemataNames(True)) == 1: raise RuntimeError(self.translate('atse_can_not_remove_last_schema',
if len(self.atse_getSchemataNames(True)) == 1: raise SchemaEditorError(self.translate('atse_can_not_remove_last_schema',
def atse_delSchemata(self, name, RESPONSE=None): """ delete a schemata """
raise ValueError(self.translate('atse_field_not_deleteable',
raise SchemaEditorError(self.translate('atse_field_not_deleteable',
def atse_delField(self, name, RESPONSE=None): """ remove a field from the schema"""
raise ValueError(self.translate('atse_empty_field_name',
raise SchemaEditorError(self.translate('atse_empty_field_name',
def atse_update(self, fielddata, REQUEST, RESPONSE=None): """ update a single field"""
raise ValueError(self.translate('atse_not_a_valid_id',
raise SchemaEditorError(self.translate('atse_not_a_valid_id',
def atse_update(self, fielddata, REQUEST, RESPONSE=None): """ update a single field"""
raise ValueError(self.translate('atse_field_already_exists',
raise SchemaEditorError(self.translate('atse_field_already_exists',
def atse_update(self, fielddata, REQUEST, RESPONSE=None): """ update a single field"""
else: raise TypeError(self.translate('atse_unknown_field',
else: raise SchemaEditorError(self.translate('atse_unknown_field',
def atse_update(self, fielddata, REQUEST, RESPONSE=None): """ update a single field"""
else: raise ValueError(self.translate('atse_unknown_widget', {'widget' : d.widget}, 'unknown widget type: $widget'))
else: raise SchemaEditorError(self.translate('atse_unknown_widget', {'widget' : d.widget}, 'unknown widget type: $widget'))
def atse_update(self, fielddata, REQUEST, RESPONSE=None): """ update a single field"""
raise RuntimeError
raise SchemaEditorError
def atse_update(self, fielddata, REQUEST, RESPONSE=None): """ update a single field"""
return '%s %s' % (self.getId(), self.Title())
return '%s: %s' % (self.getId(), self.Title())
def title_or_id(self): """ return the id + title (override for navigation tree) """ return '%s %s' % (self.getId(), self.Title())
users = wftool.getInfoFor(self, 'assigned_to', ())or () if sorted: users = list(users); users.sort()
users = list(wftool.getInfoFor(self, 'assigned_to', ()) or ()) if sorted: users.sort()
def assigned_to(self, sorted=0): """ return assigned users according to the workflow """ wftool = getToolByName(self, 'portal_workflow') users = wftool.getInfoFor(self, 'assigned_to', ())or () if sorted: users = list(users); users.sort() return users
return wftool.getInfoFor(self, 'state', 'Pending')
return wftool.getInfoFor(self, 'state', 'pending')
def status(self): """ return workflow state """ wftool = getToolByName(self, 'portal_workflow') return wftool.getInfoFor(self, 'state', 'Pending')
return self.workflow_history['pcng_issue_workflow']
return self.workflow_history[IssueWorkflowName]
def getWorkflowHistory(self): """ return the workflow history """ return self.workflow_history['pcng_issue_workflow']
if not hasattr(obj, url):
context = controller_state.getContext() if not hasattr(context, url):
def __call__(self, controller_state): url = self.getArg(controller_state) REQUEST = controller_state.getContext().REQUEST for (key, value) in controller_state.kwargs.items(): REQUEST.set(key, value) # make sure target exists if not hasattr(obj, url): raise ValueError, 'Unable to find %s\n' % str(url) obj = controller_s...
obj = controller_state.getContext().restrictedTraverse(url)
obj = context.restrictedTraverse(url)
def __call__(self, controller_state): url = self.getArg(controller_state) REQUEST = controller_state.getContext().REQUEST for (key, value) in controller_state.kwargs.items(): REQUEST.set(key, value) # make sure target exists if not hasattr(obj, url): raise ValueError, 'Unable to find %s\n' % str(url) obj = controller_s...
old_status = self.status()
self._v_old_status = self.status()
def issue_followup(self, action, comment='', text_format='plain', assignees=[], assignees_group=[], RESPONSE=None): """ issue followup handling """
new_status = self.status() self._transcript.addChange('status', old_status, new_status)
def issue_followup(self, action, comment='', text_format='plain', assignees=[], assignees_group=[], RESPONSE=None): """ issue followup handling """
def dowrap(text, limit=100): return fill(text, limit)
def dowrap(text, limit=80): l = [] for line in text.split('\n'): l.extend(wrap(line, limit)) return '\n'.join(l)
def dowrap(text, limit=100): return fill(text, limit)
definition(html_quote(getFieldValue(issue, 'description')), PreStyle)
description = issue.Schema()['description'].get(issue) pre(dowrap(toUnicode(description)))
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
LOG("return value of delProperty: " + str(self.new._delProperty(id))) else: self.new._delProperty(id) else: LOG("property: " + str(self.new.getProperty(id)))
self.new._delProperty(id) LOG("property: " + str(self.new.getProperty(id)))
def migrate_properties(self): """Migrates zope properties Removes the old (if exists) and adds a new """ for id in self.old.propertyIds(): LOG("propertyid: " + str(id)) if id in ('title', 'description'): # migrated by dc continue if id in ('content_type', ): # has to be taken care of separately LOG("property with id: ...
ATCTContent._notifyOfCopyTo(self, container, op=0)
def _notifyOfCopyTo(self, container, op=0): """Override this to store a flag when we are copied, to be able to discriminate the right thing to do in manage_afterAdd here below. """ ATCTContent._notifyOfCopyTo(self, container, op=0) self._v_renamed = 1
zLOG.LOG('PloneLocalFolderNG', zLOG.INFO , "validFolder() :: path = %s" %destfolder )
def validFolder(self, REQUEST=None): """ dtermine if the requested folder path is legal and exists """
zLOG.LOG('PloneLocalFolderNG', zLOG.INFO , "validFolder() :: path ok for: %s" %destfolder )
def validFolder(self, REQUEST=None): """ dtermine if the requested folder path is legal and exists """
def __call__(self, REQUEST, RESPONSE, *args, **kw): rel_dir = '/'.join(REQUEST.get('_e', [])) destpath = os.path.join(self.folder, rel_dir) if os.path.isfile(destpath): if REQUEST.get('action', '') == 'unpack': self.unpackFile(destpath, REQUEST, RESPONSE) elif REQUEST.get('action', '') == 'delete': self.deleteFile(r...
def __call__(self, REQUEST=None, RESPONSE=None, *args, **kw): if not hasattr(self, "folder"): return self else: rel_dir = '/'.join(REQUEST.get('_e', [])) destpath = os.path.join(self.folder, rel_dir) if os.path.isfile(destpath): if REQUEST.get('action', '') == 'unpack': self.unpackFile(destpath, REQUEST, RESPONSE...
def __call__(self, REQUEST, RESPONSE, *args, **kw): rel_dir = '/'.join(REQUEST.get('_e', [])) destpath = os.path.join(self.folder, rel_dir)
perm = Permission(View,'',self) view_roles = perm.getRoles() dummyFileProxy._View_Permission = view_roles
def catalogContents(self,rel_dir=None): portal = getToolByName(self, 'portal_url').getPortalObject() portalId = portal.getId() if self.filetypes_not_to_catalog: filetypePhrasesSkipList = split(self.filetypes_not_to_catalog,',') else: filetypePhrasesSkipList = [] filesCataloged = 0 filesNotCataloged = 0 if rel_dir =...
def send(self, messageText, mto=None, mfrom=None, subject=None,
def send(self, message, mto=None, mfrom=None, subject=None,
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.absolute_url(0)) se...
subject=subjet, encode=encode)
subject=subject, encode=encode)
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.absolute_url(0)) se...
if not isistance(messageText, email.MIMEText.MIMEText):
if not isinstance(messageText, email.MIMEText.MIMEText):
def __SYNC_send( self, mfrom, mto, messageText, debug=False): """Send the message """ if not isistance(messageText, email.MIMEText.MIMEText): message = email.message_from_string(messageText) else: message = messageText mail = Mail(mfrom, mto, message, smtp_host=self.smtp_host, smtp_port=self.smtp_port, userid=self._smt...
raise ValueError(self.Translate('no_self_reference', 'Issues can not reference themselves')
raise ValueError(self.Translate('no_self_reference', 'Issues can not reference themselves'))
def add_reference(self, reference, RESPONSE=None): """ add a new reference (record object) """
ZopeTestCase.installProduct('MailHost', quiet=1) ZopeTestCase.installProduct('PageTemplates', quiet=1) ZopeTestCase.installProduct('PythonScripts', quiet=1) ZopeTestCase.installProduct('ExternalMethod', quiet=1)
ZopeTestCase.installProduct('MailHost', 1) ZopeTestCase.installProduct('PageTemplates', 1) ZopeTestCase.installProduct('PythonScripts', 1) ZopeTestCase.installProduct('ExternalMethod', 1)
def dcEdit(obj): """dublin core edit (inplace) """ obj.setTitle('Test Title') obj.setDescription('Test description') # XXX more
class BrokenImplementation(ExeATCTion): pass class DoesNotImplement(ExeATCTion): pass class BrokenMethodImplementation(ExeATCTion): pass
class BrokenImplementation(Exception): pass class DoesNotImplement(Exception): pass class BrokenMethodImplementation(Exception): pass
def flattenInterfaces(interfaces, remove_duplicates=1): return ()
def __call__(self, REQUEST, RESPONSE, *args, **kw): rel_dir = '/'.join(REQUEST.get('_e', [])) destpath = os.path.join(self.folder, rel_dir) if os.path.isfile(destpath): if REQUEST.get('action', '') == 'unpack': self.unpackFile(destpath, REQUEST, RESPONSE) elif REQUEST.get('action', '') == 'delete': self.deleteFile(r...
def __call__(self, REQUEST=None, RESPONSE=None, *args, **kw): if not hasattr(self, "folder"): return self elif not REQUEST: zLOG.LOG('PloneLocalFolderNG', zLOG.INFO , "__call__() :: no REQUEST") raise NotImplementedError, "PLFNG objects can only be created and viewed through the Plone interface." else: rel_dir = '/'.j...
def __call__(self, REQUEST, RESPONSE, *args, **kw): rel_dir = '/'.join(REQUEST.get('_e', [])) destpath = os.path.join(self.folder, rel_dir)
def installProduct(self,p,locked=0,hidden=0,swallowExceptions=0):
def installProduct(p,locked=0,hidden=0,swallowExceptions=0):
def installProduct(self,p,locked=0,hidden=0,swallowExceptions=0): ''' installs a product by name throws AlreadyInstalled exception, if components of the product are already installed if swallowExceptions is true, exceptions are caught and logged '''
def getProductFile(self,p,fname='readme.txt'):
def getProductFile(p,fname='readme.txt'):
def getProductFile(self,p,fname='readme.txt'): ''' returns the content of a file of the product case-insensitive, if it does not exist -> None '''
def getProductReadme(self,p):
def getProductReadme(p):
def getProductReadme(self,p): ''' returns the readme file of the product case-insensitive '''
def getProductVersion(self,p):
def getProductVersion(p):
def getProductVersion(self,p): ''' returns the version string stored in version.txt'''
print self.workflow_history return self.workflow_history[IssueWorkflowName]
return self.workflow_history[self.collector_workflow]
def getWorkflowHistory(self): """ return the workflow history """ print self.workflow_history return self.workflow_history[IssueWorkflowName]
print >>fp, '\t\tlabel = "%s";' % graph
def build_graphviz(graphs, nodes, edges): """ Graphviz generation """ external_edges = [] fname = tempfile.mktemp() fp = open(fname, 'w') print >>fp, 'digraph G {' for graph in graphs.keys(): print >>fp, '\tsubgraph %s {' % graph print >>fp, '\t\tlabel = "%s";' % graph for e in edges: if e.src.id.startswith(graph) a...
print >>fp, '\t\t%s -> %s' % (e.src.id, e.dest.id) else: if not e in external_edges and e.src.id.startswith(graph):
print >>fp, '\t\t%s -> %s;' % (e.src.id, e.dest.id) elif e.src.id.startswith(graph):
def build_graphviz(graphs, nodes, edges): """ Graphviz generation """ external_edges = [] fname = tempfile.mktemp() fp = open(fname, 'w') print >>fp, 'digraph G {' for graph in graphs.keys(): print >>fp, '\tsubgraph %s {' % graph print >>fp, '\t\tlabel = "%s";' % graph for e in edges: if e.src.id.startswith(graph) a...
print >>fp, '\t}'
print >>fp, '\t\tlabel="%s";' % graph print >>fp, '\t}\n'
def build_graphviz(graphs, nodes, edges): """ Graphviz generation """ external_edges = [] fname = tempfile.mktemp() fp = open(fname, 'w') print >>fp, 'digraph G {' for graph in graphs.keys(): print >>fp, '\tsubgraph %s {' % graph print >>fp, '\t\tlabel = "%s";' % graph for e in edges: if e.src.id.startswith(graph) a...
print >>fp, '\t%s -> %s' % (e.src.id, e.dest.id)
print >>fp, '\t%s -> %s;' % (e.src.id, e.dest.id)
def build_graphviz(graphs, nodes, edges): """ Graphviz generation """ external_edges = [] fname = tempfile.mktemp() fp = open(fname, 'w') print >>fp, 'digraph G {' for graph in graphs.keys(): print >>fp, '\tsubgraph %s {' % graph print >>fp, '\t\tlabel = "%s";' % graph for e in edges: if e.src.id.startswith(graph) a...
def getFullName(self):
def getEmail(self):
def getFullName(self): return self.email
Log(LOG_DEBUG, "Roles", roles)
def getRolesInContext(self, object, userid = None): """Return the list of roles assigned to the user, including local roles assigned in context of the passed in object.""" if not userid: userid=self.getId() roles=self.getRoles() group_roles = [] local={} object=getattr(object, 'aq_inner', object) while 1: # Get local r...
self._p_changed = 1
def atse_update(self, fielddata, REQUEST, RESPONSE=None): """ update a single field"""
rev_date = "$Date: 2005/01/07 20:32:46 $"[7:-2]
rev_date = "$Date: 2005/02/15 14:23:19 $"[7:-2]
def getGRUFVersion(self,): """ getGRUFVersion(self,) => Return human-readable GRUF version as a string. """ rev_date = "$Date: 2005/01/07 20:32:46 $"[7:-2] return "%s / Revised %s" % (version__, rev_date)
grp_name
def updateLDAPUserFolderMapping(self, REQUEST = None): """ updateLDAPUserFolderMapping(self, REQUEST = None) => None Update the first LUF source in the process so that LDAP-group-to-Zope-role mapping is done. This is done by calling the appropriate method in LUF and affecting all 'group_' roles to the matching LDAP gr...
gruf_ids = self.getGroupNames()
gruf_ids = self.getGroupIds()
def listLDAPUserFolderMapping(self,): """ listLDAPUserFolderMapping(self,) => utility method """ ret = [] gruf_done = [] ldap_done = [] # Scan sources for src in self.listUserSources(): if not src.meta_type == "LDAPUserFolder": continue
Log(LOG_DEBUG, "return", ret)
def listLDAPUserFolderMapping(self,): """ listLDAPUserFolderMapping(self,) => utility method """ ret = [] gruf_done = [] ldap_done = [] # Scan sources for src in self.listUserSources(): if not src.meta_type == "LDAPUserFolder": continue
import pdb pdb.set_trace()
if logException: logException()
def manage_afterAdd(self, object, container): try: BaseClass.manage_afterAdd(self, object, container) # Re-read .metadata after adding so that we can do validation checks # using information in portal_form_controller. Since manage_afterAdd # is not guaranteed to run, we also call these in __init__ object._read_action_...
if d.widget == 'String': pass
if d.widget == 'String': widget = StringWidget(visible=visible)
def schema_update(self, REQUEST, RESPONSE=None): """ update a schema schema """
print issue.getId() print issue.absolute_url() print tracker.getId() print reference.comment
def add_reference(self, reference, RESPONSE=None): """ add a new reference (record object) """
util.redirect(RESPONSE, 'pcng_issue_references',
util.redirect(RESPONSE, 'pcng_issue_uploads',
def upload_file(self, uploaded_file=None, comment='', srcname='', mimetype='', notify=1, RESPONSE=None): """ Upload a file """
util.redirect(RESPONSE, 'pcng_issue_references',
util.redirect(RESPONSE, 'pcng_issue_uploads',
def upload_remove(self, id, RESPONSE): """ Remove an uploaded file """ self.manage_delObjects([id]) util.redirect(RESPONSE, 'pcng_issue_references', self.Translate('upload_removed', 'File has been removed'))
return self.getRefs()
tool = getToolByName(self, REFERENCE_CATALOG) return tool.getReferences(self)
def getForwardReferences(self): """ AT forward references """ if self.haveATReferences(): return self.getRefs() else: return ()
return self.getBRefs()
tool = getToolByName(self, REFERENCE_CATALOG) return tool.getBackReferences(self)
def getBackReferences(self): """ AT forward references """ if self.haveATReferences(): return self.getBRefs() else: return ()
security.declareProtected(View, 'getTargetObjectForReference') def getTargetObjectForReference(self, ref): """ Wrapper for reference.getTargetObject() """ return ref.getTargetObject()
def getBackReferences(self): """ AT forward references """ if self.haveATReferences(): return self.getBRefs() else: return ()
self.atse_init(issue_schema.schema)
self.atse_init(issue_schema.schema, filtered_schemas=('default', 'metadata'), undeleteable_fields = UNDELETEABLE_FIELDS, domain='plonecollectorng')
def manage_afterAdd(self, item, container): """ post creation (or post renaming) actions """ BaseBTreeFolder.manage_afterAdd(self, item, container)
raise error
raise MigrationError(obj, migrator, tb)
def migrate(self, objs): """Migrates the objects in the ist objs """
mimetype = self.guessMimetypeOfText()
if hasattr(self, '_v_renamed'): mimetype = field.getContentType(self) del self._v_renamed else: mimetype = self.guessMimetypeOfText()
def manage_afterAdd(self, item, container): """ Fix text when created througt webdav Guess the right mimetype from the id/data """ ATCTContent.manage_afterAdd(self, item, container)
config = ConfigParser() config.read([CFG_FILE, os.path.expanduser('~/%s' % CFG_FILE), options.configuration_file])
def parse_mail(options): # parse configuration if options.configuration: config = ConfigParser() config.read([CFG_FILE, os.path.expanduser('~/%s' % CFG_FILE), options.configuration_file]) section = options.configuration if not config.has_section(section): raise ValueError("Section '%s' not found in configuration file"...
print options.max_length
def parse_mail(options): # parse configuration if options.configuration: config = ConfigParser() config.read([CFG_FILE, os.path.expanduser('~/%s' % CFG_FILE), options.configuration_file]) section = options.configuration if not config.has_section(section): raise ValueError("Section '%s' not found in configuration file"...
parser.add_option('-c', '--configuration-file', dest='configuration_file', help='Path to configuration file (~/%s)' % CFG_FILE, default='~/%s' % CFG_FILE)
def handle_response(R, status, reason, data): LOG.debug('Status: %s' % status) LOG.debug('Reason: %s' % reason) LOG.debug('Data: %s' % data) if status == 200: # OK LOG.info('Submission ok') elif status == 401: # Unauthorized LOG.info('Submission unauthorized') elif status == 404: # NotFound LOG.info('Submission ...
R = parse_mail(options) status, reason, data = submit_request(R, options) handle_response(R, status, reason, data)
try: R = parse_mail(options) status, reason, data = submit_request(R, options) handle_response(R, status, reason, data) except: LOG.error('Error processing mail', exc_info=sys.exc_info())
def handle_response(R, status, reason, data): LOG.debug('Status: %s' % status) LOG.debug('Reason: %s' % reason) LOG.debug('Data: %s' % data) if status == 200: # OK LOG.info('Submission ok') elif status == 401: # Unauthorized LOG.info('Submission unauthorized') elif status == 404: # NotFound LOG.info('Submission ...
v = str(context.Schema()[fieldname].get(context))
context.LOG('getValue :%s' % fieldname)
def getValue(fieldname, translate=0): v = str(context.Schema()[fieldname].get(context)) vocab = context.pcng_vocabulary_values(fieldname) if translate: return TR(vocab[v], vocab[v]) else: return vocab[v]
return TR(vocab[v], vocab[v])
return TR(vocab[str(v)], vocab[str(v)])
def getValue(fieldname, translate=0): v = str(context.Schema()[fieldname].get(context)) vocab = context.pcng_vocabulary_values(fieldname) if translate: return TR(vocab[v], vocab[v]) else: return vocab[v]
return vocab[v]
if same_type(v, []): return ', '.join([vocab[item] for item in v]) else: return vocab[v]
def getValue(fieldname, translate=0): v = str(context.Schema()[fieldname].get(context)) vocab = context.pcng_vocabulary_values(fieldname) if translate: return TR(vocab[v], vocab[v]) else: return vocab[v]
if tb[1].endswith('already in use.'):
if str(tb[1]).endswith('already in use.'):
def installProduct(self,p,locked=0,hidden=0,swallowExceptions=0): ''' installs a product by name ''' if self.isProductInstalled(p): prod=self._getOb(p) msg='this product is already installed, please uninstall before reinstalling it' prod.log(msg) return msg portal_types=getToolByName(self,'portal_types') portal_skins...
self.DEFAULT_LANGGUAGE=langs[-1]
self.DEFAULT_LANGUAGE=langs[-1]
def setLanguageBindings(self, useCookie=1, useRequest=1, useDefault=1): # setup the current language stuff langs=[] if useCookie: langsDefault=[self.tool.getPreferredLanguage(),] else: langsCookie=[] if useRequest: langsRequest=self.tool.getRequestLanguages() else: langsRequest=[] if useDefault: langsDefault=[self...
issue = self.restrictedTraverse(issue_url)
issue = self.getPhysicalRoot().restrictedTraverse(issue_url)
def delete_reference(self, issue_url, RESPONSE=None): """ delete a reference given by its position """
tracker = self.restrictedTraverse(tracker_url)
tracker = self.getPhysicalRoot().restrictedTraverse(tracker_url)
def add_reference(self, reference, RESPONSE=None): """ add a new reference (record object) """
icon = getIconURL(o2, icon_base_url) title = o2.title_and_id() url_tool = getToolByName(self, 'portal_url') path = escape(url_tool.getRelativeUrl(obj))
icon = escape(getIconURL(o2, icon_base_url).encode('utf8')) title = escape(o2.title_and_id().encode('utf8')) path = obj.absolute_url()
def _render_editing(self, obj, text, icon_base_url): o2 = obj.dereference() icon = getIconURL(o2, icon_base_url) title = o2.title_and_id() url_tool = getToolByName(self, 'portal_url') path = escape(url_tool.getRelativeUrl(obj)) composite_tool = getToolByName(self, TOOL_ID) viewlets_info = composite_tool.getViewletsFor(...
return edit_tag % (path, escape(icon), escape(title), " ".join(allowed_viewlets_ids), "%".join(allowed_viewlets_titles),
allowed_viewlets_ids = " ".join(allowed_viewlets_ids) allowed_viewlets_ids = allowed_viewlets_ids.encode('utf8') allowed_viewlets_titles = "%".join(allowed_viewlets_titles) allowed_viewlets_titles = allowed_viewlets_titles.encode('utf8') result = edit_tag % (path, icon, title, allowed_viewlets_ids, allowed_viewlets_tit...
def _render_editing(self, obj, text, icon_base_url): o2 = obj.dereference() icon = getIconURL(o2, icon_base_url) title = o2.title_and_id() url_tool = getToolByName(self, 'portal_url') path = escape(url_tool.getRelativeUrl(obj)) composite_tool = getToolByName(self, TOOL_ID) viewlets_info = composite_tool.getViewletsFor(...
prefix = GRUFFolder.GRUFGroups._group_prefix if name.startswith(prefix): self._doAddGroup(name, roles, groups, **kw)
def _doAddUser(self, name, password, roles, domains, groups = (), **kw): """Create a new user. This should be implemented by subclasses to do the actual adding of a user. The 'password' will be the original input password, unencrypted. The implementation of this method is responsible for performing any needed encryptio...
prefix = GRUFFolder.GRUFGroups._group_prefix
def _doAddUser(self, name, password, roles, domains, groups = (), **kw): """Create a new user. This should be implemented by subclasses to do the actual adding of a user. The 'password' will be the original input password, unencrypted. The implementation of this method is responsible for performing any needed encryptio...
rev_date = "$Date: 2004/01/15 11:05:20 $"[7:-2]
rev_date = "$Date: 2004/01/15 11:09:26 $"[7:-2]
def getGRUFVersion(self,): """ getGRUFVersion(self,) => Return human-readable GRUF version as a string. """ rev_date = "$Date: 2004/01/15 11:05:20 $"[7:-2] return "%s / Revised %s" % (version__, rev_date)
"""Interface for criteria used for searching
"""Interface for criteria used for sorting
def getCriteriaItems(): """Return a sequence of items to be used to build the catalog query. """
binding = here.get('LANGUAGE_TOOL')
binding = context.get('LANGUAGE_TOOL')
def __init__(self, context): self._env = context self.languages = []