bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
4,200
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
4,201
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
4,202
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
4,203
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
4,204
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
4,205
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
4,206
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
4,207
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. """ i=Folder() i.id=id i.title=title self._setObject(id,i) if createUserF: i.manage_addUserFolder() if createPublic: i.manage_addDTMLDocument(id='index_html',title='') if REQUEST is not None: return self.manage_main(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. """ i=Folder() i.id=id i.title=title self._setObject(id,i) if createUserF: i.manage_addUserFolder() if createPublic: i.manage_addDTMLDocument(id='index_html',title='') if REQUEST is not None: return self.manage_main(self,REQUEST,update_menu=1)
4,208
def _argdata(self,REQUEST,raw=0,return_missing_keys=0):
def _argdata(self,REQUEST,raw=0,return_missing_keys=0):
4,209
def default_input_form(id,arguments,action='query'): if arguments: return ( "%s\n%s%s" % ( '<html><head><title>%s Input Data</title></head><body>\n' '<form action="<!--#var URL2-->/<!--#var id-->/%s" ' 'method="get">\n' '<h2>%s Input Data</h2>\n' 'Enter query parameters:<br>' '<table>\n' % (id,action,id), string.joinfields( map( lambda a: ('<tr>\t<td><strong>%s</strong>:</td>\n' '\t<td><input name="%s" width=30 value="%s">' '</td></tr>' % (nicify(a[0]), ( a[1].has_key('type') and ("%s:%s" % (a[0],a[1]['type'])) or a[0] ), a[1].has_key('default') and a[1]['default'] or '' )) , arguments.items() ), '\n'), '\n<tr><td></td><td>\n' '<input type="SUBMIT" name="SUBMIT" value="Submit Query">\n' '<!--#if HTTP_REFERER-->\n' ' <input type="SUBMIT" name="SUBMIT" value="Cancel">\n' ' <INPUT NAME="CANCEL_ACTION" TYPE="HIDDEN"\n' ' VALUE="<!--#var HTTP_REFERER-->">\n' '<!--#/if HTTP_REFERER-->\n' '</td></tr>\n</table>\n</form>\n</body>\n</html>\n' ) ) else: return ( '<html><head><title>%s Input Data</title></head><body>\n' '<form action="<!--#var URL2-->/<!--#var id-->/%s" ' 'method="get">\n' '<h2>%s Input Data</h2>\n' 'This query requires no input.<p>\n' '<input type="SUBMIT" name="SUBMIT" value="Submit Query">\n' '<!--#if HTTP_REFERER-->\n' ' <input type="SUBMIT" name="SUBMIT" value="Cancel">\n' ' <INPUT NAME="CANCEL_ACTION" TYPE="HIDDEN"\n' ' VALUE="<!--#var HTTP_REFERER-->">\n' '<!--#/if HTTP_REFERER-->\n' '</td></tr>\n</table>\n</form>\n</body>\n</html>\n' % (id, action, id) )
def default_input_form(id,arguments,action='query'): if arguments: return ( "%s\n%s%s" % ( '<html><head><title>%s Input Data</title></head><body>\n' '<form action="<!--#var URL2-->/<!--#var id-->/%s" ' 'method="get">\n' '<h2>%s Input Data</h2>\n' 'Enter query parameters:<br>' '<table>\n' % (id,action,id), string.joinfields( map( lambda a: ('<tr>\t<td><strong>%s</strong>:</td>\n' '\t<td><input name="%s" width=30 value="%s">' '</td></tr>' % (nicify(a[0]), ( a[1].has_key('type') and ("%s:%s" % (a[0],a[1]['type'])) or a[0] ), a[1].has_key('default') and a[1]['default'] or '' )) , items ), '\n'), '\n<tr><td></td><td>\n' '<input type="SUBMIT" name="SUBMIT" value="Submit Query">\n' '<!--#if HTTP_REFERER-->\n' ' <input type="SUBMIT" name="SUBMIT" value="Cancel">\n' ' <INPUT NAME="CANCEL_ACTION" TYPE="HIDDEN"\n' ' VALUE="<!--#var HTTP_REFERER-->">\n' '<!--#/if HTTP_REFERER-->\n' '</td></tr>\n</table>\n</form>\n</body>\n</html>\n' ) ) else: return ( '<html><head><title>%s Input Data</title></head><body>\n' '<form action="<!--#var URL2-->/<!--#var id-->/%s" ' 'method="get">\n' '<h2>%s Input Data</h2>\n' 'This query requires no input.<p>\n' '<input type="SUBMIT" name="SUBMIT" value="Submit Query">\n' '<!--#if HTTP_REFERER-->\n' ' <input type="SUBMIT" name="SUBMIT" value="Cancel">\n' ' <INPUT NAME="CANCEL_ACTION" TYPE="HIDDEN"\n' ' VALUE="<!--#var HTTP_REFERER-->">\n' '<!--#/if HTTP_REFERER-->\n' '</td></tr>\n</table>\n</form>\n</body>\n</html>\n' % (id, action, id) )
4,210
def manage_addVocabulary(self, id, title, globbing=None, REQUEST=None): """Add a Vocabulary object """ id=str(id) title=str(title) if globbing: globbing=1 c=Vocabulary(id, title, globbing) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self,REQUEST)
def manage_addVocabulary(self, id, title, globbing=None, REQUEST=None): """Add a Vocabulary object """ id=str(id) title=str(title) if globbing: globbing=1 c=Vocabulary(id, title, globbing) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self,REQUEST)
4,211
def hasRole(self,parent,roles=None):
def hasRole(self,parent,roles=None):
4,212
def hasRole(self,parent,roles=None):
def hasRole(self,parent,roles=None):
4,213
def tearDown(self): if self.thread: self.httpd.server_close() self.thread.join()
def tearDown(self): if self.thread: self.httpd.server_close() self.thread.join()
4,214
def validate(self, inst, parent, name, value, md):
def validate(self, inst, parent, name, value, md):
4,215
def getRolesInContext(self, object): """Return the list of roles assigned to the user, including local roles assigned in context of the passed in object.""" name=self.getUserName() roles=self.getRoles() local={} object=getattr(object, 'aq_inner', object) while 1: if hasattr(object, '__ac_local_roles__'): local_roles=object.__ac_local_roles__ if callable(local_roles): local_roles=local_roles() dict=local_roles or {} for r in dict.get(name, []): local[r]=1 if hasattr(object, 'aq_parent'): object=object.aq_parent continue if hasattr(object, 'im_self'): object=object.im_self object=getattr(object, 'aq_inner', object) continue break roles=list(roles) + local.keys() return roles
def getRolesInContext(self, object): """Return the list of roles assigned to the user, including local roles assigned in context of the passed in object.""" name=self.getUserName() roles=self.getRoles() local={} object=getattr(object, 'aq_inner', object) while 1: local_roles = getattr(object, '__ac_local_roles__', None) if local_roles: if callable(local_roles): local_roles=local_roles() dict=local_roles or {} for r in dict.get(name, []): local[r]=1 if hasattr(object, 'aq_parent'): object=object.aq_parent continue if hasattr(object, 'im_self'): object=object.im_self object=getattr(object, 'aq_inner', object) continue break roles=list(roles) + local.keys() return roles
4,216
def getRolesInContext(self, object): """Return the list of roles assigned to the user, including local roles assigned in context of the passed in object.""" name=self.getUserName() roles=self.getRoles() local={} object=getattr(object, 'aq_inner', object) while 1: if hasattr(object, '__ac_local_roles__'): local_roles=object.__ac_local_roles__ if callable(local_roles): local_roles=local_roles() dict=local_roles or {} for r in dict.get(name, []): local[r]=1 if hasattr(object, 'aq_parent'): object=object.aq_parent continue if hasattr(object, 'im_self'): object=object.im_self object=getattr(object, 'aq_inner', object) continue break roles=list(roles) + local.keys() return roles
def getRolesInContext(self, object): """Return the list of roles assigned to the user, including local roles assigned in context of the passed in object.""" name=self.getUserName() roles=self.getRoles() local={} object=getattr(object, 'aq_inner', object) while 1: if hasattr(object, '__ac_local_roles__'): local_roles=object.__ac_local_roles__ if callable(local_roles): local_roles=local_roles() dict=local_roles or {} for r in dict.get(name, []): local[r]=1 inner = getattr(object, 'aq_inner', object) parent = getattr(inner, 'aq_parent', None) if parent: object = parent continue if hasattr(object, 'im_self'): object=object.im_self object=getattr(object, 'aq_inner', object) continue break roles=list(roles) + local.keys() return roles
4,217
def getRolesInContext(self, object): """Return the list of roles assigned to the user, including local roles assigned in context of the passed in object.""" name=self.getUserName() roles=self.getRoles() local={} object=getattr(object, 'aq_inner', object) while 1: if hasattr(object, '__ac_local_roles__'): local_roles=object.__ac_local_roles__ if callable(local_roles): local_roles=local_roles() dict=local_roles or {} for r in dict.get(name, []): local[r]=1 if hasattr(object, 'aq_parent'): object=object.aq_parent continue if hasattr(object, 'im_self'): object=object.im_self object=getattr(object, 'aq_inner', object) continue break roles=list(roles) + local.keys() return roles
defgetRolesInContext(self,object):"""Returnthelistofrolesassignedtotheuser,includinglocalrolesassignedincontextofthepassedinobject."""name=self.getUserName()roles=self.getRoles()local={}object=getattr(object,'aq_inner',object)while1:ifhasattr(object,'__ac_local_roles__'):local_roles=object.__ac_local_roles__ifcallable(local_roles):local_roles=local_roles()dict=local_rolesor{}forrindict.get(name,[]):local[r]=1ifhasattr(object,'aq_parent'):object=object.aq_parentcontinueifhasattr(object,'im_self'):object=object.im_selfobject=getattr(object,'aq_inner',object)continuebreakroles=list(roles)+local.keys()returnroles
4,218
def _get_id(self, id): # Allow containers to override the generation of # object copy id by attempting to call its _get_id # method, if it exists. n=0 if (len(id) > 8) and (id[8:]=='copy_of_'): n=1 orig_id=id while 1: if self._getOb(id, None) is None: return id id='copy%s_of_%s' % (n and n+1 or '', orig_id) n=n+1
def _get_id(self, id): # Allow containers to override the generation of # object copy id by attempting to call its _get_id # method, if it exists. copy_match=self.copy_re.match(id) if (copy_match) and (copy_match.end() < len(id)): n=1 orig_id=id while 1: if self._getOb(id, None) is None: return id id='copy%s_of_%s' % (n and n+1 or '', orig_id) n=n+1
4,219
def _get_id(self, id): # Allow containers to override the generation of # object copy id by attempting to call its _get_id # method, if it exists. n=0 if (len(id) > 8) and (id[8:]=='copy_of_'): n=1 orig_id=id while 1: if self._getOb(id, None) is None: return id id='copy%s_of_%s' % (n and n+1 or '', orig_id) n=n+1
def _get_id(self, id): # Allow containers to override the generation of # object copy id by attempting to call its _get_id # method, if it exists. n=0 if (len(id) > 8) and (id[8:]=='copy_of_'): n=1 orig_id=self.copy_re.sub('', id) else: n=0 orig_id=id while 1: if self._getOb(id, None) is None: return id id='copy%s_of_%s' % (n and n+1 or '', orig_id) n=n+1
4,220
def manage_pasteObjects(self, cb_copy_data=None, REQUEST=None): """Paste previously copied objects into the current object. If calling manage_pasteObjects from python code, pass the result of a previous call to manage_cutObjects or manage_copyObjects as the first argument.""" cp=None if cb_copy_data is not None: cp=cb_copy_data else: if REQUEST and REQUEST.has_key('__cp'): cp=REQUEST['__cp'] if cp is None: raise CopyError, eNoData try: cp=_cb_decode(cp) except: raise CopyError, eInvalid
def manage_pasteObjects(self, cb_copy_data=None, REQUEST=None): """Paste previously copied objects into the current object. If calling manage_pasteObjects from python code, pass the result of a previous call to manage_cutObjects or manage_copyObjects as the first argument.""" cp=None if cb_copy_data is not None: cp=cb_copy_data else: if REQUEST and REQUEST.has_key('__cp'): cp=REQUEST['__cp'] if cp is None: raise CopyError, eNoData try: cp=_cb_decode(cp) except: raise CopyError, eInvalid
4,221
def _construct(self, context, id, final): """Creates and returns the named folder.""" dispatcher = guarded_getattr(context, 'manage_addProduct')['OFSP'] factory = guarded_getattr(dispatcher, 'manage_addFolder') factory(id) o = context.restrictedTraverse(id) # Commit a subtransaction to assign the new object to # the correct database. transaction.commit(1) return o
def _construct(self, context, id): """Creates and returns the named folder.""" dispatcher = guarded_getattr(context, 'manage_addProduct')['OFSP'] factory = guarded_getattr(dispatcher, 'manage_addFolder') factory(id) o = context.restrictedTraverse(id) # Commit a subtransaction to assign the new object to # the correct database. transaction.commit(1) return o
4,222
def render(self,md):
defrender(self,md):
4,223
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,224
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,225
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,226
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,227
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,228
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,229
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,230
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,231
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,232
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,233
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,234
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,235
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,236
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,237
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,238
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,239
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,240
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,241
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,242
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,243
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,244
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,245
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,246
def parseSubstitution(arg, position=(None, None)): m = _subst_re.match(arg) if not m: raise TALError("Bad syntax in substitution text: " + `onError`, position) key, expr = m.group(1, 2) if not key: key = "text" return key, expr
def parseSubstitution(arg, position=(None, None)): m = _subst_re.match(arg) if not m: raise TALError("Bad syntax in substitution text: " + `arg`, position) key, expr = m.group(1, 2) if not key: key = "text" return key, expr
4,247
def __getitem__(self,index):
def __getitem__(self,index):
4,248
def __init__(self, id, title, file, permissions=None, categories=None): self.id=id self.title=title if string.rfind(file, '.dtml') == len(file) -5: file=file[:-5] self.index_html=HTMLFile(file,'') if permissions is not None: self.permissions=permissions if categories is not None: self.categories=categories
def __init__(self, id, title, file, permissions=None, categories=None): self.id=id self.title=title file,ext=os.path.splitext(file) prefix,file=os.path.split(file) self.index_html=HTMLFile(file,prefix) if permissions is not None: self.permissions=permissions if categories is not None: self.categories=categories
4,249
def SearchableText(self): "The full text of the Help Topic, for indexing purposes" return '%s %s' % (self.title, self.obj.read())
def SearchableText(self): "The full text of the Help Topic, for indexing purposes" return '%s %s' % (self.title, self.obj.read())
4,250
def filtered_manage_options(self, REQUEST=None):
def filtered_manage_options(self, REQUEST=None):
4,251
def index_object(self, documentId, obj, threshold=None): """ index an object 'obj' with integer id 'i'
def index_object(self, documentId, obj, threshold=None): """ index an object 'obj' with integer id 'i'
4,252
def index_object(self, documentId, obj, threshold=None): """ index an object 'obj' with integer id 'i'
def index_object(self, documentId, obj, threshold=None): """ index an object 'obj' with integer id 'i'
4,253
def doc_href( self, s, expr1 = re.compile("(\"[ a-zA-Z0-9\n\-\.\,\;\(\)\/\:\/]+\")(:)([a-zA-Z0-9\:\/\.\~\-]+)([,]*\s*)").search, expr2 = re.compile('(\"[ a-zA-Z0-9\n\-\.\:\;\(\)\/]+\")([,]+\s+)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\#]+)(\s*)').search): #expr1=re.compile('\"([ a-zA-Z0-9.:/;,\n\~\(\)\-]+)\"' # ':' # '([a-zA-Z0-9.:/;,\n\~]+)(?=(\s+|\.|\!|\?))' # ).search, #expr2=re.compile('\"([ a-zA-Z0-9./:]+)\"' # ',\s+' # '([ a-zA-Z0-9@.:/;]+)(?=(\s+|\.|\!|\?))' # ).search, punctuation = re.compile("[\,\.\?\!\;]+").match r=expr1(s) or expr2(s)
def doc_href( self, s, expr1 = re.compile("(\"[ a-zA-Z0-9\n\-\.\,\;\(\)\/\:\/]+\")(:)([a-zA-Z0-9\:\/\.\~\-]+)([,]*\s*)").search, expr2 = re.compile('(\"[ a-zA-Z0-9\n\-\.\:\;\(\)\/]+\")([,]+\s+)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\#]+)(\s*)').search): #expr1=re.compile('\"([ a-zA-Z0-9.:/;,\n\~\(\)\-]+)\"' # ':' # '([a-zA-Z0-9.:/;,\n\~]+)(?=(\s+|\.|\!|\?))' # ).search, #expr2=re.compile('\"([ a-zA-Z0-9./:]+)\"' # ',\s+' # '([ a-zA-Z0-9@.:/;]+)(?=(\s+|\.|\!|\?))' # ).search, punctuation = re.compile("[\,\.\?\!\;]+").match r=expr1(s) or expr2(s)
4,254
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments."""
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments."""
4,255
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments."""
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments."""
4,256
def __init__(self, args, fmt=''):
def __init__(self, args, fmt=''):
4,257
def hasSessionData(self): """ """ if self.getBrowserIdManager().getToken(create=0): if self._hasSessionDataObject(key): return 1
def hasSessionData(self): """ """ key = self.getBrowserIdManager().getToken(create=0) if key: if self._hasSessionDataObject(key): return 1
4,258
def modified_in_version(self): """Was the object modified in this version? """ jar=self._p_jar oid=self._p_oid if jar is None or oid is None: return None try: mv=jar.db().modifiedInVersion except: pass else: return mv()==jar.getVersion()
def modified_in_version(self): """Was the object modified in this version? """ jar=self._p_jar oid=self._p_oid if jar is None or oid is None: return None try: mv=jar.db().modifiedInVersion except: pass else: return mv()==jar.getVersion()
4,259
def index_html(self, REQUEST, RESPONSE): """ The default view of the contents of a File or Image.
def index_html(self, REQUEST, RESPONSE): """ The default view of the contents of a File or Image.
4,260
def _construct(self, context, id): """Creates and returns the named object.""" jar = self.base._p_jar klass = jar.db().classFactory(jar, self.module_name, self.class_name) obj = klass(id) obj._setId(id) context._setObject(id, obj) obj = context.unrestrictedTraverse(id) # Commit a subtransaction to assign the new object to # the correct database. transaction.commit(1) return obj
def _construct(self, context, id): """Creates and returns the named object.""" jar = self.base._p_jar klass = jar.db().classFactory(jar, self.module_name, self.class_name) obj = klass(id) obj._setId(id) context._setObject(id, obj) obj = context.unrestrictedTraverse(id) # Commit a subtransaction to assign the new object to # the correct database. transaction.commit(1) return obj
4,261
def _traverseToMountedRoot(self, root, mount_parent): """Hook for getting the object to be mounted. """ params = self._v_mount_params if params is None: params = self._loadMountParams() real_root, real_path, container_class = params if real_root is None: real_root = 'Application' try: obj = root[real_root] except KeyError: if container_class or self._create_mount_points: # Create a database automatically. from OFS.Application import Application obj = Application() root[real_root] = obj # Get it into the database transaction.commit(1) else: raise
def _traverseToMountedRoot(self, root, mount_parent): """Hook for getting the object to be mounted. """ params = self._v_mount_params if params is None: params = self._loadMountParams() real_root, real_path, container_class = params if real_root is None: real_root = 'Application' try: obj = root[real_root] except KeyError: if self._create_mount_points: # Create a database automatically. from OFS.Application import Application obj = Application() root[real_root] = obj # Get it into the database transaction.commit(1) else: raise
4,262
def _traverseToMountedRoot(self, root, mount_parent): """Hook for getting the object to be mounted. """ params = self._v_mount_params if params is None: params = self._loadMountParams() real_root, real_path, container_class = params if real_root is None: real_root = 'Application' try: obj = root[real_root] except KeyError: if container_class or self._create_mount_points: # Create a database automatically. from OFS.Application import Application obj = Application() root[real_root] = obj # Get it into the database transaction.commit(1) else: raise
def _traverseToMountedRoot(self, root, mount_parent): """Hook for getting the object to be mounted. """ params = self._v_mount_params if params is None: params = self._loadMountParams() real_root, real_path, container_class = params if real_root is None: real_root = 'Application' try: obj = root[real_root] except KeyError: if container_class and self._create_mount_points: # Create a database automatically. from OFS.Application import Application obj = Application() root[real_root] = obj # Get it into the database transaction.commit(1) else: raise
4,263
def clear(self):
def clear(self):
4,264
def locked_in_version(self): return 0
def locked_in_version(self): return 0
4,265
def get_refcounts(self, n=100, t=(type(Fake), type(Acquisition.Implicit))): # get class refcount info
def get_refcounts(self, n=100, t=(type(Fake), type(Acquisition.Implicit))): # get class refcount info
4,266
def get_refcounts(self, n=100, t=(type(Fake), type(Acquisition.Implicit))): # get class refcount info
def get_refcounts(self, n=100, t=(type(Fake), type(Acquisition.Implicit))): # get class refcount info
4,267
def get_refcounts(self, n=100, t=(type(Fake), type(Acquisition.Implicit))): # get class refcount info
def get_refcounts(self, n=100, t=(type(Fake), type(Acquisition.Implicit))): # get class refcount info
4,268
def get_refcounts(self, n=100, t=(type(Fake), type(Acquisition.Implicit))): # get class refcount info
def get_refcounts(self, n=100, t=(type(Fake), type(Acquisition.Implicit))): # get class refcount info
4,269
def __call__(self, REQUEST=None, __ick__=None, src__=0, **kw):
def __call__(self, REQUEST=None, __ick__=None, src__=0, **kw):
4,270
def _argdata(self, REQUEST):
def _argdata(self, REQUEST):
4,271
def document_src(self, REQUEST=None, RESPONSE=None): """Return expanded document source."""
def document_src(self, REQUEST=None, RESPONSE=None): """Return expanded document source."""
4,272
def __init__(self, mnem, class_name, base_class = '', code = None, opt_args = [], *extras): self.mnemonic = mnem self.class_name = class_name self.base_class = base_class if code: #If the user already made a CodeBlock, pick the parts from it if isinstance(code, CodeBlock): origCode = code.orig_code codeBlock = code else: origCode = code codeBlock = CodeBlock(code) compositeCode = '\n'.join([origCode] + [pair[1] for pair in extras]) compositeBlock = CodeBlock(compositeCode) for code_attr in compositeBlock.__dict__.keys(): setattr(self, code_attr, getattr(compositeBlock, code_attr)) for (key, snippet) in extras: setattr(self, key, CodeBlock(snippet).code) self.code = codeBlock.code self.orig_code = origCode else: self.constructor = '' self.flags = [] # Optional arguments are assumed to be either StaticInst flags # or an OpClass value. To avoid having to import a complete # list of these values to match against, we do it ad-hoc # with regexps. for oa in opt_args: if instFlagRE.match(oa): self.flags.append(oa) elif opClassRE.match(oa): self.op_class = oa else: error(0, 'InstObjParams: optional arg "%s" not recognized ' 'as StaticInst::Flag or OpClass.' % oa)
def __init__(self, mnem, class_name, base_class = '', code = None, opt_args = [], extras = {}): self.mnemonic = mnem self.class_name = class_name self.base_class = base_class if code: #If the user already made a CodeBlock, pick the parts from it if isinstance(code, CodeBlock): origCode = code.orig_code codeBlock = code else: origCode = code codeBlock = CodeBlock(code) compositeCode = '\n'.join([origCode] + [pair[1] for pair in extras]) compositeBlock = CodeBlock(compositeCode) for code_attr in compositeBlock.__dict__.keys(): setattr(self, code_attr, getattr(compositeBlock, code_attr)) for (key, snippet) in extras: setattr(self, key, CodeBlock(snippet).code) self.code = codeBlock.code self.orig_code = origCode else: self.constructor = '' self.flags = [] # Optional arguments are assumed to be either StaticInst flags # or an OpClass value. To avoid having to import a complete # list of these values to match against, we do it ad-hoc # with regexps. for oa in opt_args: if instFlagRE.match(oa): self.flags.append(oa) elif opClassRE.match(oa): self.op_class = oa else: error(0, 'InstObjParams: optional arg "%s" not recognized ' 'as StaticInst::Flag or OpClass.' % oa)
4,273
def __init__(self, mnem, class_name, base_class = '', code = None, opt_args = [], *extras): self.mnemonic = mnem self.class_name = class_name self.base_class = base_class if code: #If the user already made a CodeBlock, pick the parts from it if isinstance(code, CodeBlock): origCode = code.orig_code codeBlock = code else: origCode = code codeBlock = CodeBlock(code) compositeCode = '\n'.join([origCode] + [pair[1] for pair in extras]) compositeBlock = CodeBlock(compositeCode) for code_attr in compositeBlock.__dict__.keys(): setattr(self, code_attr, getattr(compositeBlock, code_attr)) for (key, snippet) in extras: setattr(self, key, CodeBlock(snippet).code) self.code = codeBlock.code self.orig_code = origCode else: self.constructor = '' self.flags = [] # Optional arguments are assumed to be either StaticInst flags # or an OpClass value. To avoid having to import a complete # list of these values to match against, we do it ad-hoc # with regexps. for oa in opt_args: if instFlagRE.match(oa): self.flags.append(oa) elif opClassRE.match(oa): self.op_class = oa else: error(0, 'InstObjParams: optional arg "%s" not recognized ' 'as StaticInst::Flag or OpClass.' % oa)
def __init__(self, mnem, class_name, base_class = '', code = None, opt_args = [], *extras): self.mnemonic = mnem self.class_name = class_name self.base_class = base_class if code: #If the user already made a CodeBlock, pick the parts from it if isinstance(code, CodeBlock): origCode = code.orig_code codeBlock = code else: origCode = code codeBlock = CodeBlock(code) stringExtras = {} otherExtras = {} for (k, v) in extras.items(): if type(v) == str: stringExtras[k] = v else: otherExtras[k] = v compositeCode = "\n".join([origCode] + stringExtras.values()) compositeBlock = CodeBlock(compositeCode) for code_attr in compositeBlock.__dict__.keys(): setattr(self, code_attr, getattr(compositeBlock, code_attr)) for (key, snippet) in extras: setattr(self, key, CodeBlock(snippet).code) self.code = codeBlock.code self.orig_code = origCode else: self.constructor = '' self.flags = [] # Optional arguments are assumed to be either StaticInst flags # or an OpClass value. To avoid having to import a complete # list of these values to match against, we do it ad-hoc # with regexps. for oa in opt_args: if instFlagRE.match(oa): self.flags.append(oa) elif opClassRE.match(oa): self.op_class = oa else: error(0, 'InstObjParams: optional arg "%s" not recognized ' 'as StaticInst::Flag or OpClass.' % oa)
4,274
def __init__(self, mnem, class_name, base_class = '', code = None, opt_args = [], *extras): self.mnemonic = mnem self.class_name = class_name self.base_class = base_class if code: #If the user already made a CodeBlock, pick the parts from it if isinstance(code, CodeBlock): origCode = code.orig_code codeBlock = code else: origCode = code codeBlock = CodeBlock(code) compositeCode = '\n'.join([origCode] + [pair[1] for pair in extras]) compositeBlock = CodeBlock(compositeCode) for code_attr in compositeBlock.__dict__.keys(): setattr(self, code_attr, getattr(compositeBlock, code_attr)) for (key, snippet) in extras: setattr(self, key, CodeBlock(snippet).code) self.code = codeBlock.code self.orig_code = origCode else: self.constructor = '' self.flags = [] # Optional arguments are assumed to be either StaticInst flags # or an OpClass value. To avoid having to import a complete # list of these values to match against, we do it ad-hoc # with regexps. for oa in opt_args: if instFlagRE.match(oa): self.flags.append(oa) elif opClassRE.match(oa): self.op_class = oa else: error(0, 'InstObjParams: optional arg "%s" not recognized ' 'as StaticInst::Flag or OpClass.' % oa)
def __init__(self, mnem, class_name, base_class = '', code = None, opt_args = [], *extras): self.mnemonic = mnem self.class_name = class_name self.base_class = base_class if code: #If the user already made a CodeBlock, pick the parts from it if isinstance(code, CodeBlock): origCode = code.orig_code codeBlock = code else: origCode = code codeBlock = CodeBlock(code) compositeCode = '\n'.join([origCode] + [pair[1] for pair in extras]) compositeBlock = CodeBlock(compositeCode) for code_attr in compositeBlock.__dict__.keys(): setattr(self, code_attr, getattr(compositeBlock, code_attr)) for (key, snippet) in stringExtras.items(): setattr(self, key, CodeBlock(snippet).code) self.code = codeBlock.code self.orig_code = origCode else: self.constructor = '' self.flags = [] # Optional arguments are assumed to be either StaticInst flags # or an OpClass value. To avoid having to import a complete # list of these values to match against, we do it ad-hoc # with regexps. for oa in opt_args: if instFlagRE.match(oa): self.flags.append(oa) elif opClassRE.match(oa): self.op_class = oa else: error(0, 'InstObjParams: optional arg "%s" not recognized ' 'as StaticInst::Flag or OpClass.' % oa)
4,275
def _convert(cls, value): if value == Nxone: return
def _convert(cls, value): if value == None: return
4,276
def __init__(cls, name, bases, dict): super(MetaConfigNode, cls).__init__(name, bases, dict)
def __init__(cls, name, bases, dict): super(MetaConfigNode, cls).__init__(name, bases, dict)
4,277
def __init__(cls, name, bases, dict): super(MetaConfigNode, cls).__init__(name, bases, dict)
def __init__(cls, name, bases, dict): super(MetaConfigNode, cls).__init__(name, bases, dict)
4,278
def __init__(cls, name, bases, dict): super(MetaConfigNode, cls).__init__(name, bases, dict)
def __init__(cls, name, bases, dict): super(MetaConfigNode, cls).__init__(name, bases, dict)
4,279
def __init__(cls, name, bases, dict): super(MetaConfigNode, cls).__init__(name, bases, dict)
def __init__(cls, name, bases, dict): super(MetaConfigNode, cls).__init__(name, bases, dict)
4,280
def disp(*args): print "%-35s %12s %12s %4s %5s %5s %5s %10s" % args
def disp(*args): print "%-35s %12s %12s %4s %5s %5s %5s %10s" % args
4,281
def disp(*args): print "%-35s %12s %12s %4s %5s %5s %5s %10s" % args
def disp(*args): print "%-35s %12s %12s %4s %5s %5s %5s %10s" % args
4,282
def display(): if options.graph: output.graph(command, options.graphdir, proxy) else: output.display(command, options.binned, options.printmode)
def display(): if options.graph: output.graph(command, options.graphdir, proxy) else: output.display(command, options.binned, options.printmode)
4,283
def display(): if options.graph: output.graph(command, options.graphdir, proxy) else: output.display(command, options.binned, options.printmode)
def display(): if options.graph: output.graph(command, options.graphdir, proxy) else: output.display(command, options.binned, options.printmode)
4,284
def graph(self): if self.chartdata is None: raise AttributeError, "Data not set for bar chart!"
def graph(self): if self.chartdata is None: raise AttributeError, "Data not set for bar chart!"
4,285
def graph(self): if self.chartdata is None: raise AttributeError, "Data not set for bar chart!"
def graph(self): if self.chartdata is None: raise AttributeError, "Data not set for bar chart!"
4,286
def system(): if not system.dir: try: path = env['M5_PATH'].split(':') except KeyError: path = [ '/dist/m5/system', '/n/poolfs/z/dist/m5/system' ] for system.dir in path: if os.path.isdir(system.dir): break else: raise ImportError, "Can't find a path to system files." if not binary.dir: binary.dir = joinpath(system.dir, 'binaries') if not disk.dir: disk.dir = joinpath('/n/zamp/z/ktlim/local/clean/linux', 'disks') if not script.dir: script.dir = joinpath(system.dir, 'boot')
def system(): if not system.dir: try: path = env['M5_PATH'].split(':') except KeyError: path = [ '/dist/m5/system', '/n/poolfs/z/dist/m5/system' ] for system.dir in path: if os.path.isdir(system.dir): break else: raise ImportError, "Can't find a path to system files." if not binary.dir: binary.dir = joinpath(system.dir, 'binaries') if not disk.dir: disk.dir = joinpath(system.dir, 'disks') if not script.dir: script.dir = joinpath(system.dir, 'boot')
4,287
def main(): import cc_main parse_args() done = False if options.copyright: done = True print info.LICENSE print if options.authors: done = True print 'Author information:' print print info.AUTHORS print if options.readme: done = True print 'Readme:' print print info.README print if options.release_notes: done = True print 'Release Notes:' print print info.RELEASE_NOTES print if done: sys.exit(0) if options.verbose >= 0: print "M5 Simulator System" print brief_copyright print print "M5 compiled %s" % cc_main.cvar.compileDate; print "M5 started %s" % datetime.now().ctime() print "M5 executing on %s" % socket.gethostname() # check to make sure we can find the listed script if not arguments or not os.path.isfile(arguments[0]): usage(2) # tell C++ about output directory cc_main.setOutputDir(options.outdir) # update the system path with elements from the -p option sys.path[0:0] = options.path import objects # set stats options objects.Statistics.text_file = options.stats_file # set debugging options objects.Debug.break_cycles = options.debug_break # set tracing options objects.Trace.flags = options.trace_flags objects.Trace.start = options.trace_start objects.Trace.file = options.trace_file objects.Trace.bufsize = options.trace_circlebuf objects.Trace.dump_on_exit = options.trace_dumponexit objects.Trace.ignore = options.trace_ignore # set execution trace options objects.ExecutionTrace.speculative = options.speculative objects.ExecutionTrace.print_cycle = options.print_cycle objects.ExecutionTrace.pc_symbol = options.print_symbol objects.ExecutionTrace.print_opclass = options.print_opclass objects.ExecutionTrace.print_thread = options.print_thread objects.ExecutionTrace.print_effaddr = options.print_effaddr objects.ExecutionTrace.print_data = options.print_data objects.ExecutionTrace.print_iregs = options.print_iregs objects.ExecutionTrace.print_fetchseq = options.print_fetch_seq objects.ExecutionTrace.print_cpseq = options.print_cpseq scope = { '__file__' : sys.argv[0] } sys.argv = arguments sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path exec("import readline", scope) execfile(sys.argv[0], scope) # once the script is done if options.interactive: interact = code.InteractiveConsole(scope) interact.interact("M5 Interactive Console")
def main(): import cc_main parse_args() done = False if options.copyright: done = True print info.LICENSE print if options.authors: done = True print 'Author information:' print print info.AUTHORS print if options.readme: done = True print 'Readme:' print print info.README print if options.release_notes: done = True print 'Release Notes:' print print info.RELEASE_NOTES print if done: sys.exit(0) if options.verbose >= 0: print "M5 Simulator System" print brief_copyright print print "M5 compiled %s" % cc_main.cvar.compileDate; print "M5 started %s" % datetime.now().ctime() print "M5 executing on %s" % socket.gethostname() # check to make sure we can find the listed script if not arguments or not os.path.isfile(arguments[0]): usage(2) # tell C++ about output directory cc_main.setOutputDir(options.outdir) # update the system path with elements from the -p option sys.path[0:0] = options.path import objects # set stats options objects.Statistics.text_file = options.stats_file # set debugging options objects.Debug.break_cycles = options.debug_break # set tracing options objects.Trace.flags = options.trace_flags objects.Trace.start = options.trace_start objects.Trace.file = options.trace_file objects.Trace.bufsize = options.trace_circlebuf objects.Trace.dump_on_exit = options.trace_dumponexit objects.Trace.ignore = options.trace_ignore # set execution trace options objects.ExecutionTrace.speculative = options.speculative objects.ExecutionTrace.print_cycle = options.print_cycle objects.ExecutionTrace.pc_symbol = options.print_symbol objects.ExecutionTrace.print_opclass = options.print_opclass objects.ExecutionTrace.print_thread = options.print_thread objects.ExecutionTrace.print_effaddr = options.print_effaddr objects.ExecutionTrace.print_data = options.print_data objects.ExecutionTrace.print_iregs = options.print_iregs objects.ExecutionTrace.print_fetchseq = options.print_fetch_seq objects.ExecutionTrace.print_cpseq = options.print_cpseq sys.argv = arguments sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path exec("import readline", scope) execfile(sys.argv[0], scope) # once the script is done if options.interactive: interact = code.InteractiveConsole(scope) interact.interact("M5 Interactive Console")
4,288
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if options.graph: graphdata(runs, stat.name, stat.name, stat) else: if options.binned: print 'kernel ticks' stat.bins = 'kernel' printdata(runs, stat) print 'idle ticks' stat.bins = 'idle' printdata(runs, stat) print 'user ticks' stat.bins = 'user' printdata(runs, stat) print 'interrupt ticks' stat.bins = 'user' printdata(runs, stat) print 'total ticks' stat.bins = None print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if options.graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if options.binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.etherdev.rxPackets if options.graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.etherdev.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.etherdev.rxPackets / sim_seconds if options.graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes bpt = bytes / sim_ticks * 8 if options.graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes if options.binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.etherdev.rxBandwidth / 1e9 if options.graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.etherdev.txBandwidth / 1e9 if options.graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.etherdev.rxBandwidth txbps = system.tsunami.etherdev.txBandwidth gbps = (rxbps + txbps) / 1e9 if options.graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L2.overall_mshr_misses if options.binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if options.graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L2.overall_mshr_misses rxbytes = system.tsunami.etherdev.rxBytes txbytes = system.tsunami.etherdev.txBytes if options.binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if options.graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'bpp': ed = system.tsunami.etherdev bpp = (ed.rxBytes + ed.txBytes) / (ed.rxPackets + ed.txPackets) if options.graph: graphdata(runs, 'bpp', 'Bytes / Packet', bpp) else: printdata(runs, bpp) return if command == 'rxbpp': bpp = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.rxPackets if options.graph: graphdata(runs, 'rxbpp', 'Receive Bytes / Packet', bpp) else: printdata(runs, bpp) return if command == 'txbpp': bpp = system.tsunami.etherdev.txBytes / system.tsunami.etherdev.txPackets if options.graph: graphdata(runs, 'txbpp', 'Transmit Bytes / Packet', bpp) else: printdata(runs, bpp) return if command == 'rtp': rtp = system.tsunami.etherdev.rxPackets / system.tsunami.etherdev.txPackets if options.graph: graphdata(runs, 'rtp', 'rxPackets / txPackets', rtp) else: printdata(runs, rtp) return if command == 'rtb': rtb = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.txBytes if options.graph: graphdata(runs, 'rtb', 'rxBytes / txBytes', rtb) else: printdata(runs, rtb) return raise CommandException
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if options.graph: graphdata(runs, stat.name, stat.name, stat) else: if options.binned: print 'kernel ticks' stat.bins = 'kernel' printdata(runs, stat) print 'idle ticks' stat.bins = 'idle' printdata(runs, stat) print 'user ticks' stat.bins = 'user' printdata(runs, stat) print 'interrupt ticks' stat.bins = 'user' printdata(runs, stat) print 'total ticks' stat.bins = None print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if options.graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if options.binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.etherdev.rxPackets if options.graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.etherdev.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.etherdev.rxPackets / sim_seconds if options.graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes bpt = bytes / sim_ticks * 8 if options.graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.etherdev.rxBytes + system.tsunami.etherdev.txBytes if options.binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.etherdev.rxBandwidth / 1e9 if options.graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.etherdev.txBandwidth / 1e9 if options.graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.etherdev.rxBandwidth txbps = system.tsunami.etherdev.txBandwidth gbps = (rxbps + txbps) / 1e9 if options.graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L2.overall_mshr_misses if options.binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if options.graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L2.overall_mshr_misses rxbytes = system.tsunami.etherdev.rxBytes txbytes = system.tsunami.etherdev.txBytes if options.binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if options.graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'bpp': ed = system.tsunami.etherdev bpp = (ed.rxBytes + ed.txBytes) / (ed.rxPackets + ed.txPackets) if options.graph: graphdata(runs, 'bpp', 'Bytes / Packet', bpp) else: printdata(runs, bpp) return if command == 'rxbpp': bpp = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.rxPackets if options.graph: graphdata(runs, 'rxbpp', 'Receive Bytes / Packet', bpp) else: printdata(runs, bpp) return if command == 'txbpp': bpp = system.tsunami.etherdev.txBytes / system.tsunami.etherdev.txPackets if options.graph: graphdata(runs, 'txbpp', 'Transmit Bytes / Packet', bpp) else: printdata(runs, bpp) return if command == 'rtp': rtp = system.tsunami.etherdev.rxPackets / system.tsunami.etherdev.txPackets if options.graph: graphdata(runs, 'rtp', 'rxPackets / txPackets', rtp) else: printdata(runs, rtp) return if command == 'rtb': rtb = system.tsunami.etherdev.rxBytes / system.tsunami.etherdev.txBytes if options.graph: graphdata(runs, 'rtb', 'rxBytes / txBytes', rtb) else: printdata(runs, rtb) return raise CommandException
4,289
def isproxy(obj): if isinstance(obj, BaseProxy): return True elif isinstance(obj, (list, tuple)): for v in obj: if isproxy(v): return True return False
def isproxy(obj): if isinstance(obj, (BaseProxy, EthernetAddr)): return True elif isinstance(obj, (list, tuple)): for v in obj: if isproxy(v): return True return False
4,290
def IncEthernetAddr(addr, val = 1): bytes = map(lambda x: int(x, 16), addr.split(':')) bytes[5] += val for i in (5, 4, 3, 2, 1): val,rem = divmod(bytes[i], 256) bytes[i] = rem if val == 0: break bytes[i - 1] += val assert(bytes[0] <= 255) return ':'.join(map(lambda x: '%02x' % x, bytes))
def IncEthernetAddr(addr, val = 1): bytes = map(lambda x: int(x, 16), addr.split(':')) bytes[5] += val for i in (5, 4, 3, 2, 1): val,rem = divmod(bytes[i], 256) bytes[i] = rem if val == 0: break bytes[i - 1] += val assert(bytes[0] <= 255) return ':'.join(map(lambda x: '%02x' % x, bytes))
4,291
def __init__(self, inc = 1): self.value = self.addr self.addr = IncEthernetAddr(self.addr, inc)
def __init__(self, inc = 1): self.value = self.addr self.addr = IncEthernetAddr(self.addr, inc)
4,292
def __str__(self): if self.value == NextEthernetAddr: self.value = self.value().value return self.value
def __str__(self): if self.value == NextEthernetAddr: self.value = self.value().value return self.value
4,293
def unproxy(self,base): return self
def unproxy(self, base): return self
4,294
def finalize(self): self.flags = self.getFlags() self.constructor = self.makeConstructor() self.op_decl = self.makeDecl()
def finalize(self): self.flags = self.getFlags() self.constructor = self.makeConstructor() self.op_decl = self.makeDecl()
4,295
def outputDot(self, dot):
def outputDot(self, dot):
4,296
def __setattr__(self, attr, value): if attr != 'ptype': raise AttributeError, \ 'Attribute %s not available in %s' % (attr, self.__class__) super(ParamFactory, self).__setattr__(attr, value)
def__setattr__(self,attr,value):ifattr!='ptype':raiseAttributeError,\'Attribute%snotavailablein%s'%(attr,self.__class__)super(ParamFactory,self).__setattr__(attr,value)
4,297
def _string(cls, value): return value
def_string(cls,value):returnvalue
4,298
def _string(): return 'NULL'
def_string():return'NULL'
4,299