bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
def parse_comment(self, i): rawdata = self.rawdata if rawdata[i:i+4] != '<!--': raise HTMLParseError('unexpected call to parse_comment()', self.getpos()) match = commentclose.search(rawdata, i+4) if not match: return -1 j = match.start(0) self.handle_comment(rawdata[i+4: j]) j = match.end(0) return j-i
|
def parse_comment(self, i): rawdata = self.rawdata assert rawdata[i:i+4] == '<!--', 'unexpected call to parse_comment()' match = commentclose.search(rawdata, i+4) if not match: return -1 j = match.start(0) self.handle_comment(rawdata[i+4: j]) j = match.end(0) return j-i
| 4,000
|
def parse_pi(self, i): rawdata = self.rawdata if rawdata[i:i+2] != '<?': raise HTMLParseError('unexpected call to parse_pi()', self.getpos()) match = piclose.search(rawdata, i+2) if not match: return -1 j = match.start(0) self.handle_pi(rawdata[i+2: j]) j = match.end(0) return j-i
|
def parse_pi(self, i): rawdata = self.rawdata assert rawdata[i:i+2] == '<?', 'unexpected call to parse_pi()' match = piclose.search(rawdata, i+2) if not match: return -1 j = match.start(0) self.handle_pi(rawdata[i+2: j]) j = match.end(0) return j-i
| 4,001
|
def parse_starttag(self, i): self.__starttag_text = None rawdata = self.rawdata m = locatestarttagend.match(rawdata, i) if not m: return -1 endpos = m.end(0) self.__starttag_text = rawdata[i:endpos]
|
def parse_starttag(self, i): self.__starttag_text = None rawdata = self.rawdata m = locatestarttagend.match(rawdata, i) if not m: return -1 endpos = m.end(0) self.__starttag_text = rawdata[i:endpos]
| 4,002
|
def namespace(self, **kw): """Create a tuple consisting of a single instance whos attributes are provided as keyword arguments.""" # NOTE: the self argument needs to be a TemplateDict instance. return apply(self, (), kw)
|
def namespace(self, **kw): """Create a tuple consisting of a single instance whose attributes are provided as keyword arguments.""" # NOTE: the self argument needs to be a TemplateDict instance. return apply(self, (), kw)
| 4,003
|
def namespace(self, **kw): """Create a tuple consisting of a single instance whos attributes are provided as keyword arguments.""" # NOTE: the self argument needs to be a TemplateDict instance. return apply(self, (), kw)
|
defif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' namespace(self,if type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' **kw):if type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' """Createif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' aif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' tupleif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' consistingif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' ofif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' aif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' singleif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' instanceif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' whosif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' attributesif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' areif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' providedif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' asif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' keywordif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' arguments."""if type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' #if type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' NOTE:if type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' theif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' selfif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' argumentif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' needsif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' toif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' beif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' aif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' TemplateDictif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' instance.if type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' returnif type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' apply(self,if type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' (),if type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.''' kw)if type(self) != TemplateDict: raise TypeError,'''A call was made to DT_Util.namespace() with an incorrect "self" argument. It could be caused by a product which is not yet compatible with this version of Zope. The traceback information may contain more details.'''
| 4,004
|
def spacestrip(txt): """ dedent text by 2 spaces ! We need this to workaround a nasty bug in STXNG. STXNG creates empty <pre>..</pre> when then text start if a level > 1 """ l = [] for x in string.split(txt,"\n"): if len(x)>2 and x[:2]==' ': l.append(x[2:]) return string.join(l,'\n')
|
def spacestrip(txt): """ dedent text by 2 spaces ! We need this to workaround a nasty bug in STXNG. STXNG creates empty <pre>..</pre> when then text start if a level > 1. This fix is lame. The problem should be fixed inside STXNG """ l = [] for x in string.split(txt,"\n"): if len(x)>2 and x[:2]==' ': l.append(x[2:]) return string.join(l,'\n')
| 4,005
|
def manage_addFolder(self, id, title='', createPublic=0, createUserF=0, REQUEST=None): """Add a new Folder object with id *id*. If the 'createPublic' and 'createUserF' parameters are set to any true value, an 'index_html' and a 'UserFolder' objects are created respectively in the new folder. """ ob=Folder() ob.id=id ob.title=title self._setObject(id, ob) try: user=REQUEST['AUTHENTICATED_USER'] except: user=None if createUserF: if (user is not None) and not ( user.has_permission('Add User Folders', self)): raise 'Unauthorized', ( 'You are not authorized to add User Folders.' ) ob.manage_addUserFolder() if createPublic: if (user is not None) and not ( user.has_permission('Add Documents, Images, and Files', self)): raise 'Unauthorized', ( 'You are not authorized to add DTML Documents.' ) ob.manage_addDTMLDocument(id='index_html', title='') if REQUEST is not None: return self.manage_workspace(self, REQUEST, update_menu=1)
|
def manage_addFolder(self, id, title='', createPublic=0, createUserF=0, REQUEST=None): """Add a new Folder object with id *id*. If the 'createPublic' and 'createUserF' parameters are set to any true value, an 'index_html' and a 'UserFolder' objects are created respectively in the new folder. """ ob=Folder() ob.id=id ob.title=title self._setObject(id, ob) try: user=REQUEST['AUTHENTICATED_USER'] except: user=None if createUserF: if (user is not None) and not ( user.has_permission('Add User Folders', self)): raise 'Unauthorized', ( 'You are not authorized to add User Folders.' ) ob.manage_addUserFolder() if createPublic: if (user is not None) and not ( user.has_permission('Add Documents, Images, and Files', self)): raise 'Unauthorized', ( 'You are not authorized to add DTML Documents.' ) ob.manage_addDTMLDocument(id='index_html', title='') if REQUEST is not None: return self.manage_main(self, REQUEST, update_menu=1)
| 4,006
|
def appendHeader(name, value, delimiter=","): ''' Append a value to a cookie Sets an HTTP return header "name" with value "value", appending it following a comma if there was a previous value set for the header.
|
def appendHeader(name, value, delimiter=","): ''' Append a value to a header. Sets an HTTP return header "name" with value "value", appending it following a comma if there was a previous value set for the header.
| 4,007
|
def shutdown(exit_code,fast = 0): global _shutdown_phase global _shutdown_timeout if _shutdown_phase == 0: # Thread safety? proably no need to care import ZServer ZServer.exit_code = exit_code _shutdown_phase = 1 if fast: # Someone wants us to shutdown fast. This is hooked into SIGTERM - so possibly # the system is going down and we can expect a SIGKILL within a few seconds. # Limit each shutdown phase to one second. This is fast enough, but still clean. _shutdown_timeout = 1.0
|
def shutdown(exit_code,fast = 0): global _shutdown_phase global _shutdown_timeout if _shutdown_phase == 0: # Thread safety? proably no need to care import ZServer ZServer.exit_code = exit_code _shutdown_phase = 1 if fast: # Someone wants us to shutdown fast. This is hooked into SIGTERM - so possibly # the system is going down and we can expect a SIGKILL within a few seconds. # Limit each shutdown phase to one second. This is fast enough, but still clean. _shutdown_timeout = 1.0
| 4,008
|
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
| 4,009
|
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
| 4,010
|
def badRequestError(self,name):
|
def badRequestError(self,name):
| 4,011
|
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(id) obj=obj.aq_parent if not relative: url.append(self.aq_acquire('REQUEST').script) url.reverse() return quote(join(url, '/'))
|
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(quote(id)) obj=obj.aq_parent if not relative: url.append(self.aq_acquire('REQUEST').script) url.reverse() return quote(join(url, '/'))
| 4,012
|
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(id) obj=obj.aq_parent if not relative: url.append(self.aq_acquire('REQUEST').script) url.reverse() return quote(join(url, '/'))
|
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(id) obj=obj.aq_parent if not relative: url.append(self.aq_acquire('REQUEST').script) url.reverse() return quote(join(url, '/'))
| 4,013
|
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateAFactory=0, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: base=find_class(self, b) bases.append(base) Z=ZClass(id,title,bases) if meta_type: Z._zclass_.meta_type=meta_type self._setObject(id, Z) if CreateAFactory and meta_type: self.manage_addDTMLMethod( id+'_addForm', id+' constructor input form', addFormDefault % {'id': id, 'meta_type': meta_type}, ) self.manage_addDTMLMethod( id+'_add', id+' constructor', addDefault % {'id': id}, ) self.manage_addPermission( id+'_add_permission', id+' constructor permission', 'Add %ss' % meta_type ) self.manage_addPrincipiaFactory( id+'_factory', id+' factory', meta_type, id+'_addForm', 'Add %ss' % meta_type ) getattr(self,id).propertysheets.permissions.manage_edit( selected=['Add %ss' % id]) getattr(self,id).manage_setPermissionMapping( permission_names=['Create class instances'], class_permissions=['Add %ss' % meta_type] ) if REQUEST is not None: return self.manage_main(self,REQUEST, update_menu=1)
|
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateAFactory=0, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: base=find_class(self, b) bases.append(base) Z=ZClass(id,title,bases) if meta_type: Z._zclass_.meta_type=meta_type self._setObject(id, Z) if CreateAFactory and meta_type: self.manage_addDTMLMethod( id+'_addForm', id+' constructor input form', addFormDefault % {'id': id, 'meta_type': meta_type}, ) self.manage_addDTMLMethod( id+'_add', id+' constructor', addDefault % {'id': id}, ) self.manage_addPermission( id+'_add_permission', id+' constructor permission', 'Add %ss' % meta_type ) self.manage_addPrincipiaFactory( id+'_factory', id+' factory', meta_type, id+'_addForm', 'Add %ss' % meta_type ) Z=self._getOb(id) Z.propertysheets.permissions.manage_edit( selected=['Add %ss' % id]) Z.manage_setPermissionMapping( permission_names=['Create class instances'], class_permissions=['Add %ss' % meta_type] ) if REQUEST is not None: return self.manage_main(self,REQUEST, update_menu=1)
| 4,014
|
def __getattr__(self, name): p=self.__dict__['_product'] d=p.__dict__ if hasattr(p,name) and d.has_key(name): m=d[name] w=getattr(m, '_permissionMapper', None) if w is not None: m=ofWrapper(aqwrap(m, getattr(w,'aq_base',w), self)) return m
|
def __getattr__(self, name): p=self.__dict__['_product'] d=p.__dict__ if hasattr(p,name) and d.has_key(name): m=d[name] w=getattr(m, '_permissionMapper', None) if w is not None: m=ofWrapper(aqwrap(m, getattr(w,'aq_base',w), self)) return m
| 4,015
|
def parens(s, parens_re=re.compile(r'(\|)').search): index = open_index = paren_count = 0 while 1: index = parens_re(s, index) if index is None : break if s[index] == '(': paren_count = paren_count + 1 if open_index == 0 : open_index = index + 1 else: paren_count = paren_count - 1 if paren_count == 0: return open_index, index else: index = index + 1 if paren_count == 0: # No parentheses Found return None else: raise QueryError, "Mismatched parentheses"
|
def parens(s, parens_re=re.compile('[\(\)]').search): index = open_index = paren_count = 0 while 1: index = parens_re(s, index) if index is None : break if s[index] == '(': paren_count = paren_count + 1 if open_index == 0 : open_index = index + 1 else: paren_count = paren_count - 1 if paren_count == 0: return open_index, index else: index = index + 1 if paren_count == 0: # No parentheses Found return None else: raise QueryError, "Mismatched parentheses"
| 4,016
|
def parens(s, parens_re=re.compile(r'(\|)').search): index = open_index = paren_count = 0 while 1: index = parens_re(s, index) if index is None : break if s[index] == '(': paren_count = paren_count + 1 if open_index == 0 : open_index = index + 1 else: paren_count = paren_count - 1 if paren_count == 0: return open_index, index else: index = index + 1 if paren_count == 0: # No parentheses Found return None else: raise QueryError, "Mismatched parentheses"
|
def parens(s, parens_re=re.compile(r'(\|)').search): index = open_index = paren_count = 0 while 1: mo = parens_re(s, index) if mo is None : break index = mo.start(0) if s[index] == '(': paren_count = paren_count + 1 if open_index == 0 : open_index = index + 1 else: paren_count = paren_count - 1 if paren_count == 0: return open_index, index else: index = index + 1 if paren_count == 0: # No parentheses Found return None else: raise QueryError, "Mismatched parentheses"
| 4,017
|
def parens(s, parens_re=re.compile(r'(\|)').search): index = open_index = paren_count = 0 while 1: index = parens_re(s, index) if index is None : break if s[index] == '(': paren_count = paren_count + 1 if open_index == 0 : open_index = index + 1 else: paren_count = paren_count - 1 if paren_count == 0: return open_index, index else: index = index + 1 if paren_count == 0: # No parentheses Found return None else: raise QueryError, "Mismatched parentheses"
|
defparens(s,parens_re=re.compile(r'(\|)').search):index=open_index=paren_count=0while1:index=parens_re(s,index)ifindexisNone:breakifs[index]=='(':paren_count=paren_count+1ifopen_index==0:open_index=index+1else:paren_count=paren_count-1ifparen_count==0:returnopen_index,indexelse:index=index+1ifparen_count==0:#NoparenthesesFoundreturnNoneelse:raiseQueryError,"Mismatchedparentheses"
| 4,018
|
def close(self, unlink=0): """Close the file.
|
def close(self, unlink=1): """Close the file.
| 4,019
|
def close(self, unlink=0): """Close the file.
|
def close(self, unlink=0): """Close the file.
| 4,020
|
def test_suite(): return unittest.makeSuite(BatchTests)
|
def test_suite(): return makeSuite(BatchTests)
| 4,021
|
def __getitem__(self, index, ttype=type(())): """ Returns instances of self._v_brains, or whatever is passed into self.useBrains. """
|
def __getitem__(self, index, ttype=type(())): """ Returns instances of self._v_brains, or whatever is passed into self.useBrains. """
| 4,022
|
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
|
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
| 4,023
|
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
|
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
| 4,024
|
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
|
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
| 4,025
|
def median(self): all = self.all() l = len(all) if l == 0: return "I" else: if l == 1: return all[0] elif l % 2 != 0: i = l/2 + 1 return all[i] else: i = l/2 - 1 i2 = i + 1 v1 = all[i] v2 = all[i2] if v1 == "NA" or v2 == "NA": return "I" else: return (all[i] + all[i2]) / 2
|
def median(self): all = self.all() l = len(all) if l == 0: return "I" else: if l == 1: return all[0] elif l % 2 != 0: i = l/2 + 1 return all[i] else: i = l/2 - 1 i2 = i + 1 v1 = all[i] v2 = all[i2] if type(v1) is type('') or type(v2) is type(''): return "I" else: return (v1 + v2) / 2
| 4,026
|
def unindex_object(self, i): """ Unindex the object with integer id 'i' and don't raise an exception if we fail """ index = self._index unindex = self._unindex
|
def unindex_object(self, i): """ Unindex the object with integer id 'i' and don't raise an exception if we fail """ index = self._index unindex = self._unindex
| 4,027
|
def unindex_object(self, i): """ Unindex the object with integer id 'i' and don't raise an exception if we fail """ index = self._index unindex = self._unindex
|
def unindex_object(self, i): """ Unindex the object with integer id 'i' and don't raise an exception if we fail """ index = self._index unindex = self._unindex
| 4,028
|
def head(self, before, t, level, d): if level > 0 and level < 6: return ('%s<h%d>%s</h%d>\n%s\n' % (before,level,strip(ctag(t)),level,d)) t="<p><strong>%s</strong><p>" % strip(ctag(t)) return ('%s<dl><dt>%s\n</dt><dd>%s\n</dd></dl>\n' % (before,t,d))
|
def head(self, before, t, level, d): if level > 0 and level < 6: return ('%s<h%d>%s</h%d>\n%s\n' % (before,level,strip(ctag(t)),level,d)) t="<p><strong>%s</strong></p>" % strip(ctag(t)) return ('%s<dl><dt>%s\n</dt><dd>%s\n</dd></dl>\n' % (before,t,d))
| 4,029
|
def startup(): global app # Import products OFS.Application.import_products() configuration = getConfiguration() # Open the database dbtab = configuration.dbtab try: # Try to use custom storage try: m=imp.find_module('custom_zodb',[configuration.testinghome]) except: m=imp.find_module('custom_zodb',[configuration.instancehome]) except: # if there is no custom_zodb, use the config file specified databases DB = dbtab.getDatabase('/', is_root=1) else: m=imp.load_module('Zope2.custom_zodb', m[0], m[1], m[2]) sys.modules['Zope2.custom_zodb']=m if hasattr(m,'DB'): DB=m.DB dbtab.databases.update(getattr(DB, 'databases', {})) DB.databases = dbtab.databases else: DB = ZODB.DB(m.Storage, databases=dbtab.databases) Globals.BobobaseName = DB.getName() if DB.getActivityMonitor() is None: from ZODB.ActivityMonitor import ActivityMonitor DB.setActivityMonitor(ActivityMonitor()) Globals.DB = DB # Ick, this is temporary until we come up with some registry Zope2.DB = DB # Hook for providing multiple transaction object manager undo support: Globals.UndoManager=DB Globals.opened.append(DB) import ClassFactory DB.classFactory = ClassFactory.ClassFactory # "Log on" as system user newSecurityManager(None, AccessControl.User.system) # Set up the "app" object that automagically opens # connections app = App.ZApplication.ZApplicationWrapper( DB, 'Application', OFS.Application.Application, (), Globals.VersionNameName) Zope2.bobo_application = app # Initialize the app object application = app() OFS.Application.initialize(application) if Globals.DevelopmentMode: # Set up auto-refresh. from App.RefreshFuncs import setupAutoRefresh setupAutoRefresh(application._p_jar) application._p_jar.close() # "Log off" as system user noSecurityManager() global startup_time startup_time = asctime() Zope2.zpublisher_transactions_manager = TransactionsManager() Zope2.zpublisher_exception_hook = zpublisher_exception_hook Zope2.zpublisher_validated_hook = validated_hook Zope2.__bobo_before__ = noSecurityManager
|
def startup(): global app # Import products OFS.Application.import_products() configuration = getConfiguration() # Open the database dbtab = configuration.dbtab try: # Try to use custom storage try: m=imp.find_module('custom_zodb',[configuration.testinghome]) except: m=imp.find_module('custom_zodb',[configuration.instancehome]) except: # if there is no custom_zodb, use the config file specified databases DB = dbtab.getDatabase('/', is_root=1) else: m=imp.load_module('Zope2.custom_zodb', m[0], m[1], m[2]) sys.modules['Zope2.custom_zodb']=m if hasattr(m,'DB'): DB=m.DB databases.update(getattr(DB, 'databases', {})) DB.databases = databases else: DB = ZODB.DB(m.Storage, databases=dbtab.databases) Globals.BobobaseName = DB.getName() if DB.getActivityMonitor() is None: from ZODB.ActivityMonitor import ActivityMonitor DB.setActivityMonitor(ActivityMonitor()) Globals.DB = DB # Ick, this is temporary until we come up with some registry Zope2.DB = DB # Hook for providing multiple transaction object manager undo support: Globals.UndoManager=DB Globals.opened.append(DB) import ClassFactory DB.classFactory = ClassFactory.ClassFactory # "Log on" as system user newSecurityManager(None, AccessControl.User.system) # Set up the "app" object that automagically opens # connections app = App.ZApplication.ZApplicationWrapper( DB, 'Application', OFS.Application.Application, (), Globals.VersionNameName) Zope2.bobo_application = app # Initialize the app object application = app() OFS.Application.initialize(application) if Globals.DevelopmentMode: # Set up auto-refresh. from App.RefreshFuncs import setupAutoRefresh setupAutoRefresh(application._p_jar) application._p_jar.close() # "Log off" as system user noSecurityManager() global startup_time startup_time = asctime() Zope2.zpublisher_transactions_manager = TransactionsManager() Zope2.zpublisher_exception_hook = zpublisher_exception_hook Zope2.zpublisher_validated_hook = validated_hook Zope2.__bobo_before__ = noSecurityManager
| 4,030
|
def startup(): global app # Import products OFS.Application.import_products() configuration = getConfiguration() # Open the database dbtab = configuration.dbtab try: # Try to use custom storage try: m=imp.find_module('custom_zodb',[configuration.testinghome]) except: m=imp.find_module('custom_zodb',[configuration.instancehome]) except: # if there is no custom_zodb, use the config file specified databases DB = dbtab.getDatabase('/', is_root=1) else: m=imp.load_module('Zope2.custom_zodb', m[0], m[1], m[2]) sys.modules['Zope2.custom_zodb']=m if hasattr(m,'DB'): DB=m.DB dbtab.databases.update(getattr(DB, 'databases', {})) DB.databases = dbtab.databases else: DB = ZODB.DB(m.Storage, databases=dbtab.databases) Globals.BobobaseName = DB.getName() if DB.getActivityMonitor() is None: from ZODB.ActivityMonitor import ActivityMonitor DB.setActivityMonitor(ActivityMonitor()) Globals.DB = DB # Ick, this is temporary until we come up with some registry Zope2.DB = DB # Hook for providing multiple transaction object manager undo support: Globals.UndoManager=DB Globals.opened.append(DB) import ClassFactory DB.classFactory = ClassFactory.ClassFactory # "Log on" as system user newSecurityManager(None, AccessControl.User.system) # Set up the "app" object that automagically opens # connections app = App.ZApplication.ZApplicationWrapper( DB, 'Application', OFS.Application.Application, (), Globals.VersionNameName) Zope2.bobo_application = app # Initialize the app object application = app() OFS.Application.initialize(application) if Globals.DevelopmentMode: # Set up auto-refresh. from App.RefreshFuncs import setupAutoRefresh setupAutoRefresh(application._p_jar) application._p_jar.close() # "Log off" as system user noSecurityManager() global startup_time startup_time = asctime() Zope2.zpublisher_transactions_manager = TransactionsManager() Zope2.zpublisher_exception_hook = zpublisher_exception_hook Zope2.zpublisher_validated_hook = validated_hook Zope2.__bobo_before__ = noSecurityManager
|
def startup(): global app # Import products OFS.Application.import_products() configuration = getConfiguration() # Open the database dbtab = configuration.dbtab try: # Try to use custom storage try: m=imp.find_module('custom_zodb',[configuration.testinghome]) except: m=imp.find_module('custom_zodb',[configuration.instancehome]) except: # if there is no custom_zodb, use the config file specified databases DB = dbtab.getDatabase('/', is_root=1) else: m=imp.load_module('Zope2.custom_zodb', m[0], m[1], m[2]) sys.modules['Zope2.custom_zodb']=m if hasattr(m,'DB'): DB=m.DB dbtab.databases.update(getattr(DB, 'databases', {})) DB.databases = dbtab.databases else: DB = ZODB.DB(m.Storage, databases=databases) Globals.BobobaseName = DB.getName() if DB.getActivityMonitor() is None: from ZODB.ActivityMonitor import ActivityMonitor DB.setActivityMonitor(ActivityMonitor()) Globals.DB = DB # Ick, this is temporary until we come up with some registry Zope2.DB = DB # Hook for providing multiple transaction object manager undo support: Globals.UndoManager=DB Globals.opened.append(DB) import ClassFactory DB.classFactory = ClassFactory.ClassFactory # "Log on" as system user newSecurityManager(None, AccessControl.User.system) # Set up the "app" object that automagically opens # connections app = App.ZApplication.ZApplicationWrapper( DB, 'Application', OFS.Application.Application, (), Globals.VersionNameName) Zope2.bobo_application = app # Initialize the app object application = app() OFS.Application.initialize(application) if Globals.DevelopmentMode: # Set up auto-refresh. from App.RefreshFuncs import setupAutoRefresh setupAutoRefresh(application._p_jar) application._p_jar.close() # "Log off" as system user noSecurityManager() global startup_time startup_time = asctime() Zope2.zpublisher_transactions_manager = TransactionsManager() Zope2.zpublisher_exception_hook = zpublisher_exception_hook Zope2.zpublisher_validated_hook = validated_hook Zope2.__bobo_before__ = noSecurityManager
| 4,031
|
def parens(s, parens_re=re.compile(r'(\|)').search): index = open_index = paren_count = 0 while 1: index = parens_re(s, index) if index is None : break if s[index] == '(': paren_count = paren_count + 1 if open_index == 0 : open_index = index + 1 else: paren_count = paren_count - 1 if paren_count == 0: return open_index, index else: index = index + 1 if paren_count == 0: # No parentheses Found return None else: raise QueryError, "Mismatched parentheses"
|
def parens(s, parens_re=re.compile('[\(\)]').search): index = open_index = paren_count = 0 while 1: index = parens_re(s, index) if index is None : break if s[index] == '(': paren_count = paren_count + 1 if open_index == 0 : open_index = index + 1 else: paren_count = paren_count - 1 if paren_count == 0: return open_index, index else: index = index + 1 if paren_count == 0: # No parentheses Found return None else: raise QueryError, "Mismatched parentheses"
| 4,032
|
def parens(s, parens_re=re.compile(r'(\|)').search): index = open_index = paren_count = 0 while 1: index = parens_re(s, index) if index is None : break if s[index] == '(': paren_count = paren_count + 1 if open_index == 0 : open_index = index + 1 else: paren_count = paren_count - 1 if paren_count == 0: return open_index, index else: index = index + 1 if paren_count == 0: # No parentheses Found return None else: raise QueryError, "Mismatched parentheses"
|
def parens(s, parens_re=re.compile(r'(\|)').search): index = open_index = paren_count = 0 while 1: mo = parens_re(s, index) if mo is None : break index = mo.start(0) if s[index] == '(': paren_count = paren_count + 1 if open_index == 0 : open_index = index + 1 else: paren_count = paren_count - 1 if paren_count == 0: return open_index, index else: index = index + 1 if paren_count == 0: # No parentheses Found return None else: raise QueryError, "Mismatched parentheses"
| 4,033
|
def parens(s, parens_re=re.compile(r'(\|)').search): index = open_index = paren_count = 0 while 1: index = parens_re(s, index) if index is None : break if s[index] == '(': paren_count = paren_count + 1 if open_index == 0 : open_index = index + 1 else: paren_count = paren_count - 1 if paren_count == 0: return open_index, index else: index = index + 1 if paren_count == 0: # No parentheses Found return None else: raise QueryError, "Mismatched parentheses"
|
defparens(s,parens_re=re.compile(r'(\|)').search):index=open_index=paren_count=0while1:index=parens_re(s,index)ifindexisNone:breakifs[index]=='(':paren_count=paren_count+1ifopen_index==0:open_index=index+1else:paren_count=paren_count-1ifparen_count==0:returnopen_index,indexelse:index=index+1ifparen_count==0:#NoparenthesesFoundreturnNoneelse:raiseQueryError,"Mismatchedparentheses"
| 4,034
|
def load_config_file(option, opt, config_file, *ignored): config_file = os.path.abspath(config_file) print "Parsing %s" % config_file import Zope2 Zope2.configure(config_file)
|
def load_config_file(option, opt, config_file, *ignored): config_file = os.path.abspath(config_file) print "Parsing %s" % config_file import Zope2 Zope2.configure(config_file)
| 4,035
|
def load_config_file(option, opt, config_file, *ignored): config_file = os.path.abspath(config_file) print "Parsing %s" % config_file import Zope2 Zope2.configure(config_file)
|
def load_config_file(option, opt, config_file, *ignored): config_file = os.path.abspath(config_file) print "Parsing %s" % config_file import Zope2 Zope2.configure(config_file)
| 4,036
|
def _check(self, lev='250'): data = self.conn.recv(1024) if data[:3] != lev: raise smtpError, "Expected %s, got %s from SMTP"%(lev, data[:3])
|
def _check(self, lev='250'): data = self.getLine() if data[:3] != lev: raise smtpError, "Expected %s, got %s from SMTP"%(lev, data[:3])
| 4,037
|
def manage_addFile(self,id,file,title='',precondition='',REQUEST=None): """Add a new File object. Creates a new file object 'id' with the contents of 'file'""" self._setObject(id, File(id,title,file,precondition)) if REQUEST is not None: return self.manage_main(self,REQUEST)
|
def manage_addFile(self,id,file,title='',precondition='',REQUEST=None): """Add a new File object. Creates a new file object 'id' with the contents of 'file'""" self._setObject(id, File(id,title,file,precondition)) if REQUEST is not None: return self.manage_main(self,REQUEST)
| 4,038
|
def view_image_or_file(self,REQUEST,RESPONSE):
|
def view_image_or_file(self,REQUEST,RESPONSE):
| 4,039
|
def view_image_or_file(self,REQUEST,RESPONSE):
|
def view_image_or_file(self,REQUEST,RESPONSE):
| 4,040
|
def getFirstChild(self, type=type, st=type('')): """ The first child of this node. If there is no such node this returns None """ children = self.getChildren()
|
def getFirstChild(self, type=type, st=type('')): """ The first child of this node. If there is no such node this returns None """ children = self.getChildren()
| 4,041
|
def _get_NodeValue(self, type=type, st=type('')): return self.GetNodeValue(type,st)
|
def _get_NodeValue(self, type=type, st=type('')): return self.getNodeValue(type,st)
| 4,042
|
def db_name(self): try: db=self._p_jar.db() except: # BoboPOS 2 return Globals.BobobaseName else: # ZODB 3 return db.getName()
|
def db_name(self): try: db=self._p_jar.db() except: # BoboPOS 2 return Globals.BobobaseName else: # ZODB 3 return db.getName()
| 4,043
|
def rcdeltas(self): if self._v_rcs is None: self.rcsnapshot() nc=self.refdict() rc=self._v_rcs rd=[] for n, c in nc.items(): prev=rc[n] if c > prev: rd.append( (c - prev, (c, prev, n)) ) rd.sort() rd.reverse()
|
def def dbconnections(self): return Globals.DB.connectionDebugInfo() rcdeltas(self): def dbconnections(self): return Globals.DB.connectionDebugInfo() if def dbconnections(self): return Globals.DB.connectionDebugInfo() self._v_rcs def dbconnections(self): return Globals.DB.connectionDebugInfo() is def dbconnections(self): return Globals.DB.connectionDebugInfo() None: def dbconnections(self): return Globals.DB.connectionDebugInfo() self.rcsnapshot() def dbconnections(self): return Globals.DB.connectionDebugInfo() nc=self.refdict() def dbconnections(self): return Globals.DB.connectionDebugInfo() rc=self._v_rcs def dbconnections(self): return Globals.DB.connectionDebugInfo() rd=[] def dbconnections(self): return Globals.DB.connectionDebugInfo() for def dbconnections(self): return Globals.DB.connectionDebugInfo() n, def dbconnections(self): return Globals.DB.connectionDebugInfo() c def dbconnections(self): return Globals.DB.connectionDebugInfo() in def dbconnections(self): return Globals.DB.connectionDebugInfo() nc.items(): def dbconnections(self): return Globals.DB.connectionDebugInfo() prev=rc[n] def dbconnections(self): return Globals.DB.connectionDebugInfo() if def dbconnections(self): return Globals.DB.connectionDebugInfo() c def dbconnections(self): return Globals.DB.connectionDebugInfo() > def dbconnections(self): return Globals.DB.connectionDebugInfo() prev: def dbconnections(self): return Globals.DB.connectionDebugInfo() rd.append( def dbconnections(self): return Globals.DB.connectionDebugInfo() (c def dbconnections(self): return Globals.DB.connectionDebugInfo() - def dbconnections(self): return Globals.DB.connectionDebugInfo() prev, def dbconnections(self): return Globals.DB.connectionDebugInfo() (c, def dbconnections(self): return Globals.DB.connectionDebugInfo() prev, def dbconnections(self): return Globals.DB.connectionDebugInfo() n)) def dbconnections(self): return Globals.DB.connectionDebugInfo() ) def dbconnections(self): return Globals.DB.connectionDebugInfo() rd.sort() def dbconnections(self): return Globals.DB.connectionDebugInfo() rd.reverse()
| 4,044
|
def manage_pack(self, days=0, REQUEST=None): """Pack the database"""
|
def manage_pack(self, days=0, REQUEST=None): """Pack the database"""
| 4,045
|
def manage_edit(self, RESPONSE, URL1, threshold=1000, REQUEST=None): """ edit the catalog """ self.threshold = thresholdb
|
def manage_edit(self, RESPONSE, URL1, threshold=1000, REQUEST=None): """ edit the catalog """ self.threshold = thresholdb
| 4,046
|
def catalog_object(self, obj, uid): """ wrapper around catalog """ if not hasattr(self, '_v_total'): self._v_total = 0 self._v_total = (self._v_total + self._catalog.catalogObject(obj, uid, self.threshold)) if self._v_total > self.threshold: get_transaction().commit(1) self._v_total = 0
|
def catalog_object(self, obj, uid): """ wrapper around catalog """ self._v_total = (self._v_total + self._catalog.catalogObject(obj, uid, self.threshold)) if self._v_total > self.threshold: get_transaction().commit(1) self._v_total = 0
| 4,047
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 4,048
|
def publish(self, module_name, after_list, published='web_objects',
|
def publish(self, module_name, after_list, published='web_objects',
| 4,049
|
def old_validation(groups, HTTP_AUTHORIZATION, roles=UNSPECIFIED_ROLES): if lower(HTTP_AUTHORIZATION[:6]) != 'basic ': return None [name,password] = string.splitfields( base64.decodestring( split(HTTP_AUTHORIZATION)[-1]), ':') if roles is None: return name keys=None try: keys=groups.keys except: try: groups=groups() # Maybe it was a method defining a group keys=groups.keys except: pass if keys is not None: # OK, we have a named group, so apply the roles to the named # group. if roles is UNSPECIFIED_ROLES: roles=keys() g=[] for role in roles: if groups.has_key(role): g.append(groups[role]) groups=g for d in groups: if d.has_key(name) and d[name]==password: return name if keys is None: # Not a named group, so don't go further raise 'Forbidden', ( """<strong>You are not authorized to access this resource""") return None
|
defold_validation(groups,HTTP_AUTHORIZATION,roles=UNSPECIFIED_ROLES):iflower(HTTP_AUTHORIZATION[:6])!='basic':returnNone[name,password]=string.splitfields(base64.decodestring(split(HTTP_AUTHORIZATION)[-1]),':')ifrolesisNone:returnnamekeys=Nonetry:keys=groups.keysexcept:try:groups=groups()#Maybeitwasamethoddefiningagroupkeys=groups.keysexcept:passifkeysisnotNone:#OK,wehaveanamedgroup,soapplytherolestothenamed#group.ifrolesisUNSPECIFIED_ROLES:roles=keys()g=[]forroleinroles:ifgroups.has_key(role):g.append(groups[role])groups=gfordingroups:ifd.has_key(name)andd[name]==password:returnnameifkeysisNone:#Notanamedgroup,sodon'tgofurtherraise'Forbidden',("""<strong>Youarenotauthorizedtoaccessthisresource""")returnNone
| 4,050
|
def publish_module(module_name, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ, debug=0): must_die=0 status=200 after_list=[None] try: response=Response(stdout=stdout, stderr=stderr) publisher = ModulePublisher(stdin=stdin, stdout=stdout, stderr=stderr, environ=environ) response = publisher.response response = publisher.publish(module_name,after_list,debug=debug) except SystemExit: must_die=1 response.exception(must_die) except ImportError, v: if type(v)==types.TupleType and len(v)==3: sys.exc_type, sys.exc_value, sys.exc_traceback = v must_die=1 response.exception(must_die) except: status=response.getStatus() response.exception() if response: response=str(response) if response: stdout.write(response) # The module defined a post-access function, call it if after_list[0] is not None: after_list[0]() if must_die: raise sys.exc_type, sys.exc_value, sys.exc_traceback sys.exc_type, sys.exc_value, sys.exc_traceback = None, None, None return status
|
def publish_module(module_name, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ, debug=0): must_die=0 status=200 after_list=[None] try: response=Response(stdout=stdout, stderr=stderr) publisher = ModulePublisher(stdin=stdin, stdout=stdout, stderr=stderr, environ=environ) response = publisher.response response = publisher.publish(module_name,after_list,debug=debug) except SystemExit: must_die=1 response.exception(must_die) except ImportError, v: if type(v)==types.TupleType and len(v)==3: sys.exc_type, sys.exc_value, sys.exc_traceback = v must_die=1 response.exception(must_die) except: status=response.getStatus() if response: response=str(response) if response: stdout.write(response) # The module defined a post-access function, call it if after_list[0] is not None: after_list[0]() if must_die: raise sys.exc_type, sys.exc_value, sys.exc_traceback sys.exc_type, sys.exc_value, sys.exc_traceback = None, None, None return status
| 4,051
|
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
| 4,052
|
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
| 4,053
|
def parse_cookie(text, result=None, parmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)=\([^\0- =\"]+\)' '\([\0- ]*[;,]\)?[\0- ]*\)' ), qparmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)="\([^"]*\)\"' '\([\0- ]*[;,]\)?[\0- ]*\)' ), ): result=result or {} if parmre.match(text) >= 0: name=lower(parmre.group(2)) value=parmre.group(3) l=len(parmre.group(1)) elif qparmre.match(text) >= 0: name=lower(qparmre.group(2)) value=qparmre.group(3) l=len(qparmre.group(1)) else: if not text or not strip(text): return result raise "InvalidParameter", text result[name]=value return apply(parse_cookie,(text[l:],result))
|
def parse_cookie(text, result=None, parmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)=\([^\0- =\"]+\)' '\([\0- ]*[;,]\)?[\0- ]*\)' ), qparmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)="\([^"]*\)\"' '\([\0- ]*[;,]\)?[\0- ]*\)' ), ): if result is None: result={} if parmre.match(text) >= 0: name=lower(parmre.group(2)) value=parmre.group(3) l=len(parmre.group(1)) elif qparmre.match(text) >= 0: name=lower(qparmre.group(2)) value=qparmre.group(3) l=len(qparmre.group(1)) else: if not text or not strip(text): return result raise "InvalidParameter", text result[name]=value return apply(parse_cookie,(text[l:],result))
| 4,054
|
def __init__(self, id, title, file): self.id=id self.title=title dict={} execfile(file, dict) self.doc=dict.get('__doc__','')
|
def __init__(self, id, title, file): self.id=id self.title=title dict={} execfile(file, dict) self.doc=dict.get('__doc__','')
| 4,055
|
def SearchableText(self): """ The full text of the API, for indexing purposes. """ text="%s %s" % (self.name, self.doc) for attribute in self.attributes: text="%s %s" % (text, attribute.name) for method in self.methods: text="%s %s %s" % (text, method.name, method.doc) return text
|
def SearchableText(self): """ The full text of the API, for indexing purposes. """ text="%s %s" % (self.name, self.doc) for attribute in self.attributes: text="%s %s" % (text, attribute.name) for method in self.methods: text="%s %s %s" % (text, method.name, method.doc) return text
| 4,056
|
def __init__(self, name, value): self.name=name self.value=value
|
def __init__(self, name, value): self.name=name self.value=value
| 4,057
|
def _createFromFunc(self, func): if hasattr(func, 'im_func'): func=func.im_func
|
def _createFromFunc(self, func): if hasattr(func, 'im_func'): func=func.im_func
| 4,058
|
def test_url_(self):
|
def test_url_(self):
| 4,059
|
def manage_test(self,REQUEST):
|
def manage_test(self,REQUEST):
| 4,060
|
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
| 4,061
|
def _verifyObjectPaste(self, ob, REQUEST): if not hasattr(ob, 'meta_type'): raise CopyError, MessageDialog( title='Not Supported', message='The object <EM>%s</EM> does not support this ' \ 'operation' % absattr(ob.id), action='manage_main') mt=ob.meta_type if not hasattr(self, 'all_meta_types'): raise CopyError, MessageDialog( title='Not Supported', message='Cannot paste into this object.', action='manage_main')
|
def _verifyObjectPaste(self, ob, REQUEST): if not hasattr(ob, 'meta_type'): raise CopyError, MessageDialog( title='Not Supported', message='The object <EM>%s</EM> does not support this ' \ 'operation' % absattr(ob.id), action='manage_main') mt=ob.meta_type if not hasattr(self, 'all_meta_types'): raise CopyError, MessageDialog( title='Not Supported', message='Cannot paste into this object.', action='manage_main')
| 4,062
|
def __getitem__(self,key, default=_marker, # Any special internal marker will do URLmatch=regex.compile('URL[0-9]+$').match, BASEmatch=regex.compile('BASE[0-9]+$').match, ): """Get a variable value
|
def __getitem__(self,key, default=_marker, # Any special internal marker will do URLmatch=regex.compile('URL[0-9]+$').match, BASEmatch=regex.compile('BASE[0-9]+$').match, ): """Get a variable value
| 4,063
|
def publish_module_pm(module_name, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ, debug=0): from CGIResponse import Response from Publish import ModulePublisher after_list=[None] request=None try: response=Response(stdout=stdout, stderr=stderr) publisher = ModulePublisher(stdin=stdin, stdout=stdout, stderr=stderr, environ=environ) response = publisher.response request=publisher.request response = publisher.publish(module_name,after_list,debug=debug) request.other={} response=str(response) finally: try: request.other={} except: pass if after_list[0] is not None: after_list[0]()
|
def publish_module_pm(module_name, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ, debug=0): from Response import Response from Publish import ModulePublisher after_list=[None] request=None try: response=Response(stdout=stdout, stderr=stderr) publisher = ModulePublisher(stdin=stdin, stdout=stdout, stderr=stderr, environ=environ) response = publisher.response request=publisher.request response = publisher.publish(module_name,after_list,debug=debug) request.other={} response=str(response) finally: try: request.other={} except: pass if after_list[0] is not None: after_list[0]()
| 4,064
|
def __init__(self, basepath): # initialize python path self.basepath=path=basepath pjoin=os.path.join if sys.platform == 'win32': sys.path.insert(0, pjoin(path, 'lib/python')) sys.path.insert(1, pjoin(path, 'bin/lib')) sys.path.insert(2, pjoin(path, 'bin/lib/plat-win')) sys.path.insert(3, pjoin(path, 'bin/lib/win32')) sys.path.insert(4, pjoin(path, 'bin/lib/win32/lib')) sys.path.insert(5, path) else: sys.path.insert(0, pjoin(path, 'lib/python')) sys.path.insert(1, path)
|
def __init__(self, basepath): # initialize python path self.basepath=path=basepath pjoin=os.path.join if sys.platform == 'win32': sys.path.insert(0, pjoin(path, 'lib/python')) sys.path.insert(1, pjoin(path, 'bin/lib')) sys.path.insert(2, pjoin(path, 'bin/lib/plat-win')) sys.path.insert(3, pjoin(path, 'bin/lib/win32')) sys.path.insert(4, pjoin(path, 'bin/lib/win32/lib')) sys.path.insert(5, path) else: sys.path.insert(0, pjoin(path, 'lib/python')) sys.path.insert(1, path)
| 4,065
|
def runPath(self, pathname): """Run all tests found in the directory named by pathname and all subdirectories.""" names=os.listdir(pathname) skip_name = self.skip_name for name in names: fname, ext=os.path.splitext(name) if name[:4]=='test' and name[-3:]=='.py' and \ (not skip_name(name)): filepath=os.path.join(pathname, name) self.runFile(filepath) for name in names: fullpath=os.path.join(pathname, name) if os.path.isdir(fullpath): self.runPath(fullpath)
|
def runPath(self, pathname): """Run all tests found in the directory named by pathname and all subdirectories.""" names=os.listdir(pathname) for name in names: fname, ext=os.path.splitext(name) if name[:4]=='test' and name[-3:]=='.py' and \ (not skip_name(name)): filepath=os.path.join(pathname, name) self.runFile(filepath) for name in names: fullpath=os.path.join(pathname, name) if os.path.isdir(fullpath): self.runPath(fullpath)
| 4,066
|
def runPath(self, pathname): """Run all tests found in the directory named by pathname and all subdirectories.""" names=os.listdir(pathname) skip_name = self.skip_name for name in names: fname, ext=os.path.splitext(name) if name[:4]=='test' and name[-3:]=='.py' and \ (not skip_name(name)): filepath=os.path.join(pathname, name) self.runFile(filepath) for name in names: fullpath=os.path.join(pathname, name) if os.path.isdir(fullpath): self.runPath(fullpath)
|
def runPath(self, pathname): """Run all tests found in the directory named by pathname and all subdirectories.""" names=os.listdir(pathname) skip_name = self.skip_name for name in names: fname, ext=os.path.splitext(name) if name[:4]=='test' and name[-3:]=='.py' and \ name != 'testrunner.py': filepath=os.path.join(pathname, name) self.runFile(filepath) for name in names: fullpath=os.path.join(pathname, name) if os.path.isdir(fullpath): self.runPath(fullpath)
| 4,067
|
def runPath(self, pathname): """Run all tests found in the directory named by pathname and all subdirectories.""" names=os.listdir(pathname) skip_name = self.skip_name for name in names: fname, ext=os.path.splitext(name) if name[:4]=='test' and name[-3:]=='.py' and \ (not skip_name(name)): filepath=os.path.join(pathname, name) self.runFile(filepath) for name in names: fullpath=os.path.join(pathname, name) if os.path.isdir(fullpath): self.runPath(fullpath)
|
def runPath(self, pathname): """Run all tests found in the directory named by pathname and all subdirectories.""" names=os.listdir(pathname) skip_name = self.skip_name for name in names: fname, ext=os.path.splitext(name) if name[:4]=='test' and name[-3:]=='.py' and \ (not skip_name(name)): filepath=os.path.join(pathname, name) if self.smellsLikeATest(filepath): self.runFile(filepath) for name in names: fullpath=os.path.join(pathname, name) if os.path.isdir(fullpath): self.runPath(fullpath)
| 4,068
|
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run.\n""" pathname=None filename=None test_all=None try: options, arg=getopt.getopt(args, 'ad:f:') for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) else: err_exit(usage_msg) if not options: test_all=1 except: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0)
|
def main(args): usage_msg="""Usage: python testrunner.py options If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run.\n""" pathname=None filename=None test_all=None try: options, arg=getopt.getopt(args, 'ad:f:') for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) else: err_exit(usage_msg) if not options: test_all=1 except: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0)
| 4,069
|
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run.\n""" pathname=None filename=None test_all=None try: options, arg=getopt.getopt(args, 'ad:f:') for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) else: err_exit(usage_msg) if not options: test_all=1 except: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0)
|
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will display this usage message. If you want to run all test suites found in all subdirectories of the current working directory, use the -a option. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run.\n""" pathname=None filename=None test_all=None try: options, arg=getopt.getopt(args, 'ad:f:') for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) else: err_exit(usage_msg) if not options: test_all=1 except: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0)
| 4,070
|
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run.\n""" pathname=None filename=None test_all=None try: options, arg=getopt.getopt(args, 'ad:f:') for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) else: err_exit(usage_msg) if not options: test_all=1 except: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0)
|
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run. -h Display usage information.\n""" pathname=None filename=None test_all=None try: options, arg=getopt.getopt(args, 'ad:f:') for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) else: err_exit(usage_msg) if not options: test_all=1 except: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0)
| 4,071
|
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run.\n""" pathname=None filename=None test_all=None try: options, arg=getopt.getopt(args, 'ad:f:') for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) else: err_exit(usage_msg) if not options: test_all=1 except: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0)
|
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run.\n""" pathname=None filename=None test_all=None try: options, arg=getopt.getopt(args, 'ahd:f:') if not options: err_exit(usage_msg) for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) else: err_exit(usage_msg) if not options: test_all=1 except: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0)
| 4,072
|
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run.\n""" pathname=None filename=None test_all=None try: options, arg=getopt.getopt(args, 'ad:f:') for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) else: err_exit(usage_msg) if not options: test_all=1 except: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0)
|
def main(args): usage_msg="""Usage: python testrunner.py [options] If run without options, testrunner will run all test suites found in all subdirectories of the current working directory. options: -a Run all tests found in all subdirectories of the current working directory. This is the default if no options are specified. -d dirpath Run all tests found in the directory specified by dirpath, and recursively in all its subdirectories. The dirpath should be a full system path. -f filepath Run the test suite found in the file specified. The filepath should be a fully qualified path to the file to be run.\n""" pathname=None filename=None test_all=None try: options, arg=getopt.getopt(args, 'ad:f:') for name, value in options: name=name[1:] if name == 'a': test_all=1 elif name == 'd': pathname=string.strip(value) elif name == 'f': filename=string.strip(value) else: err_exit(usage_msg) except: err_exit(usage_msg) testrunner=TestRunner(os.getcwd()) if test_all: testrunner.runAllTests() elif pathname: testrunner.runPath(pathname) elif filename: testrunner.runFile(filename) sys.exit(0)
| 4,073
|
def query(self, pattern): """ """ result = [] for x in self.lexicon.get(pattern): if self.globbing: result.append(self.lexicon._inverseLex[x]) else: result.append(pattern)
|
defquery(self,pattern):""""""result=[]forxinself.lexicon.get(pattern):ifself.globbing:result.append(self.lexicon._inverseLex[x])else:result.append(pattern)
| 4,074
|
def manage_editCataloger(self, default): """ """ self.default_catalog=default message = "Your changes have been saved" return self.manage_main(self, REQUEST, manage_tabs_message=message)
|
def manage_editCataloger(self, default, REQUEST): """ """ self.default_catalog=default message = "Your changes have been saved" return self.manage_main(self, REQUEST, manage_tabs_message=message)
| 4,075
|
def render(self,md):
|
defrender(self,md):
| 4,076
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
|
deftpRender(self,md,section):#Checkforcollapseall,expandall,andstatetry:collapse_all=md['collapse_all']except:collapse_all=Noneifcollapse_all:state=[]else:try:expand_all=md['expand_all']except:expand_all=Noneifexpand_all:#incaseofexpandall-tomaintainstatecorrectlywe#havetomakestatebetheidsofALLsubobjectswhich#arenon-empty(recursively).state=tpValuesIds(self)else:try:state=md['state']ifstate[0]!='[':state=unquote(state)state=list(eval(state,{'__builtins__':{}}))except:state=[]#Trytosavestateinacookieaswell...#md['RESPONSE'].setCookie('state',state)root=md['URL']l=rfind(root,'/')ifl>=0:root=root[l+1:]url=''data=[]data.append('<tablecellspacing=0>\n')colspan=1+tpStateLevel(state)treeData={'tree-root-url':root}md.push(treeData)try:foriteminself.tpValues():data=tpRenderTABLE(item,root,url,state,state,data,colspan,section,md,treeData)data.append('</table>\n')result=join(data,'')finally:md.pop(1)returnresult
| 4,077
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
| 4,078
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
| 4,079
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[]# Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
| 4,080
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
| 4,081
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
|
deftpRender(self,md,section):#Checkforcollapseall,expandall,andstatetry:collapse_all=md['collapse_all']except:collapse_all=Noneifcollapse_all:state=[]else:try:expand_all=md['expand_all']except:expand_all=Noneifexpand_all:#incaseofexpandall-tomaintainstatecorrectlywe#havetomakestatebetheidsofALLsubobjectswhich#arenon-empty(recursively).state=tpValuesIds(self)else:try:state=md['state']ifstate[0]!='[':state=unquote(state)state=list(eval(state,{'__builtins__':{}}))except:state=[]#Trytosavestateinacookieaswell...#md['RESPONSE'].setCookie('state',state)root=md['URL']l=rfind(root,'/')ifl>=0:root=root[l+1:]url=''data=[]data.append('<tablecellspacing=0>\n')colspan=1+tpStateLevel(state)treeData={'tree-root-url':root}md.push(treeData)try:foriteminself.tpValues():data=tpRenderTABLE(item,root,url,state,state,data,colspan,section,md,treeData)data.append('</table>\n')result=join(data,'')finally:md.pop(1)returnresult
| 4,082
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
|
deftpRender(self,md,section):#Checkforcollapseall,expandall,andstatetry:collapse_all=md['collapse_all']except:collapse_all=Noneifcollapse_all:state=[]else:try:expand_all=md['expand_all']except:expand_all=Noneifexpand_all:#incaseofexpandall-tomaintainstatecorrectlywe#havetomakestatebetheidsofALLsubobjectswhich#arenon-empty(recursively).state=tpValuesIds(self)else:try:state=md['state']ifstate[0]!='[':state=unquote(state)state=list(eval(state,{'__builtins__':{}}))except:state=[]#Trytosavestateinacookieaswell...#md['RESPONSE'].setCookie('state',state)root=md['URL']l=rfind(root,'/')ifl>=0:root=root[l+1:]url=''data=[]data.append('<tablecellspacing=0>\n')colspan=1+tpStateLevel(state)treeData={'tree-root-url':root}md.push(treeData)try:foriteminself.tpValues():data=tpRenderTABLE(item,root,url,state,state,data,colspan,section,md,treeData)data.append('</table>\n')result=join(data,'')finally:md.pop(1)returnresult
| 4,083
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<TABLE CELLSPACING="0">\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
| 4,084
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</TABLE>\n') result=join(data,'') finally: md.pop(1) return result
| 4,085
|
def tpRender(self, md, section): # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: # in case of expand all - to maintain state correctly we # have to make state be the ids of ALL subobjects which # are non-empty (recursively). state=tpValuesIds(self) else: try: state=md['state'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] # Try to save state in a cookie as well... # md['RESPONSE'].setCookie('state',state) root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' data =[] data.append('<table cellspacing=0>\n') colspan=1+tpStateLevel(state) treeData={'tree-root-url': root} md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,state,data,colspan, section,md,treeData) data.append('</table>\n') result=join(data,'') finally: md.pop(1) return result
|
deftpRender(self,md,section):#Checkforcollapseall,expandall,andstatetry:collapse_all=md['collapse_all']except:collapse_all=Noneifcollapse_all:state=[]else:try:expand_all=md['expand_all']except:expand_all=Noneifexpand_all:#incaseofexpandall-tomaintainstatecorrectlywe#havetomakestatebetheidsofALLsubobjectswhich#arenon-empty(recursively).state=tpValuesIds(self)else:try:state=md['state']ifstate[0]!='[':state=unquote(state)state=list(eval(state,{'__builtins__':{}}))except:state=[]#Trytosavestateinacookieaswell...#md['RESPONSE'].setCookie('state',state)root=md['URL']l=rfind(root,'/')ifl>=0:root=root[l+1:]url=''data=[]data.append('<tablecellspacing=0>\n')colspan=1+tpStateLevel(state)treeData={'tree-root-url':root}md.push(treeData)try:foriteminself.tpValues():data=tpRenderTABLE(item,root,url,state,state,data,colspan,section,md,treeData)data.append('</table>\n')result=join(data,'')finally:md.pop(1)returnresult
| 4,086
|
def tpValuesIds(self): r=[] try: for item in self.tpValues(): try: id=item.tpId() e=tpValuesIds(item) if e: id=[id,e] else: id=[id] r.append(id) except: pass except: pass return r
|
def tpValuesIds(self): r=[] try: for item in self.tpValues(): try: if item.tpValues(): id=item.tpId() e=tpValuesIds(item) if e: id=[id,e] else: id=[id] r.append(id) except: pass except: pass return r
| 4,087
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
| 4,088
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
| 4,089
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
| 4,090
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<TR>\n') if level: output('<TD WIDTH="16"></TD>\n' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
| 4,091
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
| 4,092
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
| 4,093
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
|
deftpRenderTABLE(self,root_url,url,state,substate,data,colspan,section,md,treeData,level=0):#Wearebeingcalledfromabovetry:items=self.tpValues()except:items=NonetpUrl=self.tpURL()url=(urland('%s/%s'%(url,tpUrl)))ortpUrltreeData['tree-item-url']=urltry:id=self.tpId()except:id=NoneifidisNone:try:id=self._p_oidexcept:id=NoneifidisNone:id=pyid(self)exp=0sub=Noneoutput=data.append#Addprefixoutput('<tr>')iflevel:output('<td></td>'*level)#Addtreeexpand/contracticonifitems:output('<tdvalign=top>')foriinrange(len(substate)):sub=substate[i]ifsub[0]==id:exp=i+1breakifexp:delsubstate[exp-1]output('<AHREF="%s?state=%s">%s</A>'%(root_url,quote(str(state)[1:-1]+','),icoMinus))substate.append(sub)else:substate.append([id])output('<AHREF="%s?state=%s">%s</A>'%(root_url,quote(str(state)[1:-1]+','),icoPlus))delsubstate[-1]else:output('<td>')output('</td>\n')#additemtextoutput('<tdcolspan=%svalign=top>'%colspan)output(section(self,md))output('</td></tr>\n')ifexp:foriteminitems:iflen(sub)==1:sub.append([])data=tpRenderTABLE(item,root_url,url,state,sub[1],data,colspan,section,md,treeData,level+1)ifnotsub[1]:delsub[1]returndata
| 4,094
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<TD WIDTH="16">') output('</TD>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
| 4,095
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<TD COLSPAN="%s" VALIGN="TOP">' % (colspan-level)) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
| 4,096
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</TD>\n</TR>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
| 4,097
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
|
deftpRenderTABLE(self,root_url,url,state,substate,data,colspan,section,md,treeData,level=0):#Wearebeingcalledfromabovetry:items=self.tpValues()except:items=NonetpUrl=self.tpURL()url=(urland('%s/%s'%(url,tpUrl)))ortpUrltreeData['tree-item-url']=urltry:id=self.tpId()except:id=NoneifidisNone:try:id=self._p_oidexcept:id=NoneifidisNone:id=pyid(self)exp=0sub=Noneoutput=data.append#Addprefixoutput('<tr>')iflevel:output('<td></td>'*level)#Addtreeexpand/contracticonifitems:output('<tdvalign=top>')foriinrange(len(substate)):sub=substate[i]ifsub[0]==id:exp=i+1breakifexp:delsubstate[exp-1]output('<AHREF="%s?state=%s">%s</A>'%(root_url,quote(str(state)[1:-1]+','),icoMinus))substate.append(sub)else:substate.append([id])output('<AHREF="%s?state=%s">%s</A>'%(root_url,quote(str(state)[1:-1]+','),icoPlus))delsubstate[-1]else:output('<td>')output('</td>\n')#additemtextoutput('<tdcolspan=%svalign=top>'%colspan)output(section(self,md))output('</td></tr>\n')ifexp:foriteminitems:iflen(sub)==1:sub.append([])data=tpRenderTABLE(item,root_url,url,state,sub[1],data,colspan,section,md,treeData,level+1)ifnotsub[1]:delsub[1]returndata
| 4,098
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
|
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0): # We are being called from above try: items=self.tpValues() except: items=None tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<tr>') if level: output('<td></td>' * level) # Add tree expand/contract icon if items: output('<td valign=top>') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: del substate[exp-1] output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] else: output('<td>') output('</td>\n') # add item text output('<td colspan=%s valign=top>' % colspan) output(section(self, md)) output('</td></tr>\n') if exp: for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level+1) if not sub[1]: del sub[1] return data
| 4,099
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.