bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def manage_test(self, REQUEST):
def manage_test(self, REQUEST):
3,800
def manage_test(self, REQUEST):
def manage_test(self, REQUEST):
3,801
def __call__(self, REQUEST=None, **kw):
def __call__(self, REQUEST=None, **kw):
3,802
def __str__(self, html_search=regex.compile('<html>',regex.casefold).search, ): if self._wrote: return '' # Streaming output was used.
def __str__(self, html_search=regex.compile('<html>',regex.casefold).search, ): if self._wrote: return '' # Streaming output was used.
3,803
def evaluate(self, expression): expression = self.uncompile(expression) m = re.match(r"(?s)(%s):(.*)\Z" % NAME_RE, expression) if m: type, expr = m.group(1, 2) else: type = "path" expr = expression if type in ("string", "str"): return expr if type in ("path", "var", "global", "local"): expr = string.strip(expr) if self...
def evaluate(self, expression): expression = self.uncompile(expression) m = re.match(r"(?s)(%s):(.*)\Z" % NAME_RE, expression) if m: type, expr = m.group(1, 2) else: type = "path" expr = expression if type in ("string", "str"): return expr if type in ("path", "var", "global", "local"): expr = string.strip(expr) if self...
3,804
def __setstate__(self, state): # Perform on-the-fly migration to unicode. # Perhaps it might be work with the 'generation' module here? if not isinstance(state['_text'], unicode): text, encoding = convertToUnicode(state['_text'], state['content_type']) state['_text'] = text state['output_encoding'] = encoding self.__di...
def __setstate__(self, state): # Perform on-the-fly migration to unicode. # Perhaps it might be work with the 'generation' module here? if not isinstance(state['_text'], unicode): text, encoding = convertToUnicode(state['_text'], state.get('content_type', 'text/html')) state['_text'] = text state['output_encoding'] = e...
3,805
def testExpandsionMap(self): treeroot = self.tm.tree(self.root, self.expansionmap)
def testExpansionMap(self): treeroot = self.tm.tree(self.root, self.expansionmap)
3,806
def productItems(self, name=name): t=[] for i in self.objectMap(): if i['meta_type']=='Image': n=i['name'] t.append((n,getattr(self,n))) return t
def productItems(self, name=name): t=[] for i in self.objectMap(): if i['meta_type']=='Image': n=i['name'] t.append((n,getattr(self,n))) return t
3,807
def _searchable_result_columns(self): r = [] for name in self._catalog.indexes.keys(): i = {} i['name'] = name i['type'] = 's' i['parser'] = str i['width'] = 8 r.append(i) r.append({'name': 'data_record_id_', 'type': 's', 'parser': str, 'width': 8}) return r
def _searchable_result_columns(self): r = [] for name in self._catalog.schema.keys(): i = {} i['name'] = name i['type'] = 's' i['parser'] = str i['width'] = 8 r.append(i) r.append({'name': 'data_record_id_', 'type': 's', 'parser': str, 'width': 8}) return r
3,808
def _manage_add_product_data(self, type, product, id, **data): values=filter( lambda d, product=product, id=id: not (d['product']==product and d['id']==id), list(self._getProductRegistryData(type)) )
def _manage_add_product_data(self, type, product, id, **data): values=filter( lambda d, product=product, id=id: not (d['product']==product and d['id']==id), list(self.aq_acquire('_getProductRegistryData')(type)) )
3,809
def _manage_add_product_data(self, type, product, id, **data): values=filter( lambda d, product=product, id=id: not (d['product']==product and d['id']==id), list(self._getProductRegistryData(type)) )
def _manage_add_product_data(self, type, product, id, **data): values=filter( lambda d, product=product, id=id: not (d['product']==product and d['id']==id), list(self._getProductRegistryData(type)) )
3,810
def _manage_remove_product_data(self, type, product, id): values=filter( lambda d, product=product, id=id: not (d['product']==product and d['id']==id), self._getProductRegistryData(type) )
def _manage_remove_product_data(self, type, product, id): values=filter( lambda d, product=product, id=id: not (d['product']==product and d['id']==id), self.aq_acquire('_getProductRegistryData')(type) )
3,811
def _manage_remove_product_data(self, type, product, id): values=filter( lambda d, product=product, id=id: not (d['product']==product and d['id']==id), self._getProductRegistryData(type) )
def _manage_remove_product_data(self, type, product, id): values=filter( lambda d, product=product, id=id: not (d['product']==product and d['id']==id), self._getProductRegistryData(type) )
3,812
def doc_literal( self, s, expr = re.compile(r"'([%s%s%s\s]+)'[%s]+" % (letters, digits, literal_punc, phrase_delimiters)).search):
def doc_literal( self, s, expr = re.compile(r"'([%s%s%s\s]+)'[%s]+" % (letters, digits, literal_punc, phrase_delimiters)).search):
3,813
def doc_literal( self, s, expr = re.compile(r"'([%s%s%s\s]+)'[%s]+" % (letters, digits, literal_punc, phrase_delimiters)).search):
def doc_literal( self, s, expr = re.compile(r"'([%s%s%s\s]+)'[%s]+" % (letters, digits, literal_punc, phrase_delimiters)).search):
3,814
def doc_literal( self, s, expr = re.compile(r"'([%s%s%s\s]+)'[%s]+" % (letters, digits, literal_punc, phrase_delimiters)).search):
def doc_literal( self, s, expr = re.compile(r"'([%s%s%s\s]+)'[%s]+" % (letters, digits, literal_punc, phrase_delimiters)).search):
3,815
def parse(text, result=None, keys=None, unparmre=ts_regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)'), parmre=ts_regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)'), qparmre=ts_regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]*\)\"\)'), ): if result is None: result = {} keys=[] __traceback_info__=text ts_results ...
def parse(text, result=None, keys=None, unparmre=ts_regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)'), parmre=ts_regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)'), qparmre=ts_regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]*\)\"\)'), ): if result is None: result = {} keys=[] __traceback_info__=text ts_results ...
3,816
def insertBase(self, base_re=regex.compile('<base[\0- ]+[^>]+>\)', regex.casefold) ): if (self.headers.has_key('content-type') and self.headers['content-type']!='text/html'): return
def insertBase(self, base_re=regex.compile('\(<base[\0- ]+[^>]+>\)', regex.casefold) ): if (self.headers.has_key('content-type') and self.headers['content-type']!='text/html'): return
3,817
def Destination(self): "Return the destination for factory output" return self._d
def Destination(self): "Return the destination for factory output" return self._d
3,818
def logmsg(self, event): # log a service event using servicemanager.LogMsg try: servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, event, (self._svc_name_, " (%s)" % self._svc_display_name_)) except win32api.error, details: # Failed to write a log entry - most likely problem is # that the event log is full...
def logmsg(self, event): # log a service event using servicemanager.LogMsg try: servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, event, (self._svc_name_, " (%s)" % self._svc_display_name_)) except win32api.error, details: # Failed to write a log entry - most likely problem is # that the event log is full...
3,819
def _dolog(self, func, msg): try: fullmsg = "%s (%s): %s" % \ (self._svc_name_, self._svc_display_name_, msg) func(fullmsg) except win32api.error, details: # Failed to write a log entry - most likely problem is # that the event log is full. We don't want this to kill us print "FAILED to write event log entry:", detail...
def _dolog(self, func, msg): try: fullmsg = "%s (%s): %s" % \ (self._svc_name_, self._svc_display_name_, msg) func(fullmsg) except win32api.error, details: # Failed to write a log entry - most likely problem is # that the event log is full. We don't want this to kill us print "FAILED to write event log entry:", detail...
3,820
def __setstate__(self, state): Script.__setstate__(self, state) if (getattr(self, 'Python_magic', None) != Python_magic or getattr(self, 'Script_magic', None) != Script_magic): global _log_complaint if _log_complaint: LOG(self.meta_type, INFO, _log_complaint) _log_complaint = 0 # Changes here won't get saved, unless th...
def __setstate__(self, state): Script.__setstate__(self, state) if (getattr(self, 'Python_magic', None) != Python_magic or getattr(self, 'Script_magic', None) != Script_magic): global _log_complaint if _log_complaint: LOG(self.meta_type, INFO, _log_complaint) _log_complaint = 0 # Changes here won't get saved, unless th...
3,821
def _compile(self): r = self._compiler(self._params, self._body or 'pass', self.id, self.meta_type) code = r[0] errors = r[1] self.warnings = tuple(r[2]) if errors: self._code = None self._v_f = None self._setFuncSignature((), (), 0) # Fix up syntax errors. filestring = ' File "<string>",' for i in range(len(errors)):...
def _compile(self): r = self._compiler(self._params, self._body or 'pass', self.id, self.meta_type) code = r[0] errors = r[1] self.warnings = tuple(r[2]) if errors: self._code = None self._v_ft = None self._setFuncSignature((), (), 0) # Fix up syntax errors. filestring = ' File "<string>",' for i in range(len(errors))...
3,822
def _newfun(self, code): g = {'__debug__': __debug__, '__builtins__': safe_builtins, '_getattr_': guarded_getattr, '_getitem_': guarded_getitem, '_write_': full_write_guard, '_print_': RestrictedPython.PrintCollector, } l = {} exec code in g, l self._v_f = f = l.values()[0] return f
def _newfun(self, code): g = {'__debug__': __debug__, '__builtins__': safe_builtins, '_getattr_': guarded_getattr, '_getitem_': guarded_getitem, '_write_': full_write_guard, '_print_': RestrictedPython.PrintCollector, } l = {} exec code in g, l f = l.values()[0] self._v_ft = (f.func_code, g, f.func_defaults or ()) retu...
3,823
def _editedBindings(self): if getattr(self, '_v_f', None) is not None: self._makeFunction()
def _editedBindings(self): if getattr(self, '_v_ft', None) is not None: self._makeFunction()
3,824
def _exec(self, bound_names, args, kw): """Call a Python Script
def _exec(self, bound_names, args, kw): """Call a Python Script
3,825
def _exec(self, bound_names, args, kw): """Call a Python Script
def _exec(self, bound_names, args, kw): """Call a Python Script
3,826
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
3,827
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
3,828
def attrAction(self, item): name, value, action = item[:3] if action > 1 and not self.showtal: return 0, name, value ok = 1 if action == 2 and self.metal: i = rfind(name, ":") + 1 prefix, suffix = name[:i], name[i:] ##self.dumpMacroStack(prefix, suffix, value) what, macroName, slots = self.macroStack[-1] if suffix == "...
def attrAction(self, item): name, value, action = item[:3] if action == 1 or (action > 1 and not self.showtal): return 0, name, value ok = 1 if action == 2 and self.metal: i = rfind(name, ":") + 1 prefix, suffix = name[:i], name[i:] ##self.dumpMacroStack(prefix, suffix, value) what, macroName, slots = self.macroStack[-...
3,829
def _er(self,data,title,SUBMIT,dtpref_cols,dtpref_rows,REQUEST): dr,dc = self._size_changes[SUBMIT] rows=max(1,atoi(dtpref_rows)+dr) cols=max(40,atoi(dtpref_cols)+dc) e='Friday, 31-Dec-99 23:59:59 GMT' resp=REQUEST['RESPONSE'] resp.setCookie('dtpref_rows',str(rows),path='/',expires=e) resp.setCookie('dtpref_cols',str(...
def _er(self,data,title,SUBMIT,dtpref_cols,dtpref_rows,REQUEST): dr,dc = self._size_changes[SUBMIT] rows=max(1,atoi(dtpref_rows)+dr) cols=max(40,atoi(dtpref_cols)+dc) e='Friday, 31-Dec-99 23:59:59 GMT' resp=REQUEST['RESPONSE'] resp.setCookie('dtpref_rows',str(rows),path='/',expires=e) resp.setCookie('dtpref_cols',str(...
3,830
def output(self, text): print >>self.fp, '%s: %s' % (self._ident, text)
def output(self, text): print >>self.fp, '%s: %s' % (self._ident, text)
3,831
def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, '__import_error__'): ie=productp.__import_error__ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=get...
def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, '__import_error__'): ie=productp.__import_error__ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=get...
3,832
def log (self, bytes): user_agent=self.get_header('user-agent') if not user_agent: user_agent='' referer=self.get_header('referer') if not referer: referer='' auth=self.get_header('Authorization') name='Anonymous' if auth is not None: if string.lower(auth[:6]) == 'basic ': try: decoded=base64.decodestring(auth[6:]) ex...
def log (self, bytes): user_agent=self.get_header('user-agent') if not user_agent: user_agent='' referer=self.get_header('referer') if not referer: referer='' auth=self.get_header('Authorization') name='Anonymous' if auth is not None: if string.lower(auth[:6]) == 'basic ': try: decoded=base64.decodestring(auth[6:]) ex...
3,833
def translate(self, msgid, domain=None, mapping=None, default=None): context = self.contexts.get('context') return getGlobalTranslationService().translate( domain, msgid, mapping=mapping, context=context, default=default)
def translate(self, msgid, domain=None, mapping=None, default=None): context = self.contexts.get('context') return getGlobalTranslationService().translate( domain, msgid, mapping=mapping, context=context, default=default)
3,834
def __init__(self, id, title, file, content_type='', precondition=''): self.__name__=id self.title=title self.precondition=precondition headers=hasattr(file, 'headers') and file.headers or None if (headers is None) and (not content_type): raise 'Bad Request', 'No content type specified.' if headers and headers.has_key(...
def __init__(self, id, title, file, content_type='', precondition=''): self.__name__=id self.title=title self.precondition=precondition headers=hasattr(file, 'headers') and file.headers or None data=(headers is None) and file or file.read() if headers and headers.has_key('content-type') and (not content_type): content_...
3,835
def __init__(self, id, title, file, content_type='', precondition=''): self.__name__=id self.title=title self.precondition=precondition headers=hasattr(file, 'headers') and file.headers or None if (headers is None) and (not content_type): raise 'Bad Request', 'No content type specified.' if headers and headers.has_key(...
def __init__(self, id, title, file, content_type='', precondition=''): self.__name__=id self.title=title self.precondition=precondition headers=hasattr(file, 'headers') and file.headers or None if (headers is None) and (not content_type): raise 'Bad Request', 'No content type specified.' if headers and headers.has_key(...
3,836
def manage_upload(self,file='',REQUEST=None): """ Replaces the current contents of the File or Image object with file.
def manage_upload(self,file='',REQUEST=None): """ Replaces the current contents of the File or Image object with file.
3,837
def startTagCommon(self, name, attrList, end): if not attrList: self.stream_write("<%s%s" % (name, end)) return self.stream_write("<" + name) align = self.col+1 for item in attrList: name, value = item[:2] if len(item) > 2: try: action = self.actionIndex(item[2]) except ValueError: raise TALError, ('Error in TAL progra...
def startTagCommon(self, name, attrList, end): if not attrList: self.stream_write("<%s%s" % (name, end)) return self.stream_write("<" + name) align = self.col+1 for item in attrList: name, value = item[:2] if len(item) > 2: try: action = self.actionIndex(item[2]) except ValueError: raise TALError, ('Error in TAL progra...
3,838
def info(self,t=None): idx=self.index(t)[0] zs =self.az[self.tinfo[idx][2]:] return self.tinfo[idx][0],self.tinfo[idx][1],zs[:find(zs,'\000')]
def info(self,t=None): idx=self.index(t)[0] zs =self.az[self.tinfo[idx][2]:] return self.tinfo[idx][0],self.tinfo[idx][1],zs[:find(zs,'\000')]
3,839
def objectMap(self): # Return a tuple of mappings containing subobject meta-data return map(lambda dict: dict.copy(), self._objects)
def objectMap(self): # Return a tuple of mappings containing subobject meta-data return map(lambda dict: dict.copy(), self._objects)
3,840
def testResolveUrl(self): # Check that ResolveUrl really raises the same error
def testResolveUrl(self): # Check that ResolveUrl really raises the same error
3,841
def testResolveUrl(self): # Check that ResolveUrl really raises the same error
def testResolveUrl(self): # Check that ResolveUrl really raises the same error
3,842
def test_csv_table_file_option_raise(self):
def test_csv_table_file_option_raise(self):
3,843
def __init__(self, blocks):
def __init__(self, blocks):
3,844
def moveObjectsByDelta(self, ids, delta): """ Move specified sub-objects by delta. """ if type(ids) is StringType: ids = (ids,) min_position = 0 objects = list(self._objects) obj_dict = {} for obj in self._objects: obj_dict[ obj['id'] ] = obj # unify moving direction if delta > 0: ids = list(ids) ids.reverse() objects....
def moveObjectsByDelta(self, ids, delta): """ Move specified sub-objects by delta. """ if type(ids) is StringType: ids = (ids,) min_position = 0 objects = list(self._objects) obj_dict = {} for obj in self._objects: obj_dict[ obj['id'] ] = obj # unify moving direction if delta > 0: ids = list(ids) ids.reverse() objects....
3,845
def getObjectPosition(self, id): """ Get the position of an object by its id. """ ids = self.objectIds() if id in ids: return ids.index(id) raise ValueError, 'The object with the id "%s" does not exist.' % id
def getObjectPosition(self, id): """ Get the position of an object by its id. """ ids = self.objectIds() if id in ids: return ids.index(id) raise ValueError, 'The object with the id "%s" does not exist.' % id
3,846
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateAFactory=0, REQUEST=None, zope_object=0): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: base=find_class(self, b) bases.append(base) Z=ZClass(id, title, b...
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateAFactory=0, REQUEST=None, zope_object=0): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: raise 'Invalid class', b Z=ZClass(id, title, bases, zope_object=zo...
3,847
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateAFactory=0, REQUEST=None, zope_object=0): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: base=find_class(self, b) bases.append(base) Z=ZClass(id, title, b...
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateAFactory=0, REQUEST=None, zope_object=0): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: base=find_class(self, b) bases.append(base) Z=ZClass(id, title, b...
3,848
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateAFactory=0, REQUEST=None, zope_object=0): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: base=find_class(self, b) bases.append(base) Z=ZClass(id, title, b...
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateAFactory=0, REQUEST=None, zope_object=0): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: base=find_class(self, b) bases.append(base) Z=ZClass(id, title, b...
3,849
def _register(self):
def _register(self):
3,850
def _unregister(self):
def _unregister(self):
3,851
def Send(host, port, localhost, timeout, from_, to, subject, body): SendMail(host, port, localhost, timeout).send(from_, to, subject, body)
def Send(host, port, localhost, timeout, from_, to, subject, body): SendMail(host, port, localhost, timeout).send(from_, to, subject, body)
3,852
def _check(self, lev='250'): line = self.getLine() if not line: return 0 try: code=string.atoi(line[:3]) except: raise smtpError, \ "Cannot convert line from SMTP: %s" % line if code > 400: # my change... raise smtpError, \ "Recieved error code %s from SMTP: %s"\ % (code, line) return 1
def _check(self, lev='250'): line = self.getLine() if not line: return 0 try: code=string.atoi(line[:3]) except: raise smtpError, \ "Cannot convert line from SMTP: %s" % line if code > 400: # my change... raise smtpError, \ "Recieved error code %s from SMTP: %s"\ % (code, line) return 1
3,853
def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\015\012" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\015\012" % person) self._check() else: self.conn.send("rcpt to:<%s>\015\012" % mto) self....
def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\015\012" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\015\012" % person) self._check() else: self.conn.send("rcpt to:<%s>\015\012" % mto) self....
3,854
def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\015\012" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\015\012" % person) self._check() else: self.conn.send("rcpt to:<%s>\015\012" % mto) self....
def send(self, mfrom, mto, subj='No Subject', body='Blank Message'): self.conn.send("mail from:<%s>\015\012" % mfrom) self._check() if type(mto) in [types.ListType, types.TupleType]: for person in mto: self.conn.send("rcpt to:<%s>\015\012" % person) self._check() else: self.conn.send("rcpt to:<%s>\015\012" % mto) self....
3,855
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
3,856
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
3,857
def publish(self, module_name, published='web_objects',
def publish(self, module_name, published='web_objects',
3,858
def publish(self, module_name, published='web_objects',
def publish(self, module_name, published='web_objects',
3,859
def manage_addUserFolder(self,dtself,REQUEST): """ """ i=UserFolder() i._init() self._setObject('UserFolder', i) self.__allow_groups__=self.UserFolder return self.manage_main(self,REQUEST)
def manage_addUserFolder(self,dtself,REQUEST): """ """ i=UserFolder() i._init() self._setObject('acl_users', i) self.__allow_groups__=self.UserFolder return self.manage_main(self,REQUEST)
3,860
def save_tuple(self, object):
defprint '+2' save_tuple(self,print '+2' object):
3,861
def save_tuple(self, object):
defprint '+3' save_tuple(self,print '+3' object):
3,862
def __call__(self, container, request): try: meth = getattr(container, self.name) except AttributeError: return
def __call__(self, container, request): try: meth = getattr(container, self.name) except AttributeError: return
3,863
def __call__(self, *args, **kw): '''Calls the script. ''' return self._bindAndExec(args, kw, None)
def __call__(self, *args, **kw): '''Calls the script.''' return self._bindAndExec(args, kw, None)
3,864
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
3,865
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
3,866
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={} while 1: if hasattr(object, '__ac_local_roles__'): dict=object.__ac_local_roles__ or {} for r in dict.get(na...
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={} while 1: if hasattr(object, '__ac_local_roles__'): dict=object.__ac_local_roles__ or {} for r in dict.get(na...
3,867
def analyze(f, top, sortf, start=None, end=None, mode='cumulative'): beginrequests = {} cumulative = {} finished = {} unfinished = {} while 1: line = f.readline() if not line: break line = string.strip(line) tup = parsebigmlogline(line) if tup is None: print "Could not interpret line: %s" % line continue code, id, tim...
def analyze(f, top, sortf, start=None, end=None, mode='cumulative'): beginrequests = {} cumulative = {} finished = [] unfinished = [] while 1: line = f.readline() if not line: break line = string.strip(line) tup = parsebigmlogline(line) if tup is None: print "Could not interpret line: %s" % line continue code, id, tim...
3,868
def analyze(f, top, sortf, start=None, end=None, mode='cumulative'): beginrequests = {} cumulative = {} finished = {} unfinished = {} while 1: line = f.readline() if not line: break line = string.strip(line) tup = parsebigmlogline(line) if tup is None: print "Could not interpret line: %s" % line continue code, id, tim...
def analyze(f, top, sortf, start=None, end=None, mode='cumulative'): beginrequests = {} cumulative = {} finished = {} unfinished = {} while 1: line = f.readline() if not line: break line = string.strip(line) tup = parsebigmlogline(line) if tup is None: print "Could not interpret line: %s" % line continue code, id, tim...
3,869
def analyze(f, top, sortf, start=None, end=None, mode='cumulative'): beginrequests = {} cumulative = {} finished = {} unfinished = {} while 1: line = f.readline() if not line: break line = string.strip(line) tup = parsebigmlogline(line) if tup is None: print "Could not interpret line: %s" % line continue code, id, tim...
def analyze(f, top, sortf, start=None, end=None, mode='cumulative'): beginrequests = {} cumulative = {} finished = {} unfinished = {} while 1: line = f.readline() if not line: break line = string.strip(line) tup = parsebigmlogline(line) if tup is None: print "Could not interpret line: %s" % line continue code, id, tim...
3,870
def install_product(app, product_dir, product_name, meta_types, folder_permissions, raise_exc=0, log_exc=1): path_join=os.path.join isdir=os.path.isdir exists=os.path.exists global_dict=globals() silly=('__doc__',) if 1: # Preserve indentation for diff :-) package_dir=path_join(product_dir, product_name) __traceback...
def install_product(app, product_dir, product_name, meta_types, folder_permissions, raise_exc=0, log_exc=1): path_join=os.path.join isdir=os.path.isdir exists=os.path.exists global_dict=globals() silly=('__doc__',) if 1: # Preserve indentation for diff :-) package_dir=path_join(product_dir, product_name) __traceback...
3,871
def structure(list): if not list: return [] i=0 l=len(list) r=[] while i < l: sublen=paragraphs(list,i) i=i+1 r.append((list[i-1][1],structure(list[i:i+sublen]))) i=i+sublen return r
defstructure(list):ifnotlist:return[]i=0l=len(list)r=[]whilei<l:sublen=paragraphs(list,i)i=i+1r.append((list[i-1][1],structure(list[i:i+sublen])))i=i+sublenreturnr
3,872
def create(self,aPar, td_reg=re.compile(r'[ \t\n]*\|\|([^\0x00|]*)') ): '''parses a table and returns nested list representing the table''' self.table=[] text=filter(None,aPar.split('\n')) for line in text: row=[] while 1: mo = td_reg.match(line) if not mo: return 0 pos = mo.end(1) row.append(mo.group(1)) if pos==len(...
def create(self,aPar, td_reg=re.compile(r'[ \t\n]*\|\|([^\0|]*)') ): '''parses a table and returns nested list representing the table''' self.table=[] text=filter(None,aPar.split('\n')) for line in text: row=[] while 1: mo = td_reg.match(line) if not mo: return 0 pos = mo.end(1) row.append(mo.group(1)) if pos==len(lin...
3,873
def validate( self, *args, **kw ): return self._lambdas[ 0 ]( *args, **kw )
def validate( self, *args, **kw ): return self._lambdas[ 0 ]( *args, **kw )
3,874
def _takeOutGarbage(self, oid): # take out the garbage. referenceCount=self._referenceCount referenceCount_get=referenceCount.get
def _takeOutGarbage(self, oid): # take out the garbage. referenceCount=self._referenceCount referenceCount_get=referenceCount.get
3,875
def _takeOutGarbage(self, oid): # take out the garbage. referenceCount=self._referenceCount referenceCount_get=referenceCount.get
def _takeOutGarbage(self, oid): # take out the garbage. referenceCount=self._referenceCount referenceCount_get=referenceCount.get
3,876
def update(self): if self.update_status is not None: # We've been called before. Just return the status we previously # computed. return self.update_status
def update(self): if self.update_status is not None: # We've been called before. Just return the status we previously # computed. return self.update_status
3,877
def update(self): if self.update_status is not None: # We've been called before. Just return the previous result. return self.update_status
def update(self): if self.update_status is not None: # We've been called before. Just return the previous result. return self.update_status
3,878
def allowed(self, object, object_roles=None): """Check whether the user has access to object, assuming that object.__roles__ is the given roles.""" if object_roles is None or 'Anonymous' in object_roles: return 1 usr_roles=self.getRolesInContext(object) for role in object_roles: if role in usr_roles: # The user apparen...
def allowed(self, object, object_roles=None): """Check whether the user has access to object, assuming that object.__roles__ is the given roles.""" if object_roles is None or 'Anonymous' in object_roles: return 1 usr_roles=self.getRolesInContext(object) for role in object_roles: if role in usr_roles: # The user apparen...
3,879
def reqattr(request, attr): try: return request[attr] except: return None
def reqattr(request, attr): try: return request[attr] except: return None
3,880
def doc_underline(self, s, expr=re.compile(r"\_([%s0-9\s\.,\?]+)\_" % letters).search): result = expr(s) if result: start,end = result.span(1) st,e = result.span() return (StructuredTextUnderline(s[start:end]),st,e) else: return None
def doc_underline(self, s, expr=re.compile(r"\s*\_([%s0-9\s\.,\?]+)\_" % letters).search): result = expr(s) if result: start,end = result.span(1) st,e = result.span() return (StructuredTextUnderline(s[start:end]),st,e) else: return None
3,881
def manage_addZCatalog(self, id, title, vocab='', vocab_id='', REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id, title, vocab, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self, REQUEST)
def manage_addZCatalog(self,id,title,REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id, title, vocab, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self, REQUEST)
3,882
def manage_addZCatalog(self, id, title, vocab='', vocab_id='', REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id, title, vocab, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self, REQUEST)
def manage_addZCatalog(self, id, title, vocab='', vocab_id='', REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id,title) self._setObject(id,c) if REQUEST is not None: return self.manage_main(self, REQUEST)
3,883
def manage_addZCatalog(self, id, title, vocab='', vocab_id='', REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id, title, vocab, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self, REQUEST)
def manage_addZCatalog(self, id, title, vocab='', vocab_id='', REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id, title, vocab, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self, REQUEST)
3,884
def VocabularyIDs(self): """ returns a list of acquireable vocabularies. Stole this from ZSQLMethods """ ids={} have_id=ids.has_key StringType=type('') while self is not None: if hasattr(self, 'objectValues'): for o in self.objectValues(): if (hasattr(o,'_isAVocabulary') and o._isAVocabulary and hasattr(o,'id')): id...
def VocabularyIDs(self): """ returns a list of acquireable vocabularies. Stole this from ZSQLMethods """ ids={} have_id=ids.has_key StringType=type('') while self is not None: if hasattr(self, 'objectValues'): for o in self.objectValues(): if (hasattr(o,'_isAVocabulary') and o._isAVocabulary and hasattr(o,'id')): id...
3,885
def __init__(self, id, title='', vocab=0, vocab_id='', container=None): self.id=id self.title=title self.vocab_id = vocab_id self.threshold = 10000 self._v_total = 0
def __init__(self, id, title='', vocab=0, vocab_id='', container=None): self.id=id self.title=title self.threshold = 10000 self._v_total = 0
3,886
def __init__(self, id, title='', vocab=0, vocab_id='', container=None): self.id=id self.title=title self.vocab_id = vocab_id self.threshold = 10000 self._v_total = 0
def __init__(self, id, title='', vocab=0, vocab_id='', container=None): self.id=id self.title=title self.vocab_id = vocab_id self.threshold = 10000 self._v_total = 0
3,887
def __init__(self, id, title='', vocab=0, vocab_id='', container=None): self.id=id self.title=title self.vocab_id = vocab_id self.threshold = 10000 self._v_total = 0
def __init__(self, id, title='', vocab=0, vocab_id='', container=None): self.id=id self.title=title self.vocab_id = vocab_id self.threshold = 10000 self._v_total = 0
3,888
def catalog_object(self, obj, uid): """ wrapper around catalog """ self._v_total = (self._v_total + self._catalog.catalogObject(obj, uid, self.threshold))
def catalog_object(self, obj, uid): """ wrapper around catalog """ self._v_total = (self._v_total + self._catalog.catalogObject(obj, uid, self.threshold))
3,889
def _ii(klass, items): for k, v in klass.__dict__.items(): if type(v) is not FunctionType or not v.__doc__: continue if k[:1]=='_' and not (k[:2]=='__' and k[-2:]=='__'): continue items[k]=v for b in klass.__bases__: _ii(b) return items
def _ii(klass, items): for k, v in klass.__dict__.items(): if type(v) is not FunctionType or not v.__doc__: continue if k[:1]=='_' and not (k[:2]=='__' and k[-2:]=='__'): continue items[k]=v for b in klass.__bases__: _ii(b, items) return items
3,890
def __getitem__(self,key, special_prefixes=special_prefixes, special_prefix=special_prefixes.has_key ): data=self.data if data.has_key(key): return data[key]
def __getitem__(self,key, special_prefixes=special_prefixes, special_prefix=special_prefixes.has_key ): data=self.data if data.has_key(key): return data[key]
3,891
def server_info(old, v, offset=0): # interpret v as a port or address/port and get new value if v == '-': v='' l=string.find(v, ':') if l >= 0: a=v[:l] v=v[l+1:] else: a=IP_ADDRESS if not v: return v try: v=string.atoi(v) if v < 0: raise 'Invalid port', v v=v+offset except: raise 'Invalid port', v if type(old) is ty...
def server_info(old, v, offset=0): # interpret v as a port or address/port and get new value if v == '-': v='' l=string.find(v, ':') if l >= 0: a=v[:l] v=v[l+1:] else: a=IP_ADDRESS if not v: return v try: v=string.atoi(v) if v < 0: raise 'Invalid port', v v=v+offset except: raise 'Invalid port', v if type(old) is ty...
3,892
def is_acquired(ob, hasattr=hasattr, aq_base=aq_base, absattr=absattr): # Return true if this object is not a direct # subobject of its aq_parent object. if not hasattr(ob, 'aq_parent'): return 0 if hasattr(aq_base(ob.aq_parent), absattr(ob.id)): return 0 if hasattr(aq_base(ob), 'isTopLevelPrincipiaApplicationObject'):...
def is_acquired(ob, hasattr=hasattr, aq_base=aq_base, absattr=absattr): # Return true if this object is not a direct # subobject of its aq_parent object. if not hasattr(ob, 'aq_parent'): return 0 if hasattr(aq_base(ob.aq_parent), absattr(ob.id)): return 0 if hasattr(aq_base(ob), 'isTopLevelPrincipiaApplicationObject') ...
3,893
def valid_roles(self): "Return list of valid roles" obj=self dict={} dup =dict.has_key x=0 while x < 100: if hasattr(obj, '__ac_roles__'): roles=obj.__ac_roles__ for role in roles: if not dup(role): dict[role]=1 if not hasattr(obj, 'aq_parent'): break obj=obj.aq_parent x=x+1 roles=dict.keys() roles.sort() return roles
def valid_roles(self): "Return list of valid roles" obj=self dict={} dup =dict.has_key x=0 while x < 100: if hasattr(obj, '__ac_roles__'): roles=obj.__ac_roles__ for role in roles: if not dup(role): dict[role]=1 if not hasattr(obj, 'aq_parent'): break obj=obj.aq_parent x=x+1 roles=dict.keys() roles.sort() return roles
3,894
def resolve_url(self, path, REQUEST): """ """ while path and path[0]=='/': path=path[1:] while path and path[-1]=='/': path=path[:-1] req=REQUEST.clone() rsp=req.response req['PATH_INFO']=path object=None try: object=req.traverse(path) except: # Do NOT call rsp.exception here! pass if object is not None: if hasattr(ob...
def resolve_url(self, path, REQUEST): """ """ while path and path[0]=='/': path=path[1:] while path and path[-1]=='/': path=path[:-1] req=REQUEST.clone() rsp=req.response req['PATH_INFO']=path object=None try: object=req.traverse(path) except: # Do NOT call rsp.exception here! pass if object is not None: if hasattr(ob...
3,895
def log(self, subsystem, severity, summary, detail, error): if _log_dest is None or severity < _log_level: return
def log(self, subsystem, severity, summary, detail, error): if _log_dest is None or severity < _log_level: return
3,896
def productItems(self, name=name): t=[] for i in self.objectMap(): if i['meta_type']=='Image': n=i['name'] t.append((n,getattr(self,n))) return t
def productItems(self, name=name): t=[] for i in self.objectMap(): if i['meta_type']=='Image': n=i['name'] t.append((n,getattr(self,n))) return t
3,897
def main(): # The "main" program for this module pass
def main(): # The "main" program for this module pass
3,898
def __init__(self,
def __init__(self,
3,899