rem
stringlengths 0
322k
| add
stringlengths 0
2.05M
| context
stringlengths 8
228k
|
|---|---|---|
In all cases, invalid date, time, or timezone components will raise a DateTimeError.
|
If a string argument passed to the DateTime constructor cannot be parsed, it will raise DateTime.SyntaxError. Invalid date, time, or timezone components will raise a DateTime.DateTimeError.
|
def __init__(self,*args): """Return a new date-time object
|
attempts = attempts + 1
|
attempts = attempts - 1
|
def forkit(attempts = FORK_ATTEMPTS): while attempts: # if at first you don't succeed... attempts = attempts + 1 try: pid = os.fork() except os.error: pstamp('Houston, the fork failed') time.sleep(2) else: pstamp('Houston, we have forked') return pid
|
def get(self, key, default):
|
def get(self, key, default=None):
|
def get(self, key, default): """Get a variable value
|
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
|
signal.signal(signal.SIGCHLD, _ignoreSIGCHLD)
|
def main(args=None): # This is exactly like zdctl.main(), but uses ZopeCtlOptions and # ZopeCmd instead of ZDCtlOptions and ZDCmd, so the default values # are handled properly for Zope. options = ZopeCtlOptions() options.realize(args) c = ZopeCmd(options) if options.args: c.onecmd(" ".join(options.args)) else: options.interactive = 1 if options.interactive: try: import readline except ImportError: pass print "program:", " ".join(options.program) c.do_status() c.cmdloop()
|
return find_source(func.func_globals['__file__'], func.func_code)[1]
|
file = func.func_globals['__file__'] if file.endswith('.pyc'): file = file[:-1] source = find_source(file, func.func_code)[1] assert source.strip(), "Source should not be empty!" return source
|
def get_source(func): """Less silly interface to find_source""" # Sheesh return find_source(func.func_globals['__file__'], func.func_code)[1]
|
from RestrictedPython.tests import before_and_after
|
def checkBeforeAndAfter(self): from RestrictedPython.RCompile import RModule
|
|
globals = {"_getiter_": getiter}
|
globals = {"_getiter_": getiter, '_inplacevar_': inplacevar_wrapper}
|
def getiter(seq): calls.append(seq) return list(seq)
|
if request_get('SUBMIT','')=='cancel':
|
if lower(strip(request_get('SUBMIT','')))=='cancel':
|
def publish(self, module_name, after_list, published='web_objects', imported_modules={}, module_dicts={},debug=0):
|
n1 = child.getElementsByTagName(tagname) nodeList = nodeList + n1._data
|
if hasattr(child, 'getElementsByTagName'): n1 = child.getElementsByTagName(tagname) nodeList = nodeList + n1._data
|
def getElementsByTagName(self, tagname): """ Returns a NodeList of all the Elements with a given tag name in the order in which they would be encountered in a preorder traversal of the Document tree. Parameter: tagname The name of the tag to match (* = all tags). Return Value: A new NodeList object containing all the matched Elements. """ nodeList = [] for child in self.objectValues(): if (child.getNodeType()==ELEMENT_NODE and \ child.getTagName()==tagname or tagname== '*'): nodeList.append(child) n1 = child.getElementsByTagName(tagname) nodeList = nodeList + n1._data return NodeList(nodeList)
|
self._txn.commit() def _abort(self, tid, user, desc, ext):
|
self._transaction.commit() def _abort(self):
|
def _finish(self, tid, user, desc, ext): """Called from BaseStorage.tpc_finish(), this commits the underlying BSDDB transaction.
|
self._txn.abort()
|
self._transaction.abort()
|
def _abort(self, tid, user, desc, ext): """Called from BaseStorage.tpc_abort(), this aborts the underlying BSDDB transaction. tid is the transaction id user is the transaction user desc is the transaction description ext is the transaction extension
|
return h>=0 and h<=23 and m>=0 and m<=59 and s>=0 and s<=59
|
return h>=0 and h<=23 and m>=0 and m<=59 and s>=0 and s < 60
|
def _validTime(self,h,m,s): return h>=0 and h<=23 and m>=0 and m<=59 and s>=0 and s<=59
|
o=object[name]
|
try: o=object[name] except AttributeError: raise 'NotFound', name
|
def unrestrictedTraverse(self, path, default=_marker, restricted=0):
|
def write_object(self, oid, pickle): self._append('o', (oid, pickle))
|
def __init__(self, file=None, dir='.'): """Initialize the `full' commit log, usually with a new file.""" CommitLog.__init__(self, file, dir) self.__versions = {} def finish(self): CommitLog.finish(self) self.__versions.clear() def get_vid(self, version, missing=None): """Given a version string, return the associated vid. If not present, return `missing'. """ return self.__versions.get(version, missing) def write_object(self, oid, vid, nvrevid, pickle, prevrevid): self._append('o', (oid, vid, nvrevid, '', pickle, prevrevid)) def write_nonversion_object(self, oid, lrevid, prevrevid, zero='\0'*8): self._append('o', (oid, zero, zero, lrevid, '', prevrevid)) def write_moved_object(self, oid, vid, nvrevid, lrevid, prevrevid): self._append('o', (oid, vid, nvrevid, lrevid, '', prevrevid))
|
def write_object(self, oid, pickle): self._append('o', (oid, pickle))
|
return NOne
|
return None
|
def next_object(self): # Get the next object record. Return the key for unpacking and the # object record data. rec = self._next() if rec is None: return NOne try: key, data = rec except ValueError: raise LogCorruptedError, 'incomplete record' if key not in 'ovd': raise LogCorruptedError, 'bad record key: %s' % key return key, data
|
def store(self, oid, vid, nv, dataptr, pickle, previous, dump=marshal.dump): dump(('s',(oid,vid,nv,data,pickle,previous)), self._file) def storeNV(self, oid, data, tid, dump=marshal.dump, zero='\0\0\0\0\0\0\0\0'): dump(('s',(oid,zero,zero,data,'',tid)), self._file)
|
def next_object(self): # Get the next object record. Return the key for unpacking and the # object record data. rec = self._next() if rec is None: return NOne try: key, data = rec except ValueError: raise LogCorruptedError, 'incomplete record' if key not in 'ovd': raise LogCorruptedError, 'bad record key: %s' % key return key, data
|
|
'<em>%s</em> sucessfully exported to <em>%s</em>' % (id,f),
|
'<em>%s</em> successfully exported to <em>%s</em>' % (id,f),
|
def manage_exportObject(self, id='', download=None, toxml=None, RESPONSE=None,REQUEST=None): """Exports an object to a file and returns that file.""" if not id: # can't use getId() here (breaks on "old" exported objects) id=self.id if hasattr(id, 'im_func'): id=id() ob=self else: ob=self._getOb(id)
|
manage_tabs_message='<em>%s</em> sucessfully imported' % id,
|
manage_tabs_message='<em>%s</em> successfully imported' % id,
|
def manage_importObject(self, file, REQUEST=None, set_owner=1): """Import an object from a file""" dirname, file=os.path.split(file) if dirname: raise BadRequestException, 'Invalid file name %s' % escape(file)
|
if attrs.has_key('expires'): cookie='set-cookie: %s="%s"' % (name,attrs['value']) else: cookie=('set-cookie: %s="%s"; Version="1"' % (name,attrs['value']))
|
cookie='set-cookie: %s="%s"' % (name,attrs['value'])
|
def _cookie_list(self):
|
return self.formatSupplementLine('__traceback_info__: %s' % tbi)
|
return self.formatSupplementLine('__traceback_info__: %s' % (tbi,))
|
def formatTracebackInfo(self, tbi): return self.formatSupplementLine('__traceback_info__: %s' % tbi)
|
if level >=0:
|
if len(comps) == 0: return IISet(self._unindex.keys()) if level >= 0:
|
def search(self,path,default_level=0): """ path is either a string representing a relative URL or a part of a relative URL or a tuple (path,level).
|
return (StructuredTextInnerLink(s[start2+1,end2-1],start2,end2))
|
return (StructuredTextInnerLink(s[start2+1:end2-1],start2,end2))
|
def doc_inner_link(self, s, expr1 = re.compile(r"\.\.\s*").search, expr2 = re.compile(r"\[[%s%s]+\]" % (letters, digits) ).search): # make sure we dont grab a named link if expr2(s) and expr1(s): start1,end1 = expr1(s).span() start2,end2 = expr2(s).span() if end1 == start2: # uh-oh, looks like a named link return None else: # the .. is somewhere else, ignore it return (StructuredTextInnerLink(s[start2+1,end2-1],start2,end2)) return None elif expr2(s) and not expr1(s): start,end = expr2(s).span() return (StructuredTextInnerLink(s[start+1:end-1]),start,end) return None
|
f=BoboFunction(url, method=method, username=self.username, password=self.password, timeout=self.timeout)
|
f=Function(url, method=method, username=self.username, password=self.password, timeout=self.timeout)
|
def __getattr__(self, name):
|
obj = self.sq_parent.resolve_url(self.getpath(rid), REQUEST)
|
obj = self.aq_parent.resolve_url(self.getpath(rid), REQUEST)
|
def getobject(self, rid, REQUEST=None): """ Return a cataloged object given a 'data_record_id_' """ try: obj = self.aq_parent.restrictedTraverse(self.getpath(rid)) if not obj: if REQUEST is None: REQUEST=self.REQUEST obj = self.sq_parent.resolve_url(self.getpath(rid), REQUEST) return obj except: pass
|
if realm: self['WWW-authenticate']='basic realm="%s"' % realm
|
if realm: self.setHeader('WWW-Authenticate', 'basic realm="%s"' % realm, 1)
|
def _unauthorized(self): realm=self.realm if realm: self['WWW-authenticate']='basic realm="%s"' % realm
|
self.output_encoding = 'utf-8'
|
self.output_encoding = encoding
|
def __init__(self, id, text=None, content_type=None, encoding='utf-8', strict=True): self.id = id self.expand = 0 self.ZBindings_edit(self._default_bindings) self.output_encoding = 'utf-8'
|
encoding = self.output_encoding
|
else: encoding = self.output_encoding
|
def pt_edit(self, text, content_type, keep_output_encoding=False):
|
app.Control_Panel.initialize_cache()
|
def initialize(app): # Initialize the application # Initialize the cache: app.Control_Panel.initialize_cache() # The following items marked b/c are backward compatibility hacks # which make sure that expected system objects are added to the # bobobase. This is required because the bobobase in use may pre- # date the introduction of certain system objects such as those # which provide Lever support. # b/c: Ensure that Control Panel exists. if not hasattr(app, 'Control_Panel'): cpl=ApplicationManager() cpl._init() app._setObject('Control_Panel', cpl) get_transaction().note('Added Control_Panel') get_transaction().commit() # b/c: Ensure that a ProductFolder exists. if not hasattr(app.Control_Panel.aq_base, 'Products'): app.Control_Panel.Products=App.Product.ProductFolder() get_transaction().note('Added Control_Panel.Products') get_transaction().commit() # Ensure that a temp folder exists if not hasattr(app, 'temp_folder'): from Products.TemporaryFolder.TemporaryFolder import \ MountedTemporaryFolder tf = MountedTemporaryFolder('temp_folder','Temporary Folder') app._setObject('temp_folder', tf) get_transaction().note('Added temp_folder') get_transaction().commit() del tf # Ensure that there is a transient container in the temp folder tf = app.temp_folder if not hasattr(tf, 'session_data'): env_has = os.environ.get from Products.Transience.Transience import TransientObjectContainer addnotify = env_has('ZSESSION_ADD_NOTIFY', None) delnotify = env_has('ZSESSION_DEL_NOTIFY', None) default_limit = 1000 limit = env_has('ZSESSION_OBJECT_LIMIT', default_limit) try: limit=int(limit) if limit != default_limit: LOG('Zope Default Object Creation', INFO, ('using ZSESSION_OBJECT_LIMIT-specified max objects ' 'value of %s' % limit)) except ValueError: LOG('Zope Default Object Creation', WARNING, ('Noninteger value %s specified for ZSESSION_OBJECT_LIMIT, ' 'defaulting to %s' % (limit, default_limit))) limit = default_limit if addnotify and app.unrestrictedTraverse(addnotify, None) is None: LOG('Zope Default Object Creation', WARNING, ('failed to use nonexistent "%s" script as ' 'ZSESSION_ADD_NOTIFY' % addnotify)) addnotify=None elif addnotify: LOG('Zope Default Object Creation', INFO, 'using %s as add notification script' % addnotify) if delnotify and app.unrestrictedTraverse(delnotify, None) is None: LOG('Zope Default Object Creation', WARNING, ('failed to use nonexistent "%s" script as ' 'ZSESSION_DEL_NOTIFY' % delnotify)) delnotify=None elif delnotify: LOG('Zope Default Object Creation', INFO, 'using %s as delete notification script' % delnotify) toc = TransientObjectContainer('session_data', 'Session Data Container', addNotification = addnotify, delNotification = delnotify, limit=limit) timeout_spec = env_has('ZSESSION_TIMEOUT_MINS', '') if timeout_spec: try: timeout_spec = int(timeout_spec) except ValueError: LOG('Zope Default Object Creation', WARNING, ('"%s" is an illegal value for ZSESSION_TIMEOUT_MINS, ' 'using default timeout instead.' % timeout_spec)) else: LOG('Zope Default Object Creation', INFO, ('using ZSESSION_TIMEOUT_MINS-specified session timeout ' 'value of %s' % timeout_spec)) toc = TransientObjectContainer('session_data', 'Session Data Container', timeout_mins = timeout_spec, addNotification=addnotify, delNotification = delnotify, limit=limit) tf._setObject('session_data', toc) tf_reserved = getattr(tf, '_reserved_names', ()) if 'session_data' not in tf_reserved: tf._reserved_names = tf_reserved + ('session_data',) get_transaction().note('Added session_data to temp_folder') get_transaction().commit() del toc del addnotify del delnotify del timeout_spec del env_has del tf # Ensure that a browser ID manager exists if not hasattr(app, 'browser_id_manager'): from Products.Sessions.BrowserIdManager import BrowserIdManager bid = BrowserIdManager('browser_id_manager', 'Browser Id Manager') app._setObject('browser_id_manager', bid) get_transaction().note('Added browser_id_manager') get_transaction().commit() del bid # Ensure that a session data manager exists if not hasattr(app, 'session_data_manager'): from Products.Sessions.SessionDataManager import SessionDataManager sdm = SessionDataManager('session_data_manager', title='Session Data Manager', path='/temp_folder/session_data', requestName='SESSION') app._setObject('session_data_manager', sdm) get_transaction().note('Added session_data_manager') get_transaction().commit() del sdm # Ensure that there's an Examples folder with examples. # However, make sure that if the examples have been added already # and then deleted that we don't add them again. if not hasattr(app, 'Examples') and not \ hasattr(app, '_Zope25_examples_have_been_added'): examples_path = os.path.join(Globals.SOFTWARE_HOME, \ '..','..','import', 'Examples.zexp') if os.path.isfile(examples_path): app._importObjectFromFile(examples_path, verify=0) app._Zope25_examples_have_been_added=1 get_transaction().note('Added Examples folder') get_transaction().commit() else: LOG('Zope Default Object Creation', INFO, '%s examples import file could not be found.' % examples_path) # b/c: Ensure that Owner role exists. if hasattr(app, '__ac_roles__') and not ('Owner' in app.__ac_roles__): app.__ac_roles__=app.__ac_roles__ + ('Owner',) get_transaction().note('Added Owner role') get_transaction().commit() # ensure the Authenticated role exists. if hasattr(app, '__ac_roles__'): if not 'Authenticated' in app.__ac_roles__: app.__ac_roles__=app.__ac_roles__ + ('Authenticated',) get_transaction().note('Added Authenticated role') get_transaction().commit() # Make sure we have Globals root=app._p_jar.root() if not root.has_key('ZGlobals'): import BTree app._p_jar.root()['ZGlobals']=BTree.BTree() get_transaction().note('Added Globals') get_transaction().commit() # Install the initial user. if hasattr(app, 'acl_users'): users = app.acl_users if hasattr(users, '_createInitialUser'): app.acl_users._createInitialUser() get_transaction().note('Created initial user') get_transaction().commit() install_products(app) install_standards(app) # Note that the code from here on only runs if we are not a ZEO # client, or if we are a ZEO client and we've specified by way # of env variable that we want to force products to load. if (os.environ.get('ZEO_CLIENT') and not os.environ.get('FORCE_PRODUCT_LOAD')): return # Check for dangling pointers (broken zclass dependencies) in the # global class registry. If found, rebuild the registry. Note that # if the check finds problems but fails to successfully rebuild the # registry we abort the transaction so that we don't leave it in an # indeterminate state. did_fixups=0 bad_things=0 try: if app.checkGlobalRegistry(): LOG('Zope', INFO, 'Beginning attempt to rebuild the global ZClass registry.') app.fixupZClassDependencies(rebuild=1) did_fixups=1 LOG('Zope', INFO, 'The global ZClass registry has successfully been rebuilt.') get_transaction().note('Rebuilt global product registry') get_transaction().commit() except: bad_things=1 LOG('Zope', ERROR, 'The attempt to rebuild the registry failed.', error=sys.exc_info()) get_transaction().abort() # Now we need to see if any (disk-based) products were installed # during intialization. If so (and the registry has no errors), # there may still be zclasses dependent on a base class in the # newly installed product that were previously broken and need to # be fixed up. If any really Bad Things happened (dangling pointers # were found in the registry but it couldn't be rebuilt), we don't # try to do anything to avoid making the problem worse. if (not did_fixups) and (not bad_things): # App.Product.initializeProduct will set this if a disk-based # product was added or updated and we are not a ZEO client. if getattr(Globals, '__disk_product_installed__', 0): try: LOG('Zope', INFO, 'New disk product detected, determining '\ 'if we need to fix up any ZClasses.') if app.fixupZClassDependencies(): LOG('Zope', INFO, 'Repaired broken ZClass dependencies.') get_transaction().commit() except: LOG('Zope', ERROR, 'Attempt to fixup ZClass dependencies after detecting ' \ 'an updated disk-based product failed.', error=sys.exc_info()) get_transaction().abort()
|
|
self.setDefaultRoles(permission_name, item[2])
|
self.setPermissionDefault(permission_name, item[2])
|
def apply(self, classobj): """Apply security information to the given class object.""" dict = classobj.__dict__
|
new = string.join(map(lambda s: d[s], S), '')
|
new = string.join(map(reprs.get, S), '')
|
def convert(S, find=string.find): new = '' encoding = 'repr' new = string.join(map(lambda s: d[s], S), '') if len(new) > (1.4*len(S)): encoding = 'base64' new = base64.encodestring(S)[:-1] elif find(new,'>') >= 0 or find(new,'<') >= 0 or find(new,'&') >= 0: if find(new, ']]>') <0 : new='<![CDATA[\n\n'+new+'\n\n]]>' encoding='cdata' else: new=string.join(map(lambda s: d2[s], new), '') return encoding, new
|
new=string.join(map(lambda s: d2[s], new), '')
|
new=string.join(map(lambda s: reprs2.get(s,s), new), '')
|
def convert(S, find=string.find): new = '' encoding = 'repr' new = string.join(map(lambda s: d[s], S), '') if len(new) > (1.4*len(S)): encoding = 'base64' new = base64.encodestring(S)[:-1] elif find(new,'>') >= 0 or find(new,'<') >= 0 or find(new,'&') >= 0: if find(new, ']]>') <0 : new='<![CDATA[\n\n'+new+'\n\n]]>' encoding='cdata' else: new=string.join(map(lambda s: d2[s], new), '') return encoding, new
|
if v < 0: v=t32-v
|
if v < 0: v=t32+v
|
def u64(v, unpack=struct.unpack): h, v = unpack(">ii", v) if v < 0: v=t32-v if h: if h < 0: h=t32-h v=h*t32+v return v
|
if h < 0: h=t32-h
|
if h < 0: h=t32+h
|
def u64(v, unpack=struct.unpack): h, v = unpack(">ii", v) if v < 0: v=t32-v if h: if h < 0: h=t32-h v=h*t32+v return v
|
def cp(f1, f2, l): read=f1.read write=f2.write n=8192 while l > 0: if n > l: n=l d=read(n) write(d) l = l - len(d)
|
def u64(v, unpack=struct.unpack): h, v = unpack(">ii", v) if v < 0: v=t32-v if h: if h < 0: h=t32-h v=h*t32+v return v
|
|
def end_none(self,tag,data): return None def end_reference(self, tag, data): return self._pickleids[data[1]['id']]
|
def end_none(self,tag,data): return None
|
|
def end_item(self, tag, data): v=data[2:] return v
|
def end_dictionary(self, tag, data): D={} a=data[1] for k, v in data[2:]: D[k]=v if a.has_key('id'): self._pickleids[a['id']]=D return D
|
|
'none': end_none,
|
'none': lambda self, tag, data: None,
|
def end_item(self, tag, data): v=data[2:] return v
|
'item': end_item, 'reference': end_reference,
|
'item': lambda self, tag, data: data[2:], 'reference': lambda self, tag, data: self._pickleids[data[1]['id']],
|
def end_item(self, tag, data): v=data[2:] return v
|
def save_none(self, tag, data): return 'N'
|
def end_item(self, tag, data): v=data[2:] return v
|
|
if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v=v+put+id else: v=v+put+id+"\012" return v
|
return save_put(self, v, a)
|
def save_string(self, tag, data): binary=self.binary v='' a=data[1] if len(data)>2: for x in data[2:]: v=v+x encoding=a['encoding'] if encoding is not '': v=unconvert(encoding,v) put='p' if binary: l=len(v) s=mdumps(l)[1:] if (l<256): v='U'+s[0]+v else: v='T'+s+v put='q' else: v="S'"+v+"'\012" if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v=v+put+id else: v=v+put+id+"\012" return v
|
binary=self.binary
|
def save_tuple(self, tag, data): binary=self.binary T=data[2:] a=data[1] v='' put='p' for x in T: v=v+x if v is '': return ')' v='('+v+'t' if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v=v+put+id else: v=v+put+id+'\012' return v
|
|
a=data[1] v='' put='p' for x in T: v=v+x if v is '': return ')' v='('+v+'t' if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v=v+put+id else: v=v+put+id+'\012' return v
|
if not T: return ')' return save_put(self, '('+string.join(T,'')+'t', data[1])
|
def save_tuple(self, tag, data): binary=self.binary T=data[2:] a=data[1] v='' put='p' for x in T: v=v+x if v is '': return ')' v='('+v+'t' if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v=v+put+id else: v=v+put+id+'\012' return v
|
binary=self.binary
|
def save_list(self, tag, data): binary=self.binary L=data[2:] a=data[1] v='' x=0 if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: while x<len(L): v=v+L[x] x=x+1 if id: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' if v is not '': v=']'+put+id+'('+v+'e' else: v=']'+put+id else: while x<len(L): v=v+L[x]+'a' x=x+1 if id: v='(lp'+id+'\012'+v if v=='': v=']' return v
|
|
v='' x=0 if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: while x<len(L): v=v+L[x] x=x+1 if id: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' if v is not '': v=']'+put+id+'('+v+'e' else: v=']'+put+id
|
if self.binary: v=save_put(self, ']', a) if L: v=v+'('+string.join(L,'')+'e'
|
def save_list(self, tag, data): binary=self.binary L=data[2:] a=data[1] v='' x=0 if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: while x<len(L): v=v+L[x] x=x+1 if id: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' if v is not '': v=']'+put+id+'('+v+'e' else: v=']'+put+id else: while x<len(L): v=v+L[x]+'a' x=x+1 if id: v='(lp'+id+'\012'+v if v=='': v=']' return v
|
while x<len(L): v=v+L[x]+'a' x=x+1 if id: v='(lp'+id+'\012'+v if v=='': v=']'
|
v=save_put(self, '(l', a) if L: v=string.join(L,'a')+'a'
|
def save_list(self, tag, data): binary=self.binary L=data[2:] a=data[1] v='' x=0 if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: while x<len(L): v=v+L[x] x=x+1 if id: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' if v is not '': v=']'+put+id+'('+v+'e' else: v=']'+put+id else: while x<len(L): v=v+L[x]+'a' x=x+1 if id: v='(lp'+id+'\012'+v if v=='': v=']' return v
|
binary=self.binary
|
def save_dict(self, tag, data): binary=self.binary D=data[2:] a=data[1] id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v='}'+put+id if len(D)>0: v=v+'(' x=0 while x < len(D): v=v+D[x] x=x+1 if len(D)>0: v=v+'u' else: v='(dp'+id+'\012' x=0 while x<len(D): v=v+D[x]+'s' x=x+1 return v
|
|
a=data[1] id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v='}'+put+id if len(D)>0: v=v+'(' x=0 while x < len(D): v=v+D[x] x=x+1 if len(D)>0: v=v+'u'
|
if self.binary: v=save_put(self, '}', data[1]) if D: v=v+'('+string.join(D,'')+'u'
|
def save_dict(self, tag, data): binary=self.binary D=data[2:] a=data[1] id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v='}'+put+id if len(D)>0: v=v+'(' x=0 while x < len(D): v=v+D[x] x=x+1 if len(D)>0: v=v+'u' else: v='(dp'+id+'\012' x=0 while x<len(D): v=v+D[x]+'s' x=x+1 return v
|
v='(dp'+id+'\012' x=0 while x<len(D): v=v+D[x]+'s' x=x+1 return v def save_item(self, tag, data): v='' for x in data[2:]: v=v+x return v def save_pickle(self, tag, data): v=data[2]+'.'
|
v=save_put(self, '(d', data[1]) if D: v=v+string.join(D,'s')+'s'
|
def save_dict(self, tag, data): binary=self.binary D=data[2:] a=data[1] id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v='}'+put+id if len(D)>0: v=v+'(' x=0 while x < len(D): v=v+D[x] x=x+1 if len(D)>0: v=v+'u' else: v='(dp'+id+'\012' x=0 while x<len(D): v=v+D[x]+'s' x=x+1 return v
|
binary=self.binary
|
v='('+data[2] x=data[3][1:] stop=string.rfind(x,'t') if stop>=0: x=x[:stop] v=save_put(self, v+x+'o', data[1]) v=v+data[4]+'b' return v def save_global(self, tag, data):
|
def save_object(self, tag, data): binary=self.binary a=data[1] v='(' j=0 id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] put='p' if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' for x in data[2:]: if j==0: v=v + x elif j==1: x=x[1:] stop=string.rfind(x,'t') if stop>=0: x=x[:stop] v=v+x+'o'+put+id elif j==2: v=v+x j=j+1 else: for x in data[2:]: if j==0: v=v+x elif j==1: x=x[1:] stop=string.rfind(x,'t') if stop>=0: x=x[:stop] v=v+x+'o'+put+id+'\012' elif j==2: v=v+x j=j+1 v=v+'b' if a.has_key('id'): self._pickleids[a['id']]=v return v
|
v='(' j=0 id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] put='p' if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' for x in data[2:]: if j==0: v=v + x elif j==1: x=x[1:] stop=string.rfind(x,'t') if stop>=0: x=x[:stop] v=v+x+'o'+put+id elif j==2: v=v+x j=j+1 else: for x in data[2:]: if j==0: v=v+x elif j==1: x=x[1:] stop=string.rfind(x,'t') if stop>=0: x=x[:stop] v=v+x+'o'+put+id+'\012' elif j==2: v=v+x j=j+1 v=v+'b' if a.has_key('id'): self._pickleids[a['id']]=v return v def save_global(self, tag, data): binary=self.binary a=data[1] if a.has_key('id'): id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] put='p' if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' v='c'+a['module']+'\012'+a['name']+'\012'+put+id else: v=a['module']+'\012'+a['name']+'\012'+put+id+'\012' self._pickleids[a['id']]=v else: v=a['module']+'\012'+a['name']+'\012' return v
|
return save_put(self, 'c'+a['module']+'\012'+a['name']+'\012', a)
|
def save_object(self, tag, data): binary=self.binary a=data[1] v='(' j=0 id=a['id'] prefix=string.rfind(id,'.') if prefix>=0: id=id[prefix+1:] put='p' if binary: id=string.atoi(id) s=mdumps(id)[1:] if (id < 256): id=s[0] put='q' else: id=s put='r' for x in data[2:]: if j==0: v=v + x elif j==1: x=x[1:] stop=string.rfind(x,'t') if stop>=0: x=x[:stop] v=v+x+'o'+put+id elif j==2: v=v+x j=j+1 else: for x in data[2:]: if j==0: v=v+x elif j==1: x=x[1:] stop=string.rfind(x,'t') if stop>=0: x=x[:stop] v=v+x+'o'+put+id+'\012' elif j==2: v=v+x j=j+1 v=v+'b' if a.has_key('id'): self._pickleids[a['id']]=v return v
|
binary=self.binary
|
def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v
|
|
if binary:
|
if self.binary:
|
def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v
|
start_handlers={'pickle': start_pickle,}
|
start_handlers={ 'pickle': lambda self, tag, attrs: [tag, attrs], }
|
def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v
|
'pickle': save_pickle, 'none': save_none,
|
'pickle': lambda self, tag, data: data[2]+'.', 'none': lambda self, tag, data: 'N',
|
def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v
|
'item': save_item,
|
'item': lambda self, tag, data, j=string.join: j(data[2:],''),
|
def save_persis(self, tag, data): binary=self.binary v=data[2] if binary: v=v+'Q' else: v='P'+v return v
|
%s zpasswd
|
%s zpasswd.py
|
def write_access(home, user='', group=''): import whrandom pw_choices = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ "abcdefghijklmnopqrstuvwxyz" \ "0123456789!" ac_path=os.path.join(home, 'access') if not os.path.exists(ac_path): print 'creating default access file' acfile=open(ac_path, 'w') pw = '' for i in range(8): pw = pw + whrandom.choice(pw_choices) acfile.write('superuser:' + generate_passwd(pw, 'SHA')) acfile.close() os.system('chmod 644 access') print """Note: The super user name and password are 'superuser' and '%s'. You can change the superuser name and password with the zpasswd script. To find out more, type: %s zpasswd """ % (pw, sys.executable) import do; do.ch(ac_path, user, group)
|
$Id: Publish.py,v 1.43 1997/05/14 15:07:22 jim Exp $"""
|
$Id: Publish.py,v 1.44 1997/06/13 16:02:10 jim Exp $"""
|
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
|
__version__='$Revision: 1.43 $'[11:-2]
|
__version__='$Revision: 1.44 $'[11:-2]
|
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
|
try: transaction=get_transaction()
|
try: transaction=get_transaction() except: transaction=None if transaction is not None:
|
def publish(self, module_name, after_list, published='web_objects',
|
u=self.request['AUTHENTICATED_USER'] try: u="%s.%s" % (u, self.request['session__domain']) except: pass try: info=u+info
|
try: u=self.request['AUTHENTICATED_USER'] try: u="%s.%s" % (u, self.request['session__domain']) except: pass try: info=u+info except: pass
|
def publish(self, module_name, after_list, published='web_objects',
|
except: transaction=None
|
def publish(self, module_name, after_list, published='web_objects',
|
|
except: pass
|
def __call__(self, *args, **kw): self._a() try: return apply(self._f, args, kw) finally: self._r()
|
|
def __init__(self, *dicts): self._mm = apply(MultiMapping, dicts) def __getitem__(self, index): return self._mm[index] def __len__(self): return len(self._mm) def _push(self, arg): self._mm.push(arg) def _pop(self): return self._mm.pop() def has_key(self, key): return self._mm.has_key(key)
|
push = pop = None def _push(self, ob): MultiMapping.push(self, ob) def _pop(self, *args): if args: return apply(MultiMapping.pop, (self,) + args) else: return MultiMapping.pop(self)
|
def __init__(self, *dicts): self._mm = apply(MultiMapping, dicts)
|
v = self._mm.get(key, self) if v is self:
|
v = self.get(key, _marker) if v is _marker:
|
def has_get(self, key): v = self._mm.get(key, self) if v is self: return 0, None else: return 1, v
|
if not yr>100: yr=yr+CENTURY
|
yr = _correctYear(yr)
|
def __init__(self,*args): """Return a new date-time object
|
yr=(yr>100) and yr or yr+CENTURY
|
yr = _correctYear(yr)
|
def __init__(self,*args): """Return a new date-time object
|
if year < 100: year=year+CENTURY elif year < 1000: raise self.SyntaxError, string
|
year = _correctYear(year) if year < 1000: raise self.SyntaxError, string
|
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
|
t=0
|
tod=0
|
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
|
t=t+i/24.0
|
tod = tod + int(i) * 3600
|
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
|
t=t+i/1440.0
|
tod = tod + int(i) * 60
|
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
|
t=t+i/86400.0
|
tod = tod + i
|
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
|
t=t*86400.0 t_int = long(math.floor(t)) hr,mn,sc = _calcHMS(t_int, t - t_int)
|
tod_int = int(math.floor(tod)) ms = tod - tod_int hr,mn,sc = _calcHMS(tod_int, ms)
|
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
|
tz = self._calcTimezoneName(x, t - t_int)
|
tz = self._calcTimezoneName(x, ms)
|
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm']
|
{'label':'Find', 'action':'manage_findFrame'},
|
{'label':'Find', 'action':'manage_findFrame', 'target':'manage_main'},
|
def manage_addFolder(self,id,title='',createPublic=0,createUserF=0, REQUEST=None): """Add a new Folder object with id *id*. If the 'createPublic' and 'createUserF' parameters are set to any true value, an 'index_html' and a 'UserFolder' objects are created respectively in the new folder. """ i=Folder() i.id=id i.title=title self._setObject(id,i) if createUserF: i.manage_addUserFolder() if createPublic: i.manage_addDTMLDocument(id='index_html',title='') if REQUEST is not None: return self.manage_main(self,REQUEST,update_menu=1)
|
v=args[a]
|
try: v=args[a]['default'] except: v=None
|
def _argdata(self,REQUEST,raw=0,return_missing_keys=0):
|
, arguments.items()
|
, items
|
def default_input_form(id,arguments,action='query'): if arguments: return ( "%s\n%s%s" % ( '<html><head><title>%s Input Data</title></head><body>\n' '<form action="<!--#var URL2-->/<!--#var id-->/%s" ' 'method="get">\n' '<h2>%s Input Data</h2>\n' 'Enter query parameters:<br>' '<table>\n' % (id,action,id), string.joinfields( map( lambda a: ('<tr>\t<td><strong>%s</strong>:</td>\n' '\t<td><input name="%s" 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 '' )) , arguments.items() ), '\n'), '\n<tr><td></td><td>\n' '<input type="SUBMIT" name="SUBMIT" value="Submit Query">\n' '<!--#if HTTP_REFERER-->\n' ' <input type="SUBMIT" name="SUBMIT" value="Cancel">\n' ' <INPUT NAME="CANCEL_ACTION" TYPE="HIDDEN"\n' ' VALUE="<!--#var HTTP_REFERER-->">\n' '<!--#/if HTTP_REFERER-->\n' '</td></tr>\n</table>\n</form>\n</body>\n</html>\n' ) ) else: return ( '<html><head><title>%s Input Data</title></head><body>\n' '<form action="<!--#var URL2-->/<!--#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' '<!--#if HTTP_REFERER-->\n' ' <input type="SUBMIT" name="SUBMIT" value="Cancel">\n' ' <INPUT NAME="CANCEL_ACTION" TYPE="HIDDEN"\n' ' VALUE="<!--#var HTTP_REFERER-->">\n' '<!--#/if HTTP_REFERER-->\n' '</td></tr>\n</table>\n</form>\n</body>\n</html>\n' % (id, action, id) )
|
{'label': 'Vocabulary', 'action': 'manage_main', 'target': 'manage_workspace'}, {'label': 'Query', 'action': 'manage_query', 'target': 'manage_workspace'},
|
{'label': 'Vocabulary', 'action': 'manage_main'}, {'label': 'Query', 'action': 'manage_query'},
|
def manage_addVocabulary(self, id, title, globbing=None, REQUEST=None): """Add a Vocabulary object """ id=str(id) title=str(title) if globbing: globbing=1 c=Vocabulary(id, title, globbing) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self,REQUEST)
|
if not hasattr(obj, 'aq_parent'): return 0 obj=obj.aq_parent
|
if obj is None: return 0
|
def hasRole(self,parent,roles=None):
|
self.thread.join()
|
self.thread.join(2)
|
def tearDown(self): if self.thread: self.httpd.server_close() self.thread.join()
|
try: return md.AUTHENTICATED_USER.hasRole(value, roles) except AttributeError: return 0
|
try: if md.AUTHENTICATED_USER.hasRole(value, roles): return 1 except AttributeError: pass for r in self._proxy_roles: if r in roles: return 1 return 0
|
def validate(self, inst, parent, name, value, md):
|
if hasattr(object, '__ac_local_roles__'): local_roles=object.__ac_local_roles__
|
local_roles = getattr(object, '__ac_local_roles__', None) if local_roles:
|
def getRolesInContext(self, object): """Return the list of roles assigned to the user, including local roles assigned in context of the passed in object.""" name=self.getUserName() roles=self.getRoles() local={} object=getattr(object, 'aq_inner', object) while 1: if hasattr(object, '__ac_local_roles__'): local_roles=object.__ac_local_roles__ if callable(local_roles): local_roles=local_roles() dict=local_roles or {} for r in dict.get(name, []): local[r]=1 if hasattr(object, 'aq_parent'): object=object.aq_parent continue if hasattr(object, 'im_self'): object=object.im_self object=getattr(object, 'aq_inner', object) continue break roles=list(roles) + local.keys() return roles
|
if hasattr(object, 'aq_parent'): object=object.aq_parent
|
inner = getattr(object, 'aq_inner', object) parent = getattr(inner, 'aq_parent', None) if parent: object = parent
|
def getRolesInContext(self, object): """Return the list of roles assigned to the user, including local roles assigned in context of the passed in object.""" name=self.getUserName() roles=self.getRoles() local={} object=getattr(object, 'aq_inner', object) while 1: if hasattr(object, '__ac_local_roles__'): local_roles=object.__ac_local_roles__ if callable(local_roles): local_roles=local_roles() dict=local_roles or {} for r in dict.get(name, []): local[r]=1 if hasattr(object, 'aq_parent'): object=object.aq_parent continue if hasattr(object, 'im_self'): object=object.im_self object=getattr(object, 'aq_inner', object) continue break roles=list(roles) + local.keys() return roles
|
n=0 if (len(id) > 8) and (id[8:]=='copy_of_'):
|
copy_match=self.copy_re.match(id) if (copy_match) and (copy_match.end() < len(id)):
|
def _get_id(self, id): # Allow containers to override the generation of # object copy id by attempting to call its _get_id # method, if it exists. n=0 if (len(id) > 8) and (id[8:]=='copy_of_'): n=1 orig_id=id while 1: if self._getOb(id, None) is None: return id id='copy%s_of_%s' % (n and n+1 or '', orig_id) n=n+1
|
orig_id=id
|
orig_id=self.copy_re.sub('', id) else: n=0 orig_id=id
|
def _get_id(self, id): # Allow containers to override the generation of # object copy id by attempting to call its _get_id # method, if it exists. n=0 if (len(id) > 8) and (id[8:]=='copy_of_'): n=1 orig_id=id while 1: if self._getOb(id, None) is None: return id id='copy%s_of_%s' % (n and n+1 or '', orig_id) n=n+1
|
__traceback_info__=(`ob`, `ob.manage_afterClone`)
|
def manage_pasteObjects(self, cb_copy_data=None, REQUEST=None): """Paste previously copied objects into the current object. If calling manage_pasteObjects from python code, pass the result of a previous call to manage_cutObjects or manage_copyObjects as the first argument.""" cp=None if cb_copy_data is not None: cp=cb_copy_data else: if REQUEST and REQUEST.has_key('__cp'): cp=REQUEST['__cp'] if cp is None: raise CopyError, eNoData try: cp=_cb_decode(cp) except: raise CopyError, eInvalid
|
|
raise TALError("Bad syntax in substitution text: " + `onError`, position)
|
raise TALError("Bad syntax in substitution text: " + `arg`, position)
|
def parseSubstitution(arg, position=(None, None)): m = _subst_re.match(arg) if not m: raise TALError("Bad syntax in substitution text: " + `onError`, position) key, expr = m.group(1, 2) if not key: key = "text" return key, expr
|
if line[-1:] in '\r\n': line=line[:-1]
|
if line and line[-1:] in '\r\n': line=line[:-1]
|
def __getitem__(self,index):
|
if string.rfind(file, '.dtml') == len(file) -5: file=file[:-5] self.index_html=HTMLFile(file,'')
|
file,ext=os.path.splitext(file) prefix,file=os.path.split(file) self.index_html=HTMLFile(file,prefix)
|
def __init__(self, id, title, file, permissions=None, categories=None): self.id=id self.title=title if string.rfind(file, '.dtml') == len(file) -5: file=file[:-5] self.index_html=HTMLFile(file,'') if permissions is not None: self.permissions=permissions if categories is not None: self.categories=categories
|
return '%s %s' % (self.title, self.obj.read())
|
return '%s %s' % (self.title, self.index_html.read())
|
def SearchableText(self): "The full text of the Help Topic, for indexing purposes" return '%s %s' % (self.title, self.obj.read())
|
if validate(None, self, None, o, None):
|
if validate(None, self, None, o, _noroles):
|
def filtered_manage_options(self, REQUEST=None):
|
newKeywords = getattr(obj, self.id, None)
|
newKeywords = getattr(obj, self.id, ())
|
def index_object(self, documentId, obj, threshold=None): """ index an object 'obj' with integer id 'i'
|
if newKeywords is None: self.unindex_object(documentId) return 0
|
def index_object(self, documentId, obj, threshold=None): """ index an object 'obj' with integer id 'i'
|
|
expr1 = re.compile("(\"[ a-zA-Z0-9\n\-\.\,\;\(\)\/\:\/]+\")(:)([a-zA-Z0-9\:\/\.\~\-]+)([,]*\s*)").search, expr2 = re.compile('(\"[ a-zA-Z0-9\n\-\.\:\;\(\)\/]+\")([,]+\s+)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\
|
expr1 = re.compile("(\"[ a-zA-Z0-9\n\-\.\,\;\(\)\/\:\/\*\']+\")(:)([a-zA-Z0-9\:\/\.\~\-]+)([,]*\s*)").search, expr2 = re.compile('(\"[ a-zA-Z0-9\n\-\.\:\;\(\)\/\*\']+\")([,]+\s+)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\
|
def doc_href( self, s, expr1 = re.compile("(\"[ a-zA-Z0-9\n\-\.\,\;\(\)\/\:\/]+\")(:)([a-zA-Z0-9\:\/\.\~\-]+)([,]*\s*)").search, expr2 = re.compile('(\"[ a-zA-Z0-9\n\-\.\:\;\(\)\/]+\")([,]+\s+)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\#]+)(\s*)').search): #expr1=re.compile('\"([ a-zA-Z0-9.:/;,\n\~\(\)\-]+)\"' # ':' # '([a-zA-Z0-9.:/;,\n\~]+)(?=(\s+|\.|\!|\?))' # ).search, #expr2=re.compile('\"([ a-zA-Z0-9./:]+)\"' # ',\s+' # '([ a-zA-Z0-9@.:/;]+)(?=(\s+|\.|\!|\?))' # ).search, punctuation = re.compile("[\,\.\?\!\;]+").match r=expr1(s) or expr2(s)
|
self.__dict__['validate'] = security.DTMLValidate
|
if self.__dict__.has_key('validate'): first_time_through = 0 else: self.__dict__['validate'] = security.DTMLValidate first_time_through = 1
|
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments."""
|
try: del self.__dict__['validate'] except: pass
|
if first_time_through: del self.__dict__['validate']
|
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments."""
|
newline_to_break=1)
|
newline_to_br=1)
|
def __init__(self, args, fmt=''):
|
if self.getBrowserIdManager().getToken(create=0):
|
key = self.getBrowserIdManager().getToken(create=0) if key:
|
def hasSessionData(self): """ """ if self.getBrowserIdManager().getToken(create=0): if self._hasSessionDataObject(key): return 1
|
else: return mv()==jar.getVersion()
|
else: return mv(oid)==jar.getVersion()
|
def modified_in_version(self): """Was the object modified in this version? """ jar=self._p_jar oid=self._p_oid if jar is None or oid is None: return None try: mv=jar.db().modifiedInVersion except: pass else: return mv()==jar.getVersion()
|
ms=REQUEST.get_header('If-Modified-Since', None) if ms is not None: ms=string.split(ms, ';')[0] ms=DateTime(ms).timeTime() if self._p_mtime > ms:
|
header=REQUEST.get_header('If-Modified-Since', None) if header is not None: header=string.split(header, ';')[0] mod_since=DateTime(header).timeTime() last_mod =self._p_mtime if last_mod > 0 and last_mod <= mod_since:
|
def index_html(self, REQUEST, RESPONSE): """ The default view of the contents of a File or Image.
|
_create_mount_points = 0
|
_create_mount_points = True
|
def _construct(self, context, id): """Creates and returns the named object.""" jar = self.base._p_jar klass = jar.db().classFactory(jar, self.module_name, self.class_name) obj = klass(id) obj._setId(id) context._setObject(id, obj) obj = context.unrestrictedTraverse(id) # Commit a subtransaction to assign the new object to # the correct database. transaction.commit(1) return obj
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.