rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
if getattr(self, Python_magic, None) != Python_magic:
if getattr(self, 'Python_magic', None) != Python_magic:
def _makeFunction(self, allowSideEffect=0): from Guarded import GuardedBlock, theGuard, safebin from Guarded import WriteGuard, ReadGuard # Was the cached bytecode compiled with a compatible Python? if getattr(self, Python_magic, None) != Python_magic: allowSideEffect = 1 if allowSideEffect: self._checkCBlock(GuardedBlock) self.ZCacheable_invalidate() if getattr(self, '_v_errors', None): raise "Python Script Error", ('<pre>%s</pre>' % join(self._v_errors, '\n') ) return self._newfun(allowSideEffect, {'$guard': theGuard, '$write_guard': WriteGuard, '$read_guard': ReadGuard, '__debug__': __debug__}, __builtins__=safebin)
98aaf124f1cce91f19c10f4cf474e485f7001387 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/98aaf124f1cce91f19c10f4cf474e485f7001387/PythonScript.py
def __init__(self,*args): """Return a new date-time object
e1c2c430b141e2d724f64ffcdbbff39cde8990ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e1c2c430b141e2d724f64ffcdbbff39cde8990ef/DateTime.py
sequence.reverse()
sequence=self.reverse_sequence(sequence)
def renderwb(self, md): expr=self.expr name=self.__name__ if expr is None: sequence=md[name] cache={ name: sequence } else: sequence=expr(md) cache=None
0570634e39df30bc6dd227eb37d8db690eb7a284 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0570634e39df30bc6dd227eb37d8db690eb7a284/DT_In.py
sequence.reverse()
sequence=self.reverse_sequence(sequence)
def renderwob(self, md): expr=self.expr name=self.__name__ if expr is None: sequence=md[name] cache={ name: sequence } else: sequence=expr(md) cache=None
0570634e39df30bc6dd227eb37d8db690eb7a284 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0570634e39df30bc6dd227eb37d8db690eb7a284/DT_In.py
print 'numobjects', self.getId(), len(self._unindex)
def numObjects(self): """ return number of indexed objects """ print 'numobjects', self.getId(), len(self._unindex) return len(self._unindex)
cd2e1e57ccab0a373b34f47aa7ed29ad71b71483 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd2e1e57ccab0a373b34f47aa7ed29ad71b71483/UnIndex.py
print 'indexSize', self.getId(), len(self)
def indexSize(self): """ return of distinct values indexed""" print 'indexSize', self.getId(), len(self) return len(self)
cd2e1e57ccab0a373b34f47aa7ed29ad71b71483 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/cd2e1e57ccab0a373b34f47aa7ed29ad71b71483/UnIndex.py
if getattr(last, 'id', last) is not last:
if getattr(last, 'id', last) is last:
def load_binput(self): i = mloads('i' + self.read(1) + '\000\000\000') last = self.stack[-1] if getattr(last, 'id', last) is not last: last.id = self.idprefix + `i`
76ed329c7e5e2bfcfba751a2a21202ef55343d5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/76ed329c7e5e2bfcfba751a2a21202ef55343d5b/ppml.py
if getattr(last, 'id', last) is not last:
if getattr(last, 'id', last) is last:
def load_long_binput(self): i = mloads('i' + self.read(4)) last = self.stack[-1] if getattr(last, 'id', last) is not last: last.id = self.idprefix + `i`
76ed329c7e5e2bfcfba751a2a21202ef55343d5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/76ed329c7e5e2bfcfba751a2a21202ef55343d5b/ppml.py
'pickle': lambda self, tag, data: data[2]+'.',
'pickle': lambda self, tag, data: str(data[2])+'.',
def save_persis(self, tag, data): v=data[2] if self.binary: v=v+'Q' else: v='P'+v return v
76ed329c7e5e2bfcfba751a2a21202ef55343d5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/76ed329c7e5e2bfcfba751a2a21202ef55343d5b/ppml.py
'long': lambda self, tag, data: 'L'+data[2]+'L\012',
'long': lambda self, tag, data: 'L'+str(data[2])+'L\012',
def save_persis(self, tag, data): v=data[2] if self.binary: v=v+'Q' else: v='P'+v return v
76ed329c7e5e2bfcfba751a2a21202ef55343d5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/76ed329c7e5e2bfcfba751a2a21202ef55343d5b/ppml.py
args=n+1
def search(self, text, start=0, name_match=regex.compile('[\0- ]*[a-zA-Z]+[\0- ]*').match, end_match=regex.compile('[\0- ]*\(/\|end\)', regex.casefold).match, start_search=regex.compile('[<&]').search, ent_name=regex.compile('[-a-zA-Z0-9_.]+').match, find=find, strip=strip ):
626960a1479cc325517d37bcbdbb2eb488e228f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/626960a1479cc325517d37bcbdbb2eb488e228f2/DT_HTML.py
e=find(text,';',args)
e=find(text,';',n)
def search(self, text, start=0, name_match=regex.compile('[\0- ]*[a-zA-Z]+[\0- ]*').match, end_match=regex.compile('[\0- ]*\(/\|end\)', regex.casefold).match, start_search=regex.compile('[<&]').search, ent_name=regex.compile('[-a-zA-Z0-9_.]+').match, find=find, strip=strip ):
626960a1479cc325517d37bcbdbb2eb488e228f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/626960a1479cc325517d37bcbdbb2eb488e228f2/DT_HTML.py
if ent_name(text[n+1:e]) > 0: d=self.__dict__ d=self.__dict__ d[0]=text[s:e+1] d[1]=d['end']='' d[2]=d['name']='var' d[3]=d['args']=args return s
if ent_name(args) < 0: break d=self.__dict__ d[0]=text[s:e+1] d[1]=d['end']='' d[2]=d['name']='var' d[3]=d['args']=args+' html_quote' return s
def search(self, text, start=0, name_match=regex.compile('[\0- ]*[a-zA-Z]+[\0- ]*').match, end_match=regex.compile('[\0- ]*\(/\|end\)', regex.casefold).match, start_search=regex.compile('[<&]').search, ent_name=regex.compile('[-a-zA-Z0-9_.]+').match, find=find, strip=strip ):
626960a1479cc325517d37bcbdbb2eb488e228f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/626960a1479cc325517d37bcbdbb2eb488e228f2/DT_HTML.py
n=r._p=self._p if hasattr(parent, n): r._d=getattr(parent,n) else: r._d=self._d
r._p=self._p r._pa=parent r._d=self._d
def __of__(self, parent): r=imPermissionRole() n=r._p=self._p if hasattr(parent, n): r._d=getattr(parent,n) else: r._d=self._d return r
d2565b621f8be50b37efad2e5931337482680034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d2565b621f8be50b37efad2e5931337482680034/PermissionRole.py
def __getitem__(self, i): return self._d[i] def __len__(self): return len(self._d)
def __getitem__(self, i): try: v=self._v except: v=self._v=self.__of__(self._pa) del self._pa return v[i] def __len__(self): try: v=self._v except: v=self._v=self.__of__(self._pa) del self._pa return len(v)
def __getitem__(self, i): return self._d[i]
d2565b621f8be50b37efad2e5931337482680034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d2565b621f8be50b37efad2e5931337482680034/PermissionRole.py
consider the int() of this valua to be significant.
consider the int() of this value to be significant.
def LOG(subsystem, severity, summary, detail='', error=None, reraise=None): """Log some information The required arguments are: subsystem -- The subsystem generating the message (e.g. ZODB) severity -- The "severity" of the event. This may be an integer or a floating point number. Logging back ends may consider the int() of this valua to be significant. For example, a backend may consider any severity whos integer value is WARNING to be a warning. summary -- A short summary of the event detail -- A detailed description error -- A three-element tuple consisting of an error type, value, and traceback. If provided, then a summary of the error is added to the detail. reraise -- If provided with a true value, then the error given by error is reraised. """ if _call_initialize: initialize() log_write(subsystem, severity, summary, detail, error) if reraise and error: raise error[0], error[1], error[2]
7282e2f7438a584fc84a8bd7a1514ba4e43bdfc5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7282e2f7438a584fc84a8bd7a1514ba4e43bdfc5/__init__.py
try: try: doc=subobject.__doc__ except: doc=getattr(object, entry_name+'__doc__') if not doc: raise AttributeError, entry_name except: self.notFoundError("%s" % (URL)) if hasattr(subobject,'__roles__'): roles=subobject.__roles__
if subobject is object and entry_name=='.': URL=URL[:rfind(URL,'/')]
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
5ddb4f74f72dda318cd649830db82b43eb4c4e2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/5ddb4f74f72dda318cd649830db82b43eb4c4e2d/Publish.py
if not got: roleshack=entry_name+'__roles__' if hasattr(object, roleshack): roles=getattr(object, roleshack) parents.append(object) object=subobject steps.append(entry_name)
try: try: doc=subobject.__doc__ except: doc=getattr(object, entry_name+'__doc__') if not doc: raise AttributeError, entry_name except: self.notFoundError("%s" % (URL)) if hasattr(subobject,'__roles__'): roles=subobject.__roles__ else: if not got: roleshack=entry_name+'__roles__' if hasattr(object, roleshack): roles=getattr(object, roleshack) parents.append(object) object=subobject steps.append(entry_name)
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
5ddb4f74f72dda318cd649830db82b43eb4c4e2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/5ddb4f74f72dda318cd649830db82b43eb4c4e2d/Publish.py
return '<INPUT NAME="%s:%s" SIZE="50" VALUE="%s"></TD>' % (n,t,v)
return '<INPUT NAME="%s:%s" SIZE="40" VALUE="%s"></TD>' % (n,t,v)
def _defaultInput(self,n,t,v): return '<INPUT NAME="%s:%s" SIZE="50" VALUE="%s"></TD>' % (n,t,v)
d808fdc5a53ba745f7895abbd50900644f50892c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d808fdc5a53ba745f7895abbd50900644f50892c/ObjectManager.py
return ('<INPUT NAME="%s:%s" SIZE="50" VALUE="%s"></TD>'
return ('<INPUT NAME="%s:%s" SIZE="40" VALUE="%s"></TD>'
def _stringInput(self,n,t,v): return ('<INPUT NAME="%s:%s" SIZE="50" VALUE="%s"></TD>'
d808fdc5a53ba745f7895abbd50900644f50892c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d808fdc5a53ba745f7895abbd50900644f50892c/ObjectManager.py
'<TEXTAREA NAME="%s:lines" ROWS="10" COLS="50">%s</TEXTAREA>'
'<TEXTAREA NAME="%s:lines" ROWS="10" COLS="40">%s</TEXTAREA>'
def _linesInput(self,n,t,v):
d808fdc5a53ba745f7895abbd50900644f50892c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d808fdc5a53ba745f7895abbd50900644f50892c/ObjectManager.py
return ('<TEXTAREA NAME="%s" ROWS="10" COLS="50">%s</TEXTAREA>'
return ('<TEXTAREA NAME="%s" ROWS="10" COLS="40">%s</TEXTAREA>'
def _textInput(self,n,t,v): return ('<TEXTAREA NAME="%s" ROWS="10" COLS="50">%s</TEXTAREA>'
d808fdc5a53ba745f7895abbd50900644f50892c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d808fdc5a53ba745f7895abbd50900644f50892c/ObjectManager.py
self.locals[name] = value
self.locals[name] = value
def setLocal(self, name, value): if self.locals is self.stack[-1]: # Unmerge this scope's locals from previous scope of first set self.locals = self.locals.copy() self.locals[name] = value
da45006f4d07b64494a6bee11af58c2ef9c274f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/da45006f4d07b64494a6bee11af58c2ef9c274f0/DummyEngine.py
if globbing is not None:
if globbing :
def manage_FTPlist(self, REQUEST): "Directory listing for FTP" out=()
0f055c5cdb5c44425a58345e07b11a125d124708 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0f055c5cdb5c44425a58345e07b11a125d124708/ObjectManager.py
if r is not None: return r
if r is not None: result = r
def getPath(prefix, name, checkProduct=1, suffixes=('',)): """Find a file in one of several relative locations Arguments: prefix -- The location, relative to some home, to look for the file name -- The name of the file. This must not be a path. checkProduct -- a flag indicating whether product directories should be used as additional hope ares to be searched. This defaults to a true value. If this is true and the name contains a dot, then the text before the dot is treated as a product name and the product package directory is used as anothe rhome. suffixes -- a sequences of file suffixes to check. By default, the name is used without a suffix. The search takes on multiple homes which are the instance home, the directory containing the directory containing the software home, and possibly product areas. """ d,n = path_split(name) if d: raise ValueError, ( 'The file name, %s, should be a simple file name' % name) if checkProduct: l = name.find('.') if l > 0: p = name[:l] n = name[l + 1:] for product_dir in Products.__path__: r = _getPath(product_dir, os.path.join(p, prefix), n, suffixes) if r is not None: return r import App.config cfg = App.config.getConfiguration() sw=os.path.dirname(os.path.dirname(cfg.softwarehome)) for home in (cfg.instancehome, sw): r=_getPath(home, prefix, name, suffixes) if r is not None: return r
309d6f33d7c27eaa225f2babd6413398266fb74a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/309d6f33d7c27eaa225f2babd6413398266fb74a/Extensions.py
import App.config cfg = App.config.getConfiguration() sw=os.path.dirname(os.path.dirname(cfg.softwarehome)) for home in (cfg.instancehome, sw): r=_getPath(home, prefix, name, suffixes) if r is not None: return r
if result is None: import App.config cfg = App.config.getConfiguration() sw=os.path.dirname(os.path.dirname(cfg.softwarehome)) for home in (cfg.instancehome, sw): r=_getPath(home, prefix, name, suffixes) if r is not None: result = r if result is None: try: l = name.find('.') if l > 0: realName = name[l + 1:] toplevel = name[:l] m = __import__(toplevel) d = os.path.join(m.__path__[0], prefix, realName) for s in suffixes: if s: s="%s.%s" % (d, s) else: s=d if os.path.exists(s): result = s break except: pass return result
def getPath(prefix, name, checkProduct=1, suffixes=('',)): """Find a file in one of several relative locations Arguments: prefix -- The location, relative to some home, to look for the file name -- The name of the file. This must not be a path. checkProduct -- a flag indicating whether product directories should be used as additional hope ares to be searched. This defaults to a true value. If this is true and the name contains a dot, then the text before the dot is treated as a product name and the product package directory is used as anothe rhome. suffixes -- a sequences of file suffixes to check. By default, the name is used without a suffix. The search takes on multiple homes which are the instance home, the directory containing the directory containing the software home, and possibly product areas. """ d,n = path_split(name) if d: raise ValueError, ( 'The file name, %s, should be a simple file name' % name) if checkProduct: l = name.find('.') if l > 0: p = name[:l] n = name[l + 1:] for product_dir in Products.__path__: r = _getPath(product_dir, os.path.join(p, prefix), n, suffixes) if r is not None: return r import App.config cfg = App.config.getConfiguration() sw=os.path.dirname(os.path.dirname(cfg.softwarehome)) for home in (cfg.instancehome, sw): r=_getPath(home, prefix, name, suffixes) if r is not None: return r
309d6f33d7c27eaa225f2babd6413398266fb74a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/309d6f33d7c27eaa225f2babd6413398266fb74a/Extensions.py
if instrance(ICP_PORT, IntType): ICP_PORT=((IP_ADDRESS, ICP_PORT),)
if isinstance(ICP_PORT, IntType): ICP_PORT=((IP_ADDRESS, ICP_PORT),)
def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") )
7d39cb64283de8b999ee73c759641c86bfc48bb1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7d39cb64283de8b999ee73c759641c86bfc48bb1/z2.py
return '%s, %s %s %s %s GMT' % (t[0],t[2],t[1],t[3],t[4])
return '%s, %s %s %s %s GMT' % (t[0],t[2],t[1],t[4],t[3])
def rfc1123_date(t=None, time=time, asctime=asctime, gmtime=gmtime, split=split): # Return an RFC 1123 format date string. t=split(asctime(gmtime(t or time()))) return '%s, %s %s %s %s GMT' % (t[0],t[2],t[1],t[3],t[4])
6718f182db5609e6236d66b04b76edcf1a7e2ead /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6718f182db5609e6236d66b04b76edcf1a7e2ead/Common.py
'<html><head><title>%s Input Data</title></head><body>\n%s\n'
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">\n' '<html lang="en"><head><title>%s Input Data</title></head>\n' '<body bgcolor="
def default_input_form(id,arguments,action='query', tabs=''): if arguments: items=arguments.items() return ( "%s\n%s%s" % ( '<html><head><title>%s Input Data</title></head><body>\n%s\n' '<form action="<dtml-var URL2>/<dtml-var id>/%s" ' 'method="get">\n' '<h2>%s Input Data</h2>\n' 'Enter query parameters:<br>' '<table>\n' % (id, tabs, action,id), string.joinfields( map( lambda a: ('<tr> <th>%s</th>\n' ' <td><input name="%s"\n' ' width=30 value="%s">' ' </td></tr>' % (nicify(a[0]), ( a[1].has_key('type') and ("%s:%s" % (a[0],a[1]['type'])) or a[0] ), a[1].has_key('default') and a[1]['default'] or '' )) , items ), '\n'), '\n<tr><td colspan=2 align=center>\n' '<input type="SUBMIT" name="SUBMIT" value="Submit Query">\n' '<dtml-if HTTP_REFERER>\n' ' <input type="SUBMIT" name="SUBMIT" value="Cancel">\n' ' <INPUT NAME="CANCEL_ACTION" TYPE="HIDDEN"\n' ' VALUE="<dtml-var HTTP_REFERER>">\n' '</dtml-if>\n' '</td></tr>\n</table>\n</form>\n</body>\n</html>\n' ) ) else: return ( '<html><head><title>%s Input Data</title></head><body>\n%s\n' '<form action="<dtml-var URL2>/<dtml-var id>/%s" ' 'method="get">\n' '<h2>%s Input Data</h2>\n' 'This query requires no input.<p>\n' '<input type="SUBMIT" name="SUBMIT" value="Submit Query">\n' '<dtml-if HTTP_REFERER>\n' ' <input type="SUBMIT" name="SUBMIT" value="Cancel">\n' ' <INPUT NAME="CANCEL_ACTION" TYPE="HIDDEN"\n' ' VALUE="<dtml-var HTTP_REFERER>">\n' '</dtml-if>\n' '</td></tr>\n</table>\n</form>\n</body>\n</html>\n' % (id, tabs, action, id) )
3d1e3442c3794f3670869345b2b72bccda8e8ddf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3d1e3442c3794f3670869345b2b72bccda8e8ddf/Aqueduct.py
'<html><head><title>%s Input Data</title></head><body>\n%s\n'
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">\n' '<html lang="en"><head><title>%s Input Data</title></head>\n' '<body bgcolor="
def default_input_form(id,arguments,action='query', tabs=''): if arguments: items=arguments.items() return ( "%s\n%s%s" % ( '<html><head><title>%s Input Data</title></head><body>\n%s\n' '<form action="<dtml-var URL2>/<dtml-var id>/%s" ' 'method="get">\n' '<h2>%s Input Data</h2>\n' 'Enter query parameters:<br>' '<table>\n' % (id, tabs, action,id), string.joinfields( map( lambda a: ('<tr> <th>%s</th>\n' ' <td><input name="%s"\n' ' width=30 value="%s">' ' </td></tr>' % (nicify(a[0]), ( a[1].has_key('type') and ("%s:%s" % (a[0],a[1]['type'])) or a[0] ), a[1].has_key('default') and a[1]['default'] or '' )) , items ), '\n'), '\n<tr><td colspan=2 align=center>\n' '<input type="SUBMIT" name="SUBMIT" value="Submit Query">\n' '<dtml-if HTTP_REFERER>\n' ' <input type="SUBMIT" name="SUBMIT" value="Cancel">\n' ' <INPUT NAME="CANCEL_ACTION" TYPE="HIDDEN"\n' ' VALUE="<dtml-var HTTP_REFERER>">\n' '</dtml-if>\n' '</td></tr>\n</table>\n</form>\n</body>\n</html>\n' ) ) else: return ( '<html><head><title>%s Input Data</title></head><body>\n%s\n' '<form action="<dtml-var URL2>/<dtml-var id>/%s" ' 'method="get">\n' '<h2>%s Input Data</h2>\n' 'This query requires no input.<p>\n' '<input type="SUBMIT" name="SUBMIT" value="Submit Query">\n' '<dtml-if HTTP_REFERER>\n' ' <input type="SUBMIT" name="SUBMIT" value="Cancel">\n' ' <INPUT NAME="CANCEL_ACTION" TYPE="HIDDEN"\n' ' VALUE="<dtml-var HTTP_REFERER>">\n' '</dtml-if>\n' '</td></tr>\n</table>\n</form>\n</body>\n</html>\n' % (id, tabs, action, id) )
3d1e3442c3794f3670869345b2b72bccda8e8ddf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3d1e3442c3794f3670869345b2b72bccda8e8ddf/Aqueduct.py
from OFS.ObjectManager import ObjectManager return ObjectManager
return ObjectManagerWithIItem
def _getTargetClass( self ):
a022f459817b94efb5577d23d31752d47a75bc95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a022f459817b94efb5577d23d31752d47a75bc95/testObjectManager.py
topic_id = 'topic_%d' % id
topic_id = 'topic_%02d' % id
def initialize(context): # abuse registerClass to get a tutorial constructor # in the product add list context.registerClass( None, meta_type='Zope Tutorial', constructors=(TutorialTopic.addTutorialForm, TutorialTopic.addTutorial), ) # create tutorial help topics lesson_path=os.path.join(App.Common.package_home(globals()), 'tutorial.stx') glossary_path=os.path.join(App.Common.package_home(globals()), 'glossary.stx') help=context.getProductHelp() # test to see if nothing has changed since last registration if help.lastRegistered is not None and \ help.lastRegistered >= DateTime(os.stat(lesson_path)[stat.ST_MTIME]): return help.lastRegistered=DateTime() # delete old help topics for id in help.objectIds('Help Topic'): help._delObject(id) # create glossary text=open(glossary_path).read() text=term_pat.sub(defineTerm, text) glossary=TutorialTopic.TutorialTopic('glossary', 'Zope Tutorial Glossary', text) # create lessons f=open(lesson_path) lines=[] id=0 while 1: line = f.readline() if (string.strip(line) and string.find(line, ' ') != 0) or line=='': # new topic if lines: id = id + 1 topic_id = 'topic_%d' % id text=string.join(lines[1:], '') text=term_pat.sub(glossaryTerm, text) topic=TutorialTopic.TutorialTopic(topic_id, string.strip(lines[0]), text) context.registerHelpTopic(topic_id, topic) lines=[line] else: lines.append(line) if line == '': break f.close() # register glossary last context.registerHelpTopic('glossary', glossary)
c79ab2c1894c1115bbf5afc8c6c1a2703344f965 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c79ab2c1894c1115bbf5afc8c6c1a2703344f965/__init__.py
eol = find(html, '\r\n', spos)
eol = html.find('\r\n', spos)
def decapitate(html, RESPONSE=None): headers = [] spos = 0 eolen = 1 while 1: m = hdr_start(html, spos) if not m: if html[spos:spos+2] == '\r\n': eolen = 2 break if html[spos:spos+1] == '\n': eolen = 1 break return html header = list(m.groups()) headers.append(header) spos = m.end() + 1 while spos < len(html) and html[spos] in ' \t': eol = find(html, '\r\n', spos) if eol <> -1: eolen = 2 else: eol = find(html, '\n', spos) if eol < 0: return html eolen = 1 header.append(strip(html[spos:eol])) spos = eol + eolen if RESPONSE is not None: for header in headers: hkey = header.pop(0) RESPONSE.setHeader(hkey, ' '.join(header).strip()) return html[spos + eolen:]
35accf50e26bdab753d9070e5dfd59572c939c1a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/35accf50e26bdab753d9070e5dfd59572c939c1a/DTMLMethod.py
eol = find(html, '\n', spos)
eol = html.find( '\n', spos)
def decapitate(html, RESPONSE=None): headers = [] spos = 0 eolen = 1 while 1: m = hdr_start(html, spos) if not m: if html[spos:spos+2] == '\r\n': eolen = 2 break if html[spos:spos+1] == '\n': eolen = 1 break return html header = list(m.groups()) headers.append(header) spos = m.end() + 1 while spos < len(html) and html[spos] in ' \t': eol = find(html, '\r\n', spos) if eol <> -1: eolen = 2 else: eol = find(html, '\n', spos) if eol < 0: return html eolen = 1 header.append(strip(html[spos:eol])) spos = eol + eolen if RESPONSE is not None: for header in headers: hkey = header.pop(0) RESPONSE.setHeader(hkey, ' '.join(header).strip()) return html[spos + eolen:]
35accf50e26bdab753d9070e5dfd59572c939c1a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/35accf50e26bdab753d9070e5dfd59572c939c1a/DTMLMethod.py
header.append(strip(html[spos:eol]))
header.append(html[spos:eol].strip())
def decapitate(html, RESPONSE=None): headers = [] spos = 0 eolen = 1 while 1: m = hdr_start(html, spos) if not m: if html[spos:spos+2] == '\r\n': eolen = 2 break if html[spos:spos+1] == '\n': eolen = 1 break return html header = list(m.groups()) headers.append(header) spos = m.end() + 1 while spos < len(html) and html[spos] in ' \t': eol = find(html, '\r\n', spos) if eol <> -1: eolen = 2 else: eol = find(html, '\n', spos) if eol < 0: return html eolen = 1 header.append(strip(html[spos:eol])) spos = eol + eolen if RESPONSE is not None: for header in headers: hkey = header.pop(0) RESPONSE.setHeader(hkey, ' '.join(header).strip()) return html[spos + eolen:]
35accf50e26bdab753d9070e5dfd59572c939c1a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/35accf50e26bdab753d9070e5dfd59572c939c1a/DTMLMethod.py
if callable(object.id): name=object.id() else: name=object.id if name != os.path.split(path)[-1] and \ hasattr(object, 'aq_parent'): return object.aq_parent
if hasattr(object, 'id'): if callable(object.id): name=object.id() else: name=object.id elif hasattr(object, '__name__'): name=object.__name__ else: name='' if name != os.path.split(path)[-1]: return req.PARENTS[0]
def resolve_url(self, url): # Attempt to resolve a url into an object in the Zope # namespace. The url must be a fully-qualified url. The # method will return the requested object if it is found # or raise the same HTTP error that would be raised in # the case of a real web request. If the passed in url # does not appear to describe an object in the system # namespace (e.g. the host, port or script name dont # match that of the current request), a ValueError will # be raised. if find(url, self.script) != 0: raise ValueError, 'Different namespace.' path=url[len(self.script):] while path and path[0]=='/': path=path[1:] while path and path[-1]=='/': path=path[:-1] req=self.clone() rsp=req.response req['PATH_INFO']=path object=None try: object=req.traverse(path) except: rsp.exception(0) if object is not None: # waaa - traversal may return a "default object" # like an index_html document, though you really # wanted to get a Folder back :( if callable(object.id): name=object.id() else: name=object.id if name != os.path.split(path)[-1] and \ hasattr(object, 'aq_parent'): return object.aq_parent return object raise rsp.errmsg, sys.exc_value
36c526f3b3687d24591d1a4e10bd5fcb9a7d15ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/36c526f3b3687d24591d1a4e10bd5fcb9a7d15ba/HTTPRequest.py
('View management screens', ('manage','manage_workspace',
('View management screens', ('manage','manage_main',
def manage_addFile(self,id,file,title='',precondition='',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._setObject(id, File(id,title,file,precondition)) if REQUEST is not None: return self.manage_main(self,REQUEST)
a62838f41ddc67df9fc4679f0d887e155f22147a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a62838f41ddc67df9fc4679f0d887e155f22147a/Image.py
if os.environ.has_key('STUPID_LOG_FILE'): del os.environ['STUPID_LOG_FILE'] if os.environ.has_key('EVENT_LOG_FILE'): del os.environ['EVENT_LOG_FILE'] if os.environ.has_key('STUPID_LOG_SEVERITY'): del os.environ['STUPID_LOG_SEVERITY'] if os.environ.has_key('EVENT_LOG_SEVERITY'): del os.environ['EVENT_LOG_SEVERITY']
self.wipeEnvironment()
def tearDown(self): try: os.remove(self.path) except os.error: pass if os.environ.has_key('STUPID_LOG_FILE'): del os.environ['STUPID_LOG_FILE'] if os.environ.has_key('EVENT_LOG_FILE'): del os.environ['EVENT_LOG_FILE'] if os.environ.has_key('STUPID_LOG_SEVERITY'): del os.environ['STUPID_LOG_SEVERITY'] if os.environ.has_key('EVENT_LOG_SEVERITY'): del os.environ['EVENT_LOG_SEVERITY']
1b88370ab7b3eff3f236e8af2ed36e0c6d7240cc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1b88370ab7b3eff3f236e8af2ed36e0c6d7240cc/testzLog.py
else: return db.getSize()
else: return db.objectCount()
def database_size(self): try: db=self._p_jar.db() except: # BoboPOS2 return len(Globals.Bobobase._jar.db.index)*4 else: return db.getSize()
570f612ac28537cf14db82fb5e845ce6157d64e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/570f612ac28537cf14db82fb5e845ce6157d64e3/CacheManager.py
LOG('AccessControl', WARNING, 'A user object of type %s has no aq_parent.' % str(type(auth_user)))
ac_logger.warning( 'A user object of type %s has no aq_parent.', type(auth_user) )
def recordMetaData(self, object, request, # Optimize global var lookups: hasattr=hasattr, getattr=getattr, logger=ac_logger, ): request_get = request.get if hasattr(object, 'getPhysicalPath'): path = '/'.join(object.getPhysicalPath()) else: # Try hard to get the physical path of the object, # but there are many circumstances where that's not possible. to_append = ()
8af5b3e6b2688eee09fb2cd083d053806211581a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/8af5b3e6b2688eee09fb2cd083d053806211581a/startup.py
if path[0]=='/': path=path[1:] if path[-1]=='/': path=path[:-1]
if path[:1]=='/': path=path[1:] if path[-1:]=='/': path=path[:-1]
def traverse(self, path, response=None): """Traverse the object space
249c3c2bd25e9d90e7e7afbefe46b9afed63d07d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/249c3c2bd25e9d90e7e7afbefe46b9afed63d07d/BaseRequest.py
def manage_exportObject(self,id=None,download=None,RESPONSE=None):
def manage_exportObject(self, id='', download=None, RESPONSE=None):
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() o._p_jar.export_file(o,f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', 'inline;filename=%s.bbe' % id) return f.getvalue() f=Globals.data_dir+'/%s.bbe' % id o._p_jar.export_file(o,f) if RESPONSE is not None: return MessageDialog( title="Object exported", message="<EM>%s</EM> sucessfully\ exported to <pre>%s</pre>." % (id,f), action="manage_main")
b94b21d273bd0349b78f6576694ee29f9744529a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b94b21d273bd0349b78f6576694ee29f9744529a/Folder.py
if id is None: o=self else: o=getattr(self,id)
if not id: id=self.id if callable(id): id=id() ob=self else: ob=getattr(self,id)
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() o._p_jar.export_file(o,f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', 'inline;filename=%s.bbe' % id) return f.getvalue() f=Globals.data_dir+'/%s.bbe' % id o._p_jar.export_file(o,f) if RESPONSE is not None: return MessageDialog( title="Object exported", message="<EM>%s</EM> sucessfully\ exported to <pre>%s</pre>." % (id,f), action="manage_main")
b94b21d273bd0349b78f6576694ee29f9744529a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b94b21d273bd0349b78f6576694ee29f9744529a/Folder.py
o._p_jar.export_file(o,f)
ob._p_jar.export_file(ob, f)
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() o._p_jar.export_file(o,f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', 'inline;filename=%s.bbe' % id) return f.getvalue() f=Globals.data_dir+'/%s.bbe' % id o._p_jar.export_file(o,f) if RESPONSE is not None: return MessageDialog( title="Object exported", message="<EM>%s</EM> sucessfully\ exported to <pre>%s</pre>." % (id,f), action="manage_main")
b94b21d273bd0349b78f6576694ee29f9744529a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b94b21d273bd0349b78f6576694ee29f9744529a/Folder.py
o._p_jar.export_file(o,f)
ob._p_jar.export_file(ob, f)
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() o._p_jar.export_file(o,f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', 'inline;filename=%s.bbe' % id) return f.getvalue() f=Globals.data_dir+'/%s.bbe' % id o._p_jar.export_file(o,f) if RESPONSE is not None: return MessageDialog( title="Object exported", message="<EM>%s</EM> sucessfully\ exported to <pre>%s</pre>." % (id,f), action="manage_main")
b94b21d273bd0349b78f6576694ee29f9744529a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b94b21d273bd0349b78f6576694ee29f9744529a/Folder.py
exported to <pre>%s</pre>." % (id,f),
exported to <pre>%s</pre>." % (id, f),
def manage_exportObject(self,id=None,download=None,RESPONSE=None): """Exports an object to a file and returns that file.""" if id is None: o=self else: o=getattr(self,id) if download: f=StringIO() o._p_jar.export_file(o,f) RESPONSE.setHeader('Content-type','application/data') RESPONSE.setHeader('Content-Disposition', 'inline;filename=%s.bbe' % id) return f.getvalue() f=Globals.data_dir+'/%s.bbe' % id o._p_jar.export_file(o,f) if RESPONSE is not None: return MessageDialog( title="Object exported", message="<EM>%s</EM> sucessfully\ exported to <pre>%s</pre>." % (id,f), action="manage_main")
b94b21d273bd0349b78f6576694ee29f9744529a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b94b21d273bd0349b78f6576694ee29f9744529a/Folder.py
def __init__(self, parent, id): self.id=id self.__parent__=parent self.__roles__ =parent.PUT__roles__
b94b21d273bd0349b78f6576694ee29f9744529a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b94b21d273bd0349b78f6576694ee29f9744529a/Folder.py
raise 'Bad Request', 'Unknown content type'
content_type='application/octet-stream'
def PUT(self, REQUEST, RESPONSE): """Adds a document, image or file to the folder when a PUT request is received.""" name=self.id type=REQUEST.get_header('content-type', None) body=REQUEST.get('BODY', '') if type is None: type, enc=mimetypes.guess_type(name) if type is None: if content_types.find_binary(body) >= 0: raise 'Bad Request', 'Unknown content type' else: type=content_types.text_type(body) type=lower(type) if type in ('text/html', 'text/xml', 'text/plain'): self.__parent__.manage_addDTMLDocument(name, '', body) elif type[:6]=='image/': ob=Image(name, '', body, content_type=type) self.__parent__._setObject(name, ob) else: ob=File(name, '', body, content_type=type) self.__parent__._setObject(name, ob) RESPONSE.setStatus(201) RESPONSE.setBody('') return RESPONSE
b94b21d273bd0349b78f6576694ee29f9744529a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b94b21d273bd0349b78f6576694ee29f9744529a/Folder.py
filelist.remove(name)
def scrub(list, dirname, filelist): for name in filelist: if name in EXCLUDED_NAMES: continue prefix, ext = os.path.splitext(name) if ext == '.pyo' or ext == '.pyc': full = os.path.join(dirname, name) os.unlink(full) filelist.remove(name) if DEBUG: print full
69fec4f58f82f369d6a49fc8b8f28c318ddefd3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/69fec4f58f82f369d6a49fc8b8f28c318ddefd3b/walkandscrub.py
--prefix=DIR install Zope files in DIR [%(TARGET_DIR)s]
--prefix=DIR install Zope files in DIR [%(PREFIX)s]
def usage(): usage = ("""
18ac5c47a8bd57fb05dbe1a5fd33f8211c0e5dec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/18ac5c47a8bd57fb05dbe1a5fd33f8211c0e5dec/configure.py
'%(target_dir)s' You can specify an alternate location for these
'%(PREFIX)s' You can specify an alternate location for these
def usage(): usage = ("""
18ac5c47a8bd57fb05dbe1a5fd33f8211c0e5dec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/18ac5c47a8bd57fb05dbe1a5fd33f8211c0e5dec/configure.py
""" % ({'program':sys.argv[0], 'TARGET_DIR':TARGET_DIR})
""" % ({'program':sys.argv[0], 'PREFIX':PREFIX})
def usage(): usage = ("""
18ac5c47a8bd57fb05dbe1a5fd33f8211c0e5dec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/18ac5c47a8bd57fb05dbe1a5fd33f8211c0e5dec/configure.py
self._length = BTrees.Length.Length()
def __init__(self, vocabulary=None, brains=None): # Catalogs no longer care about vocabularies and lexicons # so the vocabulary argument is ignored. (Casey)
36e3f3b53de3b4d6ee3eea730672f6c74d19e81a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/36e3f3b53de3b4d6ee3eea730672f6c74d19e81a/Catalog.py
self._length.set(0)
self._length = BTrees.Length.Length()
def clear(self): """ clear catalog """
36e3f3b53de3b4d6ee3eea730672f6c74d19e81a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/36e3f3b53de3b4d6ee3eea730672f6c74d19e81a/Catalog.py
% productid, exc_info=exc)
% productid, exc_info=True)
def logBadRefresh(productid): exc = sys.exc_info() try: logger.error('Exception while refreshing %s' % productid, exc_info=exc) if hasattr(exc[0], '__name__'): error_type = exc[0].__name__ else: error_type = str(exc[0]) error_value = str(exc[1]) info = ''.join(format_exception(exc[0], exc[1], exc[2], limit=200)) refresh_exc_info[productid] = (error_type, error_value, info) finally: exc = None
4798174273237058ef1e744d86e1d278d375e597 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4798174273237058ef1e744d86e1d278d375e597/RefreshFuncs.py
from SignalHandler import SignalHandler
if os.name == 'posix': from SignalHandler import SignalHandler
def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' 'To use localization options, you must ensure\n' 'that the locale module is compiled into your\n' 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The specified locale is not supported by your system.\n' 'See your operating system documentation for more\n' 'information on locale support.' )
b310ba9b03933b52d3e014afb7f25ee7d0f8c7bd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b310ba9b03933b52d3e014afb7f25ee7d0f8c7bd/z2.py
for k, intset in sort_index.items():
for k, intset in sort_index._index.items():
def _indexedSearch(self, args, sort_index, append, used):
e720d086429e499e2e8dab052f88a6ea4db10fd9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e720d086429e499e2e8dab052f88a6ea4db10fd9/Catalog.py
if e=='lib': chome=d
if e=='lib': chome=d or '.'
def package_home(globals_dict): __name__=globals_dict['__name__'] m=sys.modules[__name__] if hasattr(m,'__path__'): return m.__path__[0] return sys.modules[__name__[:rfind(__name__,'.')]].__path__[0]
446255360cdab2d8539090aa47faa8ca527c035a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/446255360cdab2d8539090aa47faa8ca527c035a/Globals.py
if not parent.aq_inContextOf(self.aq_parent.aq_parent,1):
if (hasattr(parent, 'aq_inContextOf') and not parent.aq_inContextOf(self.aq_parent.aq_parent,1)):
def allowed(self, parent, roles=None): """Check whether the user has access to parent, assuming that parent.__roles__ is the given roles.""" if roles is None or 'Anonymous' in roles: return 1 usr_roles=self.getRolesInContext(parent) for role in roles: if role in usr_roles: if (hasattr(self,'aq_parent') and hasattr(self.aq_parent,'aq_parent')): if parent is None: return 1 if (not hasattr(parent, 'aq_inContextOf') and hasattr(parent, 'im_self')): # This is a method, grab it's self. parent=parent.im_self if not parent.aq_inContextOf(self.aq_parent.aq_parent,1): if 'Shared' in roles: # Damn, old role setting. Waaa roles=self._shared_roles(parent) if 'Anonymous' in roles: return 1 return None return 1
b0bfa928aaf929c8b5a6654309241157efd0d78e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b0bfa928aaf929c8b5a6654309241157efd0d78e/User.py
except (AttributeError, ValidationError):
except (AttributeError, ValidationError, KeyError):
def careful_hasattr(md, inst, name): get = md.guarded_getattr if get is None: get = getattr try: get(inst, name) except (AttributeError, ValidationError): return 0 else: return 1
55b181886b6e9dcb8074cf425135c61f3650b9a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/55b181886b6e9dcb8074cf425135c61f3650b9a7/DT_Util.py
class Traverse:
class Traverse(ExtensionClass.Base):
def connected(self):
23a86415ce0d0850496020c5638aa75d7f3bd96c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/23a86415ce0d0850496020c5638aa75d7f3bd96c/DA.py
da=self._da
da=self.__dict__['_da']
def __bobo_traverse__(self, REQUEST, key):
23a86415ce0d0850496020c5638aa75d7f3bd96c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/23a86415ce0d0850496020c5638aa75d7f3bd96c/DA.py
r=self._r
r=self.__dict__['_r']
def __getattr__(self, name):
23a86415ce0d0850496020c5638aa75d7f3bd96c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/23a86415ce0d0850496020c5638aa75d7f3bd96c/DA.py
return getattr(self._da, name)
return getattr(self.__dict__['_da'], name)
def __getattr__(self, name):
23a86415ce0d0850496020c5638aa75d7f3bd96c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/23a86415ce0d0850496020c5638aa75d7f3bd96c/DA.py
for k in filter(lambda k: k[:2]=='__', Record.__dict__.keys()): setattr(r,k,getattr(Record,k))
for k in Record.__dict__.keys(): if k[:2]=='__': setattr(r,k,getattr(Record,k))
def __init__(self,(items,data),brains=NoBrains, parent=None, zbrains=None):
1bb7d3b73bd9f8f1768e4d6d447c1bdc32f59160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1bb7d3b73bd9f8f1768e4d6d447c1bdc32f59160/Results.py
if r is not None: return r, (id,)
if r is None: r=intSet() return r, (id,)
def _apply_index(self, request):
809010766f1e3addb05a4b2cd77b01c3ca488e7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/809010766f1e3addb05a4b2cd77b01c3ca488e7b/Index.py
hidden=('Control Panel', 'Principia Draft', 'simple item')
hidden=('Control Panel', 'Principia Draft', 'simple item', 'Broken Because Product is Gone')
def hs_search_mod(self, mod, dict): # Root through a module for things that look like # createable object classes. hidden=('Control Panel', 'Principia Draft', 'simple item') for k, v in mod.__dict__.items(): if is_class(v) and hasattr(v, 'meta_type') and \ hasattr(v, '__ac_permissions__') and \ (v.meta_type not in hidden): dict[v.meta_type]=ObjectItem(k, v) if is_module(v) and hasattr(v, '__path__'): dict=self.hs_search_mod(v, dict) return dict
057904e395dec36368fe5f004427a05b46550e5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/057904e395dec36368fe5f004427a05b46550e5d/ObjectRef.py
hasattr(v, '__ac_permissions__') and \ (v.meta_type not in hidden): dict[v.meta_type]=ObjectItem(k, v)
hasattr(v, '__ac_permissions__'): if callable(v.meta_type): try: meta_type=v.meta_type() except: meta_type=None else: meta_type=v.meta_type if (meta_type is not None) and (meta_type not in hidden): dict[meta_type]=ObjectItem(k, v)
def hs_search_mod(self, mod, dict): # Root through a module for things that look like # createable object classes. hidden=('Control Panel', 'Principia Draft', 'simple item') for k, v in mod.__dict__.items(): if is_class(v) and hasattr(v, 'meta_type') and \ hasattr(v, '__ac_permissions__') and \ (v.meta_type not in hidden): dict[v.meta_type]=ObjectItem(k, v) if is_module(v) and hasattr(v, '__path__'): dict=self.hs_search_mod(v, dict) return dict
057904e395dec36368fe5f004427a05b46550e5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/057904e395dec36368fe5f004427a05b46550e5d/ObjectRef.py
self.client.log(sum, priority=sev)
self.client.log(sub + pid_str + sum, priority=sev)
def __call__(self, sub, sev, sum, det, err):
fcf83c36b6bb2578054130f6b702e00624f4c594 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fcf83c36b6bb2578054130f6b702e00624f4c594/syslogLogger.py
return getSecurityManager().checkPermission(permission, object)
roles=rolesForPermissionOn(permission, object) if type(roles) is type(''): roles=[roles] return self.allowed(object, roles)
def has_permission(self, permission, object): """Check to see if a user has a given permission on an object.""" return getSecurityManager().checkPermission(permission, object)
110ffbfc3dc125a3d0493b6a94cdf4f7df4e541c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/110ffbfc3dc125a3d0493b6a94cdf4f7df4e541c/User.py
public__roles__=ACCESS_PRIVATE def public(self, *names):
declarePublic__roles__=ACCESS_PRIVATE def declarePublic(self, *names):
def _setaccess(self, names, access): # Empty names list sets access to the class itself, named '' if not len(names): names = ('',) for name in names: if self.names.get(name, access) != access: LOG('SecurityInfo', WARNING, 'Conflicting security ' 'declarations for "%s"' % name) self._warnings = 1 self.names[name] = access
4ab8bc440b506b063b64743a9d7b36df3154a636 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ab8bc440b506b063b64743a9d7b36df3154a636/SecurityInfo.py
private__roles__=ACCESS_PRIVATE def private(self, *names):
declarePrivate__roles__=ACCESS_PRIVATE def declarePrivate(self, *names):
def public(self, *names): """Declare names to be publicly accessible.""" self._setaccess(names, ACCESS_PUBLIC)
4ab8bc440b506b063b64743a9d7b36df3154a636 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ab8bc440b506b063b64743a9d7b36df3154a636/SecurityInfo.py
protected__roles__=ACCESS_PRIVATE def protected(self, permission_name, *names):
declareProtected__roles__=ACCESS_PRIVATE def declareProtected(self, permission_name, *names):
def private(self, *names): """Declare names to be inaccessible to restricted code.""" self._setaccess(names, ACCESS_PRIVATE)
4ab8bc440b506b063b64743a9d7b36df3154a636 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ab8bc440b506b063b64743a9d7b36df3154a636/SecurityInfo.py
def protected(self, permission_name, *names):
declareProtected__roles__=ACCESS_PRIVATE def declareProtected(self, permission_name, *names):
def protected(self, permission_name, *names): """Cannot declare module names protected.""" pass
4ab8bc440b506b063b64743a9d7b36df3154a636 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4ab8bc440b506b063b64743a9d7b36df3154a636/SecurityInfo.py
import_product(product_dir, product_name)
import_product(product_dir, product_name, raise_exc=debug_mode)
def import_products(): # Try to import each product, checking for and catching errors. done={} products = get_products() for priority, product_name, index, product_dir in products: if done.has_key(product_name): LOG('OFS.Application', WARNING, 'Duplicate Product name', 'After loading Product %s from %s,\n' 'I skipped the one in %s.\n' % ( `product_name`, `done[product_name]`, `product_dir`) ) continue done[product_name]=product_dir import_product(product_dir, product_name)
9f5535db14c5d1952073c17c07d4b4daaddb45b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9f5535db14c5d1952073c17c07d4b4daaddb45b9/Application.py
folder_permissions)
folder_permissions, raise_exc=debug_mode)
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() products = get_products() for priority, product_name, index, product_dir in products: # 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)
9f5535db14c5d1952073c17c07d4b4daaddb45b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9f5535db14c5d1952073c17c07d4b4daaddb45b9/Application.py
print 'key', key
def __getitem__(self, key): self=self.aq_parent
a150bc65d31f8513a75ea91d1ff34b54973ad182 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a150bc65d31f8513a75ea91d1ff34b54973ad182/History.py
o=o.__bobo_traverse__(o, a)
o=o.__bobo_traverse__(REQUEST, a)
def filtered_manage_options( self, REQUEST=None, help_option_=({'label': 'Help', 'action': 'manage_help', 'target':"z_help_wnd"},), ): if REQUEST is None and hasattr(self, 'aq_acquire'): try: REQUEST=self.aq_acquire('REQUEST') except: pass try: user=REQUEST['AUTHENTICATED_USER'] except: user=None result=[] seen_roles={}
c473a5a11a89d9027e5c16aea38e451ff5677cb1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c473a5a11a89d9027e5c16aea38e451ff5677cb1/Management.py
LOG.error('The attempt to rebuild the registry failed.', error=sys.exc_info())
LOG.error('The attempt to rebuild the registry failed.',exc_info=True)
def check_zglobals(self): if not doInstall(): return
3699d3290bcbd074e6e078b312fb93beff0f2b03 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3699d3290bcbd074e6e078b312fb93beff0f2b03/Application.py
tag = string.lower(string.strip(rawdata[i+2:j-1])) if not tag: raise HTMLParseError("empty start tag", self.getpos())
match = endtagfind.match(rawdata, i) if not match: raise HTMLParseError("bad end tag: %s" % `rawdata[i:j]`, self.getpos()) tag = match.group(1)
def parse_endtag(self, i): rawdata = self.rawdata assert rawdata[i:i+2] == "</", "unexpected call to parse_endtag" match = endendtag.search(rawdata, i+1) # > if not match: return -1 j = match.end() tag = string.lower(string.strip(rawdata[i+2:j-1])) if not tag: raise HTMLParseError("empty start tag", self.getpos()) self.handle_endtag(tag) return j
bdda145495ce7ded36a4d0423674e0c0525e74ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/bdda145495ce7ded36a4d0423674e0c0525e74ce/HTMLParser.py
s=self._index[oid] p=self._opickle[oid] return p, s finally: self._lock_release() def loadEx(self, oid, version): p, s = self.load(oid, version) return p, s, s
try: s=self._index[oid] p=self._opickle[oid] return p, s except KeyError: if oid in self._recently_gc_oids: raise POSException.ConflictError(oid=oid) else: raise finally: self._lock_release()
def load(self, oid, version): self._lock_acquire() try: s=self._index[oid] p=self._opickle[oid] return p, s # pickle, serial finally: self._lock_release()
1a676b2cb5faf9426357ce4e2e3a36b941b8d277 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1a676b2cb5faf9426357ce4e2e3a36b941b8d277/TemporaryStorage.py
rdata = self.tryToResolveConflict(oid, oserial, serial, data) if rdata is None: raise POSException.ConflictError( oid=oid, serials=(oserial, serial), data=data) else: data = rdata
data=self.tryToResolveConflict(oid, oserial, serial, data) if not data: raise POSException.ConflictError(oid=oid, serials=(oserial, serial))
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) if version: # we allow a version to be in use although we don't # support versions in the storage. LOG('TemporaryStorage', BLATHER, ('versions in use with TemporaryStorage although Temporary' 'Storage doesnt support versions'), ) self._lock_acquire() try: if self._index.has_key(oid): oserial=self._index[oid] if serial != oserial: rdata = self.tryToResolveConflict(oid, oserial, serial, data) if rdata is None: raise POSException.ConflictError( oid=oid, serials=(oserial, serial), data=data) else: data = rdata else: oserial = serial newserial=self._tid self._tmp.append((oid, data)) now = time.time() self._conflict_cache[(oid, newserial)] = data, now return serial == oserial and newserial or ResolvedSerial finally: self._lock_release()
1a676b2cb5faf9426357ce4e2e3a36b941b8d277 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1a676b2cb5faf9426357ce4e2e3a36b941b8d277/TemporaryStorage.py
newserial=self._tid
newserial=self._serial
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) if version: # we allow a version to be in use although we don't # support versions in the storage. LOG('TemporaryStorage', BLATHER, ('versions in use with TemporaryStorage although Temporary' 'Storage doesnt support versions'), ) self._lock_acquire() try: if self._index.has_key(oid): oserial=self._index[oid] if serial != oserial: rdata = self.tryToResolveConflict(oid, oserial, serial, data) if rdata is None: raise POSException.ConflictError( oid=oid, serials=(oserial, serial), data=data) else: data = rdata else: oserial = serial newserial=self._tid self._tmp.append((oid, data)) now = time.time() self._conflict_cache[(oid, newserial)] = data, now return serial == oserial and newserial or ResolvedSerial finally: self._lock_release()
1a676b2cb5faf9426357ce4e2e3a36b941b8d277 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1a676b2cb5faf9426357ce4e2e3a36b941b8d277/TemporaryStorage.py
serial=self._tid
serial=self._serial
def _finish(self, tid, u, d, e): zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get oreferences=self._oreferences serial=self._tid index=self._index opickle=self._opickle
1a676b2cb5faf9426357ce4e2e3a36b941b8d277 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/1a676b2cb5faf9426357ce4e2e3a36b941b8d277/TemporaryStorage.py
if key==name and self.optional: return ''
if str(key)==name and self.optional: return ''
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if key==name and self.optional: return '' raise KeyError, key, sys.exc_traceback if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for <em>%s</em>' % name) else: v=[v] vs=[] for v in v: if not v and type(v) is StringType and t != 'string': continue if t=='int': try: if type(v) is StringType: atoi(v) else: v=str(int(v)) except: raise ValueError, ( 'Invalid integer value for <em>%s</em>' % name) elif t=='float': if not v and type(v) is StringType: continue try: if type(v) is StringType: atof(v) else: v=str(float(v)) except: raise ValueError, ( 'Invalid floating-point value for <em>%s</em>' % name) else: v=str(v) v=md.getitem('sql_quote__',0)(v) #if find(v,"\'") >= 0: v=join(split(v,"\'"),"''") #v="'%s'" % v vs.append(v)
b89c7c8753b9002125ad0e5ddb04e07d86ef1672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b89c7c8753b9002125ad0e5ddb04e07d86ef1672/sqltest.py
moniker=rPickle.loads(unquote(self.REQUEST['clip_data']))
def validClipData(self):
965d1d985ac087dbfceb3bc34b8d9329bc1496dd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/965d1d985ac087dbfceb3bc34b8d9329bc1496dd/CopySupport.py
def unauthorized(self, realm):
def unauthorized(self, realm,debug_mode=None):
def unauthorized(self, realm): if not (self.request.has_key('REMOTE_USER') and self.request['REMOTE_USER']): self.response['WWW-authenticate']='basic realm="%s"' % realm m="<strong>You are not authorized to access this resource.</strong>" if not self.HTTP_AUTHORIZATION: m=m+'\n<!-- No Authorization header-->' raise 'Unauthorized', m
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py
if not self.HTTP_AUTHORIZATION: m=m+'\n<!-- No Authorization header-->'
if debug_mode: if self.HTTP_AUTHORIZATION: m=m+'\nUsername and password are not correct.' else: m=m+'\nNo Authorization header found.'
def unauthorized(self, realm): if not (self.request.has_key('REMOTE_USER') and self.request['REMOTE_USER']): self.response['WWW-authenticate']='basic realm="%s"' % realm m="<strong>You are not authorized to access this resource.</strong>" if not self.HTTP_AUTHORIZATION: m=m+'\n<!-- No Authorization header-->' raise 'Unauthorized', m
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py
object, doc, published, realm, module_name ) = get_module_info(module_name)
object, doc, published, realm, module_name, hide_tracebacks, debug_mode)= get_module_info(module_name) if request.environ.has_key('BOBO_DEBUG_MODE'): debug_mode=request.environ['BOBO_DEBUG_MODE'] try: debug_mode=atoi(debug_mode) except: pass if debug_mode: debug_mode=1 else: debug_mode=None if request.environ.has_key('BOBO_HIDE_TRACEBACKS'): hide_tracebacks=request.environ['BOBO_HIDE_TRACEBACKS'] try: hide_tracebacks=atoi(hide_tracebacks) except: pass if hide_tracebacks: hide_tracebacks=1 else: hide_tracebacks=None
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py
__traceback_info__=path if path[:1] != '/': path='/'+path if path[-1:] != '/': path=path+'/' if find(path,'/.') >= 0: path=join(split(path,'/./'),'/') l=find(path,'/../',1) while l > 0: p1=path[:l] path=path[:rfind(p1,'/')+1]+path[l+4:] l=find(path,'/../',1) path=path[1:-1]
if path[:1]=='/': path=path[1:] if path[-1:]=='/': path=path[:-1]
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py
if hasattr(object,'__bobo_traverse__'): request['URL']=URL try: object=object.__bobo_traverse__(request) except: pass
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py
if entry_name[:1]=='_': self.forbiddenError(entry_name)
if entry_name[:1]=='_': if debug_mode: self.debugError("Object name begins with an underscore at: %s" % URL) else: self.forbiddenError(entry_name)
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py
self.notFoundError(URL) try: try: doc=subobject.__doc__ except: doc=getattr(object, entry_name+'__doc__') if not doc: raise AttributeError, entry_name except: self.notFoundError("%s" % (URL)) if hasattr(subobject,'__roles__'): roles=subobject.__roles__
if entry_name=='.': subobject=object elif entry_name=='..' and parents: subobject=parents[-1] elif debug_mode: self.debugError("Cannot locate object at: %s" %URL) else: self.notFoundError(URL) if subobject is object and entry_name=='.': URL=URL[:rfind(URL,'/')]
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py
if not got: roleshack=entry_name+'__roles__' if hasattr(object, roleshack): roles=getattr(object, roleshack) parents.append(object) object=subobject steps.append(entry_name)
try: try: doc=subobject.__doc__ except: doc=getattr(object, entry_name+'__doc__') if not doc: raise AttributeError, entry_name except: if debug_mode: self.debugError("Missing doc string at: %s" % URL) else: self.notFoundError("%s" % (URL)) if hasattr(subobject,'__roles__'): roles=subobject.__roles__ else: if not got: roleshack=entry_name+'__roles__' if hasattr(object, roleshack): roles=getattr(object, roleshack) parents.append(object) object=subobject steps.append(entry_name)
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py
self.notFoundError(method)
if debug_mode: self.debugError("Method %s not found at: %s" % (method,URL)) else: self.notFoundError(method)
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py
self.unauthorized(realm)
self.unauthorized(realm,debug_mode)
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py
and not module.__bobo_hide_tracebacks__): CGIResponse._tbopen, CGIResponse._tbclose = '<PRE>', '</PRE>'
and not module.__bobo_hide_tracebacks__): hide_tracebacks=None else: hide_tracebacks=1
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__ else: realm=module_name # Check whether tracebacks should be hidden: if (hasattr(module,'__bobo_hide_tracebacks__') and not module.__bobo_hide_tracebacks__): CGIResponse._tbopen, CGIResponse._tbclose = '<PRE>', '</PRE>' 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) 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()
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py
object, doc, published, realm, module_name)
object, doc, published, realm, module_name, hide_tracebacks, 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__ else: realm=module_name # Check whether tracebacks should be hidden: if (hasattr(module,'__bobo_hide_tracebacks__') and not module.__bobo_hide_tracebacks__): CGIResponse._tbopen, CGIResponse._tbclose = '<PRE>', '</PRE>' 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) 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()
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py
if server_port!='80': server_url="%s:%s" % (server_url,server_port)
if server_port!='80': server_url=server_url+':'+server_port
def __init__(self,environ,form,stdin): self.environ=environ self.other=form self.stdin=stdin have_env=environ.has_key
86142d8cf2df52c6b79f4c067e9f567cd669c1c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86142d8cf2df52c6b79f4c067e9f567cd669c1c3/Publish.py