bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def _setObject(self,id,object,roles=None,user=None): v=self._checkId(id) if v is not None: id=v try: t=object.meta_type except: t=None self._objects=self._objects+({'id':id,'meta_type':t},) self._setOb(id,object) object=self._getOb(id) object.manage_afterAdd(object, self) # Try to give user the local role "Owner", ...
def _setObject(self,id,object,roles=None,user=None): v=self._checkId(id) if v is not None: id=v try: t=object.meta_type except: t=None self._objects=self._objects+({'id':id,'meta_type':t},) self._setOb(id,object) object=self._getOb(id) object.manage_afterAdd(object, self) # Try to give user the local role "Owner", ...
2,100
def __init__(self, name, env=None, prefix='zodb_', config=None): """Create a new storage.
def __init__(self, name, env=None, prefix='zodb_', config=None): """Create a new storage.
2,101
def close(self): """Close the storage.
def close(self): """Close the storage.
2,102
def locked_in_version(self): return 0
def locked_in_version(self): return 0
2,103
def locked_in_version(self): return 0
def locked_in_version(self): return 0
2,104
def locked_in_version(self): return 0
def locked_in_version(self): return 0
2,105
def sys_platform(self): return sys.platform
def sys_platform(self): return sys.platform
2,106
def rcdeltas(self): if _v_rcs is None: self.rcsnapshot() nc=self.refdict() rc=_v_rcs rd=[] for n, c in nc.items(): try: prev=rc[n] if c > prev: rd.append( (c - prev, (c, prev, n)) ) except: pass rd.sort() rd.reverse()
defrcdeltas(self):if_v_rcsisNone:self.rcsnapshot()nc=self.refdict()rc=_v_rcsrd=[]forn,cinnc.items():try:prev=rc[n]ifc>prev:rd.append((c-prev,(c,prev,n)))except:passrd.sort()rd.reverse()
2,107
def rcdeltas(self): if _v_rcs is None: self.rcsnapshot() nc=self.refdict() rc=_v_rcs rd=[] for n, c in nc.items(): try: prev=rc[n] if c > prev: rd.append( (c - prev, (c, prev, n)) ) except: pass rd.sort() rd.reverse()
defrcdeltas(self):if_v_rcsisNone:self.rcsnapshot()nc=self.refdict()rc=_v_rcsrd=[]forn,cinnc.items():try:prev=rc[n]ifc>prev:rd.append((c-prev,(c,prev,n)))except:passrd.sort()rd.reverse()
2,108
def manage_discardVersions(self, versions, REQUEST=None): "Discard some versions" db=self._p_jar.db() for v in versions: db.abortVersion(v) if REQUEST is not None: REQUEST['RESPONSE'].redirect(REQUEST['URL1']+'/manage_main')
def manage_discardVersions(self, versions, REQUEST=None): "Discard some versions" db=self._p_jar.db() for v in versions: db.abortVersion(v) if REQUEST is not None: REQUEST['RESPONSE'].redirect(REQUEST['URL1']+'/manage_main')
2,109
def is_acquired(ob): # 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'): return 0 return 1
def is_acquired(ob): # 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') and \ ob.isTopLevelPrincipiaApplicationObject: retu...
2,110
def addError(self, test, error): TestResult.addError(self,test,error) self.stream.write('E') self.stream.flush() if err[0] is KeyboardInterrupt: self.shouldStop = 1
def addError(self, test, error): TestResult.addError(self,test,error) self.stream.write('E') self.stream.flush() if error[0] is KeyboardInterrupt: self.shouldStop = 1
2,111
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: if self.nomoretags: self.handle_data(rawdata[i:n]) i = self.updatepos(i, n) break match = interesting.search(rawdata, i) if match: j = match.start(0) else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n...
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: if self.nomoretags: self.handle_data(rawdata[i:n]) i = self.updatepos(i, n) break match = interesting.search(rawdata, i) if match: j = match.start(0) else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n...
2,112
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: if self.nomoretags: self.handle_data(rawdata[i:n]) i = self.updatepos(i, n) break match = interesting.search(rawdata, i) if match: j = match.start(0) else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n...
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: if self.nomoretags: self.handle_data(rawdata[i:n]) i = self.updatepos(i, n) break match = interesting.search(rawdata, i) if match: j = match.start(0) else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n...
2,113
def publish(request, module_name, after_list, debug=0, # Optimize: call_object=call_object, missing_name=missing_name, dont_publish_class=dont_publish_class, mapply=mapply, ): (bobo_before, bobo_after, object, realm, debug_mode, err_hook, validated_hook, transactions_manager)= get_module_info(module_name) parents=Non...
def publish(request, module_name, after_list, debug=0, # Optimize: call_object=call_object, missing_name=missing_name, dont_publish_class=dont_publish_class, mapply=mapply, ): (bobo_before, bobo_after, object, realm, debug_mode, err_hook, validated_hook, transactions_manager)= get_module_info(module_name) parents=Non...
2,114
def checkCreateWithFileobj(self): filename = 'commit.log' fp = open(filename, 'w+b') try: self.assertRaises(CommitLog.TruncationError, CommitLog.CommitLog, fp) finally: fp.close() os.unlink(filename)
def checkCreateWithFileobj(self): filename = 'commit.log' fp = open(filename, 'w+b') try: self.assertRaises(CommitLog.TruncationError, CommitLog.CommitLog, fp) finally: fp.close() os.unlink(filename)
2,115
def checkCloseNoUnlink(self): log = CommitLog.CommitLog() filename = log.get_filename() log.close() try: assert os.path.exists(filename) finally: os.unlink(filename) assert not os.path.exists(filename)
def checkCloseNoUnlink(self): log = CommitLog.CommitLog() filename = log.get_filename() log.close() try: assert os.path.exists(filename) finally: os.unlink(filename) assert not os.path.exists(filename)
2,116
def checkDel(self): log = CommitLog.CommitLog() filename = log.get_filename() del log try: assert os.path.exists(filename) finally: os.unlink(filename) assert not os.path.exists(filename)
def checkDel(self): log = CommitLog.CommitLog() filename = log.get_filename() del log try: assert os.path.exists(filename) finally: os.unlink(filename) assert not os.path.exists(filename)
2,117
def tearDown(self): self._log.close(unlink=1)
def tearDown(self): self._log.close(unlink=1)
2,118
def suite(): suite = unittest.TestSuite() # Creation and closing suite.addTest(CreateCommitLogTest('checkCreateNoFile')) suite.addTest(CreateCommitLogTest('checkCreateWithFilename')) suite.addTest(CreateCommitLogTest('checkCreateWithFileobj')) suite.addTest(CreateCommitLogTest('checkCloseNoUnlink')) suite.addTest(Creat...
def suite(): suite = unittest.TestSuite() # Creation and closing suite.addTest(CreateCommitLogTest('checkCreateNoFile')) suite.addTest(CreateCommitLogTest('checkCreateWithFilename')) suite.addTest(CreateCommitLogTest('checkCreateWithFileobj')) suite.addTest(CreateCommitLogTest('checkCloseNoUnlink')) suite.addTest(Creat...
2,119
def index_object(self, docid, obj ,threshold=100): """ hook for (Z)Catalog """
def index_object(self, docid, obj ,threshold=100): """ hook for (Z)Catalog """
2,120
def unindex_object(self, docid): """ hook for (Z)Catalog """
def unindex_object(self, docid): """ hook for (Z)Catalog """
2,121
def modified_in_session(self):
def modified_in_session(self):
2,122
def test_export_import_as_file_idempotent(self): from OFS.DTMLMethod import DTMLMethod from OFS.XMLExportImport import exportXML from OFS.XMLExportImport import importXML
def test_export_import_as_file_idempotent(self): from OFS.DTMLMethod import DTMLMethod from OFS.XMLExportImport import exportXML from OFS.XMLExportImport import importXML
2,123
def test_export_import_as_file_idempotent(self): from OFS.DTMLMethod import DTMLMethod from OFS.XMLExportImport import exportXML from OFS.XMLExportImport import importXML
def test_export_import_as_file_idempotent(self): from OFS.DTMLMethod import DTMLMethod from OFS.XMLExportImport import exportXML from OFS.XMLExportImport import importXML
2,124
def test_export_import_as_file_idempotent(self): from OFS.DTMLMethod import DTMLMethod from OFS.XMLExportImport import exportXML from OFS.XMLExportImport import importXML
def test_export_import_as_file_idempotent(self): from OFS.DTMLMethod import DTMLMethod from OFS.XMLExportImport import exportXML from OFS.XMLExportImport import importXML
2,125
def test_export_import_as_file_idempotent(self): from OFS.DTMLMethod import DTMLMethod from OFS.XMLExportImport import exportXML from OFS.XMLExportImport import importXML
def test_export_import_as_file_idempotent(self): from OFS.DTMLMethod import DTMLMethod from OFS.XMLExportImport import exportXML from OFS.XMLExportImport import importXML
2,126
def test_OFS_ObjectManager__importObjectFromFile_xml(self): from OFS.DTMLMethod import DTMLMethod from OFS.Folder import Folder from OFS.XMLExportImport import exportXML
def test_OFS_ObjectManager__importObjectFromFile_xml(self): from OFS.DTMLMethod import DTMLMethod from OFS.Folder import Folder from OFS.XMLExportImport import exportXML
2,127
def test_OFS_ObjectManager__importObjectFromFile_xml(self): from OFS.DTMLMethod import DTMLMethod from OFS.Folder import Folder from OFS.XMLExportImport import exportXML
def test_OFS_ObjectManager__importObjectFromFile_xml(self): from OFS.DTMLMethod import DTMLMethod from OFS.Folder import Folder from OFS.XMLExportImport import exportXML
2,128
def test_OFS_ObjectManager__importObjectFromFile_xml(self): from OFS.DTMLMethod import DTMLMethod from OFS.Folder import Folder from OFS.XMLExportImport import exportXML
def test_OFS_ObjectManager__importObjectFromFile_xml(self): from OFS.DTMLMethod import DTMLMethod from OFS.Folder import Folder from OFS.XMLExportImport import exportXML
2,129
def hasChildNodes(self): """Returns true if the node has any children, false if it doesn't. """ return self.objectIds()
def hasChildNodes(self): """Returns true if the node has any children, false if it doesn't. """ return len(self.objectIds())
2,130
def getElementsByTagName(self, tagname): """ Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree. Parameter: tagname The name of the tag to match (* = all tags). Return Value: A new NodeList object containing all the ...
def getElementsByTagName(self, tagname): """ Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree. Parameter: tagname The name of the tag to match (* = all tags). Return Value: A new NodeList object containing all the ...
2,131
def getElementsByTagName(self, tagname): """ Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree. Parameter: tagname The name of the tag to match (* = all tags). Return Value: A new NodeList object containing all the ...
def getElementsByTagName(self, tagname): """ Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree.""" Elements that allow DOM access to Zope properties of type 'string'. Note: This sub-class should only be used by Prop...
2,132
def getAttributes(self): attributes = self.propdict() list = [] for a in attributes.keys(): attributeNode = Attr(a, attributes[a], self.getOwnerDocument()) list.append(attributeNode) return NamedNodeMap(list)
def getAttributes(self): attributes = self.propdict() list = [] for a in attributes.keys(): attributeNode = Attr(a, attributes[a], self.getOwnerDocument()) list.append(attributeNode) return NamedNodeMap(list)
2,133
def getAttribute(self, name): return str(self.getProperty(name))
def getAttribute(self, name): return str(self.getProperty(name))
2,134
def getAttributeNode(self, name): attributes = self.propdict() if attributes.has_key(name): node = Attr(name, self.getProperty(name), self.getOwnerDocument()) return node return None
def getAttributeNode(self, name): attributes = self.propdict() if attributes.has_key(name): node = Attr(name, self.getProperty(name), self.getOwnerDocument()) return node return None
2,135
def __init__(self,list=[]): self._data = list self.length = len(list)
def __init__(self,list=None): self._data = list or []
2,136
def __getitem__(self, index): """Returns the index-th item in the collection""" if index >= self.length: return None return self._data[index]
def __getitem__(self, index): """Returns the index-th item in the collection""" if index >= self.length: return None return self._data[index]
2,137
def getLength(self): """The length of the NodeList""" return self.length
def getLength(self): """The length of the NodeList""" return self.length
2,138
def __init__(self, data=None): if data is None : data = {} self._data = data self.length = len(data)
def __init__(self, data=None): if data is None : data = {} self._data = data self.length = len(data)
2,139
def __getitem__(self, index): """Returns the index-th item in the map""" return self._data[index]
def __getitem__(self, index): """Returns the index-th item in the map""" try: return self._data.values()[index] except IndexError: return None
2,140
def getLength(self): """The length of the NodeList""" return self.length
def getLength(self): """The length of the NodeList""" return self.length
2,141
def getNamedItem(self, name): """Retrieves a node specified by name. Parameters: name Name of a node to retrieve. Return Value A Node (of any type) with the specified name, or null if the specified name did not identify any node in the map. """ if self._data.has_key(name): return self._data[name] return None
def getNamedItem(self, name): """Retrieves a node specified by name. Parameters: name Name of a node to retrieve. Return Value A Node (of any type) with the specified name, or null if the specified name did not identify any node in the map. """ if self._data.has_key(name): return self._data[name] return None
2,142
def __init__(self, name, value, ownerDocument): self.nodeName = name # attr attributes self.name = name self.value = value self.specified = 1 # attr nodes are specified because properties # don't exist without having a value self.ownerDocument = ownerDocument
def __init__(self, name, value, ownerDocument): self.nodeName = name # attr attributes self.name = name self.value = value self.specified = 1 # attr nodes are specified because properties # don't exist without having a value self.ownerDocument = ownerDocument
2,143
def getNodeType(self): return ATTRIBUTE_NODE
def getNodeType(self): return ATTRIBUTE_NODE
2,144
def parseQueryEx(self, query): tree = self.parseQueryEx(query) ignored = self.getIgnored() return tree, ignored
def parseQueryEx(self, query): tree = self.parseQuery(query) ignored = self.getIgnored() return tree, ignored
2,145
def __init__(self, stdin, environ, response, clean=0, # "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, rfi...
def __init__(self, stdin, environ, response, clean=0, # "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, rfi...
2,146
def __init__(self, stdin, environ, response, clean=0, # "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, rfi...
def __init__(self, stdin, environ, response, clean=0, # "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, rfi...
2,147
def validate(self, inst, parent, name, value, md): return getSecurityManager().validate(inst, parent, name, value)
def validate(self, inst, parent, name, value, md): return getSecurityManager().validate(inst, parent, name, value)
2,148
def validate(self, inst, parent, name, value, md): return getSecurityManager().validate(inst, parent, name, value)
def validate(self, inst, parent, name, value, md): return getSecurityManager().validate(inst, parent, name, value)
2,149
def PrincipiaSearchSource(self): """Return content for use by the Find machinery.""" return '%s\n%s' % (self.arguments_src, self.src)
def default_content_type = 'text/plain' def document_src(self, REQUEST=None, RESPONSE=None): """Return unprocessed document source.""" if RESPONSE is not None: RESPONSE.setHeader('Content-Type', 'text/plain') return '<params>%s</params>\n%s' % (self.arguments_src, self.src) def manage_FTPget(self): """Get source f...
2,150
def manage_catalogFoundItems(self, REQUEST, RESPONSE, URL2, URL1, 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 """
def manage_catalogFoundItems(self, REQUEST, RESPONSE, URL2, URL1, 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 """
2,151
def __init__(self, blocks): tname, args, section = blocks[0]
def __init__(self, blocks): tname, args, section = blocks[0]
2,152
def check2(self): self.folder.laf.write(open('input/TeeShopLAF.html').read())
def check2(self): self.folder.laf.write(open('input/TeeShopLAF.html').read())
2,153
def check3(self): self.folder.laf.write(open('input/TeeShopLAF.html').read())
def check3(self): self.folder.laf.write(open('input/TeeShopLAF.html').read())
2,154
def check3(self): self.folder.laf.write(open('input/TeeShopLAF.html').read())
defcheck3(self):self.folder.laf.write(open('input/TeeShopLAF.html').read())
2,155
def checkGlobalRegistry(self, rebuild=1): """Check the global (product) registry for problems, which can be caused by disk-based products being deleted and other things that Zope cannot know about. If rebuild is true, the global registry will be rebuilt automatically if a problem is found.
def checkGlobalRegistry(self, rebuild=1): """Check the global (product) registry for problems, which can be caused by disk-based products being deleted and other things that Zope cannot know about. If rebuild is true, the global registry will be rebuilt automatically if a problem is found.
2,156
def checkGlobalRegistry(self, rebuild=1): """Check the global (product) registry for problems, which can be caused by disk-based products being deleted and other things that Zope cannot know about. If rebuild is true, the global registry will be rebuilt automatically if a problem is found.
def checkGlobalRegistry(self, rebuild=1): """Check the global (product) registry for problems, which can be caused by disk-based products being deleted and other things that Zope cannot know about. If rebuild is true, the global registry will be rebuilt automatically if a problem is found.
2,157
def checkGlobalRegistry(self, rebuild=1): """Check the global (product) registry for problems, which can be caused by disk-based products being deleted and other things that Zope cannot know about. If rebuild is true, the global registry will be rebuilt automatically if a problem is found.
defcheckGlobalRegistry(self,rebuild=1):"""Checktheglobal(product)registryforproblems,whichcanbecausedbydisk-basedproductsbeingdeletedandotherthingsthatZopecannotknowabout.Ifrebuildistrue,theglobalregistrywillberebuiltautomaticallyifaproblemisfound.
2,158
def initialize(app): # Initialize the application # Initialize the cache: app.Control_Panel.initialize_cache() # The following items marked b/c are backward compatibility hacks # which make sure that expected system objects are added to the # bobobase. This is required because the bobobase in use may pre- # date the ...
def initialize(app): # Initialize the application # Initialize the cache: app.Control_Panel.initialize_cache() # The following items marked b/c are backward compatibility hacks # which make sure that expected system objects are added to the # bobobase. This is required because the bobobase in use may pre- # date the ...
2,159
def manage_catalogReindex(self, REQUEST, RESPONSE, URL1): """ clear the catalog, then re-index everything """
def manage_catalogReindex(self, REQUEST, RESPONSE, URL1): """ clear the catalog, then re-index everything """
2,160
def refreshCatalog(self, clear=0): """ re-index everything we can find """
def refreshCatalog(self, clear=0, pghandler=None): """ re-index everything we can find """
2,161
def refreshCatalog(self, clear=0): """ re-index everything we can find """
def refreshCatalog(self, clear=0): """ re-index everything we can find """
2,162
def refreshCatalog(self, clear=0): """ re-index everything we can find """
def refreshCatalog(self, clear=0): """ re-index everything we can find """
2,163
def refreshCatalog(self, clear=0): """ re-index everything we can find """
def refreshCatalog(self, clear=0): """ re-index everything we can find """
2,164
def encodeExpansion(nodes, compress=1): '''Encode the expanded node ids of a tree into a string. Accepts a list of nodes, such as that produced by root.flat(). Marks each expanded node with an expansion_number attribute. Since node ids are encoded, the resulting string is safe for use in cookies and URLs. ''' steps = ...
def encodeExpansion(nodes, compress=1): '''Encode the expanded node ids of a tree into a string. Accepts a list of nodes, such as that produced by root.flat(). Marks each expanded node with an expansion_number attribute. Since node ids are encoded, the resulting string is safe for use in cookies and URLs. ''' steps = ...
2,165
def handle_starttag(self, tag, attrs): if tag in EMPTY_HTML_TAGS: return self.handle_startendtag(tag, attrs) self.close_para_tags(tag) self.tagstack.append(tag) self.scan_xmlns(attrs) attrlist, taldict, metaldict = self.extract_attrs(attrs) self.gen.emitStartElement(tag, attrlist, taldict, metaldict, self.getpos())
def handle_starttag(self, tag, attrs): self.close_para_tags(tag) self.tagstack.append(tag) self.scan_xmlns(attrs) attrlist, taldict, metaldict = self.extract_attrs(attrs) self.gen.emitStartElement(tag, attrlist, taldict, metaldict, self.getpos())
2,166
def implied_endtag(self, tag, implied): assert tag == self.tagstack[-1] assert implied in (-1, 1, 2) if implied > 0: if tag in TIGHTEN_IMPLICIT_CLOSE_TAGS: # Pick out trailing whitespace from the program, and # insert the close tag before the whitespace. white = self.gen.unEmitWhitespace() self.gen.emitEndElement(tag, ...
def implied_endtag(self, tag, implied): assert tag == self.tagstack[-1] assert implied in (-1, 1, 2) if implied > 0: if tag in TIGHTEN_IMPLICIT_CLOSE_TAGS: # Pick out trailing whitespace from the program, and # insert the close tag before the whitespace. white = self.gen.unEmitWhitespace() self.gen.emitEndElement(tag, ...
2,167
def addIndex(self, name, type,extra=None):
def addIndex(self, name, type,extra=None):
2,168
def addIndex(self, name, type,extra=None):
defaddIndex(self,name,type,extra=None):
2,169
def delIndex(self, name ):
defdelIndex(self,name):
2,170
def clearIndex(self, name):
def clearIndex(self, name):
2,171
def getAttributes(self): """Returns a NamedNodeMap containing the attributes of this node (if it is an element) or None otherwise.""" if self.getAttribute('title'): return NamedNodeMap({'title' : self.title}) return NamedNodeMap()
def getAttributes(self): """Returns a NamedNodeMap containing the attributes of this node (if it is an element) or None otherwise.""" title = self.getAttributeNode('title') if title is not None: return NamedNodeMap({'title':title}) return NamedNodeMap()
2,172
def __init__(self, request, iid, options=[]): """ parse a request from the ZPublisher and return a uniform datastructure back to the _apply_index() method of the index
def __init__(self, request, iid, options=[]): """ parse a request from the ZPublisher and return a uniform datastructure back to the _apply_index() method of the index
2,173
def field2int(v): if isinstance(v, (ListType, TupleType)): return map(field2int, v) v = field2string(v) if v: try: return int(v) except ValueError: raise ValueError, ( "An integer was expected in the value '%s'" % escape(v) ) raise ValueError, 'Empty entry when <strong>integer</strong> expected'
def field2int(v): if isinstance(v, (ListType, TupleType)): return map(field2int, v) v = field2string(v) if v: try: return int(v) except ValueError: raise ValueError, ( "An integer was expected in the value %s" % escape(`v`) ) raise ValueError, 'Empty entry when <strong>integer</strong> expected'
2,174
def field2float(v): if isinstance(v, (ListType, TupleType)): return map(field2float, v) v = field2string(v) if v: try: return float(v) except ValueError: raise ValueError, ( "A floating-point number was expected in the value '%s'" % escape(v) ) raise ValueError, ( 'Empty entry when <strong>floating-point number</strong...
def field2float(v): if isinstance(v, (ListType, TupleType)): return map(field2float, v) v = field2string(v) if v: try: return float(v) except ValueError: raise ValueError, ( "A floating-point number was expected in the value %s" % escape(`v`) ) raise ValueError, ( 'Empty entry when <strong>floating-point number</strong...
2,175
def field2long(v): if isinstance(v, (ListType, TupleType)): return map(field2long, v) v = field2string(v) # handle trailing 'L' if present. if v[-1:] in ('L', 'l'): v = v[:-1] if v: try: return long(v) except ValueError: raise ValueError, ( "A long integer was expected in the value '%s'" % escape(v) ) raise ValueError,...
def field2long(v): if isinstance(v, (ListType, TupleType)): return map(field2long, v) v = field2string(v) # handle trailing 'L' if present. if v[-1:] in ('L', 'l'): v = v[:-1] if v: try: return long(v) except ValueError: raise ValueError, ( "A long integer was expected in the value %s" % escape(`v`) ) raise ValueError,...
2,176
def field2date(v): v = field2string(v) try: v = DateTime(v) except DateTime.SyntaxError, e: raise DateTime.SyntaxError, escape(e) return v
def field2date(v): v = field2string(v) try: v = DateTime(v) except DateTime.SyntaxError, e: raise DateTime.SyntaxError, "Invalid DateTime "+escape(`v`) return v
2,177
def field2date_international(v): v = field2string(v) try: v = DateTime(v, datefmt="international") except DateTime.SyntaxError, e: raise DateTime.SyntaxError, escape(e) return v
def field2date_international(v): v = field2string(v) try: v = DateTime(v, datefmt="international") except DateTime.SyntaxError, e: raise DateTime.SyntaxError, "Invalid DateTime "+escape(`v`) return v
2,178
def __init__(self, *attrs): Distribution.__init__(self, *attrs) self.cmdclass['build'] = MyBuilder self.cmdclass['build_ext'] = MyExtBuilder self.cmdclass['install_lib'] = MyLibInstaller
def __init__(self, *attrs): Distribution.__init__(self, *attrs) self.cmdclass['build'] = MyBuilder self.cmdclass['build_ext'] = MyExtBuilder self.cmdclass['install_lib'] = MyLibInstaller
2,179
def __init__(self, *attrs): Distribution.__init__(self, *attrs) self.cmdclass['build'] = MyBuilder self.cmdclass['build_ext'] = MyExtBuilder self.cmdclass['install_lib'] = MyLibInstaller
def __init__(self, *attrs): Distribution.__init__(self, *attrs) self.cmdclass['build'] = MyBuilder self.cmdclass['build_ext'] = MyExtBuilder self.cmdclass['install_lib'] = MyLibInstaller
2,180
def __init__(self, *attrs): Distribution.__init__(self, *attrs) self.cmdclass['build'] = MyBuilder self.cmdclass['build_ext'] = MyExtBuilder self.cmdclass['install_lib'] = MyLibInstaller
def__init__(self,*attrs):Distribution.__init__(self,*attrs)self.cmdclass['build']=MyBuilderself.cmdclass['build_ext']=MyExtBuilderself.cmdclass['install_lib']=MyLibInstaller
2,181
def __init__(self, *attrs): Distribution.__init__(self, *attrs) self.cmdclass['build'] = MyBuilder self.cmdclass['build_ext'] = MyExtBuilder self.cmdclass['install_lib'] = MyLibInstaller
def __init__(self, *attrs): Distribution.__init__(self, *attrs) self.cmdclass['build'] = MyBuilder self.cmdclass['build_ext'] = MyExtBuilder self.cmdclass['install_lib'] = MyLibInstaller
2,182
def _doAddUser(self, name, password, roles, domains, **kw): """Create a new user""" if password is not None and self.encrypt_passwords \ and not self._isPasswordEncrypted(pw): password = self._encryptPassword(password) self.data[name]=User(name,password,roles,domains)
def _doAddUser(self, name, password, roles, domains, **kw): """Create a new user""" if password is not None and self.encrypt_passwords \ and not self._isPasswordEncrypted(password): password = self._encryptPassword(password) self.data[name]=User(name,password,roles,domains)
2,183
def testSplitterLocaleAwareness(self): from Products.ZCTextIndex.HTMLSplitter import HTMLWordSplitter import locale loc = locale.setlocale(locale.LC_ALL) # get current locale # set German locale if sys.platform != 'win32': locale.setlocale(locale.LC_ALL, 'de_DE.ISO8859-1') else: locale.setlocale(locale.LC_ALL, 'German_...
def testSplitterLocaleAwareness(self): from Products.ZCTextIndex.HTMLSplitter import HTMLWordSplitter import locale loc = locale.setlocale(locale.LC_ALL) # get current locale # set German locale try: if sys.platform != 'win32': locale.setlocale(locale.LC_ALL, 'de_DE.ISO8859-1') else: locale.setlocale(locale.LC_ALL, 'Ge...
2,184
def testSplitterLocaleAwareness(self): from Products.ZCTextIndex.HTMLSplitter import HTMLWordSplitter import locale loc = locale.setlocale(locale.LC_ALL) # get current locale # set German locale if sys.platform != 'win32': locale.setlocale(locale.LC_ALL, 'de_DE.ISO8859-1') else: locale.setlocale(locale.LC_ALL, 'German_...
def testSplitterLocaleAwareness(self): from Products.ZCTextIndex.HTMLSplitter import HTMLWordSplitter import locale loc = locale.setlocale(locale.LC_ALL) # get current locale # set German locale if sys.platform != 'win32': locale.setlocale(locale.LC_ALL, 'de_DE.ISO8859-1') else: locale.setlocale(locale.LC_ALL, 'German_...
2,185
def testSplitterLocaleAwareness(self): from Products.ZCTextIndex.HTMLSplitter import HTMLWordSplitter import locale loc = locale.setlocale(locale.LC_ALL) # get current locale # set German locale if sys.platform != 'win32': locale.setlocale(locale.LC_ALL, 'de_DE.ISO8859-1') else: locale.setlocale(locale.LC_ALL, 'German_...
def testSplitterLocaleAwareness(self): from Products.ZCTextIndex.HTMLSplitter import HTMLWordSplitter import locale loc = locale.setlocale(locale.LC_ALL) # get current locale # set German locale if sys.platform != 'win32': locale.setlocale(locale.LC_ALL, 'de_DE.ISO8859-1') else: locale.setlocale(locale.LC_ALL, 'German_...
2,186
def manage_addZCatalog(self, id, title, vocab_id=None, REQUEST=None): """Add a ZCatalog object """ id=str(id) title=str(title) vocab_id=str(vocab_id) if vocab_id == 'create_default_catalog_': vocab_id = None c=ZCatalog(id, title, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(se...
def manage_addZCatalog(self, id, title, vocab_id='create_default_catalog_', REQUEST=None): """Add a ZCatalog object """ id=str(id) title=str(title) vocab_id=str(vocab_id) if vocab_id == 'create_default_catalog_': vocab_id = None c=ZCatalog(id, title, vocab_id, self) self._setObject(id, c) if REQUEST is not None: retur...
2,187
def PersistentClassDict(doc=None, meta_type=None): # Build new class dict dict={} dict.update(Template.__dict__) if meta_type is not None: dict['meta_type']=dict['__doc__']=meta_type if doc is not None: dict['__doc__']=doc return dict
def PersistentClassDict(doc=None, meta_type=None): # Build new class dict dict={} dict.update(Template.__dict__) if meta_type is not None: dict['meta_type']=dict['__doc__']=meta_type if doc is not None: dict['__doc__']=doc return dict
2,188
def _setBasesHoldOnToYourButts(self, bases): # Eeeek copy=self.__class__(self.id, self.title, bases)
def _setBasesHoldOnToYourButts(self, bases): # Eeeek copy=self.__class__(self.id, self.title, bases)
2,189
def index_html(self, id, REQUEST, RESPONSE=None): """ Create Z instance. If called with a RESPONSE, the RESPONSE will be redirected to the management screen of the new instance's parent Folder. Otherwise, the instance will be returned. """ i=mapply(self._zclass_, (), REQUEST) if not hasattr(i, 'id') or not i.id: i.id=i...
def createInObjectManager(self, id, REQUEST, RESPONSE=None): """ Create Z instance. If called with a RESPONSE, the RESPONSE will be redirected to the management screen of the new instance's parent Folder. Otherwise, the instance will be returned. """ i=mapply(self._zclass_, (), REQUEST) if not hasattr(i, 'id') or not i...
2,190
def index_html(self, id, REQUEST, RESPONSE=None): """ Create Z instance. If called with a RESPONSE, the RESPONSE will be redirected to the management screen of the new instance's parent Folder. Otherwise, the instance will be returned. """ i=mapply(self._zclass_, (), REQUEST) if not hasattr(i, 'id') or not i.id: i.id=i...
def index_html(self, id, REQUEST, RESPONSE=None): """ Create Z instance. If called with a RESPONSE, the RESPONSE will be redirected to the management screen of the new instance's parent Folder. Otherwise, the instance will be returned. """ i=mapply(self._zclass_, (), REQUEST) if not hasattr(i, 'id') or not i.id: i.id=i...
2,191
def findActions(klass, found): for b in klass.__bases__: try: for d in b.manage_options: found[d['action']]=1 findActions(b, found) except: pass
def findActions(klass, found): for b in klass.__bases__: try: for d in b.manage_options: found[d['action']]=1 findActions(b, found) except: pass
2,192
def __call__(self,*args,**kw): method=self.method if method=='PUT' and len(args)==1 and not kw: query=[args[0]] args=() else: query=[] for i in range(len(args)): try: k=self.args[i] if kw.has_key(k): raise TypeError, 'Keyword arg redefined' kw[k]=args[i] except IndexError: raise TypeError, 'Too many arguments'
def __call__(self,*args,**kw): method=self.method if method=='PUT' and len(args)==1 and not kw: query=[args[0]] args=() else: query=[] for i in range(len(args)): try: k=self.args[i] if kw.has_key(k): raise TypeError, 'Keyword arg redefined' kw[k]=args[i] except IndexError: raise TypeError, 'Too many arguments'
2,193
def do_start(self, arg): self.get_status() if not self.zd_up: args = [ self.options.python, self.options.zdrun, ] args += self._get_override("-S", "schemafile") args += self._get_override("-C", "configfile") args += self._get_override("-b", "backofflimit") args += self._get_override("-d", "daemon", flag=1) args += self...
def do_start(self, arg): self.get_status() if not self.zd_up: args = [ self.options.python, self.options.zdrun, ] args += self._get_override("-S", "schemafile") args += self._get_override("-C", "configfile") args += self._get_override("-b", "backofflimit") args += self._get_override("-d", "daemon", flag=1) args += self...
2,194
def _mp_call(self,kw, type2suffix={ type(1.0): ':float', type(1): ':int', type(1L): ':long', type([]): ':list', type(()): ':tuple', } ): # Call a function using the file-upload protcol
def _mp_call(self,kw, type2suffix={ type(1.0): ':float', type(1): ':int', type(1L): ':long', type([]): ':list', type(()): ':tuple', } ): # Call a function using the file-upload protcol
2,195
def render(self): h=self._headers s=[]
def render(self): h=self._headers s=[]
2,196
def render(self): h=self._headers s=[]
def render(self): h=self._headers s=[]
2,197
def render(self): h=self._headers s=[]
def render(self): h=self._headers s=[]
2,198
def rcdeltas(self): if _v_rcs is None: self.rcsnapshot() nc=self.refdict() rc=_v_rcs rd=[] for n, c in nc.items(): prev=rc[n] if c > prev: rd.append( (c - prev, (c, prev, n)) ) rd.sort() rd.reverse()
def rcdeltas(self): if _v_rcs is None: self.rcsnapshot() nc=self.refdict() rc=_v_rcs rd=[] for n, c in nc.items(): try: prev=rc[n] if c > prev: rd.append( (c - prev, (c, prev, n)) ) except: pass rd.sort() rd.reverse()
2,199