rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
_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_stu...
self.headers[n]=value
self.headers[name]=value
def setHeader(self, name, value): self.headers[n]=value
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
('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,'',con...
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 di...
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...
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, '/'.jo...
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, '/'.jo...
return Globals.Bobobase['roles']
return self.validRoles()
def roleNames(self):
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.
clip_data='',REQUEST):
clip_data='',REQUEST=None):
def manage_delObjects(self,ids=[],submit='',clip_id='', clip_data='',REQUEST):
self.parser = None
self.parser = self.feed = None
def close(self): try: self.parser.close() finally: self.parser = None # nuke circular reference
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): """
if SUPPORTS_WEBDAV_LOCKS: __implements__ = (WriteLockInterface,)
__implements__ = (WriteLockInterface,)
def __call__(self, REQUEST, RESPONSE): " " return self.document_src(REQUEST)
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()) #...
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"
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
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
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 ...
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("PluginInde...
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 P...
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 = ...
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
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.
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__
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__
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__
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__
doc(person=person)
doc(person=person())
def testNoImplicitAccess(self): class person: name='Jim'
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_stup...
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_stup...
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_stup...
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+' '
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+' '
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_...
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
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
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
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
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.SetVersi...
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
def pt_macro(self):
def pt_macros(self):
def pt_macro(self): self._cook_check() return PageTemplate.pt_macro(self)
return PageTemplate.pt_macro(self)
return PageTemplate.pt_macros(self)
def pt_macro(self): self._cook_check() return PageTemplate.pt_macro(self)
k=None
def sort_sequence(self, sequence):
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...
def sort_sequence(self, sequence):
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
e=e+1
def __getitem__(self,index):
except Unauthorized, vv:
except 'Unauthorized', vv:
def __getitem__(self,index):
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):
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)
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['Applicatio...
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`
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,...
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,...
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 ''
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 ''
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 ''
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 ''
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_n...
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
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
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
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
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
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
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
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): tpUr...
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): tpUr...
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): tpUr...
'<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): tpUr...
__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)
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, ConflictErr...
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(...
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 ...
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, ConflictErr...
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_...
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...
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>', '', '', ', ' e...
'\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>', '', '', ', ' e...
for k, intset in sort_index.items():
for k, intset in sort_index._index.items():
def _indexedSearch(self, args, sort_index, append, used):
if len(args) > 2 or len(args) < 2: raise TypeError, None if len(args) == 2: path_info=args[1]
if len(args) < 1 or len(args) > 2: raise TypeError, None elif len(args)==1: args=args[0],'/' path_info=args[1]
def main(): import sys, os, getopt, string global repeat_count try: optlist,args=getopt.getopt(sys.argv[1:], 'dtu:p:r:e:s') if len(args) > 2 or len(args) < 2: raise TypeError, None if len(args) == 2: path_info=args[1] except: sys.stderr.write(__doc__) sys.exit(-1) silent=profile=u=debug=timeit=None env={} for opt,val...
menu=HTMLFile('dtml/menu', globals())
menu=DTMLFile('dtml/menu', globals())
def __call__(self, REQUEST=None, **kw): "Searchable interface" if REQUEST is not None: perms=[] user=REQUEST.AUTHENTICATED_USER for p in self.ac_inherited_permissions(): if user.has_permission(p[0], self): perms.append(p[0]) REQUEST.set('permissions',perms) results=[] for ph in self.helpValues(): results.append(apply(g...
'\([^\0- ;,=\"]+\)=\([^\0;-=\"]*\)'
'\([^\0- ;,=\"]+\)=\([^\0- ;,\"]*\)'
def parse_cookie(text, result=None, qparmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)="\([^"]*\)\"' '\([\0- ]*[;,]\)?[\0- ]*\)' ), parmre=regex.compile( '\([\0- ]*' '\([^\0- ;,=\"]+\)=\([^\0;-=\"]*\)' '\([\0- ]*[;,]\)?[\0- ]*\)' ), acquire=parse_cookie_lock.acquire, release=parse_cookie_lock.release, ): if result ...
def parse(self, line):
def parse(self, line, _index=-1):
def parse(self, line):
self._row=line=self._Record(self.parse(line), self._schema, self._names)
self._row=line=self._Record( self.parse(line,_index), self._schema, self._names)
def __getitem__(self,input_index):
return self._Record(self.parse(file.readline()), self._schema, self._names)
return self._Record( self.parse(file.readline(), index), self._schema, self._names)
def __getitem__(self,input_index):
f.write(START_SCRIPT % (varname, varname, sys.executable, varname))
f.write(START_SCRIPT % sys.executable)
def sh(home, user, group): start=os.path.join(home, 'start') if not os.path.exists(start): print '-'*78 print 'Creating start script, start' f = open(start,'w') f.write(START_SCRIPT % (varname, varname, sys.executable, varname)) ch(start,user,group,0711) f.close() stop=os.path.join(home, 'stop') if not os.path.exists(...
%s=`cd $reldir; pwd` export %s exec %s $%s/z2.py -D "$@"
exec %s $cwd/z2.py -D "$@"
def sh(home, user, group): start=os.path.join(home, 'start') if not os.path.exists(start): print '-'*78 print 'Creating start script, start' f = open(start,'w') f.write(START_SCRIPT % (varname, varname, sys.executable, varname)) ch(start,user,group,0711) f.close() stop=os.path.join(home, 'stop') if not os.path.exists(...
if (options[i].has_key('help') and options[i]['help'] != helps[i]) or \ (not options[i].has_key('help') and helps[i]):
if options[i].get('help') != (self.zclass_productid(), helps[i]):
def manage_edit(self, actions=[], helps=[], REQUEST=None): "Change view actions" options=self.data() changed=0 if len(actions)!=len(options): raise 'Bad Request', 'wrong number of actions'
else:
changed=1 elif options[i].has_key('help'):
def manage_edit(self, actions=[], helps=[], REQUEST=None): "Change view actions" options=self.data() changed=0 if len(actions)!=len(options): raise 'Bad Request', 'wrong number of actions'
if name[:3]=='aq_' and name != 'aq_parent' and name != 'aq_explicit': return 0
try: if (name[:3]=='aq_' and name != 'aq_parent' and name != 'aq_explicit'): return 0 except: pass
def oldvalidate(self, inst, parent, name, value, md): ################################################################# # Note that this method is not used normally. It is simply a # Python rendition of the validate method implemented in # DocumentTemplate.cDocumentTemplate. The Python version # serves the role of a r...
"The specified module, <em>%s</em>, couldn't be found.")
"The specified module, <em>%s</em>, couldn't be found." % module)
def getObject(module, name, reload=0, modules={}): if modules.has_key(module): old=modules[module] if old.has_key(name) and not reload: return old[name] else: old=None if module[-3:]=='.py': p=module[:-3] elif module[-4:]=='.pyp': p=module[:-4] else: p=module p=getPath('Extensions', p, suffixes=('','py','pyp')) if p ...
for k, v in list(index.items()):
if DEBUG: TLOG('building list of index items') l = list(index.items()) if DEBUG: TLOG('done building list of index items, now iterating over them') tmp = [] for k, v in l:
def _clean(self, b, index): for k, v in list(index.items()): if v is b: self.notifyDestruct(index[k][k]) del index[k] b.clear()
multiple=1, optional=1)
multiple=1, optional=1, op=None)
def __init__(self, args): args = parse_params(args, name='', type=None, column=None, multiple=1, optional=1) self.__name__ = name_param(args,'sqlvar') has_key=args.has_key if not has_key('type'): raise ParseError, ('the type attribute is required', 'dtvar') self.type=t=args['type'] if not valid_type(t): raise ParseErro...
raise ParseError, ('the type attribute is required', 'dtvar')
raise ParseError, ('the type attribute is required', 'sqltest')
def __init__(self, args): args = parse_params(args, name='', type=None, column=None, multiple=1, optional=1) self.__name__ = name_param(args,'sqlvar') has_key=args.has_key if not has_key('type'): raise ParseError, ('the type attribute is required', 'dtvar') self.type=t=args['type'] if not valid_type(t): raise ParseErro...
raise ParseError, ('invalid type, %s' % t, 'dtvar')
raise ParseError, ('invalid type, %s' % t, 'sqltest')
def __init__(self, args): args = parse_params(args, name='', type=None, column=None, multiple=1, optional=1) self.__name__ = name_param(args,'sqlvar') has_key=args.has_key if not has_key('type'): raise ParseError, ('the type attribute is required', 'dtvar') self.type=t=args['type'] if not valid_type(t): raise ParseErro...
return "%s=%s" % (self.column,vs[0])
return "%s %s %s" % (self.column, self.op, vs[0])
def render(self, md): name=self.__name__ t=self.type try: v = md[name] except KeyError, key: if str(key)==name and self.optional: return '' raise KeyError, key, sys.exc_traceback if type(v) in (ListType, TupleType): if len(v) > 1 and not self.multiple: raise 'Multiple Values', ( 'multiple values are not allowed for <...
ev = translate(str(v), nl2sp) if ev.find( '<html>') >= 0: ev = 'bobo exception' self.setHeader('bobo-exception-value', ev[:255])
ev = 'See the server error log for details' self.setHeader('bobo-exception-value', ev)
def exception(self, fatal=0, info=None, absuri_match=re.compile(r'\w+://[\w\.]+').match, tag_search=re.compile('[a-zA-Z]>').search, abort=1 ): if type(info) is type(()) and len(info) == 3: t, v, tb = info else: t, v, tb = sys.exc_info()
uri=os.path.join(url, absattr(ob.id))
uri=urljoin(url, absattr(ob.id))
def apply(self, obj, url=None, depth=0, result=None, top=1): if result is None: result=StringIO() depth=self.depth url=urlfix(self.request['URL'], 'PROPFIND') url=urlbase(url) result.write('<?xml version="1.0" encoding="utf-8"?>\n' \ '<d:multistatus xmlns:d="DAV:">\n') iscol=isDavCollection(obj) if iscol and url[-1] !=...
uri = os.path.join(url, absattr(ob.id))
uri = urljoin(url, absattr(ob.id))
def apply(self, obj, creator=None, depth='infinity', token=None, result=None, url=None, top=1): """ Apply, built for recursion (so that we may lock subitems of a collection if requested """
uri = os.path.join(url, absattr(ob.id))
uri = urljoin(url, absattr(ob.id))
def apply(self, obj, token, url=None, result=None, top=1): if result is None: result = StringIO() url = urlfix(url, 'UNLOCK') url = urlbase(url) iscol = isDavCollection(obj) if iscol and url[-1] != '/': url = url + '/' errmsg = None
uri = os.path.join(url, absattr(ob.id))
uri = urljoin(url, absattr(ob.id))
def apply(self, obj, token, user, url=None, result=None, top=1): if result is None: result = StringIO() url = urlfix(url, 'DELETE') url = urlbase(url) iscol = isDavCollection(obj) errmsg = None parent = aq_parent(obj)