bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def decapitate(html, RESPONSE=None, header_re=regex.compile( '\(\(' '[^\n\0\- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0\- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), space_re=regex.compile('\([ \t]+\)'), name_re=regex.compile('\([^\0\- <>:]+\):\([^\n]*\)'), ): if header_re.match(html) < 0: return html headers, html = header_re....
def decapitate(html, RESPONSE=None, header_re=regex.compile( '\(\(' '[^\n\0\- <>:]+:[^\n]*\n' '\|' '[ \t]+[^\0\- ][^\n]*\n' '\)+\)[ \t]*\n\([\0-\377]+\)' ), space_re=regex.compile('\([ \t]+\)'), name_re=regex.compile('\([^\0\- <>:]+\):\([^\n]*\)'), ): if header_re.match(html) < 0: return html headers, html = header_re....
2,000
def __init__(self, index_dictionary = None, synstop = None): 'Create an inverted index' if (synstop is None): synstop = {} for key, value in default_stop_words: synstop[key] = value self.synstop = synstop
def __init__(self, index_dictionary = None, synstop = None): 'Create an inverted index' if (synstop is None): synstop = {} for key, value in default_stop_words.items(): synstop[key] = value self.synstop = synstop
2,001
def appendCookie(self, name, value):
def appendCookie(self, name, value):
2,002
def expireCookie(self, name):
def expireCookie(self, name):
2,003
def setCookie(self,name, value=None,
def setCookie(self,name, value=None,
2,004
def _cookie_list(self):
def _cookie_list(self):
2,005
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_...
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_...
2,006
def _read_and_report(file, rpt=None, fromEnd=0, both=0, n=99999999, show=0): """\ Read a file's index up to the given time. """ first=1 seek=file.seek read=file.read unpack=struct.unpack split=string.split join=string.join find=string.find seek(0,2) file_size=file.tell() gmtime=time.gmtime if fromEnd: pos=file_size el...
def _read_and_report(file, rpt=None, fromEnd=0, both=0, n=99999999, show=0): """\ Read a file's index up to the given time. """ first=1 seek=file.seek read=file.read unpack=struct.unpack split=string.split join=string.join find=string.find seek(0,2) file_size=file.tell() gmtime=time.gmtime if fromEnd: pos=file_size el...
2,007
def xmls(pos, oid, start, tname, user, t, p, first, newtrans): write=sys.stdout.write if first: write('<?xml version="1.0">\n<transactions>\n') if pos is None: write('</transaction>\n') write('</transactioons>\n') return if newtrans: if pos > 9: write('</transaction>\n') write('<transaction name="%s" user="%s">\n%s\n...
def xmls(pos, oid, start, tname, user, t, p, first, newtrans): write=sys.stdout.write if first: write('<?xml version="1.0">\n<transactions>\n') if pos is None: write('</transaction>\n') write('</transactioons>\n') return if newtrans: if pos > 9: write('</transaction>\n') write('<transaction name="%s" user="%s">\n%s\n...
2,008
def xmls(pos, oid, start, tname, user, t, p, first, newtrans): write=sys.stdout.write if first: write('<?xml version="1.0">\n<transactions>\n') if pos is None: write('</transaction>\n') write('</transactioons>\n') return if newtrans: if pos > 9: write('</transaction>\n') write('<transaction name="%s" user="%s">\n%s\n...
def xmls(pos, oid, start, tname, user, t, p, first, newtrans): write=sys.stdout.write if first: write('<?xml version="1.0">\n<transactions>\n') if pos is None: write('</transaction>\n') write('</transactioons>\n') return if newtrans: if pos > 9: write('</transaction>\n') write('<transaction name="%s" user="%s">\n%s\n...
2,009
def doc_underline(self, s, expr=re.compile("_([%s0-9\s\.,\?\/]+)_" % letters).search):
def doc_underline(self, s, expr=re.compile("_([%s0-9\s\.,\?\/]+)_" % letters).search):
2,010
def doc_underline(self, s, expr=re.compile("_([%s0-9\s\.,\?\/]+)_" % letters).search):
def doc_underline(self, s, expr=re.compile("_([%s0-9\s\.,\?\/]+)_" % letters).search):
2,011
def doc_strong(self, s, expr = re.compile(r'\s*\*\*([ \n%s0-9]+)\*\*' % lettpunc).search ):
def doc_strong(self, s, expr = re.compile(r'\s*\*\*([ \n%s0-9]+)\*\*' % lettpunc).search ):
2,012
def finish_starttag(self, tag, attrs): self.scan_xmlns(attrs) if tag in EMPTY_HTML_TAGS: self.pop_xmlns() elif BLOCK_CLOSING_TAG_MAP.has_key(tag): blocks_to_close = BLOCK_CLOSING_TAG_MAP[tag] close_to = -1 for i in range(len(self.tagstack)): t = self.tagstack[i] if t in blocks_to_close: close_to = i elif t in BLOCK_LEV...
def finish_starttag(self, tag, attrs): self.scan_xmlns(attrs) if tag in EMPTY_HTML_TAGS: self.pop_xmlns() elif BLOCK_CLOSING_TAG_MAP.has_key(tag): blocks_to_close = BLOCK_CLOSING_TAG_MAP[tag] close_to = -1 for i in range(len(self.tagstack)): t = self.tagstack[i] if t in blocks_to_close: close_to = i elif t in BLOCK_LEV...
2,013
def manage_edit(self, title, module, function, REQUEST=None):
def manage_edit(self, title, module, function, REQUEST=None):
2,014
def getFunction(self):
def getFunction(self):
2,015
def getFunction(self):
def getFunction(self):
2,016
def __cmp__(self,other):
def __cmp__(self,other):
2,017
def __init__(self, blocks): tname, args, section = blocks[0]
def __init__(self, blocks): tname, args, section = blocks[0]
2,018
def render(self, md): # first we try to render the first block try: return render_blocks(self.section, md) except DTReturn: raise except: # but an error occurs.. save the info. t,v = sys.exc_info()[:2] if type(t)==type(''): errname = t else: errname = t.__name__
def render(self, md): # first we try to render the first block try: result = render_blocks(self.section, md) except DTReturn: raise except: # but an error occurs.. save the info. t,v = sys.exc_info()[:2] if type(t)==type(''): errname = t else: errname = t.__name__
2,019
def render(self, md): # first we try to render the first block try: return render_blocks(self.section, md) except DTReturn: raise except: # but an error occurs.. save the info. t,v = sys.exc_info()[:2] if type(t)==type(''): errname = t else: errname = t.__name__
def else: if (self.elseBlock is None): return result else: return result + render_blocks(self.elseBlock, md) def render_try_finally(self, md): result = '' try: result = render_blocks(self.section, md) finally: result = result + render_blocks(self.finallyBlock, md) return result render(self, else: if (self.elseBlo...
2,020
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_]+$').search, rfind=string.rfind, ): """Process ...
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_]+$').search, rfind=string.rfind, ): """Process ...
2,021
def __getitem__(self,index):
def __getitem__(self,index):
2,022
def __getitem__(self,index):
def __getitem__(self,index):
2,023
def manage_importObject(self, file, REQUEST=None): """Import an object from a file""" dirname, file=os.path.split(file) if dirname: raise 'Bad Request', 'Invalid file name %s' % file file=os.path.join(INSTANCE_HOME, 'import', file) if not os.path.exists(file): raise 'Bad Request', 'File does not exist: %s' % file ob=se...
def manage_importObject(self, file, REQUEST=None): """Import an object from a file""" dirname, file=os.path.split(file) if dirname: raise 'Bad Request', 'Invalid file name %s' % file file=os.path.join(INSTANCE_HOME, 'import', file) if not os.path.exists(file): raise 'Bad Request', 'File does not exist: %s' % file conn...
2,024
def parse2(q, default_operator, operator_dict = {AndNot: AndNot, And: And, Or: Or, Near: Near}, ListType=type([]), ): '''Find operators and operands''' i = 0 isop=operator_dict.has_key while (i < len(q)): if (type(q[i]) is ListType): q[i] = parse2(q[i], default_operator) # every other item, starting with the first, sh...
def parse2(q, default_operator, operator_dict = {AndNot: AndNot, And: And, Or: Or, Near: Near}, ListType=type([]), ): '''Find operators and operands''' i = 0 isop=operator_dict.has_key while (i < len(q)): if (type(q[i]) is ListType): q[i] = parse2(q[i], default_operator) # every other item, starting with the first, sh...
2,025
def __bobo_traverse__(self, REQUEST, name=None):
def __bobo_traverse__(self, REQUEST, name=None):
2,026
def clear(self):
def clear(self):
2,027
def __call__(self, *args, **kw): """Call an ExternalMethod
def __call__(self, *args, **kw): """Call an ExternalMethod
2,028
def _delDB(): transaction.abort() del stuff['db']
def _delDB(): transaction.abort() del stuff['db']
2,029
def testSubcommit(self): sd = self.app.session_data_manager.getSessionData() sd.set('foo', 'bar') # TODO: this is used to test that transaction.commit(1) returned # None, but transaction.commit(whatever) always returns None (unless # there's an exception). What is this really trying to test? transaction.savepoint(opti...
def testSubcommit(self): sd = self.app.session_data_manager.getSessionData() sd.set('foo', 'bar') # TODO: this is used to test that transaction.commit(1) returned # None, but transaction.commit(whatever) always returns None (unless # there's an exception). What is this really trying to test? transaction.savepoint(opti...
2,030
def testAqWrappedObjectsFail(self): a = Foo() b = Foo() aq_wrapped = a.__of__(b) sd = self.app.session_data_manager.getSessionData() sd.set('foo', aq_wrapped) self.assertRaises(TypeError, transaction.commit)
def testAqWrappedObjectsFail(self): a = DummyAqImplicit() b = DummyAqImplicit() aq_wrapped = a.__of__(b) sd = self.app.session_data_manager.getSessionData() sd.set('foo', aq_wrapped) self.assertRaises(TypeError, transaction.commit)
2,031
def boboTraverseAwareSimpleTraverse(object, path_items, econtext): """A slightly modified version of zope.tales.expressions.simpleTraverse that interacts correctly with objects requiring.""" request = getattr(econtext, 'request', None) path_items = list(path_items) path_items.reverse() while path_items: name = path_it...
def boboTraverseAwareSimpleTraverse(object, path_items, econtext): """A slightly modified version of zope.tales.expressions.simpleTraverse that interacts correctly with objects providing OFS.interfaces.ITraversable. """ request = getattr(econtext, 'request', None) path_items = list(path_items) path_items.reverse() whi...
2,032
def do_adduser(self, arg): try: name, password = arg.split() except: print "usage: adduser <name> <password>" return cmdline = self.get_startup_cmd( self.options.python , 'import Zope2; app=Zope2.app();' 'app.acl_users._doAddUser(\'%s\', \'%s\', [\'Manager\'], []);' 'transaction.commit()' ) % (name, password) os.system...
def do_adduser(self, arg): try: name, password = arg.split() except: print "usage: adduser <name> <password>" return cmdline = self.get_startup_cmd( self.options.python , 'import Zope2; ' 'app = Zope2.app(); ' 'app.acl_users._doAddUser(\'%s\', \'%s\', [\'Manager\'], []); ' 'import transaction; ' 'transaction.commit(); ...
2,033
def get(self, pattern): """ Query the lexicon for words matching a pattern.""" wc_set = [self.multi_wc, self.single_wc]
def get(self, pattern): """ Query the lexicon for words matching a pattern.""" wc_set = [self.multi_wc, self.single_wc]
2,034
def _check_context(self, object): # Check that 'object' exists in the acquisition context of # the parent of the acl_users object containing this user, # to prevent "stealing" access through acquisition tricks. # Return true if in context, false if not or if context # cannot be determined (object is not wrapped). paren...
def _check_context(self, object): # Check that 'object' exists in the acquisition context of # the parent of the acl_users object containing this user, # to prevent "stealing" access through acquisition tricks. # Return true if in context, false if not or if context # cannot be determined (object is not wrapped). paren...
2,035
def searchResults(self, REQUEST=None, used=None, query_map={ type(regex.compile('')): Query.Regex, type([]): orify, type(''): Query.String, }, **kw):
def searchResults(self, REQUEST=None, used=None, query_map={ type(regex.compile('')): Query.Regex, type([]): orify, type(''): Query.String, }, **kw):
2,036
def and_not(self, x): result = {} dict = self._dict xdict = x._dict xhas = xdict.has_key for id, score in dict.items(): if not xhas(id): result[id] = xdict[id]+score return self.__class__(result, self._words, self._index)
def and_not(self, x): result = {} dict = self._dict xdict = x._dict xhas = xdict.has_key for id, score in dict.items(): if not xhas(id): result[id] = score return self.__class__(result, self._words, self._index)
2,037
def publish(self, module_name, after_list, published='web_objects',
def publish(self, module_name, after_list, published='web_objects',
2,038
def publish(self, module_name, after_list, published='web_objects',
def publish(self, module_name, after_list, published='web_objects',
2,039
def publish(self, module_name, after_list, published='web_objects',
def publish(self, module_name, after_list, published='web_objects',
2,040
def publish(self, module_name, after_list, published='web_objects',
def publish(self, module_name, after_list, published='web_objects',
2,041
def publish(self, module_name, after_list, published='web_objects',
def publish(self, module_name, after_list, published='web_objects',
2,042
def publish(self, module_name, after_list, published='web_objects',
def publish(self, module_name, after_list, published='web_objects',
2,043
def publish(self, module_name, after_list, published='web_objects',
def publish(self, module_name, after_list, published='web_objects',
2,044
def publish(self, module_name, after_list, published='web_objects',
def publish(self, module_name, after_list, published='web_objects',
2,045
def publish(self, module_name, after_list, published='web_objects',
def publish(self, module_name, after_list, published='web_objects',
2,046
def field2tuple(v): if type(v) is not ListType: v=(v,) return tuple(v)
def field2tuple(v): if type(v) is not ListType: v=(v,) return tuple(v)
2,047
def str(self,name): dict=getattr(self,name) return "%s:\n\t%s\n\n" % ( name, join( map(lambda k, d=dict: "%s: %s" % (k, `d[k]`), dict.keys()), "\n\t" ) )
def str(self,name): dict=getattr(self,name) return "%s:\n\t%s\n\n" % ( name, join( map(lambda k, d=dict: "%s: %s" % (k, `d[k]`), dict.keys()), "\n\t" ) )
2,048
def old_validation(groups, HTTP_AUTHORIZATION, roles=UNSPECIFIED_ROLES): global base64 if base64 is None: import base64 if lower(HTTP_AUTHORIZATION[:6]) != 'basic ': return None [name,password] = string.splitfields( base64.decodestring( split(HTTP_AUTHORIZATION)[-1]), ':') if roles is None: return name keys=None try...
def old_validation(groups, HTTP_AUTHORIZATION, roles=UNSPECIFIED_ROLES): global base64 if base64 is None: import base64 if lower(HTTP_AUTHORIZATION[:6]) != 'basic ': if roles is None: return '' return None [name,password] = string.splitfields( base64.decodestring( split(HTTP_AUTHORIZATION)[-1]), ':') if roles is None...
2,049
def parse_text(s): if find('\\') < 0 or (find('\\t') < 0 and find('\\n') < 0): return s r=[] for x in split(s,'\\\\'): x=join(split(x,'\\n'),'\n') r.append(join(split(x,'\\t'),'\t')) return join(r,'\\')
def parse_text(s): if find(s,'\\') < 0 or (find(s,'\\t') < 0 and find(s,'\\n') < 0): return s r=[] for x in split(s,'\\\\'): x=join(split(x,'\\n'),'\n') r.append(join(split(x,'\\t'),'\t')) return join(r,'\\')
2,050
def publish(self, module_name, after_list, published='web_objects',
def publish(self, module_name, after_list, published='web_objects',
2,051
def publish(self, module_name, after_list, published='web_objects',
def publish(self, module_name, after_list, published='web_objects',
2,052
def handler(self, conn): from string import split, join, atoi hdr = conn.recv(10)
def handler(self, conn): from string import split, join, atoi hdr = conn.recv(10)
2,053
def handler(self, conn): from string import split, join, atoi hdr = conn.recv(10)
def handler(self, conn): from string import split, join, atoi hdr = conn.recv(10)
2,054
def traverse(self, path, response=None, validated_hook=None): """Traverse the object space
def traverse(self, path, response=None, validated_hook=None): """Traverse the object space
2,055
def _cached_result(self, DB__, query):
def _cached_result(self, DB__, query):
2,056
def get_module_info(module_name, modules={}, acquire=_l.acquire, release=_l.release, ): if modules.has_key(module_name): return modules[module_name] if module_name[-4:]=='.cgi': module_name=module_name[:-4] acquire() tb=None try: try: module=__import__(module_name) realm=module_name # Let the app specify a realm i...
def get_module_info(module_name, modules={}, acquire=_l.acquire, release=_l.release, ): if modules.has_key(module_name): return modules[module_name] if module_name[-4:]=='.cgi': module_name=module_name[:-4] acquire() tb=None try: try: module=__import__(module_name, globals(), globals(), ('__doc__',)) realm=module_n...
2,057
def StructuredText(paragraphs, delimiter=re.compile(para_delim)): """ StructuredText accepts paragraphs, which is a list of lines to be parsed. StructuredText creates a structure which mimics the structure of the paragraphs. Structure => [paragraph,[sub-paragraphs]] """ currentlevel = 0 currentindent = 0 levels ...
def StructuredText(paragraphs, delimiter=re.compile(para_delim)): """ StructuredText accepts paragraphs, which is a list of lines to be parsed. StructuredText creates a structure which mimics the structure of the paragraphs. Structure => [paragraph,[sub-paragraphs]] """ currentlevel = 0 currentindent = 0 levels ...
2,058
def validate( self, *args, **kw ): return self._lambdas[ 0 ]( *args, **kw )
def validate( self, *args, **kw ): return self._lambdas[ 0 ]( *args, **kw )
2,059
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,060
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,061
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,062
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,063
def reindexIndex(self, name, REQUEST): if isinstance(name, str): name = (name,) for p in self._catalog.uids.keys(): obj = self.resolve_path(p) if not obj: obj = self.resolve_url(p, REQUEST) if obj is None: LOG.error('reindexIndex could not resolve ' 'an object from the uid %r.' % (uid)) else: # don't update metadata wh...
def reindexIndex(self, name, REQUEST): if isinstance(name, str): name = (name,) for p in self._catalog.uids.keys(): obj = self.resolve_path(p) if not obj: obj = self.resolve_url(p, REQUEST) if obj is None: LOG.error('reindexIndex could not resolve ' 'an object from the uid %r.' % p) else: # don't update metadata when o...
2,064
def _getCurrentBucket(self): """ Do housekeeping if necessary, then return the 'current' bucket. """ self.lock.acquire() try: # do in-place upgrade of old "ring-based" instances if # we've just upgraded from Zope 2.5.X if self._data is None: self._upgrade()
def _getCurrentBucket(self): """ Do housekeeping if necessary, then return the 'current' bucket. """ self.lock.acquire() try: # do in-place upgrade of old "ring-based" instances if # we've just upgraded from Zope 2.5.X if self._data is None: self._upgrade()
2,065
def dav__allprop(self, propstat=propstat ): # DAV helper method - return one or more propstat elements # indicating property names and values for all properties. result=[] for item in self._propertyMap(): name, type=item['id'], item.get('type','string') value=self.getProperty(name)
def dav__allprop(self, propstat=propstat ): # DAV helper method - return one or more propstat elements # indicating property names and values for all properties. result=[] for item in self._propertyMap(): name, type=item['id'], item.get('type','string') value=self.getProperty(name)
2,066
def dav__allprop(self, propstat=propstat ): # DAV helper method - return one or more propstat elements # indicating property names and values for all properties. result=[] for item in self._propertyMap(): name, type=item['id'], item.get('type','string') value=self.getProperty(name)
def dav__allprop(self, propstat=propstat ): # DAV helper method - return one or more propstat elements # indicating property names and values for all properties. result=[] for item in self._propertyMap(): name, type=item['id'], item.get('type','string') value=self.getProperty(name)
2,067
def dav__propstat(self, name, result, propstat=propstat, propdesc=propdesc): # DAV helper method - return a propstat element indicating # property name and value for the requested property. xml_id=self.xml_namespace() propdict=self._propdict() if not propdict.has_key(name): prop='<n:%s xmlns:n="%s"/>\n' % (name, xml_id...
def dav__propstat(self, name, result, propstat=propstat, propdesc=propdesc): # DAV helper method - return a propstat element indicating # property name and value for the requested property. xml_id=self.xml_namespace() propdict=self._propdict() if not propdict.has_key(name): prop='<n:%s xmlns:n="%s"/>\n' % (name, xml_id...
2,068
def dav__propstat(self, name, result, propstat=propstat, propdesc=propdesc): # DAV helper method - return a propstat element indicating # property name and value for the requested property. xml_id=self.xml_namespace() propdict=self._propdict() if not propdict.has_key(name): prop='<n:%s xmlns:n="%s"/>\n' % (name, xml_id...
def dav__propstat(self, name, result, propstat=propstat, propdesc=propdesc): # DAV helper method - return a propstat element indicating # property name and value for the requested property. xml_id=self.xml_namespace() propdict=self._propdict() if not propdict.has_key(name): prop='<n:%s xmlns:n="%s"/>\n' % (name, xml_id...
2,069
def sighandler(signum, frame): signame = zdaemon.Daemon.get_signal_name(signum) zLOG.LOG('Z2', zLOG.INFO , "Caught signal %s" % signame)
def sighandler(signum, frame): signame = zdaemon.Daemon.get_signal_name(signum) zLOG.LOG('Z2', zLOG.INFO , "Caught signal %s" % signame)
2,070
def doc_emphasize( self, s, expr = re.compile(r'\s*\*([ \na-zA-Z0-9.:/;,\'\"\?\-\_\/\=]+)\*(?!\*|-)').search ):
def doc_emphasize( self, s, expr = re.compile(r'\s*\*([ \na-zA-Z0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)').search ):
2,071
def register_loop_callback(callback, args=(), kw=None): _loop_lock.acquire() try: if _looping: apply(cb, (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: apply(callback, (map,)+args, kw or {}) else: _loop_callbacks.append((callback, args, kw)) finally: _loop_lock.release()
2,072
def _check(self, lev='250'): line = self.getLine() if not line: return 0 #can't check an empty line, eh? try: code=string.atoi(line[:3]) except: raise smtpError, "Cannot convert line from SMTP: %s" % line
def _check(self, lev='250'): line = self.getLine() if not line: return 0 #can't check an empty line, eh? try: code=string.atoi(line[:3]) except: raise smtpError, "Cannot convert line from SMTP: %s" % line
2,073
def _check(self, lev='250'): line = self.getLine() if not line: return 0 #can't check an empty line, eh? try: code=string.atoi(line[:3]) except: raise smtpError, "Cannot convert line from SMTP: %s" % line
def _check(self, lev='250'): line = self.getLine() if not line: return 0 #can't check an empty line, eh? try: code=string.atoi(line[:3]) except: raise smtpError, "Cannot convert line from SMTP: %s" % line
2,074
def load_config_text(self, text): # We have to create a directory of our own since the existence # of the directory is checked. This handles this in a # platform-independent way. schema = Zope.Startup.getSchema() sio = cStringIO.StringIO( text.replace("<<INSTANCE_HOME>>", TEMPNAME)) os.mkdir(TEMPNAME) os.mkdir(TEMPPRO...
def load_config_text(self, text): # We have to create a directory of our own since the existence # of the directory is checked. This handles this in a # platform-independent way. schema = self.schema sio = cStringIO.StringIO( text.replace("<<INSTANCE_HOME>>", TEMPNAME)) os.mkdir(TEMPNAME) os.mkdir(TEMPPRODUCTS) try: c...
2,075
def test_load_config_template(self): schema = Zope.Startup.getSchema() cfg = getConfiguration() fn = os.path.join(cfg.zopehome, "skel", "etc", "zope.conf.in") f = open(fn) text = f.read() f.close() self.load_config_text(text)
def test_load_config_template(self): schema = self.schema cfg = getConfiguration() fn = os.path.join(cfg.zopehome, "skel", "etc", "zope.conf.in") f = open(fn) text = f.read() f.close() self.load_config_text(text)
2,076
def get_module_info(module_name, modules={}, acquire=_l.acquire, release=_l.release, ): if modules.has_key(module_name): return modules[module_name] if module_name[-4:]=='.cgi': module_name=module_name[:-4] acquire() tb=None try: try: module=__import__(module_name, globals(), globals(), ('__doc__',)) realm=module_n...
def get_module_info(module_name, modules={}, acquire=_l.acquire, release=_l.release, ): if modules.has_key(module_name): return modules[module_name] if module_name[-4:]=='.cgi': module_name=module_name[:-4] acquire() tb=None try: try: module=__import__(module_name, globals(), globals(), ('__doc__',)) realm=module_n...
2,077
def pt_upload(self, REQUEST, file=''): """Replace the document with the text in file.""" if SUPPORTS_WEBDAV_LOCKS and self.wl_isLocked(): raise ResourceLockedError, "File is locked via WebDAV"
def pt_upload(self, REQUEST, file=''): """Replace the document with the text in file.""" if SUPPORTS_WEBDAV_LOCKS and self.wl_isLocked(): raise ResourceLockedError, "File is locked via WebDAV"
2,078
def manage_test(self, REQUEST): ' '
def manage_test(self, REQUEST): ' '
2,079
def manage_test(self, REQUEST): ' '
def manage_test(self, REQUEST): ' '
2,080
def manage_test(self, REQUEST): ' '
def manage_test(self, REQUEST): ' '
2,081
def __setattr__(self, name, v): klass=self._k setattr(klass, name, v) if not klass._p_changed: get_transaction().register(klass) klass._p_changed=1
def __setattr__(self, name, v): klass=self._k setattr(klass, name, v) if not getattr(klass,'_p_changed',None): get_transaction().register(klass) klass._p_changed=1
2,082
def __delattr__(self, name): klass=self._k delattr(klass, name) if not klass._p_changed: get_transaction().register(klass) klass._p_changed=1
def __delattr__(self, name): klass=self._k delattr(klass, name) if not getattr(klass,'_p_changed',None): get_transaction().register(klass) klass._p_changed=1
2,083
def manage_setPermissionMapping(self, permission_names=[], class_permissions=[], REQUEST=None): "Change property sheet permissions" ips=self.getClassAttr('propertysheets') ips=getattr(ips, self.id)
def manage_setPermissionMapping(self, permission_names=[], class_permissions=[], REQUEST=None): "Change property sheet permissions" ips=self.getClassAttr('propertysheets') ips=getattr(ips, self.id)
2,084
def manage_setPermissionMapping(self, permission_names=[], class_permissions=[], REQUEST=None): "Change property sheet permissions" ips=self.getClassAttr('propertysheets') ips=getattr(ips, self.id)
def manage_setPermissionMapping(self, permission_names=[], class_permissions=[], REQUEST=None): "Change property sheet permissions" ips=self.getClassAttr('propertysheets') ips=getattr(ips, self.id)
2,085
def rclass(klass): if klass._p_changed==0: get_transaction().register(klass) klass._p_changed=1
def rclass(klass): if not getattr(klass, '_p_changed', 0): get_transaction().register(klass) klass._p_changed=1
2,086
def _delOb(self, id): delattr(self, id) pc=self.aq_inner.aq_parent.aq_parent._zclass_propertysheets_class delattr(pc,id) pc.__propset_attrs__=tuple(map(lambda o: o['id'], self._objects)) rclass(pc)
def _delOb(self, id): delattr(self, id) pc=self.aq_inner.aq_parent.aq_parent._zclass_propertysheets_class try: delattr(pc,id) except: pass pc.__propset_attrs__=tuple(map(lambda o: o['id'], self._objects)) rclass(pc)
2,087
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_...
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_...
2,088
def _changeUser(self,name,password,confirm,roles,domains,REQUEST=None): if not name: return MessageDialog( title ='Illegal value', message='A username must be specified', action ='manage_main')
def _changeUser(self,name,password,confirm,roles,domains,REQUEST=None): if not name: return MessageDialog( title ='Illegal value', message='A username must be specified', action ='manage_main')
2,089
def runTest(self): sys.stdout.write(os.path.basename(self.__file) + " ") sys.stdout.flush() sys.argv = ["", "-Q", self.__file] pwd = os.getcwd() try: try: os.chdir(self.__dir) runtest.main() finally: os.chdir(pwd) except SystemExit, what: if what.code: self.fail("output for %s didn't match" % self.__file)
def runTest(self): basename = os.path.basename(self.__file) sys.stdout.write(basename + " ") sys.stdout.flush() sys.argv = ["", "-Q", self.__file] pwd = os.getcwd() try: try: os.chdir(self.__dir) runtest.main() finally: os.chdir(pwd) except SystemExit, what: if what.code: self.fail("output for %s didn't match" % self._...
2,090
def runTest(self): sys.stdout.write(os.path.basename(self.__file) + " ") sys.stdout.flush() sys.argv = ["", "-Q", self.__file] pwd = os.getcwd() try: try: os.chdir(self.__dir) runtest.main() finally: os.chdir(pwd) except SystemExit, what: if what.code: self.fail("output for %s didn't match" % self.__file)
def runTest(self): sys.stdout.write(os.path.basename(self.__file) + " ") sys.stdout.flush() if basename[:10] == 'test_metal': sys.argv = ["", "-Q", "-m", self.__file] else: sys.argv = ["", "-Q", self.__file] pwd = os.getcwd() try: try: os.chdir(self.__dir) runtest.main() finally: os.chdir(pwd) except SystemExit, what: ...
2,091
def getPath(prefix, name, checkProduct=1, suffixes=('',)): """Find a file in one of several relative locations Arguments: prefix -- The location, relative to some home, to look for the file name -- The name of the file. This must not be a path. checkProduct -- a flag indicating whether product directories should b...
def getPath(prefix, name, checkProduct=1, suffixes=('',)): """Find a file in one of several relative locations Arguments: prefix -- The location, relative to some home, to look for the file name -- The name of the file. This must not be a path. checkProduct -- a flag indicating whether product directories should b...
2,092
def getObject(module, name, reload=0, # The use of a mutable default is intentional here, # because modules is a module cache. modules={} ): # The use of modules here is not thread safe, however, there is # no real harm in a rece condition here. If two threads # update the cache, then one will have simply worked a li...
def getObject(module, name, reload=0, # The use of a mutable default is intentional here, # because modules is a module cache. modules={} ): # The use of modules here is not thread safe, however, there is # no real harm in a rece condition here. If two threads # update the cache, then one will have simply worked a li...
2,093
def getObject(module, name, reload=0, # The use of a mutable default is intentional here, # because modules is a module cache. modules={} ): # The use of modules here is not thread safe, however, there is # no real harm in a rece condition here. If two threads # update the cache, then one will have simply worked a li...
def getObject(module, name, reload=0, # The use of a mutable default is intentional here, # because modules is a module cache. modules={} ): # The use of modules here is not thread safe, however, there is # no real harm in a rece condition here. If two threads # update the cache, then one will have simply worked a li...
2,094
def tpValuesIds(self, branches, args, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): # This should build the ids of subitems which are # expandable (non-empty). Leaves should never be # in the state - it will screw the colspan counting. r=[] idattr=args['id'] try: try: items=getattr(self, branches)() exce...
def tpValuesIds(self, branches, args, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): # This should build the ids of subitems which are # expandable (non-empty). Leaves should never be # in the state - it will screw the colspan counting. r=[] idattr=args['id'] try: try: items=getattr(self, branches)() exce...
2,095
def manage_cache_age(self,value,REQUEST): "set cache age" try: v=self._p_jar.getVersion() except: pass else: if v: self._vcache_age=value self._p_jar.db().setVersionCacheDeactivateAfter(value) else: self._cache_age=value self._p_jar.db().setCacheDeactivateAfter(value) return
def manage_cache_age(self,value,REQUEST): "set cache age" try: v=self._p_jar.getVersion() except: if self._p_jar.db is not Globals.Bobobase._jar.db: raise 'Version Error', ( '''You may not change the database cache age while working in a <em>version</em>''') self._cache_age=Globals.Bobobase._jar.cache.cache_age=value ...
2,096
def manage_cache_age(self,value,REQUEST): "set cache age" try: v=self._p_jar.getVersion() except: pass else: if v: self._vcache_age=value self._p_jar.db().setVersionCacheDeactivateAfter(value) else: self._cache_age=value self._p_jar.db().setCacheDeactivateAfter(value) return
def manage_cache_age(self,value,REQUEST): "set cache age" try: v=self._p_jar.getVersion() except: pass else: if v: self._vcache_age=value self._p_jar.db().setVersionCacheDeactivateAfter(value) else: self._cache_age=value self._p_jar.db().setCacheDeactivateAfter(value) return
2,097
def manage_cache_size(self,value,REQUEST): "set cache size" try: v=self._p_jar.getVersion() except: pass else: if v: self._vcache_size=value self._p_jar.db().setVersionCacheSize(value) else: self._cache_size=value self._p_jar.db().setCacheSize(value) return
def manage_cache_size(self,value,REQUEST): "set cache size" try: v=self._p_jar.getVersion() except: if self._p_jar.db is not Globals.Bobobase._jar.db: raise 'Version Error', ( '''You may not change the database cache size while working in a <em>version</em>''') self._cache_size=Globals.Bobobase._jar.cache.cache_size=v...
2,098
def manage_cache_size(self,value,REQUEST): "set cache size" try: v=self._p_jar.getVersion() except: pass else: if v: self._vcache_size=value self._p_jar.db().setVersionCacheSize(value) else: self._cache_size=value self._p_jar.db().setCacheSize(value) return
def manage_cache_size(self,value,REQUEST): "set cache size" try: v=self._p_jar.getVersion() except: pass else: if v: self._vcache_size=value self._p_jar.db().setVersionCacheSize(value) else: self._cache_size=value self._p_jar.db().setCacheSize(value) return
2,099