bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def registerClass(self, instance_class=None, meta_type='', permission=None, constructors=(), icon=None, permissions=None, legacy=(), ): """Register a constructor
def registerClass(self, instance_class=None, meta_type='', permission=None, constructors=(), icon=None, permissions=None, legacy=(), ): """Register a constructor
3,300
def _indexedSearch(self, args, sort_index, append, used, IIBType=type(IIBucket()), intSType=type(intSet())): """ Iterate through the indexes, applying the query to each one. Do some magic to join result sets. Be intelligent about handling intSets and IIBuckets. """
def _indexedSearch(self, args, sort_index, append, used, IIBType=type(IIBucket()), intSType=type(intSet())): """ Iterate through the indexes, applying the query to each one. Do some magic to join result sets. Be intelligent about handling intSets and IIBuckets. """
3,301
def _indexedSearch(self, args, sort_index, append, used, IIBType=type(IIBucket()), intSType=type(intSet())): """ Iterate through the indexes, applying the query to each one. Do some magic to join result sets. Be intelligent about handling intSets and IIBuckets. """
def _indexedSearch(self, args, sort_index, append, used, IIBType=type(IIBucket()), intSType=type(intSet())): """ Iterate through the indexes, applying the query to each one. Do some magic to join result sets. Be intelligent about handling intSets and IIBuckets. """
3,302
def manage_workspace(self, REQUEST): """Dispatch to first interface in manage_options """ options=self.filtered_manage_options(REQUEST) try: m=options[0]['action'] if m=='manage_workspace': raise TypeError except: raise Unauthorized, ( 'You are not authorized to view this object.')
def manage_workspace(self, REQUEST): """Dispatch to first interface in manage_options """ options=self.filtered_manage_options(REQUEST) try: m=options[0]['action'] if m=='manage_workspace': raise TypeError except: raise Unauthorized, ( 'You are not authorized to view this object.')
3,303
def emitRepeat(self, arg, position=(None, None)): m = re.match("(?s)\s*(%s)\s+(.*)\Z" % NAME_RE, arg) if not m: raise TALError("invalid repeat syntax: " + `repeat`, position) name, expr = m.group(1, 2) cexpr = self.compileExpression(expr) program = self.popProgram() self.emit("loop", name, cexpr, program)
def emitRepeat(self, arg, position=(None, None)): m = re.match("(?s)\s*(%s)\s+(.*)\Z" % NAME_RE, arg) if not m: raise TALError("invalid repeat syntax: " + `arg`, position) name, expr = m.group(1, 2) cexpr = self.compileExpression(expr) program = self.popProgram() self.emit("loop", name, cexpr, program)
3,304
def emitFillSlot(self, slotName, position=(None, None)): program = self.popProgram() if self.slots.has_key(slotName): raise METALError("duplicate slot definition: %s" % slotName, position) self.slots[slotName] = program self.emit("fillSlot", slotName, program)
def emitFillSlot(self, slotName, position=(None, None)): program = self.popProgram() if self.slots.has_key(slotName): raise METALError("duplicate fill-slot name: %s" % slotName, position) self.slots[slotName] = program self.emit("fillSlot", slotName, program)
3,305
def __init__(self, product, dest, REQUEST): self._product=product.__dict__ self._d=dest v=REQUEST['URL'] v=v[:rfind(v,'/')] self._u=v[:rfind(v,'/')]
def __init__(self, product, dest, REQUEST): if hasattr(product,'aq_base'): product=product.aq_base self._product=product self._d=dest v=REQUEST['URL'] v=v[:rfind(v,'/')] self._u=v[:rfind(v,'/')]
3,306
def manage_catalogObject(self, REQUEST, urls=None): """ index all Zope objects that 'urls' point to """ if urls: for url in urls: try: # if an error happens here, the catalog will be in # an unstable state. If this happens, ignore the # object. obj = REQUEST.resolve_url(url, REQUEST) except: continue self.catalog_obj...
def manage_catalogObject(self, REQUEST, urls=None): """ index all Zope objects that 'urls' point to """ if urls: for url in urls: try: # if an error happens here, the catalog will be in # an unstable state. If this happens, ignore the # object. obj = self.resolve_url(url, REQUEST) except: continue self.catalog_object...
3,307
def manage_uncatalogObject(self, REQUEST, urls=None): """ removes Zope object 'urls' from catalog """
def manage_uncatalogObject(self, REQUEST, urls=None): """ removes Zope object 'urls' from catalog """
3,308
def manage_uncatalogObject(self, REQUEST, urls=None): """ removes Zope object 'urls' from catalog """
def manage_uncatalogObject(self, REQUEST, urls=None): """ removes Zope object 'urls' from catalog """
3,309
def manage_catalogReindex(self, REQUEST): """ clear the catalog, then re-index everything """
def manage_catalogReindex(self, REQUEST): """ clear the catalog, then re-index everything """
3,310
def manage_catalogReindex(self, REQUEST): """ clear the catalog, then re-index everything """
def manage_catalogReindex(self, REQUEST): """ clear the catalog, then re-index everything """
3,311
def getobject(self, rid, REQUEST=None): """ Return a cataloged object given a 'data_record_id_' """ if REQUEST is None: REQUEST=self.REQUEST url='%s/%s' %(REQUEST.script, self.getpath(rid))
def getobject(self, rid, REQUEST=None): """ Return a cataloged object given a 'data_record_id_' """ if REQUEST is None: REQUEST=self.REQUEST url='%s/%s' %(REQUEST.script, self.getpath(rid))
3,312
def getobject(self, rid, REQUEST=None): """ Return a cataloged object given a 'data_record_id_' """ if REQUEST is None: REQUEST=self.REQUEST url='%s/%s' %(REQUEST.script, self.getpath(rid))
def getobject(self, rid, REQUEST=None): """ Return a cataloged object given a 'data_record_id_' """ if REQUEST is None: REQUEST=self.REQUEST url='%s/%s' %(REQUEST.script, self.getpath(rid))
3,313
def resolve_url(self, path, REQUEST): """ The use of this function is depricated. Use 'getobject' """ # Attempt to resolve a url into an object in the Zope # namespace. The url must be a fully-qualified url. The # method will return the requested object if it is found # or raise the same HTTP error that would be raise...
def resolve_url(self, path, REQUEST): """ The use of this function is depricated.Use 'getobject' """ # Attempt to resolve a url into an object in the Zope # namespace. The url must be a fully-qualified url. The # method will return the requested object if it is found # or raise the same HTTP error that would be raised ...
3,314
def install_products(): # Install a list of products into the basic folder class, so # that all folders know about top-level objects, aka products path_join=os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') isdir=os.path.isdir exists=os.path.exists DictType=type({}) meta_types=list(Folder.Folder...
def install_products(): # Install a list of products into the basic folder class, so # that all folders know about top-level objects, aka products path_join=os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') isdir=os.path.isdir exists=os.path.exists DictType=type({}) meta_types=list(Folder.Folder...
3,315
def lic_check(product_name): path_join =os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') package_dir=path_join(product_dir, product_name) bobobase =Globals.Bobobase try: f=open(path_join(package_dir,'%s.lic' % product_name), 'rb') except: try: product=getattr(__import__("Products.%s" % produc...
def lic_check(product_name): path_join =os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') package_dir=path_join(product_dir, product_name) bobobase =Globals.Bobobase try: f=open(path_join(package_dir,'%s.lic' % product_name), 'rb') except: try: product=getattr(__import__("Products.%s" % produc...
3,316
def lic_check(product_name): path_join =os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') package_dir=path_join(product_dir, product_name) bobobase =Globals.Bobobase try: f=open(path_join(package_dir,'%s.lic' % product_name), 'rb') except: try: product=getattr(__import__("Products.%s" % produc...
def lic_check(product_name): path_join =os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') package_dir=path_join(product_dir, product_name) bobobase =Globals.Bobobase try: f=open(path_join(package_dir,'%s.lic' % product_name), 'rb') except: try: product=getattr(__import__("Products.%s" % produc...
3,317
def absolute_url(self, relative=0): """Return an absolute url to the object. Note that the url will reflect the acquisition path of the object if the object has been acquired.""" obj=self url=[] while hasattr(obj, 'aq_parent') and hasattr(obj.aq_parent, 'id'): id=callable(obj.id) and obj.id() or str(obj.id) url.append(...
def absolute_url(self, relative=0): """Return an absolute url to the object. Note that the url will reflect the acquisition path of the object if the object has been acquired.""" obj=self url=[] while hasattr(obj, 'aq_parent') and hasattr(obj.aq_parent, 'id'): id=callable(obj.id) and obj.id() or str(obj.id) url.append(...
3,318
def __len__(self): return 1
def def absolute_url(self, relative=0): id=quote(self.id) p=getattr(self,'aq_inner', None) if p is not None: url=p.aq_parent.absolute_url(relative) if url: id=url+'/'+id return id __len__(self): def absolute_url(self, relative=0): id=quote(self.id) p=getattr(self,'aq_inner', None) if p is not None: url=p.aq_parent.a...
3,319
def justify_and_indent(text, level, munge=0, width=72): """ indent and justify text, rejustify (munge) if specified """ lines = [] if munge: line = " " * level text = string.split(string.strip(string.translate(text, string.maketrans("\r\n", " ")))) for word in text: line = string.join([line, word]) if len(line) > ...
defjustify_and_indent(text,level,munge=0,width=72):"""indentandjustifytext,rejustify(munge)ifspecified"""lines=[]ifmunge:line=""*leveltext=string.split(string.strip(string.translate(text,string.maketrans("\r\n",""))))forwordintext:line=string.join([line,word])iflen(line)>width:lines.append(line)line=""*levelelse:lines....
3,320
def __init__(self, *attrs): Distribution.__init__(self, *attrs) self.cmdclass['build'] = MyBuilder self.cmdclass['build_ext'] = MyExtBuilder self.cmdclass['install_lib'] = MyLibInstaller
def __init__(self, *attrs): Distribution.__init__(self, *attrs) self.cmdclass['build'] = MyBuilder self.cmdclass['build_ext'] = MyExtBuilder self.cmdclass['install_lib'] = MyLibInstaller
3,321
def __init__(self, *attrs): Distribution.__init__(self, *attrs) self.cmdclass['build'] = MyBuilder self.cmdclass['build_ext'] = MyExtBuilder self.cmdclass['install_lib'] = MyLibInstaller
def __init__(self, *attrs): Distribution.__init__(self, *attrs) self.cmdclass['build'] = MyBuilder self.cmdclass['build_ext'] = MyExtBuilder self.cmdclass['install_lib'] = MyLibInstaller
3,322
def render(self,md): args=self.args have=args.has_key
def render(self,md): args=self.args have=args.has_key
3,323
def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): "Render a tree as a table" have_arg=args.has_key exp=0 if level >= 0: urlattr=args['url'] if urlattr and hasattr(self, urlattr): tpUr...
def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): "Render a tree as a table" have_arg=args.has_key exp=0 if level >= 0: urlattr=args['url'] if urlattr and hasattr(self, urlattr): tpUr...
3,324
def _checkId(self, id, allow_dup=0): # If allow_dup is false, an error will be raised if an object # with the given id already exists. If allow_dup is true, # only check that the id string contains no illegal chars; # _checkId() will be called again later with allow_dup # set to false before the object is added. if not...
def _checkId(self, id, allow_dup=0): # If allow_dup is false, an error will be raised if an object # with the given id already exists. If allow_dup is true, # only check that the id string contains no illegal chars; # _checkId() will be called again later with allow_dup # set to false before the object is added. if not...
3,325
def render(self, md): args=self.args has_key=args.has_key
def render(self, md): args=self.args has_key=args.has_key
3,326
def log(self, subsystem, severity, summary, detail, error): if _log_dest is None or severity < _log_level: return buf = ["------"] line = ("%s %s %s %s" % (log_time(), severity_string(severity), subsystem, summary)) if not textwrap or len(line) < 80: buf.append(line) else: buf.extend(textwrap.wrap(line, width=79, subse...
def log(self, subsystem, severity, summary, detail, error): if _log_dest is None or severity < _log_level: return buf = ["------"] line = ("%s %s %s %s" % (log_time(), severity_string(severity), subsystem, summary)) if not textwrap or len(line) < 80: buf.append(line) else: buf.extend(textwrap.wrap(line, width=79, subse...
3,327
def search(self,path,default_level=0): """ path is either a string representing a relative URL or a part of a relative URL or a tuple (path,level).
def search(self,path,default_level=0): """ path is either a string representing a relative URL or a part of a relative URL or a tuple (path,level).
3,328
def search(self,path,default_level=0): """ path is either a string representing a relative URL or a part of a relative URL or a tuple (path,level).
def search(self,path,default_level=0): """ path is either a string representing a relative URL or a part of a relative URL or a tuple (path,level).
3,329
def PersistentClassDict(doc=None, meta_type=None): # Build new class dict dict={} dict.update(Template.__dict__) if meta_type is not None: dict['meta_type']=dict['__doc__']=meta_type if doc is not None: dict['__doc__']=doc return dict
def _marker=[] PersistentClassDict(doc=None, _marker=[] meta_type=None): _marker=[] # _marker=[] Build _marker=[] new _marker=[] class _marker=[] dict _marker=[] dict={} _marker=[] dict.update(Template.__dict__) _marker=[] if _marker=[] meta_type _marker=[] is _marker=[] not _marker=[] None: _marker=[] dict['meta_type'...
3,330
def getClassAttr(self, name): r=self._zclass_.__dict__[name] return r
def getClassAttr(self, name): r=self._zclass_.__dict__[name] return r
3,331
def parse_params(text, result=None, tag='', unparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)'), parmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)'), qparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]*\)\"\)'), **parms): """Parse tag parameters The format of tag parameters consists of 1 or mor...
def parse_params(text, result=None, tag='', unparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)'), parmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)'), qparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]*\)\"\)'), **parms): """Parse tag parameters The format of tag parameters consists of 1 or mor...
3,332
def unindex_item(self,i):
def unindex_item(self,i):
3,333
def call_with_ns(f, ns, arg=1): td = TemplateDict() td.validate = getSecurityManager().validate td.this = None td._push(ns['request']) td._push(InstanceDict(ns['here'], td)) td._push(ns['var']) try: if arg==2: return f(None, td) else: return f(td) finally: td._pop(3)
def call_with_ns(f, ns, arg=1): td = TemplateDict() td.validate = validate td.this = None td._push(ns['request']) td._push(InstanceDict(ns['here'], td)) td._push(ns['var']) try: if arg==2: return f(None, td) else: return f(td) finally: td._pop(3)
3,334
def index_html(self, REQUEST, PARENTS, RESPONSE):
def index_html(self, REQUEST, PARENTS, RESPONSE):
3,335
def manage_edit(self,data,title,roles,REQUEST=None):
def manage_edit(self,data,title,roles,REQUEST=None):
3,336
def manage_edit(self,data,title,roles,REQUEST=None):
def manage_edit(self,data,title,roles,REQUEST=None):
3,337
def manage_addDocument(self,id,title,roles,REQUEST,file=''):
def manage_addDocument(self,id,title,roles,REQUEST,file=''):
3,338
def __bobo_traverse__(self, request, name): '''Traversing away''' if name in ('manage_main', 'manage_workspace'): return self.manage_main request.setVirtualRoot([]) stack = request['TraversalRequestNameStack'] stack.append(name) parents = request.PARENTS parents.pop() # I don't belong there return parents.pop() # He'll...
def __bobo_traverse__(self, request, name): '''Traversing away''' if name in ('manage_main', 'manage_workspace'): return self.manage_main request.setVirtualRoot([]) stack = request['TraversalRequestNameStack'] stack.append(name) # I don't belong there return parents.pop() # He'll get put back on
3,339
def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): "Render a tree as a table" have_arg=args.has_key exp=0 if level >= 0: urlattr=args['url'] if urlattr and hasattr(self, urlattr): tpUr...
def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): "Render a tree as a table" have_arg=args.has_key exp=0 if level >= 0: urlattr=args['url'] if urlattr and hasattr(self, urlattr): tpUr...
3,340
def add(self, id='aMailHost', title='Some mail thing', smtp_host=None, localhost='localhost', smtp_port=25, REQUEST): ' add a MailHost into the system ' i=MailHost() #create new mail host i.id=id #give it id i.title=title #title i._init(localHost=localhost, smtpHost=smtp_host, smtpP...
def add(self, id='aMailHost', title='Some mail thing', smtp_host=None, localhost='localhost', smtp_port=25, REQUEST): ' add a MailHost into the system ' i=MailHost() #create new mail host i.id=id #give it id i.title=title #title i._init(localHost=localhost, smtpHost=smtp_host, smtpP...
3,341
def add(self, id='aMailHost', title='Some mail thing', smtp_host=None, localhost='localhost', smtp_port=25, REQUEST): ' add a MailHost into the system ' i=MailHost() #create new mail host i.id=id #give it id i.title=title #title i._init(localHost=localhost, smtpHost=smtp_host, smtpP...
def add(self, id='aMailHost', title='Some mail thing', smtp_host=None, localhost='localhost', smtp_port=25, REQUEST): ' add a MailHost into the system ' i=MailHost() #create new mail host i.id=id #give it id i.title=title #title i._init(localHost=localhost, smtpHost=smtp_host, smtpP...
3,342
def newDecapitate(message): blank_re =regex.compile('^[%s]+$' % string.whitespace) header_re=regex.symcomp('^\(<headerName>[^\0- <>:]+\):\(<headerText>.*\)$') linecount=0; headerDict={} maxwell=map(lambda x: string.strip(x),string.split(message,'\n')) for line in maxwell: if not line: break if blank_re.match(line) >=...
def newDecapitate(message): blank_re =regex.compile('^[%s]+$' % string.whitespace) header_re=regex.symcomp('^\(<headerName>[^\0- <>:]+\):\(<headerText>.*\)$') space_re =regex.compile('^[%s]+' % string.whitespace) linecount=0; headerDict={};curHeader={} maxwell=map(lambda x: string.rstrip(x),string.split(message,'\n'))...
3,343
def decapitate(message, header_re=regex.compile( '\(\(' '[^\0- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), #r'(([^\0- <>:]+:[^\n]*\n|[ \t]+[^\0- ][^\n]*\n)+)[ \t]*\n([\0-\377]+)' space_re=regex.compile('\([ \t]+\)'), name_re=regex.compile('\([^\0- <>:]+\):\([^\n]*\)'), ): if header_re....
def decapitate(message, header_re=regex.compile( '\(\(' '[^\0- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), #r'(([^\0- <>:]+:[^\n]*\n|[ \t]+[^\0- ][^\n]*\n)+)[ \t]*\n([\0-\377]+)' space_re=regex.compile('\([ \t]+\)'), name_re=regex.compile('\([^\0- <>:]+\):\([^\n]*\)'), ): if header_re....
3,344
def decapitate(message, header_re=regex.compile( '\(\(' '[^\0- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), #r'(([^\0- <>:]+:[^\n]*\n|[ \t]+[^\0- ][^\n]*\n)+)[ \t]*\n([\0-\377]+)' space_re=regex.compile('\([ \t]+\)'), name_re=regex.compile('\([^\0- <>:]+\):\([^\n]*\)'), ): if header_re....
def decapitate(message, header_re=regex.compile( '\(\(' '[^\0- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), #r'(([^\0- <>:]+:[^\n]*\n|[ \t]+[^\0- ][^\n]*\n)+)[ \t]*\n([\0-\377]+)' ...
3,345
def check_zglobals(self): if not doInstall(): return
def check_zglobals(self): if not doInstall(): return
3,346
def __of__(self, parent): return parent.pt_macros()
def __of__(self, parent): return parent.pt_macros()
3,347
def _getOb(self, id, default=_marker): if hasattr(self, 'aq_base'): self=self.aq_base if default is _marker: return getattr(self, id) try: return getattr(self, id) except: return default
def _getOb(self, id, default=_marker): if hasattr(self, 'aq_base'): self=self.aq_base if default is _marker: return getattr(self, id) try: return getattr(self, id) except: return default
3,348
def tpValues(self): # Return a list of subobjects, used by tree tag. r=[] if hasattr(aq_base(self), 'tree_ids'): tree_ids=self.tree_ids try: tree_ids=list(tree_ids) except TypeError: pass if hasattr(tree_ids, 'sort'): tree_ids.sort() for id in tree_ids: if hasattr(self, id): r.append(self._getOb(id)) else: obj_ids=se...
def tpValues(self): # Return a list of subobjects, used by tree tag. r=[] if hasattr(aq_base(self), 'tree_ids'): tree_ids=self.tree_ids try: tree_ids=list(tree_ids) except TypeError: pass if hasattr(tree_ids, 'sort'): tree_ids.sort() for id in tree_ids: if hasattr(self, id): r.append(self._getOb(id)) else: obj_ids=se...
3,349
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=()
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=()
3,350
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=()
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=()
3,351
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=()
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=()
3,352
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=()
def manage_FTPlist(self, REQUEST): """Directory listing for FTP. """ out=()
3,353
def findChildren(obj,dirname=''): """ recursive walk through the object hierarchy to find all children of an object (ajung) """ lst =[] for name,child in obj.objectItems(): if child.meta_type=="Folder": lst.extend(findChildren(child,dirname+ obj.id + '/')) else: lst.append( (dirname + obj.id + "/" + name,child) ) ret...
def findChildren(obj,dirname=''): """ recursive walk through the object hierarchy to find all children of an object (ajung) """ lst = [] for name, child in obj.objectItems(): if hasattr(aq_base(child), 'isPrincipiaFolderish') and child.isPrincipiaFolderish: lst.extend(findChildren(child, dirname + obj.id + '/')) else:...
3,354
def findChildren(obj,dirname=''): """ recursive walk through the object hierarchy to find all children of an object (ajung) """ lst =[] for name,child in obj.objectItems(): if child.meta_type=="Folder": lst.extend(findChildren(child,dirname+ obj.id + '/')) else: lst.append( (dirname + obj.id + "/" + name,child) ) ret...
def findChildren(obj,dirname=''): """ recursive walk through the object hierarchy to find all children of an object (ajung) """ lst =[] for name,child in obj.objectItems(): if child.meta_type=="Folder": lst.extend(findChildren(child,dirname+ obj.id + '/')) else: lst.append((dirname + obj.id + "/" + name, child)) retu...
3,355
def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s...
def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s...
3,356
def render(self, md): name=self.__name__ args=self.args t=args['type'] try: expr=self.expr if type(expr) is type(''): v=md[expr] else: v=expr(md) except: if args.has_key('optional') and args['optional']: return 'null' raise 'Missing Input', 'Missing input variable, <em>%s</em>' % name
def render(self, md): name=self.__name__ args=self.args t=args['type'] try: expr=self.expr if type(expr) is type(''): v=md[expr] else: v=expr(md) except: if args.has_key('optional') and args['optional']: return 'null' raise 'Missing Input', 'Missing input variable, <em>%s</em>' % name
3,357
def render(self, md): args=self.args have_arg=args.has_key name=self.__name__
def render(self, md): args=self.args have_arg=args.has_key name=self.__name__
3,358
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite...
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite...
3,359
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite...
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite...
3,360
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite...
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite...
3,361
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite...
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite...
3,362
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite...
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite...
3,363
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite...
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite...
3,364
def import_products(): # Try to import each product, checking for and catching errors. path_join=os.path.join product_dir=path_join(SOFTWARE_HOME,'Products') isdir=os.path.isdir exists=os.path.exists DictType=type({}) product_names=os.listdir(product_dir) product_names.sort() global_dict=globals() silly=('__doc__',) ...
def import_products(): # Try to import each product, checking for and catching errors. path_join=os.path.join product_dir=path_join(SOFTWARE_HOME,'Products') isdir=os.path.isdir exists=os.path.exists DictType=type({}) product_names=os.listdir(product_dir) product_names.sort() global_dict=globals() silly=('__doc__',) ...
3,365
def _delObject(self,id): # Ick! This is necessary to deal with spaces. Waaa! id=strip(id) if id=='acl_users': if hasattr(self, '__allow_groups__') and \ self.__dict__.has_key('__allow_groups__'): delattr(self, '__allow_groups__')
def _delObject(self, id, dp=1): # Ick! This is necessary to deal with spaces. Waaa! id=strip(id) if id=='acl_users': if hasattr(self, '__allow_groups__') and \ self.__dict__.has_key('__allow_groups__'): delattr(self, '__allow_groups__')
3,366
def _validateProxy(self, request, roles=None): if roles is None: roles=self._proxy_roles if not roles: return user=u=request.get('AUTHENTICATED_USER',None) if user is not None: user=user.hasRole for r in roles: if r and not user(None, (r,)): user=None break
def _validateProxy(self, request, roles=None): if roles is None: roles=self._proxy_roles if not roles: return user=u=request.get('AUTHENTICATED_USER',None) if user is not None: user=user.hasRole for r in roles: if r and not user(self, (r,)): user=None break
3,367
def domainSpecValidate(spec):
def domainSpecValidate(spec):
3,368
def sort(sequence, sort=(), _=None, mapping=0): """ - sequence is a sequence of objects to be sorted - sort is a sequence of tuples (key,func,direction) that define the sort order: - key is the name of an attribute to sort the objects by - func is the name of a comparison function. This parameter is optional allowe...
def sort(sequence, sort=(), _=None, mapping=0): """ - sequence is a sequence of objects to be sorted - sort is a sequence of tuples (key,func,direction) that define the sort order: - key is the name of an attribute to sort the objects by - func is the name of a comparison function. This parameter is optional allowe...
3,369
def wl_clearLocks(self): # Called by lock management machinery to quickly and effectively # destroy all locks. locks = self.wl_lockmapping() locks.clear() if hasattr(Acquisition.aq_base(self), '__no_valid_write_locks__'): self.__no_valid_write_locks__()
def wl_clearLocks(self): # Called by lock management machinery to quickly and effectively # destroy all locks. try: locks = self.wl_lockmapping() locks.clear() except: if hasattr(self, '_dav_writelocks'): del self._dav_writelocks if WriteLockInterface.isImplementedBy(self): self._dav_writelocks = PersistentMapping() ...
3,370
def render(self, md):
def render(self, md):
3,371
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
3,372
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
3,373
def __init__(self,
def __init__(self,
3,374
def __init__(self,
def if environ.has_key('HTTP_COOKIE'): d=parse_cookie(self.environ['HTTP_COOKIE']) for k in d.keys(): if not form.has_key(k): form[k]=d[k] __init__(self,
3,375
def guarded_getitem(object, index): if type(index) is SliceType: if index.step is not None: v = object[index] else: start = index.start stop = index.stop if start is None: start = 0 if stop is None: v = object[start:] else: v = object[start:stop] # We don't guard slices. return v v = object[index] if Containers(type(ob...
def guarded_getitem(object, index): if type(index) is SliceType: if index.step is not None: v = object[index] else: start = index.start stop = index.stop if start is None: start = 0 if stop is None: v = object[start:] else: v = object[start:stop] # We don't guard slices. return v v = object[index] if Containers(type(ob...
3,376
def delPropertySheet(self, name): result=[] for propset in self.aq_parent.__propsets__: if propset.getId() != name and propset.xml_namespace() != name: result.append(propset) self.parent.__propsets__=tuple(result)
def delPropertySheet(self, name): result=[] for propset in self.aq_parent.__propsets__: if propset.getId() != name and propset.xml_namespace() != name: result.append(propset) self.parent.__propsets__=tuple(result)
3,377
def __init__(self, stdin, environ, response, clean=0, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile( ':[a-zA-Z][a-zA-Z0-9_]+$' ).search, rfi...
def __init__(self, stdin, environ, response, clean=0, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile( ':[a-zA-Z][a-zA-Z0-9_]+$' ).search, rfi...
3,378
def __init__(self, stdin, environ, response, clean=0, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile( ':[a-zA-Z][a-zA-Z0-9_]+$' ).search, rfi...
def __init__(self, stdin, environ, response, clean=0, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile( ':[a-zA-Z][a-zA-Z0-9_]+$' ).search, rfi...
3,379
def __init__(self, stdin, environ, response, clean=0, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile( ':[a-zA-Z][a-zA-Z0-9_]+$' ).search, rfi...
def __init__(self, stdin, environ, response, clean=0, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile( ':[a-zA-Z][a-zA-Z0-9_]+$' ).search, rfi...
3,380
def __init__(self, stdin, environ, response, clean=0, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile( ':[a-zA-Z][a-zA-Z0-9_]+$' ).search, rfi...
def __init__(self, stdin, environ, response, clean=0, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile( ':[a-zA-Z][a-zA-Z0-9_]+$' ).search, rfi...
3,381
def __init__(self, id, title): self.id=id self.title=title self._setObject('Help', ProductHelp('Help', '%s Help' % id))
def __init__(self, id, title): self.id=id self.title=title self._setObject('Help', ProductHelp('Help', id))
3,382
def getProductHelp(self): """ Returns the ProductHelp object associated with the Product. """ if not hasattr(self, 'Help'): self._setObject('Help', ProductHelp('Help', '%s Help' % self.id)) return self.Help
def getProductHelp(self): """ Returns the ProductHelp object associated with the Product. """ if not hasattr(self, 'Help'): self._setObject('Help', ProductHelp('Help', self.id)) return self.Help
3,383
def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, '__import_error__'): ie=productp.__import_error__ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=get...
def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, '__import_error__'): ie=productp.__import_error__ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=get...
3,384
def meta_type(self): try: return self.aq_parent.aq_parent.meta_type except: return ''
def meta_type(self): try: return self.aq_parent.aq_parent.meta_type except: return ''
3,385
def index_html(self, REQUEST=None): ''' Getting the formatted text ''' REQUEST.RESPONSE.setHeader('content-type', 'text/html; charset: %s' % self.output_encoding) return self.formatted
def index_html(self, REQUEST=None): ''' Getting the formatted text ''' REQUEST.RESPONSE.setHeader('content-type', 'text/html; charset=%s' % self.output_encoding) return self.formatted
3,386
def source_txt(self, REQUEST=None): ''' Getting the source text ''' REQUEST.RESPONSE.setHeader('content-type', 'text/plain; charset: %s' % self.input_encoding) return self.source
def source_txt(self, REQUEST=None): ''' Getting the source text ''' REQUEST.RESPONSE.setHeader('content-type', 'text/plain; charset=%s' % self.input_encoding) return self.source
3,387
def _construct(self, context, id, final): """Creates and returns the named folder.""" dispatcher = guarded_getattr(context, 'manage_addProduct')['OFSP'] factory = guarded_getattr(dispatcher, 'manage_addFolder') factory(id) o = context.restrictedTraverse(id) # Commit a subtransaction to assign the new object to # the co...
def _construct(self, context, id): """Creates and returns the named folder.""" dispatcher = guarded_getattr(context, 'manage_addProduct')['OFSP'] factory = guarded_getattr(dispatcher, 'manage_addFolder') factory(id) o = context.restrictedTraverse(id) # Commit a subtransaction to assign the new object to # the correct d...
3,388
def ZCacheable_get(self, view_name='', keywords=None, mtime_func=None, default=None): '''Retrieves the cached view for the object under the conditions specified by keywords. If the value is not yet cached, returns the default. ''' c = self.ZCacheable_getCache() if c is not None and self.__enabled: ob, view_name = self....
def ZCacheable_get(self, view_name='', keywords=None, mtime_func=None, default=None): '''Retrieves the cached view for the object under the conditions specified by keywords. If the value is not yet cached, returns the default. ''' c = self.ZCacheable_getCache() if c is not None and self.__enabled: ob, view_name = self....
3,389
def ZCacheable_set(self, data, view_name='', keywords=None, mtime_func=None): '''Cacheable views should call this method after generating cacheable results. The data argument can be of any Python type. ''' c = self.ZCacheable_getCache() if c is not None and self.__enabled: ob, view_name = self.ZCacheable_getObAndView(v...
def ZCacheable_set(self, data, view_name='', keywords=None, mtime_func=None): '''Cacheable views should call this method after generating cacheable results. The data argument can be of any Python type. ''' c = self.ZCacheable_getCache() if c is not None and self.__enabled: ob, view_name = self.ZCacheable_getObAndView(v...
3,390
def ZCacheable_invalidate(self, view_name='', REQUEST=None): '''Called after a cacheable object is edited. Causes all cache entries that apply to the view_name to be removed. Returns a status message. ''' c = self.ZCacheable_getCache() if c is not None: ob, view_name = self.ZCacheable_getObAndView(view_name) try: messa...
def ZCacheable_invalidate(self, view_name='', REQUEST=None): '''Called after a cacheable object is edited. Causes all cache entries that apply to the view_name to be removed. Returns a status message. ''' c = self.ZCacheable_getCache() if c is not None: ob, view_name = self.ZCacheable_getObAndView(view_name) try: messa...
3,391
def __init__(self): # Initialize users self.__allow_groups__=UserFolder() self._setObject('acl_users', self.__allow_groups__)
def __init__(self): # Initialize users self.__allow_groups__=UserFolder() self._setObject('acl_users', self.__allow_groups__)
3,392
def domainSpecMatch(spec, request): if request.has_key('REMOTE_HOST'): host=request['REMOTE_HOST'] else: host='' if request.has_key('REMOTE_ADDR'): addr=request['REMOTE_ADDR'] else: addr='' if not host and not addr: return 0 if not host: host=socket.gethostbyaddr(addr)[0] if not addr: addr=socket.gethostbyname(host...
def domainSpecMatch(spec, request): if request.has_key('REMOTE_HOST'): host=request['REMOTE_HOST'] else: host='' if request.has_key('REMOTE_ADDR'): addr=request['REMOTE_ADDR'] else: addr='' if not host and not addr: return 0 if not host: try: host=socket.gethostbyaddr(addr)[0] except: pass if not addr: addr=socket....
3,393
def domainSpecMatch(spec, request): if request.has_key('REMOTE_HOST'): host=request['REMOTE_HOST'] else: host='' if request.has_key('REMOTE_ADDR'): addr=request['REMOTE_ADDR'] else: addr='' if not host and not addr: return 0 if not host: host=socket.gethostbyaddr(addr)[0] if not addr: addr=socket.gethostbyname(host...
def domainSpecMatch(spec, request): if request.has_key('REMOTE_HOST'): host=request['REMOTE_HOST'] else: host='' if request.has_key('REMOTE_ADDR'): addr=request['REMOTE_ADDR'] else: addr='' if not host and not addr: return 0 if not host: host=socket.gethostbyaddr(addr)[0] if not addr: try: addr=socket.gethostbyname...
3,394
def render(self, md):
def render(self, md):
3,395
def manage_test(self, REQUEST): """Test an SQL method.""" # Try to render the query template first so that the rendered # source will be available for the error message in case some # error occurs... try: src=self(REQUEST, src__=1) except: src="Could not render the query template!" result=() t=v=tb=None try: try: sr...
def manage_test(self, REQUEST): """Test an SQL method.""" # Try to render the query template first so that the rendered # source will be available for the error message in case some # error occurs... try: src=self(REQUEST, src__=1) except: src="Could not render the query template!" result=() t=v=tb=None try: try: sr...
3,396
def setupPublisher(self): import Globals import ZPublisher.Publish Globals.DevelopmentMode = self.cfg.debug_mode ZPublisher.Publish.set_default_debug_mode(self.cfg.debug_mode) ZPublisher.Publish.set_default_realm(self.cfg.http_realm)
def setupPublisher(self): import Globals import ZPublisher.Publish Globals.DevelopmentMode = self.cfg.debug_mode ZPublisher.Publish.set_default_debug_mode(self.cfg.debug_mode) ZPublisher.Publish.set_default_realm(self.cfg.http_realm)
3,397
def main(): import sys, os, getopt, string global repeat_count try: optlist,args=getopt.getopt(sys.argv[1:], 'dtu:p:r:e:s') if len(args) < 1 or len(args) > 2: raise TypeError, None elif len(args)==1: args=args[0],'/' path_info=args[1] except: sys.stderr.write(__doc__) sys.exit(-1) silent=profile=u=debug=timeit=None e...
def main(): import sys, os, getopt, string global repeat_count try: optlist,args=getopt.getopt(sys.argv[1:], 'dtu:p:r:e:s') if len(args) < 1 or len(args) > 2: raise TypeError, None elif len(args)==1: args=args[0],'/' path_info=args[1] except: sys.stderr.write(__doc__) sys.exit(-1) silent=profile=u=debug=timeit=None e...
3,398
def tag(self, height=None, width=None, alt=None, **args): """ Generate an HTML IMG tag for this image, with customization. Arguments to self.tag() can be any valid attributes of an IMG tag. 'src' will always be an absolute pathname, to prevent redundant downloading of images. Defaults are applied intelligently for 'hei...
def tag(self, height=None, width=None, alt=None, **args): """ Generate an HTML IMG tag for this image, with customization. Arguments to self.tag() can be any valid attributes of an IMG tag. 'src' will always be an absolute pathname, to prevent redundant downloading of images. Defaults are applied intelligently for 'hei...
3,399