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.... |
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 ... |
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 ... | 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 re... |
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 re... | |
'<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... |
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 ... | |
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]]>' enc... |
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]]>' enc... |
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[... |
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 pu... | |
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 pu... |
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='' 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 ''... |
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 ''... |
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)>... | |
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)>... |
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)>... |
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... |
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+... | 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... |
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 + wh... |
$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 ... |
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 ... |
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 ... |
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 ... |
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 ... |
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 ... |
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 ... |
{'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... |
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.joinfi... |
{'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=ob... |
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=ob... |
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_... | |
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\~\(\)\-]+)\"' # ... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.