bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def _search_before(self, c, oid, tid, end_tid): # Operates on the cursor created by loadBefore(). p = c.prev() if p is None: return None key, rec = p # If the previous record is for a different oid, then # there is no matching record. if key[:8] != oid: return None vid, nvrevid, lrevid = unpack(">8s8s8s", rec[:24]) if ...
def _search_before(self, c, oid, tid, end_tid): # Operates on the cursor created by loadBefore(). p = c.prev() if p is None: return None key, rec = p # If the previous record is for a different oid, then # there is no matching record. if key[:8] != oid: return None vid, nvrevid, lrevid = unpack(">8s8s8s", rec[:24]) if ...
2,200
def _search_before(self, c, oid, tid, end_tid): # Operates on the cursor created by loadBefore(). p = c.prev() if p is None: return None key, rec = p # If the previous record is for a different oid, then # there is no matching record. if key[:8] != oid: return None vid, nvrevid, lrevid = unpack(">8s8s8s", rec[:24]) if ...
def _search_before(self, c, oid, tid, end_tid): # Operates on the cursor created by loadBefore(). p = c.prev() if p is None: return None key, rec = p # If the previous record is for a different oid, then # there is no matching record. if key[:8] != oid: return None vid, nvrevid, lrevid = unpack(">8s8s8s", rec[:24]) if ...
2,201
def manage_convertIndexes(self, REQUEST=None, RESPONSE=None, URL1=None): """Recreate indexes derived from UnIndex because the implementation of __len__ changed in Zope 2.8. Pre-Zope 2.7 installation used to implement __len__ as persistent attribute of the index instance which is totally incompatible with the new extens...
def manage_convertIndexes(self, REQUEST=None, RESPONSE=None, URL1=None): """Recreate indexes derived from UnIndex because the implementation of __len__ changed in Zope 2.8. Pre-Zope 2.7 installation used to implement __len__ as persistent attribute of the index instance which is totally incompatible with the new extens...
2,202
def has_codec(x): try: codecs.lookup(x) except LookupError: return 0 else: return 1
def has_codec(x): try: codecs.lookup(x) except (LookupError, SystemError): return 0 else: return 1
2,203
def parse_params(text, result=None, tag='', unparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)'), qunparmre=regex.compile( '\([\0- ]*\("[^\0- =\"]+"\)\)'), parmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)'), qparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]*\)\"\)'), **parms): """Parse tag par...
def parse_params(text, result=None, tag='', unparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)'), qunparmre=regex.compile( '\([\0- ]*\("[^"]*"\)\)'), parmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)'), qparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]*\)\"\)'), **parms): """Parse tag parameter...
2,204
def parse(text, result=None, keys=None, unparmre=re.compile( r'([\000- ]*([^\000- ="]+))'), parmre=re.compile( r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'), qparmre=re.compile( r'([\000- ]*([^\000- ="]+)="([^"]*)")'), ): if result is None: result = {} keys=[] __traceback_info__=text mo = parmre.match(text) if mo: n...
def parse(text, result=None, keys=None, unparmre=re.compile( r'([\000- ]*([^\000- ="]+))'), parmre=re.compile( r'([\000- ]*([^\000- ="]+)=([^\000- ="]+))'), qparmre=re.compile( r'([\000- ]*([^\000- ="]+)="([^"]*)")'), ): if result is None: result = {} keys=[] __traceback_info__=text mo = parmre.match(text) if mo: n...
2,205
def emitEndElement(self, name, isend=0, implied=0): todo = self.todoPop() if not todo: # Shortcut if not isend: self.emitEndTag(name) return
def emitEndElement(self, name, isend=0, implied=0): todo = self.todoPop() if not todo: # Shortcut if not isend: self.emitEndTag(name) return
2,206
def addAttribute(dic, attr, msgid, position, xml): if not xml: attr = attr.lower() if attr in dic: raise TALError( "attribute may only be specified once in i18n:attributes: " + attr, position) dic[attr] = msgid
def addAttribute(dic, attr, msgid, position, xml): if not xml: attr = attr.lower() if attr in dic: raise TALError( "attribute may only be specified once in i18n:attributes: " + attr, position) dic[attr] = msgid
2,207
def __init__(self, args): args = parse_params(args, name='', type=None, column=None, multiple=1, optional=1, op=None) self.__name__ = name_param(args,'sqlvar') has_key=args.has_key if not has_key('type'): raise ParseError, ('the type attribute is required', 'sqltest') self.type=t=args['type'] if not valid_type(t): rais...
def __init__(self, args): args = parse_params(args, name='', expr='', type=None, column=None, multiple=1, optional=1, op=None) self.__name__ = name_param(args,'sqlvar') has_key=args.has_key if not has_key('type'): raise ParseError, ('the type attribute is required', 'sqltest') self.type=t=args['type'] if not valid_type...
2,208
def __init__(self, args): args = parse_params(args, name='', type=None, column=None, multiple=1, optional=1, op=None) self.__name__ = name_param(args,'sqlvar') has_key=args.has_key if not has_key('type'): raise ParseError, ('the type attribute is required', 'sqltest') self.type=t=args['type'] if not valid_type(t): rais...
def __init__(self, args): args = parse_params(args, name='', type=None, column=None, multiple=1, optional=1, op=None) name,expr = name_param(args,'sqlvar',1) if expr is None: expr=name else: expr=expr.eval self.__name__, self.expr = name, expr self.args=args if not args.has_key('type'): raise ParseError, ('the type a...
2,209
def __init__(self, args): args = parse_params(args, name='', type=None, column=None, multiple=1, optional=1, op=None) self.__name__ = name_param(args,'sqlvar') has_key=args.has_key if not has_key('type'): raise ParseError, ('the type attribute is required', 'sqltest') self.type=t=args['type'] if not valid_type(t): rais...
def __init__(self, args): args = parse_params(args, name='', type=None, column=None, multiple=1, optional=1, op=None) self.__name__ = name_param(args,'sqlvar') has_key=args.has_key if not has_key('type'): raise ParseError, ('the type attribute is required', 'sqltest') self.type=t=args['type'] if not valid_type(t): rais...
2,210
def __init__(self, args): args = parse_params(args, name='', type=None, column=None, multiple=1, optional=1, op=None) self.__name__ = name_param(args,'sqlvar') has_key=args.has_key if not has_key('type'): raise ParseError, ('the type attribute is required', 'sqltest') self.type=t=args['type'] if not valid_type(t): rais...
def __init__(self, args): args = parse_params(args, name='', type=None, column=None, multiple=1, optional=1, op=None) self.__name__ = name_param(args,'sqlvar') has_key=args.has_key if not has_key('type'): raise ParseError, ('the type attribute is required', 'sqltest') self.type=t=args['type'] if not valid_type(t): rais...
2,211
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if str(key)==name and self.optional: return '' raise KeyError, key, sys.exc_info()[2] if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for <...
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if str(key)==name and self.optional: return '' raise KeyError, key, sys.exc_info()[2] if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for...
2,212
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if str(key)==name and self.optional: return '' raise KeyError, key, sys.exc_info()[2] if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for <...
def render(self, md): name=self.__name__ t=self.type args=self.args try: expr=self.expr if type(expr) is type(''): v=md[expr] else: v=expr(md) except KeyError: if args.has_key('optional') and args['optional']: return '' raise 'Missing Input', 'Missing input variable, <em>%s</em>' % name if type(v) in (ListType, TupleT...
2,213
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if str(key)==name and self.optional: return '' raise KeyError, key, sys.exc_info()[2] if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for <...
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if str(key)==name and self.optional: return '' raise KeyError, key, sys.exc_info()[2] if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for <...
2,214
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if str(key)==name and self.optional: return '' raise KeyError, key, sys.exc_info()[2] if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for <...
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if str(key)==name and self.optional: return '' raise KeyError, key, sys.exc_info()[2] if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for <...
2,215
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if str(key)==name and self.optional: return '' raise KeyError, key, sys.exc_info()[2] if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for <...
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if str(key)==name and self.optional: return '' raise KeyError, key, sys.exc_info()[2] if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for <...
2,216
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if str(key)==name and self.optional: return '' raise KeyError, key, sys.exc_info()[2] if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for <...
defrender(self,md):name=self.__name__t=self.typetry:v=md[name]exceptKeyError,key:ifstr(key)==nameandself.optional:return''raiseKeyError,key,sys.exc_info()[2]iftype(v)in(ListType,TupleType):iflen(v)>1andnotself.multiple:raise'MultipleValues',('multiplevaluesarenotallowedfor<em>%s</em>'%name)else:v=[v]vs=[]forvinv:ifnotv...
2,217
def manage_paste(self, moniker, clip_id, REQUEST=None): """ """
def manage_paste(self, moniker, clip_id, REQUEST=None): """ """
2,218
def _er(self,title,connection_id,arguments,template, 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...
def _er(self,title,connection_id,arguments,template, SUBMIT,sql_pref__cols,sql_pref__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...
2,219
def _er(self,title,connection_id,arguments,template, 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...
def _er(self,title,connection_id,arguments,template, SUBMIT,dtpref_cols,dtpref_rows,REQUEST): dr,dc = self._size_changes[SUBMIT] rows=max(1,atoi(sql_pref__rows)+dr) cols=max(40,atoi(sql_pref__cols)+dc) e='Friday, 31-Dec-99 23:59:59 GMT' resp=REQUEST['RESPONSE'] resp.setCookie('dtpref_rows',str(rows),path='/',expires=e...
2,220
def _er(self,title,connection_id,arguments,template, 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...
def _er(self,title,connection_id,arguments,template, 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('sql_pref__rows',str(rows),path='/',expires=e) r...
2,221
def _er(self,title,connection_id,arguments,template, 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...
def _er(self,title,connection_id,arguments,template, 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...
2,222
def manage_edit(self,title,connection_id,arguments,template, SUBMIT='Change',dtpref_cols='50', dtpref_rows='20', REQUEST=None):
def manage_edit(self,title,connection_id,arguments,template, SUBMIT='Change',sql_pref__cols='50', sql_pref__rows='20', REQUEST=None):
2,223
def manage_edit(self,title,connection_id,arguments,template, SUBMIT='Change',dtpref_cols='50', dtpref_rows='20', REQUEST=None):
def manage_edit(self,title,connection_id,arguments,template, SUBMIT='Change',dtpref_cols='50', dtpref_rows='20', REQUEST=None):
2,224
def manage_catalogObject(self, REQUEST, urls=None, blah=None): """ index all Zope objects that 'urls' point to """ if urls: for url in urls: try: # if an error happens here, the catalog will be in # an unstable state. If this happens, ignore the # object. obj = self.resolve_url(url, REQUEST) except: continue self.cat...
def manage_catalogObject(self, REQUEST, urls=None, blah=None): """ index all Zope objects that 'urls' point to """ if urls: for url in urls: try: # if an error happens here, the catalog will be in # an unstable state. If this happens, ignore the # object. obj = REQUEST.resolve_url(url, REQUEST) except: continue self....
2,225
def manage_uncatalogObject(self, REQUEST, urls=None): """ removes Zope object 'urls' from catalog """
def manage_uncatalogObject(self, REQUEST, urls=None): """ removes Zope object 'urls' from catalog """
2,226
def manage_catalogReindex(self, REQUEST): """ iterate over the whole catalog, deleting inexistent references and refreshing objects""" items = tuple(self._catalog.uids.items())
def manage_catalogReindex(self, REQUEST): """ iterate over the whole catalog, deleting inexistent references and refreshing objects""" items = tuple(self._catalog.uids.items())
2,227
def manage_catalogReindex(self, REQUEST): """ iterate over the whole catalog, deleting inexistent references and refreshing objects""" items = tuple(self._catalog.uids.items())
def manage_catalogReindex(self, REQUEST): """ iterate over the whole catalog, deleting inexistent references and refreshing objects""" items = tuple(self._catalog.uids.items())
2,228
def manage_catalogReindex(self, REQUEST): """ iterate over the whole catalog, deleting inexistent references and refreshing objects""" items = tuple(self._catalog.uids.items())
def manage_catalogReindex(self, REQUEST): """ iterate over the whole catalog, deleting inexistent references and refreshing objects""" items = tuple(self._catalog.uids.items())
2,229
def manage_catalogFoundItems(self, REQUEST, obj_metatypes=None, obj_ids=None, obj_searchterm=None, obj_expr=None, obj_mtime=None, obj_mspec=None, obj_roles=None, obj_permission=None): """ Find object according to search criteria and Catalog them """ results = self.ZopeFind(REQUEST.PARENTS[1], obj_metatypes=obj_metatyp...
def manage_catalogFoundItems(self, REQUEST, obj_metatypes=None, obj_ids=None, obj_searchterm=None, obj_expr=None, obj_mtime=None, obj_mspec=None, obj_roles=None, obj_permission=None): """ Find object according to search criteria and Catalog them """ results = self.ZopeFind(REQUEST.PARENTS[1], obj_metatypes=obj_metatyp...
2,230
def getobject(self, rid, REQUEST=None): """ Return a cataloged object given a 'data_record_id_' """ if REQUEST is None: REQUEST=self.REQUEST url='%s/%s' %(REQUEST.script, self.getpath(rid)) return REQUEST.clone().resolve_url(url)
def getobject(self, rid, REQUEST=None): """ Return a cataloged object given a 'data_record_id_' """ if REQUEST is None: REQUEST=self.REQUEST url='%s/%s' %(REQUEST.script, self.getpath(rid)) return REQUEST.clone().resolve_url(url)
2,231
def resolve_url(self, path, REQUEST): # Attempt to resolve a url into an object in the Zope # namespace. The url must be a fully-qualified url. The # method will return the requested object if it is found # or raise the same HTTP error that would be raised in # the case of a real web request. If the passed in url # doe...
def resolve_url(self, path, REQUEST): # Attempt to resolve a url into an object in the Zope # namespace. The url must be a fully-qualified url. The # method will return the requested object if it is found # or raise the same HTTP error that would be raised in # the case of a real web request. If the passed in url # doe...
2,232
def logmsg(self, event): # log a service event using servicemanager.LogMsg from servicemanager import LogMsg LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, event, (self._svc_name_, " (%s)" % self._svc_display_name_))
def logmsg(self, event): # log a service event using servicemanager.LogMsg from servicemanager import LogMsg, EVENTLOG_INFORMATION_TYPE LogMsg(EVENTLOG_INFORMATION_TYPE, event, (self._svc_name_, " (%s)" % self._svc_display_name_))
2,233
def main(): import getopt from string import split user=None try: optlist, args = getopt.getopt(sys.argv[1:],'u:') url=args[0] u =filter(lambda o: o[0]=='-u', optlist) if u: [user, pw] = split(u[0][1],':') kw={} for arg in args[1:]: [name,v]=split(arg) kw[name]=v except: print """ Usage: %s [-u username:password] u...
def main(): import getopt from string import split user=None try: optlist, args = getopt.getopt(sys.argv[1:],'u:') url=args[0] u =filter(lambda o: o[0]=='-u', optlist) if u: [user, pw] = split(u[0][1],':') kw={} for arg in args[1:]: [name,v]=split(arg) kw[name]=v except: print """ % sys.argv[0] Usage: %s [-u userna...
2,234
def orify(seq, query_map={ type(regex.compile('')): Query.Regex, type(''): Query.String, }): subqueries=[] for q in seq: try: q=query_map[type(q)](q) except: q=Query.Cmp(q) subqueries.append(q) return apply(Query.Or,tuple(subqueries))
def orify(seq, query_map={ type(regex.compile('')): Query.Regex, type(''): Query.String, }): subqueries=[] for q in seq: try: q=query_map[type(q)](q) except: q=Query.Cmp(q) subqueries.append(q) return apply(Query.Or,tuple(subqueries))
2,235
def __init__(self, brains=None):
def __init__(self, brains=None):
2,236
def __init__(self, brains=None):
def __init__(self, brains=None):
2,237
def uncatalogObject(self, uid): """ Uncatalog and object from the Catalog. and 'uid' is a unique Catalog identifier
def uncatalogObject(self, uid): """ Uncatalog and object from the Catalog. and 'uid' is a unique Catalog identifier
2,238
def _indexedSearch(self, args, sort_index, append, used, IIBType=type(IIBucket()), intSType=type(intSet())): """ Iterate through the indexes, applying the query to each one. Do some magic to join result sets. Be intelligent about handling intSets and IIBuckets. """
def _indexedSearch(self, args, sort_index, append, used, IIBType=type(IIBucket()), intSType=type(intSet())): """ Iterate through the indexes, applying the query to each one. Do some magic to join result sets. Be intelligent about handling intSets and IIBuckets. """
2,239
def __init__(self,id,title=None): self.id=id self.title=title self._ztable=ZTablesCore.ZTable(id)
def __init__(self,id,title=None): self.id=id self.title=title self._ztable=ZTablesCore.ZTable(id)
2,240
def __init__(self,id,title=None): self.id=id self.title=title self._ztable=ZTablesCore.ZTable(id)
def __init__(self,id,title=None): self.id=id self.title=title self._ztable=ZTablesCore.ZTable(id)
2,241
def register_loop_callback(callback, args=(), kw=None): _loop_lock.acquire() try: if _looping: apply(callback, (map,)+args, kw or {}) else: _loop_callbacks.append((callback, args, kw)) finally: _loop_lock.release()
def register_loop_callback(callback, args=(), kw=None): _loop_lock.acquire() try: if _looping is not None: apply(callback, (_looping,) + args, kw or {}) else: _loop_callbacks.append((callback, args, kw)) finally: _loop_lock.release()
2,242
def _start_loop(map): _loop_lock.acquire() try: global _looping _looping=1 while _loop_callbacks: cb, args, kw = _loop_callbacks.pop() apply(cb, (map,)+args, kw or {}) finally: _loop_lock.release()
def _start_loop(map): _loop_lock.acquire() try: global _looping _looping = map while _loop_callbacks: cb, args, kw = _loop_callbacks.pop() apply(cb, (map,)+args, kw or {}) finally: _loop_lock.release()
2,243
def _start_loop(map): _loop_lock.acquire() try: global _looping _looping=1 while _loop_callbacks: cb, args, kw = _loop_callbacks.pop() apply(cb, (map,)+args, kw or {}) finally: _loop_lock.release()
def _start_loop(map): _loop_lock.acquire() try: global _looping _looping=1 while _loop_callbacks: cb, args, kw = _loop_callbacks.pop() apply(cb, (map,) + args, kw or {}) finally: _loop_lock.release()
2,244
def _stop_loop(): _loop_lock.acquire() try: global _looping _looping=0 finally: _loop_lock.release()
def _stop_loop(): _loop_lock.acquire() try: global _looping _looping = None finally: _loop_lock.release()
2,245
def loop (timeout=30.0, use_poll=0, map=None): if use_poll: poll_fun = asyncore.poll2 else: poll_fun = asyncore.poll if map is None: map=asyncore.socket_map _start_loop(map) while map: poll_fun (timeout, map) _stop_loop()
def loop (timeout=30.0, use_poll=0, map=None): This function functions like the regular asyncore.loop() function except that it also triggers ThreadedAsync callback functions before starting the loop. """ if use_poll: if hasattr(select, 'poll'): poll_fun = asyncore.poll3 else: poll_fun = asyncore.poll2 else: poll_fun ...
2,246
def loop (timeout=30.0, use_poll=0, map=None): if use_poll: poll_fun = asyncore.poll2 else: poll_fun = asyncore.poll if map is None: map=asyncore.socket_map _start_loop(map) while map: poll_fun (timeout, map) _stop_loop()
def loop (timeout=30.0, use_poll=0, map=None): if use_poll: poll_fun = asyncore.poll2 else: poll_fun = asyncore.poll if map is None: map = asyncore.socket_map _start_loop(map) while map: poll_fun (timeout, map) _stop_loop()
2,247
def loop (timeout=30.0, use_poll=0, map=None): if use_poll: poll_fun = asyncore.poll2 else: poll_fun = asyncore.poll if map is None: map=asyncore.socket_map _start_loop(map) while map: poll_fun (timeout, map) _stop_loop()
def loop (timeout=30.0, use_poll=0, map=None): if use_poll: poll_fun = asyncore.poll2 else: poll_fun = asyncore.poll if map is None: map=asyncore.socket_map _start_loop(map) while map: poll_fun(timeout, map) _stop_loop()
2,248
def exception(self, fatal=0, info=None, absuri_match=re.compile(r'\w+://[\w\.]+').match, tag_search=re.compile('[a-zA-Z]>').search, abort=1 ): if type(info) is type(()) and len(info)==3: t, v, tb = info else: t, v, tb = sys.exc_info()
def exception(self, fatal=0, info=None, absuri_match=re.compile(r'\w+://[\w\.]+').match, tag_search=re.compile('[a-zA-Z]>').search, abort=1 ): if type(info) is type(()) and len(info)==3: t, v, tb = info else: t, v, tb = sys.exc_info()
2,249
def setUp(self): self.open() StorageTestBase.StorageTestBase.setUp(self)
def setUp(self): self.open() StorageTestBase.StorageTestBase.setUp(self)
2,250
def validate(self, accessed, container, name, value, context, roles=_noroles, getattr=getattr, _noroles=_noroles, valid_aq_=('aq_parent','aq_inner', 'aq_explicit')):
def validate(self, accessed, container, name, value, context, roles=_noroles, getattr=getattr, _noroles=_noroles, valid_aq_=('aq_parent','aq_inner', 'aq_explicit')):
2,251
def validate(self, accessed, container, name, value, context, roles=_noroles, getattr=getattr, _noroles=_noroles, valid_aq_=('aq_parent','aq_inner', 'aq_explicit')):
def validate(self, accessed, container, name, value, context, roles=_noroles, getattr=getattr, _noroles=_noroles, valid_aq_=('aq_parent','aq_inner', 'aq_explicit')):
2,252
def validate(self, accessed, container, name, value, context, roles=_noroles, getattr=getattr, _noroles=_noroles, valid_aq_=('aq_parent','aq_inner', 'aq_explicit')):
def validate(self, accessed, container, name, value, context, roles=_noroles, getattr=getattr, _noroles=_noroles, valid_aq_=('aq_parent','aq_inner', 'aq_explicit')):
2,253
def validate(self, accessed, container, name, value, context, roles=_noroles, getattr=getattr, _noroles=_noroles, valid_aq_=('aq_parent','aq_inner', 'aq_explicit')):
def validate(self, accessed, container, name, value, context, roles=_noroles, getattr=getattr, _noroles=_noroles, valid_aq_=('aq_parent','aq_inner', 'aq_explicit')):
2,254
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() self.interesting = interesting_normal else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': i...
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): # < ...
2,255
def index(self, src, srckey): '''\ index(src, srckey)
def index(self, src, srckey): '''\ index(src, srckey)
2,256
def raise_standardErrorMessage( self, client=None, REQUEST={}, error_type=None, error_value=None, tb=None, error_tb=None, error_message='', tagSearch=regex.compile('[a-zA-Z]>').search):
def raise_standardErrorMessage( self, client=None, REQUEST={}, error_type=None, error_value=None, tb=None, error_tb=None, error_message='', tagSearch=regex.compile('[a-zA-Z]>').search):
2,257
def raise_standardErrorMessage( self, client=None, REQUEST={}, error_type=None, error_value=None, tb=None, error_tb=None, error_message='', tagSearch=regex.compile('[a-zA-Z]>').search):
def raise_standardErrorMessage( self, client=None, REQUEST={}, error_type=None, error_value=None, tb=None, error_tb=None, error_message='', tagSearch=regex.compile('[a-zA-Z]>').search):
2,258
def _setId(self, id): if id != self.id: raise Globals.MessageDialog( title='Invalid Id', message='Cannot change the id of a %s' % self.meta_type, action ='./manage_main',)
def _setId(self, id): if id != self.id: raise MessageDialog( title='Invalid Id', message='Cannot change the id of a %s' % self.meta_type, action ='./manage_main',)
2,259
def rolejoin(roles, other): dict={} for role in roles: dict[role]=1 for role in other: dict[role]=1 roles=dict.keys() roles.sort() return roles
def rolejoin(roles, other): dict={} for role in roles: dict[role]=1 for role in other: dict[role]=1 roles=dict.keys() roles.sort() return roles
2,260
def marshal_tuple(n,l): return join(map(lambda v, n=n: "%s:tuple=%s" % (n,quote(v)),l),'&')
def marshal_tuple(n,l): return join(map(lambda v, n=n: "%s:tuple=%s" % (n,quote(v)),l),'&')
2,261
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
2,262
def testConstructor3(self): '''Constructor from date/time string''' dt = DateTime() dt1 = DateTime('%d/%d/%d %d:%d:%f %s' % ( dt.year(), dt.month(), dt.day(), dt.hour(), dt.minute(), dt.second(), dt.timezone())) assert dt.debugCompare(dt1), (dt, dt1)
def testConstructor3(self): '''Constructor from date/time string''' dt = DateTime() dt1s = '%d/%d/%d %d:%d:%f %s' % ( dt.year(), dt.month(), dt.day(), dt.hour(), dt.minute(), dt.second(), dt.timezone())) assert dt.debugCompare(dt1), (dt, dt1)
2,263
def testConstructor3(self): '''Constructor from date/time string''' dt = DateTime() dt1 = DateTime('%d/%d/%d %d:%d:%f %s' % ( dt.year(), dt.month(), dt.day(), dt.hour(), dt.minute(), dt.second(), dt.timezone())) assert dt.debugCompare(dt1), (dt, dt1)
def testConstructor3(self): '''Constructor from date/time string''' dt = DateTime() dt1 = DateTime('%d/%d/%d %d:%d:%f %s' % ( dt.year(), dt.month(), dt.day(), dt.hour(), dt.minute(), dt.second(), dt.timezone())) assert dt.debugCompare(dt1), (dt, dt1)
2,264
def testConstructor6(self): '''Constructor from year and julian date''' dt = DateTime('1980/1/5 12:00:00.050 pm') dt1 = DateTime(1980, 5.500000578705) assert dt.debugCompare(dt1), (dt, dt1)
def testConstructor6(self): '''Constructor from year and julian date''' dt = DateTime('1980/1/5 12:00:00.050 pm') dt1 = DateTime(1980, 5.500000578705) assert dt.debugCompare(dt1), (dt, dt1)
2,265
def testY10KDate(self): '''Comparison of a Y10K date and a Y2K date''' dt = DateTime('10213/09/21') dt1 = DateTime(2000, 1, 1) assert dt - dt1 == 3000000.0, (dt, dt1)
def testY10KDate(self): '''Comparison of a Y10K date and a Y2K date''' dt = DateTime('10213/09/21') dt1 = DateTime(2000, 1, 1) assert dt - dt1 == 3000000.0, (dt, dt1)
2,266
def _isNotBeingUsedAsAMethod(self): return not aq_get(self, '_isBeingUsedAsAMethod_', 0)
def _isNotBeingUsedAsAMethod(self): return not aq_get(self, '_isBeingUsedAsAMethod_', 0)
2,267
def manage_getPermissionMapping(self): """Return the permission mapping for the object
def manage_getPermissionMapping(self): """Return the permission mapping for the object
2,268
def manage_setPermissionMapping(self, permission_names=[], class_permissions=[], REQUEST=None): """Change the permission mapping """ wrapper=getattr(self, '_permissionMapper', None) if wrapper is None: wrapper=PM()
def manage_setPermissionMapping(self, permission_names=[], class_permissions=[], REQUEST=None): """Change the permission mapping """ wrapper=getattr(self, '_permissionMapper', None) if wrapper is None: wrapper=PM()
2,269
def _isBeingAccessedAsZClassDefinedInstanceMethod(self): p=getattr(self,'aq_parent',None) if p is None: return 0 # Not wrapped base=getattr(p, 'aq_base', None) return type(base) is PermissionMapper
def_isBeingAccessedAsZClassDefinedInstanceMethod(self):p=getattr(self,'aq_parent',None)ifpisNone:return0#Notwrappedbase=getattr(p,'aq_base',None)returntype(base)isPermissionMapper
2,270
def registerClass(self, instance_class=None, meta_type='', permission=None, constructors=(), icon=None, permissions=None, legacy=(), ): """Register a constructor
def registerClass(self, instance_class=None, meta_type='', permission=None, constructors=(), icon=None, permissions=None, legacy=(), ): """Register a constructor
2,271
def close(self): if self._root_connection is not None: raise RuntimeError("Should not close mounted connections directly") conns = self._mounted_connections if conns: for conn in conns.values(): # Notify the activity monitor db = conn.db() f = getattr(db, 'getActivityMonitor', None) if f is not None: am = f() if am is ...
def close(self): if self._root_connection is not None: raise RuntimeError("Should not close mounted connections directly") conns = self._mounted_connections if conns: for conn in conns.values(): # Notify the activity monitor db = conn.db() f = getattr(db, 'getActivityMonitor', None) if f is not None: am = f() if am is ...
2,272
def __init__(self, stdin, environ, response, clean=0): # Avoid the overhead of scrubbing the environment in the # case of request cloning for traversal purposes. If the # clean flag is set, we know we can use the passed in # environ dict directly. if not clean: environ=sane_environment(environ) if environ.get('REQUEST...
def__init__(self,stdin,environ,response,clean=0):#Avoidtheoverheadofscrubbingtheenvironmentinthe#caseofrequestcloningfortraversalpurposes.Ifthe#cleanflagisset,weknowwecanusethepassedin#environdictdirectly.ifnotclean:environ=sane_environment(environ)ifenviron.get('REQUEST_METHOD','GET')!='GET':fp=stdinelse:fp=None
2,273
def __init__(self,*args): """Return a new date-time object
def __init__(self,*args): """Return a new date-time object
2,274
def include(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """Include a reST file as part of the content of this reST file.""" import pdb pdb.set_trace() print '1' if not state.document.settings.file_insertion_enabled: warning = state_machine.reporter.warning( '"%s" direc...
def include(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """Include a reST file as part of the content of this reST file.""" if not state.document.settings.file_insertion_enabled: warning = state_machine.reporter.warning( '"%s" directive disabled.' % name, nodes.literal_...
2,275
def PROPFIND(self, REQUEST, RESPONSE): """Retrieve properties defined on the resource.""" self.dav__init(REQUEST, RESPONSE) cmd=davcmds.PropFind(REQUEST) result=cmd.apply(self) RESPONSE.setStatus(207) RESPONSE.setHeader('Content-Type', 'text/xml; charset="utf-8"') RESPONSE.setBody(result) return RESPONSE # work around ...
def PROPFIND(self, REQUEST, RESPONSE): """Retrieve properties defined on the resource.""" self.dav__init(REQUEST, RESPONSE) cmd=davcmds.PropFind(REQUEST) result=cmd.apply(self) # work around MSIE DAV bug for creation and modified date if (REQUEST.get_header('User-Agent') == 'Microsoft Data Access Internet Publishing Pr...
2,276
def _doChangeUser(self, name, password, roles, domains, **kw): user=self.data[name] if password is not None: if self.encrypt_passwords and not self._isPasswordEncrypted(pw): password = self._encryptPassword(password) user.__=password user.roles=roles user.domains=domains
def _doChangeUser(self, name, password, roles, domains, **kw): user=self.data[name] if password is not None: if self.encrypt_passwords and not self._isPasswordEncrypted(password): password = self._encryptPassword(password) user.__=password user.roles=roles user.domains=domains
2,277
def get_catalog(self): return self.catalog
def get_catalog(self): return self.catalog
2,278
def setUp(self): self.index=SearchIndex.UnTextIndex.UnTextIndex('text') self.doc=Dummy(text='this is the time, when all good zopes') catch_log_errors()
def setUp(self): self.index=SearchIndex.UnTextIndex.UnTextIndex('text') self.doc=Dummy(text='this is the time, when all good zopes') catch_log_errors()
2,279
def tearDown(self): ignore_log_errors() get_transaction().abort() if hasattr(self, 'jar'): self.dbclose() cleanDB() self.__dict__.clear()
def tearDown(self): get_transaction().abort() if hasattr(self, 'jar'): self.dbclose() cleanDB() self.__dict__.clear()
2,280
def __call__(self, REQUEST=None, __ick__=None, src__=0, test__=0, **kw): """Call the database method
def __call__(self, REQUEST=None, __ick__=None, src__=0, test__=0, **kw): """Call the database method
2,281
def _docommit(self, txn, tid): self._pending.put(self._serial, COMMIT, txn) deltas = {} co = cs = None try: co = self._oids.cursor(txn=txn) cs = self._serials.cursor(txn=txn) rec = co.first() while rec: oid = rec[0] rec = co.next() # Remove from the serials table all entries with key oid where # the serial is not tid. ...
def _docommit(self, txn, tid): self._pending.put(self._serial, COMMIT, txn) deltas = {} co = cs = None try: co = self._oids.cursor(txn=txn) cs = self._serials.cursor(txn=txn) rec = co.first() while rec: oid = rec[0] rec = co.next() # Remove from the serials table all entries with key oid where # the serial is not tid. ...
2,282
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile('\(:[a-zA-Z][a-zA-Z0-9_]+\|\.[xy]\)$').search, rfind=string.rfind, ):...
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=re.compile('(:[a-zA-Z][a-zA-Z0-9_]+|\\.[xy])$').search, rfind=string.rfind, ): """P...
2,283
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile('\(:[a-zA-Z][a-zA-Z0-9_]+\|\.[xy]\)$').search, rfind=string.rfind, ):...
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile('\(:[a-zA-Z][a-zA-Z0-9_]+\|\.[xy]\)$').search, rfind=string.rfind, ):...
2,284
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile('\(:[a-zA-Z][a-zA-Z0-9_]+\|\.[xy]\)$').search, rfind=string.rfind, ):...
def processInputs( self, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile('\(:[a-zA-Z][a-zA-Z0-9_]+\|\.[xy]\)$').search, rfind=string.rfind, ):...
2,285
def parse_cookie(text, result=None, qparmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)="\([^"]*\)\"' '\([\0- ]*[;,]\)?[\0- ]*\)' ), parmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)=\([^\0- ;,\"]*\)' '\([\0- ]*[;,]\)?[\0- ]*\)' ), acquire=parse_cookie_lock.acquire, release=parse_cookie_lock.release, ): if result...
def parse_cookie(text, result=None, qparmre=re.compile( '([\x00- ]*([^\x00- ;,="]+)="([^"]*)"([\x00- ]*[;,])?[\x00- ]*)'), parmre=re.compile( '([\x00- ]*([^\x00- ;,="]+)=([^\x00- ;,"]*)([\x00- ]*[;,])?[\x00- ]*)'), acquire=parse_cookie_lock.acquire, release=parse_cookie_lock.release, ): if result is None: result={} a...
2,286
def parse_cookie(text, result=None, qparmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)="\([^"]*\)\"' '\([\0- ]*[;,]\)?[\0- ]*\)' ), parmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)=\([^\0- ;,\"]*\)' '\([\0- ]*[;,]\)?[\0- ]*\)' ), acquire=parse_cookie_lock.acquire, release=parse_cookie_lock.release, ): if result...
def parse_cookie(text, result=None, qparmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)="\([^"]*\)\"' '\([\0- ]*[;,]\)?[\0- ]*\)' ), parmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)=\([^\0- ;,\"]*\)' '\([\0- ]*[;,]\)?[\0- ]*\)' ), acquire=parse_cookie_lock.acquire, release=parse_cookie_lock.release, ): if result...
2,287
def parse_cookie(text, result=None, qparmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)="\([^"]*\)\"' '\([\0- ]*[;,]\)?[\0- ]*\)' ), parmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)=\([^\0- ;,\"]*\)' '\([\0- ]*[;,]\)?[\0- ]*\)' ), acquire=parse_cookie_lock.acquire, release=parse_cookie_lock.release, ): if result...
def parse_cookie(text, result=None, qparmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)="\([^"]*\)\"' '\([\0- ]*[;,]\)?[\0- ]*\)' ), parmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)=\([^\0- ;,\"]*\)' '\([\0- ]*[;,]\)?[\0- ]*\)' ), acquire=parse_cookie_lock.acquire, release=parse_cookie_lock.release, ): if result...
2,288
def parse_cookie(text, result=None, qparmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)="\([^"]*\)\"' '\([\0- ]*[;,]\)?[\0- ]*\)' ), parmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)=\([^\0- ;,\"]*\)' '\([\0- ]*[;,]\)?[\0- ]*\)' ), acquire=parse_cookie_lock.acquire, release=parse_cookie_lock.release, ): if result...
def parse_cookie(text, result=None, qparmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)="\([^"]*\)\"' '\([\0- ]*[;,]\)?[\0- ]*\)' ), parmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)=\([^\0- ;,\"]*\)' '\([\0- ]*[;,]\)?[\0- ]*\)' ), acquire=parse_cookie_lock.acquire, release=parse_cookie_lock.release, ): if result...
2,289
def sendTemplate(trueself, self, messageTemplate, statusTemplate=None, mto=None, mfrom=None, REQUEST): 'render a mail template, then send it...' mtemplate = getattr(self, messageTemplate) messageText = mtemplate(self, trueself.REQUEST)
def sendTemplate(trueself, self, messageTemplate, statusTemplate=None, mto=None, mfrom=None, REQUEST=None): 'render a mail template, then send it...' mtemplate = getattr(self, messageTemplate) messageText = mtemplate(self, trueself.REQUEST)
2,290
def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' \ 'To use localization options, you must ensure\n' \ 'that the locale module is compiled into your\n' \ 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The spe...
def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' \ 'To use localization options, you must ensure\n' \ 'that the locale module is compiled into your\n' \ 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The spe...
2,291
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
2,292
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
2,293
def main(): # The "main" program for this module pass
def main(): # The "main" program for this module pass
2,294
def main(): # The "main" program for this module pass
def main(): # The "main" program for this module pass
2,295
def str_field(v): if type(v) is types.ListType: return map(str_field,v) if type(v) is types.InstanceType and v.__class__ is newcgi.MiniFieldStorage: v=v.value elif type(v) is not types.StringType: try: if v.file: v=v.file else: v=v.value except: pass return v
def str_field(v): if type(v) is types.ListType: return map(str_field,v) if type(v) is types.InstanceType and v.__class__ is FieldStorage: v=v.value elif type(v) is not types.StringType: try: if v.file: v=v.file else: v=v.value except: pass return v
2,296
def __init__(self,
def __init__(self,
2,297
def __init__(self,body='',status=200,headers=None,
def __init__(self,body='',status=200,headers=None,
2,298
def exception(self):
def exception(self):
2,299