rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
" "
"""Provide a namspace for product "methods" """
def __bobo_traverse__(self, REQUEST, name): product=self.aq_acquire('_getProducts')()._product(name) dispatcher=FactoryDispatcher(product, self.aq_parent, REQUEST) return dispatcher.__of__(self)
a593fea82fd275dda0573d6b643f08fb9cf2e980 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a593fea82fd275dda0573d6b643f08fb9cf2e980/FactoryDispatcher.py
try out the query, <a href="%s">click hear</a>.
try out the query, <a href="%s">click here</a>.
def manage_addZSearch(self, report_id, report_title, report_style, input_id, input_title, queries=[], REQUEST=None): 'add a report' if not queries: raise ValueError, ( 'No <em>searchable objects</em> were selected') if not report_id: raise ValueError, ( 'No <em>report id</em> were specified') if input_title and not input_id: raise ValueError, ( 'No <em>input id</em> were specified') qs=map(lambda q, self=self: _getquery(self, q), queries) arguments={} keys=[] for q in qs: id=q.id if input_id: for name, arg in q._searchable_arguments().items(): if len(qs) > 1: key="%s/%s" % (id,name) else: key=name arguments[key]=arg keys.append(key) if q._searchable_result_columns() is None: raise 'Unusable Searchable Error',( """The input searchable object, <em>%s</em>, has not been tested. Until it has been tested, it\'s output schema is unknown, and a report cannot be generated. Before creating a report from this query, you must try out the query. To try out the query, <a href="%s">click hear</a>. """ % (q.title_and_id(), id)) if input_id: arguments=Args(arguments, keys) self.manage_addDocument( input_id,input_title, default_input_form(arguments, report_id)) self.manage_addDocument( report_id,report_title, ('<!--#var standard_html_header-->\n%s\n' '<!--#var standard_html_footer-->' % join(map(lambda q, report_style=report_style: custom_default_report(q.id, q, no_table=report_style), qs), '\n<hr>\n'))) if REQUEST: return self.manage_main(self,REQUEST)
b9165f07608a289ec21bf487be71fd63f59c07d9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b9165f07608a289ec21bf487be71fd63f59c07d9/Search.py
self.munge(file.read())
if type(file) is not type(''): file=file.read() self.munge(file)
def manage_upload(self,file='', REQUEST=None): """Replace the contents of the document with the text in file.""" self._validateProxy(REQUEST) self.munge(file.read()) if REQUEST: return MessageDialog( title ='Success!', message='Your changes have been saved', action ='manage_main')
2f3bb36458683a5b36f69808ada85c2ec340fb10 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/2f3bb36458683a5b36f69808ada85c2ec340fb10/DTMLMethod.py
ms=string.split(ms, ';')[0]
ms=split(ms, ';')[0]
def _init_headers(self, request, response): # Attempt to handle If-Modified-Since headers. ms=request.get_header('If-Modified-Since', None) if ms is not None: ms=string.split(ms, ';')[0] ms=DateTime(ms).timeTime() if self.lmt > ms: RESPONSE.setStatus(304) return RESPONSE response.setHeader('Content-Type', self.content_type) response.setHeader('Last-Modified', self.lmh)
a9030504ffed9d20e170907b2460b8cecf2469d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a9030504ffed9d20e170907b2460b8cecf2469d0/ImageFile.py
RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', 'inline;filename=%s.%s' % (id, suffix))
if RESPONSE is not None: RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', 'inline;filename=%s.%s' % (id, suffix))
def manage_exportObject(self, id='', download=None, toxml=None, RESPONSE=None): """Exports an object to a file and returns that file.""" if not id: # can't use getId() here (breaks on "old" exported objects) id=self.id if hasattr(id, 'im_func'): id=id() ob=self else: ob=self._getOb(id)
a78f509aea5675cb1d229a42deaca449cf1e11c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a78f509aea5675cb1d229a42deaca449cf1e11c2/ObjectManager.py
raise 'Bad Request', 'Invalid file name %s' % file
raise BadRequestException, 'Invalid file name %s' % file
def manage_importObject(self, file, REQUEST=None, set_owner=1): """Import an object from a file""" dirname, file=os.path.split(file) if dirname: raise 'Bad Request', 'Invalid file name %s' % file
a78f509aea5675cb1d229a42deaca449cf1e11c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a78f509aea5675cb1d229a42deaca449cf1e11c2/ObjectManager.py
raise 'Bad Request', 'File does not exist: %s' % file
raise BadRequestException, 'File does not exist: %s' % file
def manage_importObject(self, file, REQUEST=None, set_owner=1): """Import an object from a file""" dirname, file=os.path.split(file) if dirname: raise 'Bad Request', 'Invalid file name %s' % file
a78f509aea5675cb1d229a42deaca449cf1e11c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a78f509aea5675cb1d229a42deaca449cf1e11c2/ObjectManager.py
RESPONSE.redirect(SCRIPT_NAME+'HelpSys/hs_index')
RESPONSE.redirect(SCRIPT_NAME+'/HelpSys/hs_index')
def manage_help(self, RESPONSE, SCRIPT_NAME): "Help!" RESPONSE.redirect(SCRIPT_NAME+'HelpSys/hs_index') return ''
9bebeb24945e09dc3f2728adee8070daded1c95d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9bebeb24945e09dc3f2728adee8070daded1c95d/Management.py
help_option_=({'label': 'Help', 'action': 'manage_help'},),
help_option_=({'label': 'Help', 'action': 'manage_help', },),
def filtered_manage_options( self, REQUEST=None, help_option_=({'label': 'Help', 'action': 'manage_help'},), ): if REQUEST is None: if hasattr(self, 'REQUEST'): REQUEST=self.REQUEST try: user=REQUEST['AUTHENTICATED_USER'] except: user=None result=[] seen_roles={}
9bebeb24945e09dc3f2728adee8070daded1c95d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9bebeb24945e09dc3f2728adee8070daded1c95d/Management.py
self._info = self._setupDB('info')
def _setupDBs(self): # Data Type Assumptions: # # - Object ids (oid) are 8-bytes # - Objects have revisions, with each revision being identified by a # unique serial number. We sometimes refer to 16-byte strings of # oid+serial as a revision id. # - Transaction ids (tid) are 8-bytes # - Version ids (vid) are 8-bytes # - Data pickles are of arbitrary length # # The Full storage uses the following tables: # # serials -- {oid -> [serial | serial+tid]} # Maps oids to serial numbers, to make it easy to look up the # serial number for the current revision of the object. The value # combined with the oid provides a revision id (revid) which is # used to point into the other tables. Usually the serial is the # tid of the transaction that modified the object, except in the # case of abortVersion(). Here, the serial number of the object # won't change (by definition), but of course the abortVersion() # happens in a new transaction so the tid pointer must change. To # handle this rare case, the value in the serials table can be a # 16-byte value, in which case it will contain both the serial # number and the tid pointer. # # metadata -- {oid+tid -> vid+nvrevid+lrevid+previd} # Maps object revisions to object metadata. This mapping is used # to find other information about a particular concrete object # revision. Essentially it stitches all the other pieces # together. The object revision is identified by the tid of the # transaction in which the object was modified. Normally this # will be the serial number (IOW, the serial number and tid will # be the same value), except in the case of abortVersion(). See # above for details. # # vid is the id of the version this object revision was modified # in. It will be zero if the object was modified in the # non-version. # # nvrevid is the tid pointing to the most current non-version # object revision. So, if the object is living in a version and # that version is aborted, the nvrevid points to the object # revision that will soon be restored. nvrevid will be zero if # the object was never modified in a version. # # lrevid is the tid pointing to object revision's pickle state (I # think of it as the "live revision id" since it's the state that # gives life to the object described by this metadata record). # # prevrevid is the tid pointing to the previous state of the # object. This is used for undo. # # txnMetadata -- {tid -> userlen+desclen+user+desc+ext} # Maps tids to metadata about a transaction. # # userlen is the length in characters of the `user' field as an # 8-byte unsigned long integer # desclen is the length in characters of the `desc' field as an # 8-byte unsigned long integer # user is the user information passed to tpc_finish() # desc is the description info passed to tpc_finish() # ext is the extra info passed to tpc_finish(). It is a # dictionary that we get already pickled by BaseStorage. # # pickles -- {oid+serial -> pickle} # Maps the object revisions to the revision's pickle data. # # refcounts -- {oid -> count} # Maps the oid to the reference count for the object. This # reference count is updated during the _finish() call. In the # Full storage the refcounts include all the revisions of the # object, so it is never decremented except at pack time. When it # goes to zero, the object is automatically deleted. # # txnoids -- {tid -> [oid]} # Maps transaction ids to the oids of the objects modified by the # transaction. # # pickleRefcounts -- {oid+tid -> count} # Maps an object revision to the reference count of that # revision's pickle. In the face of transactional undo, multiple # revisions can point to a single pickle so that pickle can't be # garbage collected until there are no revisions pointing to it. # # vids -- {version_string -> vid} # Maps version strings (which are arbitrary) to vids. # # versions -- {vid -> version_string} # Maps vids to version strings. # # currentVersions -- {vid -> [oid + tid]} # Maps vids to the revids of the objects modified in that version # for all current versions (except the 0th version, which is the # non-version). # # oids -- [oid] # This is a list of oids of objects that are modified in the # current uncommitted transaction. # # pvids -- [vid] # This is a list of all the version ids that have been created in # the current uncommitted transaction. # # prevrevids -- {oid -> tid} # This is a list of previous revision ids for objects which are # modified by transactionalUndo in the current uncommitted # transaction. It's necessary to properly handle multiple # transactionalUndo()'s in a single ZODB transaction. # # pending -- tid -> 'A' | 'C' # This is an optional flag which says what to do when the database # is recovering from a crash. The flag is normally 'A' which # means any pending data should be aborted. At the start of the # tpc_finish() this flag will be changed to 'C' which means, upon # recovery/restart, all pending data should be committed. Outside # of any transaction (e.g. before the tpc_begin()), there will be # no pending entry. It is a database invariant that if the # pending table is empty, the oids, pvids, and prevrevids tables # must also be empty. # # info -- {key -> value} # This table contains storage metadata information. The keys and # values are simple strings of variable length. Here are the # valid keys: # # packtime - time of the last pack. It is illegal to undo to # before the last pack time. # # version - the version of the database (reserved for ZODB4) # # objrevs -- {newserial+oid -> oldserial} # This table collects object revision information for packing # purposes. Every time a new object revision is committed, we # write an entry to this table. When we run pack, we iterate from # the start of this table until newserial > packtime, deleting old # revisions of objects. Note that when a new revision of an # object is first written to a version, no entry is written here. # We do write an entry when we commit or abort the version. # # delqueue -- [oid] # This is also a Queue, not a BTree. It is used during pack to # list objects for which no more references exist, such that the # objects can be completely packed away. # # packmark -- [oid] # Every object reachable from the root during a classic pack # operation will have its oid present in this table. # # oidqueue -- [oid] # This table is a Queue, not a BTree. It is used during the mark # phase of pack() and contains a list of oids for work to be done. # self._serials = self._setupDB('serials', db.DB_DUP) self._pickles = self._setupDB('pickles') self._refcounts = self._setupDB('refcounts') # Temporary tables which keep information during ZODB transactions self._oids = self._setupDB('oids') self._pvids = self._setupDB('pvids') self._prevrevids = self._setupDB('prevrevids') self._pending = self._setupDB('pending') # Other tables self._vids = self._setupDB('vids') self._versions = self._setupDB('versions') self._currentVersions = self._setupDB('currentVersions', db.DB_DUP) self._metadata = self._setupDB('metadata') self._txnMetadata = self._setupDB('txnMetadata') self._txnoids = self._setupDB('txnoids', db.DB_DUP) self._pickleRefcounts = self._setupDB('pickleRefcounts') # Tables to support packing. self._objrevs = self._setupDB('objrevs', db.DB_DUP) self._packmark = self._setupDB('packmark') self._info = self._setupDB('info') self._oidqueue = self._setupDB('oidqueue', 0, db.DB_QUEUE, 8) self._delqueue = self._setupDB('delqueue', 0, db.DB_QUEUE, 8) # Do recovery and consistency checks self._withlock(self._dorecovery)
80e75665c329591976bf34c0866815d4110a4a16 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80e75665c329591976bf34c0866815d4110a4a16/BDBFullStorage.py
self._oids.truncate(txn)
def _docommit(self, txn, tid): self._pending.put(self._serial, COMMIT, txn) # Almost all the data's already written by now so we don't need to do # much more than update reference counts. Even there, our work is # easy because we're not going to decref anything here. 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() # Get the pointer to the live pickle data for this revision metadata = self._metadata[oid + self._serial] lrevid = unpack('>8s', metadata[16:24])[0] # Incref all objects referenced by this pickle, but watch out # for the George Bailey Event, which has no pickle. if lrevid <> DNE: revid = oid + lrevid data = self._pickles[revid] self._update(deltas, data, 1) # Incref this pickle; there's a new revision pointing to it refcount = self._pickleRefcounts.get(revid, ZERO, txn=txn) self._pickleRefcounts.put(revid, incr(refcount, 1), txn=txn) # Now delete all entries from the serials table where the # stored tid is not equal to the committing tid. srec = cs.set(oid) while srec: soid, data = srec if soid <> oid: break if len(data) == 8: stid = data else: # In the face of abortVersion, the first half is the # serial number and the second half is the tid. stid = data[8:] if stid <> tid: cs.delete() srec = cs.next_dup() finally: # There's a small window of opportunity for leaking a cursor here, # if co.close() were to fail. In practice this shouldn't happen. if co: co.close() if cs: cs.close() # Now incref all the object refcounts for oid, delta in deltas.items(): refcount = self._refcounts.get(oid, ZERO, txn=txn) self._refcounts.put(oid, incr(refcount, delta), txn=txn) # Now clean up the temporary log tables self._oids.truncate(txn) self._pvids.truncate(txn) self._prevrevids.truncate(txn) self._pending.truncate(txn)
80e75665c329591976bf34c0866815d4110a4a16 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/80e75665c329591976bf34c0866815d4110a4a16/BDBFullStorage.py
_stupid_dest(format_exception(
_stupid_dest.write(format_exception(
def stupid_log_write(subsystem, severity, summary, detail, error): if severity < 0: return global _stupid_dest if _stupid_dest is None: import os if os.environ.has_key('STUPID_LOG_FILE'): f=os.environ['STUPID_LOG_FILE'] if f: _stupid_dest=open(f,'a') else: import sys _stupid_dest=sys.stderr else: _stupid_dest=_no_stupid_log if _stupid_dest is _no_stupid_log: return _stupid_dest.write( "------\n" "%s %s %s %s\n%s" % (log_time(), severity_string(severity), subsystem, summary, detail, ) ) _stupid_dest.flush() if error: try: _stupid_dest(format_exception( error[0], error[1], error[2], trailer='\n', limit=100)) except: _stupid_dest("%s: %s\n" % error[:2])
c222ef9a51ed468e124f5d72b36b93472e35cb7c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c222ef9a51ed468e124f5d72b36b93472e35cb7c/zLOG.py
_stupid_dest("%s: %s\n" % error[:2])
_stupid_dest.write("%s: %s\n" % error[:2])
def stupid_log_write(subsystem, severity, summary, detail, error): if severity < 0: return global _stupid_dest if _stupid_dest is None: import os if os.environ.has_key('STUPID_LOG_FILE'): f=os.environ['STUPID_LOG_FILE'] if f: _stupid_dest=open(f,'a') else: import sys _stupid_dest=sys.stderr else: _stupid_dest=_no_stupid_log if _stupid_dest is _no_stupid_log: return _stupid_dest.write( "------\n" "%s %s %s %s\n%s" % (log_time(), severity_string(severity), subsystem, summary, detail, ) ) _stupid_dest.flush() if error: try: _stupid_dest(format_exception( error[0], error[1], error[2], trailer='\n', limit=100)) except: _stupid_dest("%s: %s\n" % error[:2])
c222ef9a51ed468e124f5d72b36b93472e35cb7c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c222ef9a51ed468e124f5d72b36b93472e35cb7c/zLOG.py
self.headers[n]=value
self.headers[name]=value
def setHeader(self, name, value): self.headers[n]=value
9f9b7a24d55086a04c10843626094b465611634b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9f9b7a24d55086a04c10843626094b465611634b/BaseResponse.py
result=self.getUser(id) return result.__of__(self)
return self.getUser(id)
def getUserById(self, id, default=_marker): """Return the user corresponding to the given id. """ # The connection between getting by ID and by name is not a strong # one try: result=self.getUser(id) return result.__of__(self) # Wrap in our context except: if default is _marker: raise return default
99272e487ca4223ec3efc995fdf17d7add020fdd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/99272e487ca4223ec3efc995fdf17d7add020fdd/User.py
('index_html', 'tag', 'view_image_or_file', 'getSize',
('index_html', 'view_image_or_file', 'getSize',
def manage_addFile(self,id,file='',title='',precondition='', content_type='', REQUEST=None): """Add a new File object. Creates a new File object 'id' with the contents of 'file'""" id, title = cookId(id, title, file) self=self.this() # First, we create the file without data: self._setObject(id, File(id,title,'',content_type, precondition)) # Now we "upload" the data. By doing this in two steps, we # can use a database trick to make the upload more efficient. self._getOb(id).manage_upload(file) if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')
bb92612264edb3b60804857c5d923bcd563641bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bb92612264edb3b60804857c5d923bcd563641bc/Image.py
LOG('Transience', WARNING, ('Transient object container %s max subobjects ' 'reached' % self.getId()) )
LOG.warn('Transient object container %s max subobjects ' 'reached' % self.getId())
def __setitem__(self, k, v): DEBUG and TLOG('__setitem__: called with key %s, value %s' % (k,v)) if self._timeout_slices: current_ts = getCurrentTimeslice(self._period) else: current_ts = 0 item = self._move_item(k, current_ts, _marker) STRICT and _assert(self._data.has_key(current_ts)) if item is _marker: # the key didnt already exist, this is a new item
791ea4a915270f180becd9581650dc98d0d998e4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/791ea4a915270f180becd9581650dc98d0d998e4/Transience.py
LOG('Transience', WARNING, err % (callback, '/'.join(path)), error=sys.exc_info() )
LOG.warn(err % (callback, '/'.join(path)), exc_info=sys.exc_info())
def _getCallback(self, callback): if not callback: return None if type(callback) is type(''): try: method = self.unrestrictedTraverse(callback) except (KeyError, AttributeError): path = self.getPhysicalPath() err = 'No such onAdd/onDelete method %s referenced via %s' LOG('Transience', WARNING, err % (callback, '/'.join(path)), error=sys.exc_info() ) return else: method = callback return method
791ea4a915270f180becd9581650dc98d0d998e4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/791ea4a915270f180becd9581650dc98d0d998e4/Transience.py
LOG('Transience', WARNING, '%s failed when calling %s in %s' % (name,callback, '/'.join(path)), error=sys.exc_info() )
LOG.warn('%s failed when calling %s in %s' % (name,callback, '/'.join(path)), exc_info=sys.exc_info())
def _notify(self, item, callback, name): if callable(callback): sm = getSecurityManager() try: user = sm.getUser() try: newSecurityManager(None, nobody) callback(item, self) except: # dont raise, just log path = self.getPhysicalPath() LOG('Transience', WARNING, '%s failed when calling %s in %s' % (name,callback, '/'.join(path)), error=sys.exc_info() ) finally: setSecurityManager(sm) else: err = '%s in %s attempted to call non-callable %s' path = self.getPhysicalPath() LOG('Transience', WARNING, err % (name, '/'.join(path), callback), error=sys.exc_info() )
791ea4a915270f180becd9581650dc98d0d998e4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/791ea4a915270f180becd9581650dc98d0d998e4/Transience.py
LOG('Transience', WARNING, err % (name, '/'.join(path), callback), error=sys.exc_info() )
LOG.warn(err % (name, '/'.join(path), callback), exc_info=sys.exc_info())
def _notify(self, item, callback, name): if callable(callback): sm = getSecurityManager() try: user = sm.getUser() try: newSecurityManager(None, nobody) callback(item, self) except: # dont raise, just log path = self.getPhysicalPath() LOG('Transience', WARNING, '%s failed when calling %s in %s' % (name,callback, '/'.join(path)), error=sys.exc_info() ) finally: setSecurityManager(sm) else: err = '%s in %s attempted to call non-callable %s' path = self.getPhysicalPath() LOG('Transience', WARNING, err % (name, '/'.join(path), callback), error=sys.exc_info() )
791ea4a915270f180becd9581650dc98d0d998e4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/791ea4a915270f180becd9581650dc98d0d998e4/Transience.py
return Globals.Bobobase['roles']
return self.validRoles()
def roleNames(self):
03ea3d634dad01c0a360c366495b082d479be0ad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/03ea3d634dad01c0a360c366495b082d479be0ad/User.py
if not headers.has_key('content-type') and self.status == 200: self.setStatus('nocontent')
def __str__(self, html_search=regex.compile('<html>',regex.casefold).search, ): if self._wrote: return '' # Streaming output was used.
a925db54a85961bd5dbc4796caea38cd3a2b8842 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a925db54a85961bd5dbc4796caea38cd3a2b8842/HTTPResponse.py
clip_data='',REQUEST):
clip_data='',REQUEST=None):
def manage_delObjects(self,ids=[],submit='',clip_id='', clip_data='',REQUEST):
cdb01db9a51220abc79c0c4f82587a840291749d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cdb01db9a51220abc79c0c4f82587a840291749d/ObjectManager.py
self.parser = None
self.parser = self.feed = None
def close(self): try: self.parser.close() finally: self.parser = None # nuke circular reference
f3d2bed37601fc63f5fdc5186947ed6c075aa046 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f3d2bed37601fc63f5fdc5186947ed6c075aa046/xmlrpclib.py
This method will cause this object to get reindexed. Of this
This method will cause this object to get reindexed. If this
def reindex_all(self, obj=None): """
81e8827b3f635cfb7e8ebbdac33846cef76e8985 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/81e8827b3f635cfb7e8ebbdac33846cef76e8985/CatalogAwarenessInterface.py
if SUPPORTS_WEBDAV_LOCKS: __implements__ = (WriteLockInterface,)
__implements__ = (WriteLockInterface,)
def __call__(self, REQUEST, RESPONSE): " " return self.document_src(REQUEST)
f2ef0f2f16bbaf45b36f5477dd3688c339382292 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f2ef0f2f16bbaf45b36f5477dd3688c339382292/ZopePageTemplate.py
if SUPPORTS_WEBDAV_LOCKS and self.wl_isLocked():
if self.wl_isLocked():
def pt_editAction(self, REQUEST, title, text, content_type, expand): """Change the title and document.""" if SUPPORTS_WEBDAV_LOCKS and self.wl_isLocked(): raise ResourceLockedError, "File is locked via WebDAV" self.expand=expand self.pt_setTitle(title) self.pt_edit(text, content_type) REQUEST.set('text', self.read()) # May not equal 'text'! REQUEST.set('title', self.title) message = "Saved changes." if getattr(self, '_v_warnings', None): message = ("<strong>Warning:</strong> <i>%s</i>" % '<br>'.join(self._v_warnings)) return self.pt_editForm(manage_tabs_message=message)
f2ef0f2f16bbaf45b36f5477dd3688c339382292 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f2ef0f2f16bbaf45b36f5477dd3688c339382292/ZopePageTemplate.py
if SUPPORTS_WEBDAV_LOCKS and self.wl_isLocked():
if self.wl_isLocked():
def pt_upload(self, REQUEST, file='', charset=None): """Replace the document with the text in file.""" if SUPPORTS_WEBDAV_LOCKS and self.wl_isLocked(): raise ResourceLockedError, "File is locked via WebDAV"
f2ef0f2f16bbaf45b36f5477dd3688c339382292 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f2ef0f2f16bbaf45b36f5477dd3688c339382292/ZopePageTemplate.py
if SUPPORTS_WEBDAV_LOCKS: self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
def PUT(self, REQUEST, RESPONSE): """ Handle HTTP PUT requests """ self.dav__init(REQUEST, RESPONSE) if SUPPORTS_WEBDAV_LOCKS: self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1) self.write(REQUEST.get('BODY', '')) RESPONSE.setStatus(204) return RESPONSE
f2ef0f2f16bbaf45b36f5477dd3688c339382292 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f2ef0f2f16bbaf45b36f5477dd3688c339382292/ZopePageTemplate.py
if not SUPPORTS_WEBDAV_LOCKS: def wl_isLocked(self): return 0
def pt_source_file(self): """Returns a file name to be compiled into the TAL code.""" try: return '/'.join(self.getPhysicalPath()) except: # This page template is being compiled without an # acquisition context, so we don't know where it is. :-( return None
f2ef0f2f16bbaf45b36f5477dd3688c339382292 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f2ef0f2f16bbaf45b36f5477dd3688c339382292/ZopePageTemplate.py
examples_path = os.path.join(Globals.data_dir, 'Examples.zexp')
examples_path = os.path.join(Globals.INSTANCE_HOME, 'import', 'Examples.zexp')
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 introduction of certain system objects such as those # which provide Lever support. # b/c: Ensure that Control Panel exists. if not hasattr(app, 'Control_Panel'): cpl=ApplicationManager() cpl._init() app._setObject('Control_Panel', cpl) get_transaction().note('Added Control_Panel') get_transaction().commit() # b/c: Ensure that a ProductFolder exists. if not hasattr(app.Control_Panel.aq_base, 'Products'): app.Control_Panel.Products=App.Product.ProductFolder() get_transaction().note('Added Control_Panel.Products') get_transaction().commit() # Ensure that a temp folder exists if not hasattr(app, 'temp_folder'): from Products.TemporaryFolder.TemporaryFolder import \ MountedTemporaryFolder tf = MountedTemporaryFolder('temp_folder','Temporary Folder') app._setObject('temp_folder', tf) get_transaction().note('Added temp_folder') get_transaction().commit() del tf # Ensure that there is a transient container in the temp folder tf = app.temp_folder if not hasattr(tf, 'session_data'): env_has = os.environ.get from Products.Transience.Transience import TransientObjectContainer addnotify = env_has('ZSESSION_ADD_NOTIFY', None) delnotify = env_has('ZSESSION_DEL_NOTIFY', None) default_limit = 1000 limit = env_has('ZSESSION_OBJECT_LIMIT', default_limit) try: limit=int(limit) if limit != default_limit: LOG('Zope Default Object Creation', INFO, ('using ZSESSION_OBJECT_LIMIT-specified max objects ' 'value of %s' % limit)) except ValueError: LOG('Zope Default Object Creation', WARNING, ('Noninteger value %s specified for ZSESSION_OBJECT_LIMIT, ' 'defaulting to %s' % (limit, default_limit))) limit = default_limit if addnotify and app.unrestrictedTraverse(addnotify, None) is None: LOG('Zope Default Object Creation', WARNING, ('failed to use nonexistent "%s" script as ' 'ZSESSION_ADD_NOTIFY' % addnotify)) addnotify=None elif addnotify: LOG('Zope Default Object Creation', INFO, 'using %s as add notification script' % addnotify) if delnotify and app.unrestrictedTraverse(delnotify, None) is None: LOG('Zope Default Object Creation', WARNING, ('failed to use nonexistent "%s" script as ' 'ZSESSION_DEL_NOTIFY' % delnotify)) delnotify=None elif delnotify: LOG('Zope Default Object Creation', INFO, 'using %s as delete notification script' % delnotify) toc = TransientObjectContainer('session_data', 'Session Data Container', addNotification = addnotify, delNotification = delnotify, limit=limit) timeout_spec = env_has('ZSESSION_TIMEOUT_MINS', '') if timeout_spec: try: timeout_spec = int(timeout_spec) except ValueError: LOG('Zope Default Object Creation', WARNING, ('"%s" is an illegal value for ZSESSION_TIMEOUT_MINS, ' 'using default timeout instead.' % timeout_spec)) else: LOG('Zope Default Object Creation', INFO, ('using ZSESSION_TIMEOUT_MINS-specified session timeout ' 'value of %s' % timeout_spec)) toc = TransientObjectContainer('session_data', 'Session Data Container', timeout_mins = timeout_spec, addNotification=addnotify, delNotification = delnotify, limit=limit) tf._setObject('session_data', toc) tf_reserved = getattr(tf, '_reserved_names', ()) if 'session_data' not in tf_reserved: tf._reserved_names = tf_reserved + ('session_data',) get_transaction().note('Added session_data to temp_folder') get_transaction().commit() del toc del addnotify del delnotify del timeout_spec del env_has del tf # Ensure that a browser ID manager exists if not hasattr(app, 'browser_id_manager'): from Products.Sessions.BrowserIdManager import BrowserIdManager bid = BrowserIdManager('browser_id_manager', 'Browser Id Manager') app._setObject('browser_id_manager', bid) get_transaction().note('Added browser_id_manager') get_transaction().commit() del bid # Ensure that a session data manager exists if not hasattr(app, 'session_data_manager'): from Products.Sessions.SessionDataManager import SessionDataManager sdm = SessionDataManager('session_data_manager', title='Session Data Manager', path='/temp_folder/session_data', requestName='SESSION') app._setObject('session_data_manager', sdm) get_transaction().note('Added session_data_manager') get_transaction().commit() del sdm # Ensure that there's an Examples folder with examples. # However, make sure that if the examples have been added already # and then deleted that we don't add them again. if not hasattr(app, 'Examples') and not \ hasattr(app, '_Zope25_examples_have_been_added'): examples_path = os.path.join(Globals.data_dir, 'Examples.zexp') if os.path.isfile(examples_path): app._importObjectFromFile(examples_path, verify=0) app._Zope25_examples_have_been_added=1 get_transaction().note('Added Examples folder') get_transaction().commit() else: LOG('Zope Default Object Creation', INFO, '%s examples import file could not be found.' % examples_path) # b/c: Ensure that Owner role exists. if hasattr(app, '__ac_roles__') and not ('Owner' in app.__ac_roles__): app.__ac_roles__=app.__ac_roles__ + ('Owner',) get_transaction().note('Added Owner role') get_transaction().commit() # ensure the Authenticated role exists. if hasattr(app, '__ac_roles__'): if not 'Authenticated' in app.__ac_roles__: app.__ac_roles__=app.__ac_roles__ + ('Authenticated',) get_transaction().note('Added Authenticated role') get_transaction().commit() # Make sure we have Globals root=app._p_jar.root() if not root.has_key('ZGlobals'): import BTree app._p_jar.root()['ZGlobals']=BTree.BTree() get_transaction().note('Added Globals') get_transaction().commit() # Install the initial user. if hasattr(app, 'acl_users'): users = app.acl_users if hasattr(users, '_createInitialUser'): app.acl_users._createInitialUser() get_transaction().note('Created initial user') get_transaction().commit() install_products(app) install_standards(app) # Note that the code from here on only runs if we are not a ZEO # client, or if we are a ZEO client and we've specified by way # of env variable that we want to force products to load. if (os.environ.get('ZEO_CLIENT') and not os.environ.get('FORCE_PRODUCT_LOAD')): return # Check for dangling pointers (broken zclass dependencies) in the # global class registry. If found, rebuild the registry. Note that # if the check finds problems but fails to successfully rebuild the # registry we abort the transaction so that we don't leave it in an # indeterminate state. did_fixups=0 bad_things=0 try: if app.checkGlobalRegistry(): LOG('Zope', INFO, 'Beginning attempt to rebuild the global ZClass registry.') app.fixupZClassDependencies(rebuild=1) did_fixups=1 LOG('Zope', INFO, 'The global ZClass registry has successfully been rebuilt.') get_transaction().note('Rebuilt global product registry') get_transaction().commit() except: bad_things=1 LOG('Zope', ERROR, 'The attempt to rebuild the registry failed.', error=sys.exc_info()) get_transaction().abort() # Now we need to see if any (disk-based) products were installed # during intialization. If so (and the registry has no errors), # there may still be zclasses dependent on a base class in the # newly installed product that were previously broken and need to # be fixed up. If any really Bad Things happened (dangling pointers # were found in the registry but it couldn't be rebuilt), we don't # try to do anything to avoid making the problem worse. if (not did_fixups) and (not bad_things): # App.Product.initializeProduct will set this if a disk-based # product was added or updated and we are not a ZEO client. if getattr(Globals, '__disk_product_installed__', 0): try: LOG('Zope', INFO, 'New disk product detected, determining '\ 'if we need to fix up any ZClasses.') if app.fixupZClassDependencies(): LOG('Zope', INFO, 'Repaired broken ZClass dependencies.') get_transaction().commit() except: LOG('Zope', ERROR, 'Attempt to fixup ZClass dependencies after detecting ' \ 'an updated disk-based product failed.', error=sys.exc_info()) get_transaction().abort()
8d4b0eb4deeaa6a82d3c4fde25b6e3478dafb8ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8d4b0eb4deeaa6a82d3c4fde25b6e3478dafb8ef/Application.py
product_names.remove("PluginIndexes") product_names.insert(0,"PluginIndexes")
if "PluginIndexes" in product_names: product_names.remove("PluginIndexes") product_names.insert(0,"PluginIndexes")
def import_products(): # Try to import each product, checking for and catching errors. done={} for product_dir in Products.__path__: product_names=os.listdir(product_dir) product_names.sort() # Hack !!! # We must initialize the PluginIndexes first before # all other products (ajung) product_names.remove("PluginIndexes") product_names.insert(0,"PluginIndexes") for product_name in product_names: if done.has_key(product_name): continue done[product_name]=1 import_product(product_dir, product_name)
f2c505d6975a0bdc107e97d308f0d86aacebc8bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f2c505d6975a0bdc107e97d308f0d86aacebc8bb/Application.py
product_names.remove("PluginIndexes") product_names.insert(0,"PluginIndexes")
if "PluginIndexes" in product_names: product_names.remove("PluginIndexes") product_names.insert(0,"PluginIndexes")
def install_products(app): # Install a list of products into the basic folder class, so # that all folders know about top-level objects, aka products folder_permissions = get_folder_permissions() meta_types=[] done={} get_transaction().note('Prior to product installs') get_transaction().commit() for product_dir in Products.__path__: product_names=os.listdir(product_dir) product_names.sort() # Hack !!! # We must initialize the PluginIndexes first before # all other products (ajung) product_names.remove("PluginIndexes") product_names.insert(0,"PluginIndexes") for product_name in product_names: # For each product, we will import it and try to call the # intialize() method in the product __init__ module. If # the method doesnt exist, we put the old-style information # together and do a default initialization. if done.has_key(product_name): continue done[product_name]=1 install_product(app, product_dir, product_name, meta_types, folder_permissions) Products.meta_types=Products.meta_types+tuple(meta_types) Globals.default__class_init__(Folder.Folder)
f2c505d6975a0bdc107e97d308f0d86aacebc8bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/f2c505d6975a0bdc107e97d308f0d86aacebc8bb/Application.py
BUILD_BASE=os.path.join(os.getcwd(), 'build-base')
BUILD_BASE=os.path.join(os.getcwd(), 'build-base', 'python-%s.%s' % sys.version_info[:2])
def main(): # below assumes this script is in the BASE_DIR/inst directory global PREFIX BASE_DIR=os.path.abspath(os.path.dirname(os.path.dirname(sys.argv[0]))) BUILD_BASE=os.path.join(os.getcwd(), 'build-base') PYTHON=sys.executable MAKEFILE=open(os.path.join(BASE_DIR, 'inst', IN_MAKEFILE)).read() REQUIRE_LF_ENABLED = 1 REQUIRE_ZLIB = 1 REQUIRE_EXPAT = 1 INSTALL_FLAGS = '' DISTUTILS_OPTS = '' try: longopts = ['help', 'ignore-largefile', 'ignore-zlib', 'ignore-expat', 'prefix=', 'build-base=', 'optimize', 'no-compile', 'quiet'] opts, args = getopt.getopt(sys.argv[1:], 'h', longopts) except getopt.GetoptError, v: print v usage() sys.exit(1) for o, a in opts: if o in ('-h', '--help'): usage() sys.exit() if o == '--prefix': PREFIX=os.path.abspath(os.path.expanduser(a)) if o == '--ignore-largefile': REQUIRE_LF_ENABLED=0 if o == '--ignore-zlib': REQUIRE_ZLIB=0 if o == '--ignore-expat': REQUIRE_EXPAT=0 if o == '--optimize': INSTALL_FLAGS = '--optimize=1 --no-compile' if o == '--no-compile': INSTALL_FLAGS = '--no-compile' if o == '--build-base': BUILD_BASE = a if o == '--quiet': DISTUTILS_OPTS = '-q' global QUIET QUIET = 1 if REQUIRE_LF_ENABLED: test_largefile() if REQUIRE_ZLIB: test_zlib() if REQUIRE_EXPAT: test_expat() out(' - Zope top-level binary directory will be %s.' % PREFIX) if INSTALL_FLAGS: out(' - Distutils install flags will be "%s"' % INSTALL_FLAGS) idata = { '<<PYTHON>>':PYTHON, '<<PREFIX>>':PREFIX, '<<BASE_DIR>>':BASE_DIR, '<<BUILD_BASE>>':BUILD_BASE, '<<INSTALL_FLAGS>>':INSTALL_FLAGS, '<<ZOPE_MAJOR_VERSION>>':versions.ZOPE_MAJOR_VERSION, '<<ZOPE_MINOR_VERSION>>':versions.ZOPE_MINOR_VERSION, '<<VERSION_RELEASE_TAG>>':versions.VERSION_RELEASE_TAG, '<<DISTUTILS_OPTS>>':DISTUTILS_OPTS, } for k,v in idata.items(): MAKEFILE = MAKEFILE.replace(k, v) f = open(os.path.join(os.getcwd(), 'makefile'), 'w') f.write(MAKEFILE) out(' - Makefile written.') out('') out(' Next, run %s.' % MAKE_COMMAND) out('')
4c4e9ebfb122024d2ba9a6fcdfb6d8dbbe22e2b5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4c4e9ebfb122024d2ba9a6fcdfb6d8dbbe22e2b5/configure.py
try: return d[key] except KeyError, AttributeError: pass
try: return d[key] except (KeyError, AttributeError): pass
def __getitem__(self, key): for d in self.dicts: try: return d[key] except KeyError, AttributeError: pass raise KeyError, key
4ca1105a43cc9259bcab8a940fdb62f8d5c0d618 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ca1105a43cc9259bcab8a940fdb62f8d5c0d618/pDocumentTemplate.py
if name and name[:1] in '@+':
if name and name[:1] in '@+' and name != '+':
def unrestrictedTraverse(self, path, default=_marker, restricted=False): """Lookup an object by path.
7a52c20df63640f18c3d99246a2961ffa6558742 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7a52c20df63640f18c3d99246a2961ffa6558742/Traversable.py
einfo = sys.exc_info() if type(einfo[0])==type(''): errname = einfo[0]
t,v = sys.exc_info()[:2] if type(t)==type(''): errname = t
def render(self, md): # first we try to render the first block try: return render_blocks(self.section, md) except: # but an error occurs.. save the info. einfo = sys.exc_info() if type(einfo[0])==type(''): errname = einfo[0] else: errname = einfo[0].__name__
e5fa056505edfb80e052e4d5b196c1c09b21fa20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e5fa056505edfb80e052e4d5b196c1c09b21fa20/DT_Try.py
errname = einfo[0].__name__
errname = t.__name__
def render(self, md): # first we try to render the first block try: return render_blocks(self.section, md) except: # but an error occurs.. save the info. einfo = sys.exc_info() if type(einfo[0])==type(''): errname = einfo[0] else: errname = einfo[0].__name__
e5fa056505edfb80e052e4d5b196c1c09b21fa20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e5fa056505edfb80e052e4d5b196c1c09b21fa20/DT_Try.py
handler = self.find_handler(einfo[0])
handler = self.find_handler(t)
def render(self, md): # first we try to render the first block try: return render_blocks(self.section, md) except: # but an error occurs.. save the info. einfo = sys.exc_info() if type(einfo[0])==type(''): errname = einfo[0] else: errname = einfo[0].__name__
e5fa056505edfb80e052e4d5b196c1c09b21fa20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e5fa056505edfb80e052e4d5b196c1c09b21fa20/DT_Try.py
ns = namespace(self, error_type=errname, error_value=einfo[1],
ns = namespace(self, error_type=errname, error_value=v,
def render(self, md): # first we try to render the first block try: return render_blocks(self.section, md) except: # but an error occurs.. save the info. einfo = sys.exc_info() if type(einfo[0])==type(''): errname = einfo[0] else: errname = einfo[0].__name__
e5fa056505edfb80e052e4d5b196c1c09b21fa20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e5fa056505edfb80e052e4d5b196c1c09b21fa20/DT_Try.py
doc(person=person)
doc(person=person())
def testNoImplicitAccess(self): class person: name='Jim'
58712c56d0f50510ea4f1bf3f69235a906e4a402 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/58712c56d0f50510ea4f1bf3f69235a906e4a402/testSecurity.py
import os
def stupid_log_write(subsystem, severity, summary, detail, error): if severity < 0: return global _stupid_dest if _stupid_dest is None: import os if os.environ.has_key('STUPID_LOG_FILE'): f=os.environ['STUPID_LOG_FILE'] if f: _stupid_dest=open(f,'a') else: import sys _stupid_dest=sys.stderr else: _stupid_dest=_no_stupid_log import os if os.environ.has_key('Z_DEBUG_MODE'): import sys sys.stderr.write( "------\n" "%s %s %s %s\n%s" % (log_time(), severity_string(severity), subsystem, summary, detail, ) ) sys.stderr.flush() if _stupid_dest is _no_stupid_log: return _stupid_dest.write( "------\n" "%s %s %s %s\n%s" % (log_time(), severity_string(severity), subsystem, summary, detail, ) ) _stupid_dest.flush() if error: try: _stupid_dest.write(format_exception( error[0], error[1], error[2], trailer='\n', limit=100)) except: _stupid_dest.write("%s: %s\n" % error[:2])
4461148eb35b7c756329ac4d705f5460f116fcb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4461148eb35b7c756329ac4d705f5460f116fcb4/stupidFileLogger.py
else: import sys _stupid_dest=sys.stderr
else: _stupid_dest=sys.stderr elif os.environ.get('Z_DEBUG_MODE',0): _stupid_dest=sys.stderr
def stupid_log_write(subsystem, severity, summary, detail, error): if severity < 0: return global _stupid_dest if _stupid_dest is None: import os if os.environ.has_key('STUPID_LOG_FILE'): f=os.environ['STUPID_LOG_FILE'] if f: _stupid_dest=open(f,'a') else: import sys _stupid_dest=sys.stderr else: _stupid_dest=_no_stupid_log import os if os.environ.has_key('Z_DEBUG_MODE'): import sys sys.stderr.write( "------\n" "%s %s %s %s\n%s" % (log_time(), severity_string(severity), subsystem, summary, detail, ) ) sys.stderr.flush() if _stupid_dest is _no_stupid_log: return _stupid_dest.write( "------\n" "%s %s %s %s\n%s" % (log_time(), severity_string(severity), subsystem, summary, detail, ) ) _stupid_dest.flush() if error: try: _stupid_dest.write(format_exception( error[0], error[1], error[2], trailer='\n', limit=100)) except: _stupid_dest.write("%s: %s\n" % error[:2])
4461148eb35b7c756329ac4d705f5460f116fcb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4461148eb35b7c756329ac4d705f5460f116fcb4/stupidFileLogger.py
import os if os.environ.has_key('Z_DEBUG_MODE'): import sys sys.stderr.write( "------\n" "%s %s %s %s\n%s" % (log_time(), severity_string(severity), subsystem, summary, detail, ) ) sys.stderr.flush()
def stupid_log_write(subsystem, severity, summary, detail, error): if severity < 0: return global _stupid_dest if _stupid_dest is None: import os if os.environ.has_key('STUPID_LOG_FILE'): f=os.environ['STUPID_LOG_FILE'] if f: _stupid_dest=open(f,'a') else: import sys _stupid_dest=sys.stderr else: _stupid_dest=_no_stupid_log import os if os.environ.has_key('Z_DEBUG_MODE'): import sys sys.stderr.write( "------\n" "%s %s %s %s\n%s" % (log_time(), severity_string(severity), subsystem, summary, detail, ) ) sys.stderr.flush() if _stupid_dest is _no_stupid_log: return _stupid_dest.write( "------\n" "%s %s %s %s\n%s" % (log_time(), severity_string(severity), subsystem, summary, detail, ) ) _stupid_dest.flush() if error: try: _stupid_dest.write(format_exception( error[0], error[1], error[2], trailer='\n', limit=100)) except: _stupid_dest.write("%s: %s\n" % error[:2])
4461148eb35b7c756329ac4d705f5460f116fcb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4461148eb35b7c756329ac4d705f5460f116fcb4/stupidFileLogger.py
def _checkId(self, id, allow_dup=1, _reserved=('propertysheets',)):
def _checkId(self, id, allow_dup=0, _reserved=('propertysheets','manage_workspace')):
def _checkId(self, id, allow_dup=1, _reserved=('propertysheets',)): if id in _reserved: raise 'Bad Request', 'The id, %s, is reseverd' % id ZClassMethodsSheet.inheritedAttribute('_checkId')( self, id, allow_dup) return id+' '
45c0f29c1f1effc7eee93e8b5df6e753c66c3b8d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/45c0f29c1f1effc7eee93e8b5df6e753c66c3b8d/Method.py
self, id, allow_dup)
self, id, 0)
def _checkId(self, id, allow_dup=1, _reserved=('propertysheets',)): if id in _reserved: raise 'Bad Request', 'The id, %s, is reseverd' % id ZClassMethodsSheet.inheritedAttribute('_checkId')( self, id, allow_dup) return id+' '
45c0f29c1f1effc7eee93e8b5df6e753c66c3b8d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/45c0f29c1f1effc7eee93e8b5df6e753c66c3b8d/Method.py
data=(headers is None) and file or file.read()
if hasattr(file, 'read'): data=file.read() else: data=file
def __init__(self, id, title, file, content_type='', precondition=''): self.__name__=id self.title=title self.precondition=precondition headers=hasattr(file, 'headers') and file.headers or None data=(headers is None) and file or file.read() if headers and headers.has_key('content-type') and (not content_type): content_type=headers['content-type'] if not content_type: content_type, enc=mimetypes.guess_type(id) if not content_type: if content_types.find_binary(data) >= 0: content_type='application/octet-stream' else: content_type=content_types.text_type(data) content_type=string.lower(content_type) self.update_data(data, content_type)
915ef3fec4d91a9391c929aa5a1122169de9c075 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/915ef3fec4d91a9391c929aa5a1122169de9c075/Image.py
def positions(self, docid, words):
def positions(self, docid, words, obj):
def positions(self, docid, words): """Return the positions in the document for the given document id of the word, word.""" id = self.id
d1f544bec4a452ed42c765c9b0b6e59222700b15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d1f544bec4a452ed42c765c9b0b6e59222700b15/UnTextIndex.py
row = self._data[docid]
def positions(self, docid, words): """Return the positions in the document for the given document id of the word, word.""" id = self.id
d1f544bec4a452ed42c765c9b0b6e59222700b15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d1f544bec4a452ed42c765c9b0b6e59222700b15/UnTextIndex.py
doc = str(f(row, id)())
doc = str(f(obj, id)())
def positions(self, docid, words): """Return the positions in the document for the given document id of the word, word.""" id = self.id
d1f544bec4a452ed42c765c9b0b6e59222700b15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d1f544bec4a452ed42c765c9b0b6e59222700b15/UnTextIndex.py
doc = str(f(row, id))
doc = str(f(obj, id))
def positions(self, docid, words): """Return the positions in the document for the given document id of the word, word.""" id = self.id
d1f544bec4a452ed42c765c9b0b6e59222700b15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d1f544bec4a452ed42c765c9b0b6e59222700b15/UnTextIndex.py
db.SetCacheSize(self._cache_size) db.SetCacheDeactivateAfter(self._cache_age) db.SetVersionCacheSize(self._vcache_size) db.SetVersionCacheDeactivateAfter(self._vcache_age)
db.setCacheSize(self._cache_size) db.setCacheDeactivateAfter(self._cache_age) db.setVersionCacheSize(self._vcache_size) db.setVersionCacheDeactivateAfter(self._vcache_age)
def initialize_cache(self): try: db=self._p_jar.db() except: # BoboPOS2 Globals.Bobobase._jar.cache.cache_size=self._cache_size Globals.Bobobase._jar.cache.cache_age =self._cache_age else: db.SetCacheSize(self._cache_size) db.SetCacheDeactivateAfter(self._cache_age) db.SetVersionCacheSize(self._vcache_size) db.SetVersionCacheDeactivateAfter(self._vcache_age)
98ddd7dcfba754f4ee2019cd3e30c3bec9b42555 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/98ddd7dcfba754f4ee2019cd3e30c3bec9b42555/CacheManager.py
"""Object delete handler."""
"""Object delete handler. I think this is obsoleted by manage_beforeDelete """
def onDeleteObject(self): """Object delete handler.""" self.unindex_object()
20adcffda5ca4f0567b09597e585eaf7064daaff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/20adcffda5ca4f0567b09597e585eaf7064daaff/CatalogAwareness.py
options=[] for option in c.manage_options: copy={} copy.update(option) options.append(copy) c.manage_options=tuple(options)
if zope_object: options=[] for option in c.manage_options: copy={} copy.update(option) options.append(copy) c.manage_options=tuple(options)
def __init__(self, id, title, bases, zope_object=1): """Build a Zope class
028d8f2e7b62d61ef43f99fd5edd0bb458cfff33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/028d8f2e7b62d61ef43f99fd5edd0bb458cfff33/ZClass.py
def pt_macro(self):
def pt_macros(self):
def pt_macro(self): self._cook_check() return PageTemplate.pt_macro(self)
3fd48d78a9b5b8e3bdf4ac432ed95f398666e41c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3fd48d78a9b5b8e3bdf4ac432ed95f398666e41c/PageTemplateFile.py
return PageTemplate.pt_macro(self)
return PageTemplate.pt_macros(self)
def pt_macro(self): self._cook_check() return PageTemplate.pt_macro(self)
3fd48d78a9b5b8e3bdf4ac432ed95f398666e41c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3fd48d78a9b5b8e3bdf4ac432ed95f398666e41c/PageTemplateFile.py
k=None
def sort_sequence(self, sequence):
3fa0fa5665fe071d344440bd281e9660beb9fa74 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3fa0fa5665fe071d344440bd281e9660beb9fa74/DT_In.py
if mapping: k=v[sort] else: k=getattr(v, sort) if not basic_type(k): try: k=k() except: pass
if multsort: k = [] for sk in sortfields: try: if mapping: akey = v[sk] else: akey = getattr(v, sk) except AttributeError, KeyError: akey = None if not basic_type(akey): try: akey = akey() except: pass k.append(akey) else: try: if mapping: k = v[sort] else: k = getattr(v, sort) except AttributeError, KeyError: k = None if not basic_type(k): try: k = k() except: pass
def sort_sequence(self, sequence):
3fa0fa5665fe071d344440bd281e9660beb9fa74 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3fa0fa5665fe071d344440bd281e9660beb9fa74/DT_In.py
for k, client in s: sequence.append(client)
for k, client in s: sequence.append(client)
def sort_sequence(self, sequence):
3fa0fa5665fe071d344440bd281e9660beb9fa74 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3fa0fa5665fe071d344440bd281e9660beb9fa74/DT_In.py
def sort_sequence(self, sequence):
3fa0fa5665fe071d344440bd281e9660beb9fa74 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3fa0fa5665fe071d344440bd281e9660beb9fa74/DT_In.py
basic_type={type(''): 1, type(0): 1, type(0.0): 1, type(()): 1, type([]): 1 }.has_key
basic_type={type(''): 1, type(0): 1, type(0.0): 1, type(()): 1, type([]): 1, type(None) : 1 }.has_key
def reverse_sequence(self, sequence): s=list(sequence) s.reverse() return s
3fa0fa5665fe071d344440bd281e9660beb9fa74 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3fa0fa5665fe071d344440bd281e9660beb9fa74/DT_In.py
e=e+1
def __getitem__(self,index):
afb0beb00ba813cff48fdf0ea19af5e4f3d75908 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/afb0beb00ba813cff48fdf0ea19af5e4f3d75908/Zope.py
except Unauthorized, vv:
except 'Unauthorized', vv:
def __getitem__(self,index):
afb0beb00ba813cff48fdf0ea19af5e4f3d75908 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/afb0beb00ba813cff48fdf0ea19af5e4f3d75908/Zope.py
continue if skip and not getSecurityManager().checkPermission(skip, v): continue if test is None or test(v): data.append(v) ind=ind+1
skip_this = 1 else: skip_this = 0
def __getitem__(self,index):
afb0beb00ba813cff48fdf0ea19af5e4f3d75908 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/afb0beb00ba813cff48fdf0ea19af5e4f3d75908/Zope.py
do("chown %s %s" % (group, path), 0)
do("chown %s %s" % (user, path), 0)
def ch(path, user, group, mode=0600): if group: mode=mode+060 do("chgrp %s %s" % (group, path), 0) if user: do("chown %s %s" % (group, path), 0) do("chmod %s %s" % (oct(mode), path), 0)
c49d60285cb594bbf48acff444472d3236505d23 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c49d60285cb594bbf48acff444472d3236505d23/do.py
if not hasattr(app.Control_Panel, 'Products'):
if not hasattr(app.Control_Panel.aq_base, 'Products'):
def open_bobobase(): # Open the application database Bobobase=Globals.Bobobase=Globals.PickleDictionary(Globals.BobobaseName) product_dir=os.path.join(SOFTWARE_HOME,'lib/python/Products') __traceback_info__=sys.path try: app=Bobobase['Application'] except KeyError: app=Application() app._init() Bobobase['Application']=app get_transaction().commit() # 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 introduction of certain system objects such as those # which provide Lever support. # b/c: Ensure that Control Panel exists. if not hasattr(app, 'Control_Panel'): cpl=ApplicationManager() cpl._init() app._setObject('Control_Panel', cpl) get_transaction().commit() # b/c: Ensure that a ProductFolder exists. if not hasattr(app.Control_Panel, 'Products'): app.Control_Panel.Products=App.Product.ProductFolder() get_transaction().commit() # b/c: Ensure that std err msg exists. if not hasattr(app, 'standard_error_message'): import Document Document.manage_addDocument( app, 'standard_error_message', 'Standard Error Message', _standard_error_msg) get_transaction().commit() install_products(app) get_transaction().commit() return Bobobase
656beed426a6f7a0a8b802e580b6bfaddc634715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/656beed426a6f7a0a8b802e580b6bfaddc634715/Application.py
from types import BooleanType
def guarded_getitem(object, index): v = object[index] if getSecurityManager().validate(object, object, index, v): return v raise Unauthorized, 'unauthorized access to element %s' % `i`
e04ad27486fef71c955bba35808f255f7768fbde /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e04ad27486fef71c955bba35808f255f7768fbde/Zope.py
if isinstance(v, StringType):
if isinstance(v, str):
def complex_marshal(pairs): '''Add request marshalling information to a list of name-value pairs. Names must be strings. Values may be strings, integers, floats, or DateTimes, and they may also be lists or namespaces containing these types. The list is edited in place so that each (name, value) pair becomes a (name, marshal, value) triple. The middle value is the request marshalling string. Integer, float, and DateTime values will have ":int", ":float", or ":date" as their marshal string. Lists will be flattened, and the elements given ":list" in addition to their simple marshal string. Dictionaries will be flattened and marshalled using ":record". ''' i = len(pairs) while i > 0: i = i - 1 k, v = pairs[i] m = '' sublist = None if isinstance(v, StringType): pass elif hasattr(v, 'items'): sublist = [] for sk, sv in v.items(): sm = simple_marshal(sv) sublist.append(('%s.%s' % (k, sk), '%s:record' % sm, sv)) elif isinstance(v, ListType): sublist = [] for sv in v: sm = simple_marshal(sv) sublist.append((k, '%s:list' % sm, sv)) else: m = simple_marshal(v) if sublist is None: pairs[i] = (k, m, v) else: pairs[i:i + 1] = sublist return pairs
e04ad27486fef71c955bba35808f255f7768fbde /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e04ad27486fef71c955bba35808f255f7768fbde/Zope.py
elif isinstance(v, ListType):
elif isinstance(v, list):
def complex_marshal(pairs): '''Add request marshalling information to a list of name-value pairs. Names must be strings. Values may be strings, integers, floats, or DateTimes, and they may also be lists or namespaces containing these types. The list is edited in place so that each (name, value) pair becomes a (name, marshal, value) triple. The middle value is the request marshalling string. Integer, float, and DateTime values will have ":int", ":float", or ":date" as their marshal string. Lists will be flattened, and the elements given ":list" in addition to their simple marshal string. Dictionaries will be flattened and marshalled using ":record". ''' i = len(pairs) while i > 0: i = i - 1 k, v = pairs[i] m = '' sublist = None if isinstance(v, StringType): pass elif hasattr(v, 'items'): sublist = [] for sk, sv in v.items(): sm = simple_marshal(sv) sublist.append(('%s.%s' % (k, sk), '%s:record' % sm, sv)) elif isinstance(v, ListType): sublist = [] for sv in v: sm = simple_marshal(sv) sublist.append((k, '%s:list' % sm, sv)) else: m = simple_marshal(v) if sublist is None: pairs[i] = (k, m, v) else: pairs[i:i + 1] = sublist return pairs
e04ad27486fef71c955bba35808f255f7768fbde /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e04ad27486fef71c955bba35808f255f7768fbde/Zope.py
if isinstance(v, StringType):
if isinstance(v, str):
def simple_marshal(v): if isinstance(v, StringType): return '' if isinstance(v, BooleanType): return ':boolean' if isinstance(v, IntType): return ':int' if isinstance(v, FloatType): return ':float' if isinstance(v, DateTime): return ':date' return ''
e04ad27486fef71c955bba35808f255f7768fbde /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e04ad27486fef71c955bba35808f255f7768fbde/Zope.py
if isinstance(v, BooleanType):
if isinstance(v, bool):
def simple_marshal(v): if isinstance(v, StringType): return '' if isinstance(v, BooleanType): return ':boolean' if isinstance(v, IntType): return ':int' if isinstance(v, FloatType): return ':float' if isinstance(v, DateTime): return ':date' return ''
e04ad27486fef71c955bba35808f255f7768fbde /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e04ad27486fef71c955bba35808f255f7768fbde/Zope.py
if isinstance(v, IntType):
if isinstance(v, int):
def simple_marshal(v): if isinstance(v, StringType): return '' if isinstance(v, BooleanType): return ':boolean' if isinstance(v, IntType): return ':int' if isinstance(v, FloatType): return ':float' if isinstance(v, DateTime): return ':date' return ''
e04ad27486fef71c955bba35808f255f7768fbde /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e04ad27486fef71c955bba35808f255f7768fbde/Zope.py
if isinstance(v, FloatType):
if isinstance(v, float):
def simple_marshal(v): if isinstance(v, StringType): return '' if isinstance(v, BooleanType): return ':boolean' if isinstance(v, IntType): return ':int' if isinstance(v, FloatType): return ':float' if isinstance(v, DateTime): return ':date' return ''
e04ad27486fef71c955bba35808f255f7768fbde /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e04ad27486fef71c955bba35808f255f7768fbde/Zope.py
elif os.environ.has_key('BOBO_DEBUG_MODE'): debug_mode=lower(os.environ['BOBO_DEBUG_MODE'])
elif (os.environ.has_key('Z_DEBUG_MODE') or os.environ.has_key('BOBO_DEBUG_MODE')): if os.environ.has_key('Z_DEBUG_MODE'): debug_mode=lower(os.environ['Z_DEBUG_MODE']) else: debug_mode=lower(os.environ['BOBO_DEBUG_MODE'])
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_name # Let the app specify a realm if hasattr(module,'__bobo_realm__'): realm=module.__bobo_realm__ elif os.environ.has_key('BOBO_REALM'): realm=os.environ['BOBO_REALM'] else: realm=module_name # Check for debug mode if hasattr(module,'__bobo_debug_mode__'): debug_mode=not not module.__bobo_debug_mode__ elif os.environ.has_key('BOBO_DEBUG_MODE'): debug_mode=lower(os.environ['BOBO_DEBUG_MODE']) if debug_mode=='y' or debug_mode=='yes': debug_mode=1 else: try: debug_mode=atoi(debug_mode) except: debug_mode=None else: debug_mode=None # Check whether tracebacks should be hidden: if hasattr(module,'__bobo_hide_tracebacks__'): hide_tracebacks=not not module.__bobo_hide_tracebacks__ elif os.environ.has_key('BOBO_HIDE_TRACEBACKS'): hide_tracebacks=lower(os.environ['BOBO_HIDE_TRACEBACKS']) if hide_tracebacks=='y' or hide_tracebacks=='yes': hide_tracebacks=1 else: try: hide_tracebacks=atoi(hide_tracebacks) except: hide_tracebacks=None else: hide_tracebacks=1 # Reset response handling of tracebacks, if necessary: if debug_mode or not hide_tracebacks: def hack_response(): import Response Response._tbopen = '<PRE>' Response._tbclose = '</PRE>' hack_response() if hasattr(module,'__bobo_before__'): bobo_before=module.__bobo_before__ else: bobo_before=None if hasattr(module,'__bobo_after__'): bobo_after=module.__bobo_after__ else: bobo_after=None # Get request data from outermost environment: if hasattr(module,'__request_data__'): request_params=module.__request_data__ else: request_params=None # Get initial group data: inherited_groups=[] if hasattr(module,'__allow_groups__'): groups=module.__allow_groups__ inherited_groups.append(groups) else: groups=None web_objects=None roles=UNSPECIFIED_ROLES if hasattr(module,'bobo_application'): object=module.bobo_application if hasattr(object,'__allow_groups__'): groups=object.__allow_groups__ inherited_groups.append(groups) else: groups=None if hasattr(object,'__roles__'): roles=object.__roles__ else: if hasattr(module,'web_objects'): web_objects=module.web_objects object=web_objects else: object=module published=web_objects try: doc=module.__doc__ except: if web_objects is not None: doc=' ' else: doc=None info= (bobo_before, bobo_after, request_params, inherited_groups, groups, roles, object, doc, published, realm, module_name, debug_mode) modules[module_name]=modules[module_name+'.cgi']=info return info except: if hasattr(sys, 'exc_info'): t,v,tb=sys.exc_info() else: t, v, tb = sys.exc_type, sys.exc_value, sys.exc_traceback v=str(v) raise ImportError, (t, v), tb finally: tb=None release()
6820e9cef45a65ce52c2460a0cc4e80ebb7cb066 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6820e9cef45a65ce52c2460a0cc4e80ebb7cb066/Publish.py
def testResolveUrl(self): # Check that ResolveUrl really raises the same error
e90a36c2fdcac729f4ce506467132c38ce04e20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e90a36c2fdcac729f4ce506467132c38ce04e20a/testHTTPRequest.py
from zExceptions import NotFound env = TEST_ENVIRON.copy() req = HTTPRequest(None, env, None) req['PARENTS'] = ['Nobody', 'cares', 'here'] testmethod = req.resolve_url self.assertRaises(NotFound, testmethod, 'http://localhost/does_not_exist')
from zExceptions import NotFound env = TEST_ENVIRON.copy() req = HTTPRequest(None, env, None) req['PARENTS'] = ['Nobody', 'cares', 'here'] testmethod = req.resolve_url self.assertRaises(NotFound, testmethod, 'http://localhost/does_not_exist')
def testResolveUrl(self): # Check that ResolveUrl really raises the same error
e90a36c2fdcac729f4ce506467132c38ce04e20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e90a36c2fdcac729f4ce506467132c38ce04e20a/testHTTPRequest.py
ostream = tempfile.NamedTemporaryFile(suffix='.xml')
handle, path = tempfile.mkstemp(suffix='.xml')
def test_export_import_as_file_idempotent(self): from OFS.DTMLMethod import DTMLMethod from OFS.XMLExportImport import exportXML from OFS.XMLExportImport import importXML
4630a5bcfe9d964a5e40a9bb146aabf33974b639 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4630a5bcfe9d964a5e40a9bb146aabf33974b639/test_XMLExportImport.py
ostream.flush() newobj = importXML(connection, ostream.name)
ostream.close() newobj = importXML(connection, path) self.failUnless(isinstance(newobj, DTMLMethod)) self.assertEqual(newobj.read(), dm.read())
def test_export_import_as_file_idempotent(self): from OFS.DTMLMethod import DTMLMethod from OFS.XMLExportImport import exportXML from OFS.XMLExportImport import importXML
4630a5bcfe9d964a5e40a9bb146aabf33974b639 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4630a5bcfe9d964a5e40a9bb146aabf33974b639/test_XMLExportImport.py
ostream.close()
os.remove(path)
def test_export_import_as_file_idempotent(self): from OFS.DTMLMethod import DTMLMethod from OFS.XMLExportImport import exportXML from OFS.XMLExportImport import importXML
4630a5bcfe9d964a5e40a9bb146aabf33974b639 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4630a5bcfe9d964a5e40a9bb146aabf33974b639/test_XMLExportImport.py
self.failUnless(isinstance(newobj, DTMLMethod)) self.assertEqual(newobj.read(), dm.read())
def test_export_import_as_file_idempotent(self): from OFS.DTMLMethod import DTMLMethod from OFS.XMLExportImport import exportXML from OFS.XMLExportImport import importXML
4630a5bcfe9d964a5e40a9bb146aabf33974b639 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4630a5bcfe9d964a5e40a9bb146aabf33974b639/test_XMLExportImport.py
ostream = tempfile.NamedTemporaryFile(suffix='.xml')
handle, path = tempfile.mkstemp(suffix='.xml')
def test_OFS_ObjectManager__importObjectFromFile_xml(self): from OFS.DTMLMethod import DTMLMethod from OFS.Folder import Folder from OFS.XMLExportImport import exportXML
4630a5bcfe9d964a5e40a9bb146aabf33974b639 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4630a5bcfe9d964a5e40a9bb146aabf33974b639/test_XMLExportImport.py
ostream.flush() sub._importObjectFromFile(ostream.name, 0, 0)
ostream.close() sub._importObjectFromFile(path, 0, 0)
def test_OFS_ObjectManager__importObjectFromFile_xml(self): from OFS.DTMLMethod import DTMLMethod from OFS.Folder import Folder from OFS.XMLExportImport import exportXML
4630a5bcfe9d964a5e40a9bb146aabf33974b639 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4630a5bcfe9d964a5e40a9bb146aabf33974b639/test_XMLExportImport.py
ostream.close()
os.remove(path)
def test_OFS_ObjectManager__importObjectFromFile_xml(self): from OFS.DTMLMethod import DTMLMethod from OFS.Folder import Folder from OFS.XMLExportImport import exportXML
4630a5bcfe9d964a5e40a9bb146aabf33974b639 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4630a5bcfe9d964a5e40a9bb146aabf33974b639/test_XMLExportImport.py
except:
except:
def __init__( self, id, ignore_ex=None, call_methods=None, extra=None, caller=None): """Create an unindex
2625f93b9f104d03ce1e1bd98c54ccdf974fe837 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/2625f93b9f104d03ce1e1bd98c54ccdf974fe837/UnIndex.py
if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">')
if level > 3: output(_td_colspan % (level-1)) elif level > 1: output(_td_single * (level-1)) output(_td_single) output('\n') output('<TD WIDTH="16" VALIGN="TOP" NOWRAP>')
def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): "Render a tree as a table" have_arg=args.has_key exp=0 if level >= 0: urlattr=args['url'] if urlattr and hasattr(self, urlattr): tpUrl=getattr(self, urlattr) if not simple_type(type(tpUrl)): tpUrl=tpUrl() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl root_url = root_url or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 idattr=args['id'] output=data.append items=None if (have_arg('assume_children') and args['assume_children'] and substate is not state): # We should not compute children unless we have to. # See if we've been asked to expand our children. for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if not exp: items=1 if items is None: validate=md.validate if have_arg('branches') and hasattr(self, args['branches']): if validate is None or not hasattr(self, 'aq_acquire'): items=getattr(self, args['branches']) else: items=self.aq_acquire(args['branches'],validate,md) items=items() elif have_arg('branches_expr'): items=args['branches_expr'](md) if not items and have_arg('leaves'): items=1 if items and items != 1: if validate is not None: unauth=[] index=0 for i in items: try: v=validate(items,items,index,i,md) except: v=0 if not v: unauth.append(index) index=index+1 if unauth: if have_arg('skip_unauthorized') and args['skip_unauthorized']: items=list(items) unauth.reverse() for i in unauth: del items[i] else: raise ValidationError, unauth if have_arg('sort'): # Faster/less mem in-place sort if type(items)==type(()): items=list(items) sort=args['sort'] size=range(len(items)) for i in size: v=items[i] k=getattr(v,sort) try: k=k() except: pass items[i]=(k,v) items.sort() for i in size: items[i]=items[i][1] if have_arg('reverse'): items=list(items) # Copy the list items.reverse() diff.append(id) sub=None if substate is state: output('<TABLE CELLSPACING="0">\n') sub=substate[0] exp=items else: # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break #################################### # Mostly inline encode_seq for speed s=compress(str(diff)) if len(s) > 57: s=encode_str(s) else: s=b2a_base64(s)[:-1] l=find(s,'=') if l >= 0: s=s[:l] s=translate(s, tplus) #################################### script=md['SCRIPT_NAME'] if exp: treeData['tree-item-expanded']=1 output('<A NAME="%s" HREF="%s?tree-c=%s#%s">' '<IMG SRC="%s/p_/mi" ALT="-" BORDER=0></A>' % (id, root_url, s, id, script)) else: output('<A NAME="%s" HREF="%s?tree-e=%s#%s">' '<IMG SRC="%s/p_/pl" ALT="+" BORDER=0></A>' % (id, root_url, s, id, script)) output('</TD>\n') else: if level > 2: output('<TD COLSPAN="%s"></TD>' % level) elif level > 0: output('<TD></TD>' * level) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD%s%s VALIGN="TOP" ALIGN="LEFT">' % ((dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''), (have_arg('nowrap') and args['nowrap'] and ' NOWRAP' or '')) ) output(render_blocks(section, md)) output('</TD>\n</TR>\n') if exp: level=level+1 dataspan=colspan-level if level > 3: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): doc=args['header'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) if items==1: # leaves if have_arg('leaves'): doc=args['leaves'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) elif have_arg('expand'): doc=args['expand'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) else: __traceback_info__=sub, args, state, substate ids={} for item in items: if hasattr(item, idattr): id=getattr(item, idattr) if not simple_type(type(id)): id=id() elif hasattr(item, '_p_oid'): id=oid(item) else: id=pyid(item) if len(sub)==1: sub.append([]) substate=sub[1] ids[id]=1 md._push(InstanceDict(item,md)) try: data=tpRenderTABLE( item,id,root_url,url,state,substate,diff,data, colspan, section, md, treeData, level, args) finally: md._pop() if not sub[1]: del sub[1] ids=ids.has_key for i in range(len(substate)-1,-1): if not ids(substate[i][0]): del substate[i] if have_arg('footer'): doc=args['footer'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) del diff[-1] if not diff: output('</TABLE>\n') return data
661a564634752c25571a54a50081da0f06ca33ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/661a564634752c25571a54a50081da0f06ca33ce/TreeTag.py
if level > 2: output('<TD COLSPAN="%s"></TD>' % level) elif level > 0: output('<TD></TD>' * level) output('<TD WIDTH="16"></TD>\n')
if level > 2: output(_td_colspan % level) elif level > 0: output(_td_single * level) output(_td_single) output('\n')
def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): "Render a tree as a table" have_arg=args.has_key exp=0 if level >= 0: urlattr=args['url'] if urlattr and hasattr(self, urlattr): tpUrl=getattr(self, urlattr) if not simple_type(type(tpUrl)): tpUrl=tpUrl() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl root_url = root_url or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 idattr=args['id'] output=data.append items=None if (have_arg('assume_children') and args['assume_children'] and substate is not state): # We should not compute children unless we have to. # See if we've been asked to expand our children. for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if not exp: items=1 if items is None: validate=md.validate if have_arg('branches') and hasattr(self, args['branches']): if validate is None or not hasattr(self, 'aq_acquire'): items=getattr(self, args['branches']) else: items=self.aq_acquire(args['branches'],validate,md) items=items() elif have_arg('branches_expr'): items=args['branches_expr'](md) if not items and have_arg('leaves'): items=1 if items and items != 1: if validate is not None: unauth=[] index=0 for i in items: try: v=validate(items,items,index,i,md) except: v=0 if not v: unauth.append(index) index=index+1 if unauth: if have_arg('skip_unauthorized') and args['skip_unauthorized']: items=list(items) unauth.reverse() for i in unauth: del items[i] else: raise ValidationError, unauth if have_arg('sort'): # Faster/less mem in-place sort if type(items)==type(()): items=list(items) sort=args['sort'] size=range(len(items)) for i in size: v=items[i] k=getattr(v,sort) try: k=k() except: pass items[i]=(k,v) items.sort() for i in size: items[i]=items[i][1] if have_arg('reverse'): items=list(items) # Copy the list items.reverse() diff.append(id) sub=None if substate is state: output('<TABLE CELLSPACING="0">\n') sub=substate[0] exp=items else: # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break #################################### # Mostly inline encode_seq for speed s=compress(str(diff)) if len(s) > 57: s=encode_str(s) else: s=b2a_base64(s)[:-1] l=find(s,'=') if l >= 0: s=s[:l] s=translate(s, tplus) #################################### script=md['SCRIPT_NAME'] if exp: treeData['tree-item-expanded']=1 output('<A NAME="%s" HREF="%s?tree-c=%s#%s">' '<IMG SRC="%s/p_/mi" ALT="-" BORDER=0></A>' % (id, root_url, s, id, script)) else: output('<A NAME="%s" HREF="%s?tree-e=%s#%s">' '<IMG SRC="%s/p_/pl" ALT="+" BORDER=0></A>' % (id, root_url, s, id, script)) output('</TD>\n') else: if level > 2: output('<TD COLSPAN="%s"></TD>' % level) elif level > 0: output('<TD></TD>' * level) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD%s%s VALIGN="TOP" ALIGN="LEFT">' % ((dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''), (have_arg('nowrap') and args['nowrap'] and ' NOWRAP' or '')) ) output(render_blocks(section, md)) output('</TD>\n</TR>\n') if exp: level=level+1 dataspan=colspan-level if level > 3: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): doc=args['header'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) if items==1: # leaves if have_arg('leaves'): doc=args['leaves'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) elif have_arg('expand'): doc=args['expand'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) else: __traceback_info__=sub, args, state, substate ids={} for item in items: if hasattr(item, idattr): id=getattr(item, idattr) if not simple_type(type(id)): id=id() elif hasattr(item, '_p_oid'): id=oid(item) else: id=pyid(item) if len(sub)==1: sub.append([]) substate=sub[1] ids[id]=1 md._push(InstanceDict(item,md)) try: data=tpRenderTABLE( item,id,root_url,url,state,substate,diff,data, colspan, section, md, treeData, level, args) finally: md._pop() if not sub[1]: del sub[1] ids=ids.has_key for i in range(len(substate)-1,-1): if not ids(substate[i][0]): del substate[i] if have_arg('footer'): doc=args['footer'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) del diff[-1] if not diff: output('</TABLE>\n') return data
661a564634752c25571a54a50081da0f06ca33ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/661a564634752c25571a54a50081da0f06ca33ce/TreeTag.py
if level > 3: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1)
if level > 3: h=_td_colspan % (level-1) elif level > 1: h=_td_single * (level-1)
def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): "Render a tree as a table" have_arg=args.has_key exp=0 if level >= 0: urlattr=args['url'] if urlattr and hasattr(self, urlattr): tpUrl=getattr(self, urlattr) if not simple_type(type(tpUrl)): tpUrl=tpUrl() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl root_url = root_url or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 idattr=args['id'] output=data.append items=None if (have_arg('assume_children') and args['assume_children'] and substate is not state): # We should not compute children unless we have to. # See if we've been asked to expand our children. for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if not exp: items=1 if items is None: validate=md.validate if have_arg('branches') and hasattr(self, args['branches']): if validate is None or not hasattr(self, 'aq_acquire'): items=getattr(self, args['branches']) else: items=self.aq_acquire(args['branches'],validate,md) items=items() elif have_arg('branches_expr'): items=args['branches_expr'](md) if not items and have_arg('leaves'): items=1 if items and items != 1: if validate is not None: unauth=[] index=0 for i in items: try: v=validate(items,items,index,i,md) except: v=0 if not v: unauth.append(index) index=index+1 if unauth: if have_arg('skip_unauthorized') and args['skip_unauthorized']: items=list(items) unauth.reverse() for i in unauth: del items[i] else: raise ValidationError, unauth if have_arg('sort'): # Faster/less mem in-place sort if type(items)==type(()): items=list(items) sort=args['sort'] size=range(len(items)) for i in size: v=items[i] k=getattr(v,sort) try: k=k() except: pass items[i]=(k,v) items.sort() for i in size: items[i]=items[i][1] if have_arg('reverse'): items=list(items) # Copy the list items.reverse() diff.append(id) sub=None if substate is state: output('<TABLE CELLSPACING="0">\n') sub=substate[0] exp=items else: # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break #################################### # Mostly inline encode_seq for speed s=compress(str(diff)) if len(s) > 57: s=encode_str(s) else: s=b2a_base64(s)[:-1] l=find(s,'=') if l >= 0: s=s[:l] s=translate(s, tplus) #################################### script=md['SCRIPT_NAME'] if exp: treeData['tree-item-expanded']=1 output('<A NAME="%s" HREF="%s?tree-c=%s#%s">' '<IMG SRC="%s/p_/mi" ALT="-" BORDER=0></A>' % (id, root_url, s, id, script)) else: output('<A NAME="%s" HREF="%s?tree-e=%s#%s">' '<IMG SRC="%s/p_/pl" ALT="+" BORDER=0></A>' % (id, root_url, s, id, script)) output('</TD>\n') else: if level > 2: output('<TD COLSPAN="%s"></TD>' % level) elif level > 0: output('<TD></TD>' * level) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD%s%s VALIGN="TOP" ALIGN="LEFT">' % ((dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''), (have_arg('nowrap') and args['nowrap'] and ' NOWRAP' or '')) ) output(render_blocks(section, md)) output('</TD>\n</TR>\n') if exp: level=level+1 dataspan=colspan-level if level > 3: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): doc=args['header'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) if items==1: # leaves if have_arg('leaves'): doc=args['leaves'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) elif have_arg('expand'): doc=args['expand'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) else: __traceback_info__=sub, args, state, substate ids={} for item in items: if hasattr(item, idattr): id=getattr(item, idattr) if not simple_type(type(id)): id=id() elif hasattr(item, '_p_oid'): id=oid(item) else: id=pyid(item) if len(sub)==1: sub.append([]) substate=sub[1] ids[id]=1 md._push(InstanceDict(item,md)) try: data=tpRenderTABLE( item,id,root_url,url,state,substate,diff,data, colspan, section, md, treeData, level, args) finally: md._pop() if not sub[1]: del sub[1] ids=ids.has_key for i in range(len(substate)-1,-1): if not ids(substate[i][0]): del substate[i] if have_arg('footer'): doc=args['footer'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) del diff[-1] if not diff: output('</TABLE>\n') return data
661a564634752c25571a54a50081da0f06ca33ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/661a564634752c25571a54a50081da0f06ca33ce/TreeTag.py
'<TR>%s<TD WIDTH="16"></TD>'
'<TR>%s<TD WIDTH="16" NOWRAP></TD>'
def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): "Render a tree as a table" have_arg=args.has_key exp=0 if level >= 0: urlattr=args['url'] if urlattr and hasattr(self, urlattr): tpUrl=getattr(self, urlattr) if not simple_type(type(tpUrl)): tpUrl=tpUrl() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl root_url = root_url or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 idattr=args['id'] output=data.append items=None if (have_arg('assume_children') and args['assume_children'] and substate is not state): # We should not compute children unless we have to. # See if we've been asked to expand our children. for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if not exp: items=1 if items is None: validate=md.validate if have_arg('branches') and hasattr(self, args['branches']): if validate is None or not hasattr(self, 'aq_acquire'): items=getattr(self, args['branches']) else: items=self.aq_acquire(args['branches'],validate,md) items=items() elif have_arg('branches_expr'): items=args['branches_expr'](md) if not items and have_arg('leaves'): items=1 if items and items != 1: if validate is not None: unauth=[] index=0 for i in items: try: v=validate(items,items,index,i,md) except: v=0 if not v: unauth.append(index) index=index+1 if unauth: if have_arg('skip_unauthorized') and args['skip_unauthorized']: items=list(items) unauth.reverse() for i in unauth: del items[i] else: raise ValidationError, unauth if have_arg('sort'): # Faster/less mem in-place sort if type(items)==type(()): items=list(items) sort=args['sort'] size=range(len(items)) for i in size: v=items[i] k=getattr(v,sort) try: k=k() except: pass items[i]=(k,v) items.sort() for i in size: items[i]=items[i][1] if have_arg('reverse'): items=list(items) # Copy the list items.reverse() diff.append(id) sub=None if substate is state: output('<TABLE CELLSPACING="0">\n') sub=substate[0] exp=items else: # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break #################################### # Mostly inline encode_seq for speed s=compress(str(diff)) if len(s) > 57: s=encode_str(s) else: s=b2a_base64(s)[:-1] l=find(s,'=') if l >= 0: s=s[:l] s=translate(s, tplus) #################################### script=md['SCRIPT_NAME'] if exp: treeData['tree-item-expanded']=1 output('<A NAME="%s" HREF="%s?tree-c=%s#%s">' '<IMG SRC="%s/p_/mi" ALT="-" BORDER=0></A>' % (id, root_url, s, id, script)) else: output('<A NAME="%s" HREF="%s?tree-e=%s#%s">' '<IMG SRC="%s/p_/pl" ALT="+" BORDER=0></A>' % (id, root_url, s, id, script)) output('</TD>\n') else: if level > 2: output('<TD COLSPAN="%s"></TD>' % level) elif level > 0: output('<TD></TD>' * level) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD%s%s VALIGN="TOP" ALIGN="LEFT">' % ((dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''), (have_arg('nowrap') and args['nowrap'] and ' NOWRAP' or '')) ) output(render_blocks(section, md)) output('</TD>\n</TR>\n') if exp: level=level+1 dataspan=colspan-level if level > 3: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): doc=args['header'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) if items==1: # leaves if have_arg('leaves'): doc=args['leaves'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) elif have_arg('expand'): doc=args['expand'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) else: __traceback_info__=sub, args, state, substate ids={} for item in items: if hasattr(item, idattr): id=getattr(item, idattr) if not simple_type(type(id)): id=id() elif hasattr(item, '_p_oid'): id=oid(item) else: id=pyid(item) if len(sub)==1: sub.append([]) substate=sub[1] ids[id]=1 md._push(InstanceDict(item,md)) try: data=tpRenderTABLE( item,id,root_url,url,state,substate,diff,data, colspan, section, md, treeData, level, args) finally: md._pop() if not sub[1]: del sub[1] ids=ids.has_key for i in range(len(substate)-1,-1): if not ids(substate[i][0]): del substate[i] if have_arg('footer'): doc=args['footer'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) del diff[-1] if not diff: output('</TABLE>\n') return data
661a564634752c25571a54a50081da0f06ca33ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/661a564634752c25571a54a50081da0f06ca33ce/TreeTag.py
'<TR>%s<TD WIDTH="16"></TD>'
'<TR>%s<TD WIDTH="16" NOWRAP></TD>'
def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): "Render a tree as a table" have_arg=args.has_key exp=0 if level >= 0: urlattr=args['url'] if urlattr and hasattr(self, urlattr): tpUrl=getattr(self, urlattr) if not simple_type(type(tpUrl)): tpUrl=tpUrl() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl root_url = root_url or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 idattr=args['id'] output=data.append items=None if (have_arg('assume_children') and args['assume_children'] and substate is not state): # We should not compute children unless we have to. # See if we've been asked to expand our children. for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if not exp: items=1 if items is None: validate=md.validate if have_arg('branches') and hasattr(self, args['branches']): if validate is None or not hasattr(self, 'aq_acquire'): items=getattr(self, args['branches']) else: items=self.aq_acquire(args['branches'],validate,md) items=items() elif have_arg('branches_expr'): items=args['branches_expr'](md) if not items and have_arg('leaves'): items=1 if items and items != 1: if validate is not None: unauth=[] index=0 for i in items: try: v=validate(items,items,index,i,md) except: v=0 if not v: unauth.append(index) index=index+1 if unauth: if have_arg('skip_unauthorized') and args['skip_unauthorized']: items=list(items) unauth.reverse() for i in unauth: del items[i] else: raise ValidationError, unauth if have_arg('sort'): # Faster/less mem in-place sort if type(items)==type(()): items=list(items) sort=args['sort'] size=range(len(items)) for i in size: v=items[i] k=getattr(v,sort) try: k=k() except: pass items[i]=(k,v) items.sort() for i in size: items[i]=items[i][1] if have_arg('reverse'): items=list(items) # Copy the list items.reverse() diff.append(id) sub=None if substate is state: output('<TABLE CELLSPACING="0">\n') sub=substate[0] exp=items else: # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break #################################### # Mostly inline encode_seq for speed s=compress(str(diff)) if len(s) > 57: s=encode_str(s) else: s=b2a_base64(s)[:-1] l=find(s,'=') if l >= 0: s=s[:l] s=translate(s, tplus) #################################### script=md['SCRIPT_NAME'] if exp: treeData['tree-item-expanded']=1 output('<A NAME="%s" HREF="%s?tree-c=%s#%s">' '<IMG SRC="%s/p_/mi" ALT="-" BORDER=0></A>' % (id, root_url, s, id, script)) else: output('<A NAME="%s" HREF="%s?tree-e=%s#%s">' '<IMG SRC="%s/p_/pl" ALT="+" BORDER=0></A>' % (id, root_url, s, id, script)) output('</TD>\n') else: if level > 2: output('<TD COLSPAN="%s"></TD>' % level) elif level > 0: output('<TD></TD>' * level) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD%s%s VALIGN="TOP" ALIGN="LEFT">' % ((dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''), (have_arg('nowrap') and args['nowrap'] and ' NOWRAP' or '')) ) output(render_blocks(section, md)) output('</TD>\n</TR>\n') if exp: level=level+1 dataspan=colspan-level if level > 3: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): doc=args['header'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) if items==1: # leaves if have_arg('leaves'): doc=args['leaves'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) elif have_arg('expand'): doc=args['expand'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) else: __traceback_info__=sub, args, state, substate ids={} for item in items: if hasattr(item, idattr): id=getattr(item, idattr) if not simple_type(type(id)): id=id() elif hasattr(item, '_p_oid'): id=oid(item) else: id=pyid(item) if len(sub)==1: sub.append([]) substate=sub[1] ids[id]=1 md._push(InstanceDict(item,md)) try: data=tpRenderTABLE( item,id,root_url,url,state,substate,diff,data, colspan, section, md, treeData, level, args) finally: md._pop() if not sub[1]: del sub[1] ids=ids.has_key for i in range(len(substate)-1,-1): if not ids(substate[i][0]): del substate[i] if have_arg('footer'): doc=args['footer'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) del diff[-1] if not diff: output('</TABLE>\n') return data
661a564634752c25571a54a50081da0f06ca33ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/661a564634752c25571a54a50081da0f06ca33ce/TreeTag.py
'<TR>%s<TD WIDTH="16"></TD>'
'<TR>%s<TD WIDTH="16" NOWRAP></TD>'
def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): "Render a tree as a table" have_arg=args.has_key exp=0 if level >= 0: urlattr=args['url'] if urlattr and hasattr(self, urlattr): tpUrl=getattr(self, urlattr) if not simple_type(type(tpUrl)): tpUrl=tpUrl() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl root_url = root_url or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 idattr=args['id'] output=data.append items=None if (have_arg('assume_children') and args['assume_children'] and substate is not state): # We should not compute children unless we have to. # See if we've been asked to expand our children. for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if not exp: items=1 if items is None: validate=md.validate if have_arg('branches') and hasattr(self, args['branches']): if validate is None or not hasattr(self, 'aq_acquire'): items=getattr(self, args['branches']) else: items=self.aq_acquire(args['branches'],validate,md) items=items() elif have_arg('branches_expr'): items=args['branches_expr'](md) if not items and have_arg('leaves'): items=1 if items and items != 1: if validate is not None: unauth=[] index=0 for i in items: try: v=validate(items,items,index,i,md) except: v=0 if not v: unauth.append(index) index=index+1 if unauth: if have_arg('skip_unauthorized') and args['skip_unauthorized']: items=list(items) unauth.reverse() for i in unauth: del items[i] else: raise ValidationError, unauth if have_arg('sort'): # Faster/less mem in-place sort if type(items)==type(()): items=list(items) sort=args['sort'] size=range(len(items)) for i in size: v=items[i] k=getattr(v,sort) try: k=k() except: pass items[i]=(k,v) items.sort() for i in size: items[i]=items[i][1] if have_arg('reverse'): items=list(items) # Copy the list items.reverse() diff.append(id) sub=None if substate is state: output('<TABLE CELLSPACING="0">\n') sub=substate[0] exp=items else: # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break #################################### # Mostly inline encode_seq for speed s=compress(str(diff)) if len(s) > 57: s=encode_str(s) else: s=b2a_base64(s)[:-1] l=find(s,'=') if l >= 0: s=s[:l] s=translate(s, tplus) #################################### script=md['SCRIPT_NAME'] if exp: treeData['tree-item-expanded']=1 output('<A NAME="%s" HREF="%s?tree-c=%s#%s">' '<IMG SRC="%s/p_/mi" ALT="-" BORDER=0></A>' % (id, root_url, s, id, script)) else: output('<A NAME="%s" HREF="%s?tree-e=%s#%s">' '<IMG SRC="%s/p_/pl" ALT="+" BORDER=0></A>' % (id, root_url, s, id, script)) output('</TD>\n') else: if level > 2: output('<TD COLSPAN="%s"></TD>' % level) elif level > 0: output('<TD></TD>' * level) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD%s%s VALIGN="TOP" ALIGN="LEFT">' % ((dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''), (have_arg('nowrap') and args['nowrap'] and ' NOWRAP' or '')) ) output(render_blocks(section, md)) output('</TD>\n</TR>\n') if exp: level=level+1 dataspan=colspan-level if level > 3: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): doc=args['header'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) if items==1: # leaves if have_arg('leaves'): doc=args['leaves'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) elif have_arg('expand'): doc=args['expand'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) else: __traceback_info__=sub, args, state, substate ids={} for item in items: if hasattr(item, idattr): id=getattr(item, idattr) if not simple_type(type(id)): id=id() elif hasattr(item, '_p_oid'): id=oid(item) else: id=pyid(item) if len(sub)==1: sub.append([]) substate=sub[1] ids[id]=1 md._push(InstanceDict(item,md)) try: data=tpRenderTABLE( item,id,root_url,url,state,substate,diff,data, colspan, section, md, treeData, level, args) finally: md._pop() if not sub[1]: del sub[1] ids=ids.has_key for i in range(len(substate)-1,-1): if not ids(substate[i][0]): del substate[i] if have_arg('footer'): doc=args['footer'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) del diff[-1] if not diff: output('</TABLE>\n') return data
661a564634752c25571a54a50081da0f06ca33ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/661a564634752c25571a54a50081da0f06ca33ce/TreeTag.py
'<TR>%s<TD WIDTH="16"></TD>'
'<TR>%s<TD WIDTH="16" NOWRAP></TD>'
def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): "Render a tree as a table" have_arg=args.has_key exp=0 if level >= 0: urlattr=args['url'] if urlattr and hasattr(self, urlattr): tpUrl=getattr(self, urlattr) if not simple_type(type(tpUrl)): tpUrl=tpUrl() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl root_url = root_url or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 idattr=args['id'] output=data.append items=None if (have_arg('assume_children') and args['assume_children'] and substate is not state): # We should not compute children unless we have to. # See if we've been asked to expand our children. for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if not exp: items=1 if items is None: validate=md.validate if have_arg('branches') and hasattr(self, args['branches']): if validate is None or not hasattr(self, 'aq_acquire'): items=getattr(self, args['branches']) else: items=self.aq_acquire(args['branches'],validate,md) items=items() elif have_arg('branches_expr'): items=args['branches_expr'](md) if not items and have_arg('leaves'): items=1 if items and items != 1: if validate is not None: unauth=[] index=0 for i in items: try: v=validate(items,items,index,i,md) except: v=0 if not v: unauth.append(index) index=index+1 if unauth: if have_arg('skip_unauthorized') and args['skip_unauthorized']: items=list(items) unauth.reverse() for i in unauth: del items[i] else: raise ValidationError, unauth if have_arg('sort'): # Faster/less mem in-place sort if type(items)==type(()): items=list(items) sort=args['sort'] size=range(len(items)) for i in size: v=items[i] k=getattr(v,sort) try: k=k() except: pass items[i]=(k,v) items.sort() for i in size: items[i]=items[i][1] if have_arg('reverse'): items=list(items) # Copy the list items.reverse() diff.append(id) sub=None if substate is state: output('<TABLE CELLSPACING="0">\n') sub=substate[0] exp=items else: # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break #################################### # Mostly inline encode_seq for speed s=compress(str(diff)) if len(s) > 57: s=encode_str(s) else: s=b2a_base64(s)[:-1] l=find(s,'=') if l >= 0: s=s[:l] s=translate(s, tplus) #################################### script=md['SCRIPT_NAME'] if exp: treeData['tree-item-expanded']=1 output('<A NAME="%s" HREF="%s?tree-c=%s#%s">' '<IMG SRC="%s/p_/mi" ALT="-" BORDER=0></A>' % (id, root_url, s, id, script)) else: output('<A NAME="%s" HREF="%s?tree-e=%s#%s">' '<IMG SRC="%s/p_/pl" ALT="+" BORDER=0></A>' % (id, root_url, s, id, script)) output('</TD>\n') else: if level > 2: output('<TD COLSPAN="%s"></TD>' % level) elif level > 0: output('<TD></TD>' * level) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD%s%s VALIGN="TOP" ALIGN="LEFT">' % ((dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''), (have_arg('nowrap') and args['nowrap'] and ' NOWRAP' or '')) ) output(render_blocks(section, md)) output('</TD>\n</TR>\n') if exp: level=level+1 dataspan=colspan-level if level > 3: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): doc=args['header'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) if items==1: # leaves if have_arg('leaves'): doc=args['leaves'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) elif have_arg('expand'): doc=args['expand'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) try: output(doc( None,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) finally: md._pop(1) else: __traceback_info__=sub, args, state, substate ids={} for item in items: if hasattr(item, idattr): id=getattr(item, idattr) if not simple_type(type(id)): id=id() elif hasattr(item, '_p_oid'): id=oid(item) else: id=pyid(item) if len(sub)==1: sub.append([]) substate=sub[1] ids[id]=1 md._push(InstanceDict(item,md)) try: data=tpRenderTABLE( item,id,root_url,url,state,substate,diff,data, colspan, section, md, treeData, level, args) finally: md._pop() if not sub[1]: del sub[1] ids=ids.has_key for i in range(len(substate)-1,-1): if not ids(substate[i][0]): del substate[i] if have_arg('footer'): doc=args['footer'] if md.has_key(doc): doc=md.getitem(doc,0) else: doc=None if doc is not None: output(doc( None, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), standard_html_footer='</TD></TR>', )) del diff[-1] if not diff: output('</TABLE>\n') return data
661a564634752c25571a54a50081da0f06ca33ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/661a564634752c25571a54a50081da0f06ca33ce/TreeTag.py
__implements__ = IZCatalog
def manage_addZCatalog(self, id, title, vocab_id=None, # Deprecated REQUEST=None): """Add a ZCatalog object """ id=str(id) title=str(title) c=ZCatalog(id, title, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self, REQUEST,update_menu=1)
ee4a2a75639e19d6338268d60bdb049d1cbc8a53 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ee4a2a75639e19d6338268d60bdb049d1cbc8a53/ZCatalog.py
def manage_addZCatalog(self, id, title, vocab_id=None, # Deprecated REQUEST=None): """Add a ZCatalog object """ id=str(id) title=str(title) c=ZCatalog(id, title, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self, REQUEST,update_menu=1)
ee4a2a75639e19d6338268d60bdb049d1cbc8a53 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/ee4a2a75639e19d6338268d60bdb049d1cbc8a53/ZCatalog.py
lower=string.lower,
def zpublisher_exception_hook( published, REQUEST, t, v, traceback, # static StringType=type(''), lower=string.lower, ConflictError=ZODB.POSException.ConflictError, ListType=type([]), ): try: if ((type(t) is StringType and lower(t) in ('unauthorized', 'redirect')) or t is SystemExit): raise if issubclass(t, ConflictError): # now what # First, we need to close the current connection. We'll # do this by releasing the hold on it. There should be # some sane protocol for this, but for now we'll use # brute force: global conflict_errors conflict_errors = conflict_errors + 1 method_name = REQUEST.get('PATH_INFO', '') err = ('ZODB conflict error at %s (%s conflicts since startup ' 'at %s)') LOG(err % (method_name, conflict_errors, startup_time), INFO, '') LOG('Conflict traceback', BLATHER, '', error=sys.exc_info()) raise ZPublisher.Retry(t, v, traceback) if t is ZPublisher.Retry: v.reraise() if (getattr(REQUEST.get('RESPONSE', None), '_error_format', '') !='text/html'): raise if (published is None or published is app or type(published) is ListType): # At least get the top-level object published=app.__bobo_traverse__(REQUEST).__of__( RequestContainer(REQUEST)) get_transaction().begin() # Just to be sure. published=getattr(published, 'im_self', published) while 1: f=getattr(published, 'raise_standardErrorMessage', None) if f is None: published=getattr(published, 'aq_parent', None) if published is None: raise else: break client=published while 1: if getattr(client, 'standard_error_message', None) is not None: break client=getattr(client, 'aq_parent', None) if client is None: raise if REQUEST.get('AUTHENTICATED_USER', None) is None: REQUEST['AUTHENTICATED_USER']=AccessControl.User.nobody f(client, REQUEST, t, v, traceback) finally: traceback=None
d6db71a7bf50eaa36514146e0b589d740ddc111c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d6db71a7bf50eaa36514146e0b589d740ddc111c/__init__.py
if ((type(t) is StringType and lower(t) in ('unauthorized', 'redirect')) or t is SystemExit): raise if issubclass(t, ConflictError): global conflict_errors conflict_errors = conflict_errors + 1 method_name = REQUEST.get('PATH_INFO', '') err = ('ZODB conflict error at %s (%s conflicts since startup ' 'at %s)') LOG(err % (method_name, conflict_errors, startup_time), INFO, '') LOG('Conflict traceback', BLATHER, '', error=sys.exc_info()) raise ZPublisher.Retry(t, v, traceback) if t is ZPublisher.Retry: v.reraise()
if isinstance(t, StringType): if t.lower() in ('unauthorized', 'redirect'): raise else: if t is SystemExit: raise if issubclass(t, ConflictError): global conflict_errors conflict_errors = conflict_errors + 1 method_name = REQUEST.get('PATH_INFO', '') err = ('ZODB conflict error at %s ' '(%s conflicts since startup at %s)') LOG(err % (method_name, conflict_errors, startup_time), INFO, '') LOG('Conflict traceback', BLATHER, '', error=sys.exc_info()) raise ZPublisher.Retry(t, v, traceback) if t is ZPublisher.Retry: v.reraise()
def zpublisher_exception_hook( published, REQUEST, t, v, traceback, # static StringType=type(''), lower=string.lower, ConflictError=ZODB.POSException.ConflictError, ListType=type([]), ): try: if ((type(t) is StringType and lower(t) in ('unauthorized', 'redirect')) or t is SystemExit): raise if issubclass(t, ConflictError): # now what # First, we need to close the current connection. We'll # do this by releasing the hold on it. There should be # some sane protocol for this, but for now we'll use # brute force: global conflict_errors conflict_errors = conflict_errors + 1 method_name = REQUEST.get('PATH_INFO', '') err = ('ZODB conflict error at %s (%s conflicts since startup ' 'at %s)') LOG(err % (method_name, conflict_errors, startup_time), INFO, '') LOG('Conflict traceback', BLATHER, '', error=sys.exc_info()) raise ZPublisher.Retry(t, v, traceback) if t is ZPublisher.Retry: v.reraise() if (getattr(REQUEST.get('RESPONSE', None), '_error_format', '') !='text/html'): raise if (published is None or published is app or type(published) is ListType): # At least get the top-level object published=app.__bobo_traverse__(REQUEST).__of__( RequestContainer(REQUEST)) get_transaction().begin() # Just to be sure. published=getattr(published, 'im_self', published) while 1: f=getattr(published, 'raise_standardErrorMessage', None) if f is None: published=getattr(published, 'aq_parent', None) if published is None: raise else: break client=published while 1: if getattr(client, 'standard_error_message', None) is not None: break client=getattr(client, 'aq_parent', None) if client is None: raise if REQUEST.get('AUTHENTICATED_USER', None) is None: REQUEST['AUTHENTICATED_USER']=AccessControl.User.nobody f(client, REQUEST, t, v, traceback) finally: traceback=None
d6db71a7bf50eaa36514146e0b589d740ddc111c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d6db71a7bf50eaa36514146e0b589d740ddc111c/__init__.py
install_products()
def open_bobobase(): # Open the application database Bobobase=Globals.Bobobase=Globals.PickleDictionary(Globals.BobobaseName) product_dir=os.path.join(SOFTWARE_HOME,'Products') sys.path.append(product_dir) try: app=Bobobase['Application'] except KeyError: app=Application() app._init() Bobobase['Application']=app get_transaction().commit() if not Bobobase.has_key('roles'): Bobobase['roles']=('manage',) get_transaction().commit() # Backward compatibility if not hasattr(app, 'Control_Panel'): cpl=ApplicationManager() cpl._init() app._setObject('Control_Panel', cpl) get_transaction().commit() install_products() return Bobobase
9e77c365e68ef6099ea6639f42ba0bc0164d55fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9e77c365e68ef6099ea6639f42ba0bc0164d55fc/Application.py
for product_name in os.listdir(product_dir):
product_names=os.listdir(product_dir) product_names.sort() for product_name in product_names:
def install_products(): # Install a list of products into the basic folder class, so # that all folders know about top-level objects, aka products path_join=os.path.join product_dir=path_join(SOFTWARE_HOME,'Products') isdir=os.path.isdir exists=os.path.exists app =Globals.Bobobase['Application'] meta_types=list(Folder.Folder.dynamic_meta_types) role_names=list(app.__defined_roles__) for product_name in os.listdir(product_dir): package_dir=path_join(product_dir, product_name) if not isdir(package_dir): continue if not exists(path_join(package_dir, '__init__.py')): continue product=__import__(product_name) for meta_type in product.meta_types: if product_name=='OFS': meta_types.insert(0,meta_type) else: meta_types.append(meta_type) name=meta_type['name'] if (not meta_type.has_key('prefix') and not regex.match('[^a-zA-Z0-9_]', name)): meta_type['prefix']=lower(name) if meta_type.has_key('prefix'): prefix=meta_type['prefix'] def productNames(self, name=name): t=[] for i in self.objectMap(): if i['meta_type']==name: t.append(i['name']) return t setattr(Folder.Folder, "%sNames" % prefix , productNames) def productValues(self, name=name): t=[] for i in self.objectMap(): if i['meta_type']==name: t.append(getattr(self,i['name'])) return t setattr(Folder.Folder, "%sValues" % prefix , productValues) def productItems(self, name=name): t=[] for i in self.objectMap(): if i['meta_type']=='Image': n=i['name'] t.append((n,getattr(self,n))) return t setattr(Folder.Folder, "%sItems" % prefix , productItems) for name,method in product.methods.items(): setattr(Folder.Folder, name, method) # Try to install role names try: for n in product.role_names: if n not in role_names: role_names.append(n) except: pass Folder.Folder.dynamic_meta_types=tuple(meta_types) role_names.sort() role_names=tuple(role_names) if app.__defined_roles__ != role_names: app.__defined_roles__=tuple(role_names)
9e77c365e68ef6099ea6639f42ba0bc0164d55fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9e77c365e68ef6099ea6639f42ba0bc0164d55fc/Application.py
if no_table: tr='<p>' else: tr, _tr = '<tr>', '</p>' row=('%s\n%s\t\t%s' %
if no_table: tr='<p>', '</p>' else: tr, _tr = '<tr>', '</tr>' row=('%s\n%s\t%s' %
def custom_default_report(id, result, action='', no_table=0): columns=result._searchable_result_columns() __traceback_info__=columns heading=('<tr>\n%s\t</tr>' % string.joinfields( map(lambda c: '\t<th>%s</th>\n' % nicify(c['name']), columns), '' ) ) if no_table: tr, _tr, td, _td, delim = '<p>', '</p>', '', '', ', ' else: tr, _tr, td, _td, delim = '<tr>', '</tr>', '<td>', '</td>', '' if no_table: tr='<p>' else: tr, _tr = '<tr>', '</p>' row=('%s\n%s\t\t%s' % (tr,string.joinfields( map(lambda c, td=td, _td=_td: '\t\t%s<!--#var %s%s-->%s\n' % (td,urllib.quote(c['name']), c['type']!='s' and ' null=""' or '',_td), columns), delim), _tr)) return custom_default_report_src( id=id,heading=heading,row=row,action=action,no_table=no_table)
2ca25c9e8b16c221fd1ba4c7fc7eadbfda226c28 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/2ca25c9e8b16c221fd1ba4c7fc7eadbfda226c28/Aqueduct.py
'\t\t%s<!--
'\t%s<!--
def custom_default_report(id, result, action='', no_table=0): columns=result._searchable_result_columns() __traceback_info__=columns heading=('<tr>\n%s\t</tr>' % string.joinfields( map(lambda c: '\t<th>%s</th>\n' % nicify(c['name']), columns), '' ) ) if no_table: tr, _tr, td, _td, delim = '<p>', '</p>', '', '', ', ' else: tr, _tr, td, _td, delim = '<tr>', '</tr>', '<td>', '</td>', '' if no_table: tr='<p>' else: tr, _tr = '<tr>', '</p>' row=('%s\n%s\t\t%s' % (tr,string.joinfields( map(lambda c, td=td, _td=_td: '\t\t%s<!--#var %s%s-->%s\n' % (td,urllib.quote(c['name']), c['type']!='s' and ' null=""' or '',_td), columns), delim), _tr)) return custom_default_report_src( id=id,heading=heading,row=row,action=action,no_table=no_table)
2ca25c9e8b16c221fd1ba4c7fc7eadbfda226c28 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/2ca25c9e8b16c221fd1ba4c7fc7eadbfda226c28/Aqueduct.py
for k, intset in sort_index.items():
for k, intset in sort_index._index.items():
def _indexedSearch(self, args, sort_index, append, used):
98455762edc9f80cbaa5a2c2c4ce339625846281 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/98455762edc9f80cbaa5a2c2c4ce339625846281/Catalog.py