rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
finished.append(base) | finished_dict[id(base)] = None | def fixupZClassDependencies(self, rebuild=0): # Note that callers should not catch exceptions from this method # to ensure that the transaction gets aborted if the registry # cannot be rebuilt for some reason. Returns true if any ZClasses # were registered as a result of the call or the registry was # rebuilt. jar=self... |
if hasattr(ob, '_register') and hasattr(ob, '_zclass_'): class_id=getattr(ob._zclass_, '__module__', None) | if hasattr(base,'_register') and hasattr(base,'_zclass_'): class_id=getattr(base._zclass_, '__module__', None) | def fixupZClassDependencies(self, rebuild=0): # Note that callers should not catch exceptions from this method # to ensure that the transaction gets aborted if the registry # cannot be rebuilt for some reason. Returns true if any ZClasses # were registered as a result of the call or the registry was # rebuilt. jar=self... |
if hasattr(ob, 'objectItems'): | if hasattr(base, 'objectItems'): | def fixupZClassDependencies(self, rebuild=0): # Note that callers should not catch exceptions from this method # to ensure that the transaction gets aborted if the registry # cannot be rebuilt for some reason. Returns true if any ZClasses # were registered as a result of the call or the registry was # rebuilt. jar=self... |
if hasattr(ob, 'propertysheets'): | if hasattr(base, 'propertysheets'): | def fixupZClassDependencies(self, rebuild=0): # Note that callers should not catch exceptions from this method # to ensure that the transaction gets aborted if the registry # cannot be rebuilt for some reason. Returns true if any ZClasses # were registered as a result of the call or the registry was # rebuilt. jar=self... |
'Broken objects exist in product %s.' % product.id) idx = idx + 1 | 'Broken objects exist in product %s.' % product.id, error=sys.exc_info()) | def fixupZClassDependencies(self, rebuild=0): # Note that callers should not catch exceptions from this method # to ensure that the transaction gets aborted if the registry # cannot be rebuilt for some reason. Returns true if any ZClasses # were registered as a result of the call or the registry was # rebuilt. jar=self... |
try: keys=list(self._p_jar.root()['ZGlobals'].keys()) except: return 1 | try: keys=list(self._p_jar.root()['ZGlobals'].keys()) except: LOG('Zope', ERROR, 'A problem was found when checking the global product '\ 'registry. This is probably due to a Product being '\ 'uninstalled or renamed. The traceback follows.', error=sys.exc_info()) return 1 | def checkGlobalRegistry(self): """Check the global (zclass) registry for problems, which can be caused by things like disk-based products being deleted. Return true if a problem is found""" try: keys=list(self._p_jar.root()['ZGlobals'].keys()) except: return 1 return 0 |
'A broken ZClass dependency was found in the global ' \ 'class registry. This is probably due to a product ' \ 'being uninstalled. The registry has successfully ' \ 'been rebuilt.') | 'The global ZClass registry has successfully been rebuilt.') | 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 ... |
LOG('Zope', ERROR, 'A problem was found in the global product registry but ' 'the attempt to rebuild the registry failed.', | LOG('Zope', ERROR, 'The attempt to rebuild the registry failed.', | 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 ... |
def __init__(self, args, fmt=''): | def __init__(self, args, fmt='s'): | def __init__(self, args, fmt=''): |
if len(args)==1: | if len(args)==1 and fmt=='s': | def __init__(self, args, fmt=''): |
val = ('%'+self.fmt) % val | fmt=self.fmt if fmt=='s': val=str(val) else: val = ('%'+self.fmt) % (val,) | def render(self, md): |
def dav__propstat(self, allprop, vals, join=string.join): | def dav__propstat(self, allprop, names, join=string.join): | def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just... |
propstat='<d:propstat%s>\n' \ | propstat='<d:propstat xmlns:ps="%s">\n' \ | def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just... |
'%s\n' \ | '%%s\n' \ | def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just... |
' <d:status>HTTP/1.1 %s</d:status>\n' \ '</d:propstat>\n' | ' <d:status>HTTP/1.1 %%s</d:status>\n%%s' \ '</d:propstat>\n' % self.xml_namespace() errormsg=' <d:responsedescription>%s</d:responsedescription>\n' | def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just... |
if not self.propertyMap(): return '' if not allprop and not vals: | if not allprop and not names: | def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just... |
result.append(' <ns0:%s/>' % name) | result.append(' <ps:%s/>' % name) if not result: return '' | def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just... |
nsdef=' xmlns:ns0="%s"' % self.xml_namespace() return propstat % (nsdef, result, '200 OK') | return propstat % (result, '200 OK', '') | def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just... |
for name, value in self.propertyItems(): prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) | for item in self.propertyMap(): name, type=item['id'], item.get('type','string') meta=item.get('meta', {}) value=self.getProperty(name) if type=='tokens': value=join(value, ' ') elif type=='lines': value=join(value, '\n') if meta.get('dav_xml', 0): prop=value else: prop=' <ps:%s>%s</ps:%s>' % (name, value, name) | def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just... |
xml_ns=self.xml_namespace() | def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just... | |
nsdef=' xmlns:ns0="%s"' % self.xml_namespace() for name, ns in vals: if ns==xml_ns: if propdict.has_key(name): | xml_id=self.xml_namespace() for name, ns in names: if ns==xml_id: if not propdict.has_key(name): prop=' <ps:%s/>' % name emsg=errormsg % 'No such property: %s' % name result.append(propstat % (prop, '404 Not Found', emsg)) else: item=propdict[name] name, type=item['id'], item.get('type','string') meta=item.get('meta',... | def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just... |
prop=' <ns0:%s>%s</ns0:%s>' % (name, value, name) result.append(propstat % (nsdef, prop, '200 OK')) else: prop=' <ns0:%s/>' % name result.append(propstat % (nsdef, prop,'404 Not Found')) return join(result, '\n') def odav__propstat(self, url, allprop, vals, iscol, join=string.join): result=[] propstat='<d:propsta... | def dav__propstat(self, allprop, vals, join=string.join): # The dav__propstat method returns a chunk of xml containing # one or more propstat elements indicating property names, # values, errors and status codes. This is called by some # of the WebDAV support machinery. If a property set does # not support WebDAV, just... | |
else: value=str(value) prop='<z:%s>%s</z:%s>' % (name, value, name) result.append(propstat % ('', prop, '200 OK')) else: prop='<n:%s/>' % name ns=' xmlns:n="%s"' % ns result.append(propstat % (ns, prop, '404 Not Found')) result='<d:response>\n' \ '<d:href>%s</d:href>\n' \ '%s\n' \ '</d:response>' % (url, join(result,... | if meta.get('dav_xml', 0): prop=value else: prop=' <ps:%s>%s</ps:%s>' % (name, value, name) result.append(propstat % (prop, '200 OK', '')) if not result: return '' return join(result, '') | def odav__propstat(self, url, allprop, vals, iscol, join=string.join): # The dav__propstat method returns an xml response element # containing one or more propstats indicating property names, # values, errors and status codes. result=[] propstat='<d:propstat>\n' \ '<d:prop%s>\n' \ '%s\n' \ '</d:prop>\n' \ '<d:status>HT... |
Apply the test parameters. provided by the dictionary 'argvars'. | Apply the test parameters provided by the dictionary 'argvars'. | def ZScriptHTML_tryAction(REQUEST, argvars): """ |
self.size = len(dumps(index)) + len(dumps(data)) | sizer = _ByteCounter() pickler = Pickler(sizer, HIGHEST_PROTOCOL) pickler.dump(index) pickler.dump(data) self.size = sizer.getCount() | def __init__(self, index, data, view_name): try: # This is a protective barrier that hopefully prevents # us from caching something that might result in memory # leaks. It's also convenient for determining the # approximate memory usage of the cache entry. self.size = len(dumps(index)) + len(dumps(data)) except: raise... |
start, end = ws.pos(position) text = text[:start] + before + text[start:end] + after + text[end:] | if lpos != position: lpos=position start, end = ws.pos(position) text = (text[:start] + before + text[start:end] + after + text[end:]) | def highlight(self, text, positions, before, after): ws = WordSequence(text, self.synstop) positions = map(None, positions) |
product=getattr(__import__("Products.%s" % product_name), product_name) | product=__import__("Products.%s" % product_name, global_dict, global_dict, silly) | 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 path_join=os.path.join product_dir=path_join(SOFTWARE_HOME,'Products') isdir=os.path.isdir exists=os.path.exists DictType=type({}) from Folder import Folder folder_perm... |
self.emit("insertStructure", cexpr, attrDict, []) | self.emit("insertStructure", cexpr, {}, []) | def emitOnError(self, name, onError, position): block = self.popProgram() key, expr = parseSubstitution(onError, position) cexpr = self.compileExpression(expr) if key == "text": self.emit("insertText", cexpr, []) else: assert key == "structure" self.emit("insertStructure", cexpr, attrDict, []) self.emitEndTag(name) han... |
mod_since=DateTime(header).timeTime() last_mod =self._p_mtime | mod_since=int(DateTime(header).timeTime()) last_mod =int(self._p_mtime) | def index_html(self, REQUEST, RESPONSE): """ The default view of the contents of a File or Image. |
if m.find('/'): raise 'Redirect', ( "%s/%s" % (REQUEST['URL1'], m)) | if m.find('/') >= 0: prefix= m.startswith('/') and REQUEST['BASE0'] or REQUEST['URL1'] raise 'Redirect', ( "%s/%s" % (prefix, m)) | def manage_workspace(self, REQUEST): """Dispatch to first interface in manage_options """ options=self.filtered_manage_options(REQUEST) try: m=options[0]['action'] if m=='manage_workspace': raise TypeError except: raise Unauthorized, ( 'You are not authorized to view this object.') |
def declareProtected(self, permission_name, *names): | def declareProtected(self, permission_name, name, *names): | def declareProtected(self, permission_name, *names): """Declare names to be associated with a permission.""" self._setaccess(names, permission_name) |
self._setaccess(names, permission_name) | self._setaccess((name,) + names, permission_name) | def declareProtected(self, permission_name, *names): """Declare names to be associated with a permission.""" self._setaccess(names, permission_name) |
if not force: self.appendHeader('Vary', 'Accept-Encoding') | def enableHTTPCompression(self,REQUEST={},force=0,disable=0,query=0): """Enable HTTP Content Encoding with gzip compression if possible | |
Append a value to a cookie | Append a value to a header. | def appendHeader(self, name, value, delimiter=","): '''\ Append a value to a cookie Sets an HTTP return header "name" with value "value", appending it following a comma if there was a previous value set for the header. ''' headers=self.headers if headers.has_key(name): h=self.header[name] h="%s%s\n\t%s" % (h,delimiter... |
h=self.header[name] | h=headers[name] | def appendHeader(self, name, value, delimiter=","): '''\ Append a value to a cookie Sets an HTTP return header "name" with value "value", appending it following a comma if there was a previous value set for the header. ''' headers=self.headers if headers.has_key(name): h=self.header[name] h="%s%s\n\t%s" % (h,delimiter... |
main() | unittest.main(defaultTest='test_suite') | def test_suite(): return unittest.makeSuite(TALESTests) |
self.setHeader('content-length', len(self.body)) | def insertBase(self, base_re_search=regex.compile('\(<base[\0- ]+[^>]+>\)', regex.casefold).search ): if (self.headers.has_key('content-type') and self.headers['content-type'] != 'text/html'): return | |
raise exepctions.RuntimeError,"operator not valid: %s" % operator | raise RuntimeError,"operator not valid: %s" % operator | def _apply_index(self, request, cid='', type=type, None=None): """Apply the index to query parameters given in the request arg. |
w, h = struct.unpack(">LL", data[16:24]) | w, h = struct.unpack(">LL", data[16:24]) self.width=str(int(w)) self.height=str(int(h)) | def update_data(self, data, content_type=None, size=None): if content_type is not None: self.content_type=content_type if size is None: size=len(data) |
ts_results = indent_tab.search_group(rest, (1,2)) | ts_results = indent_tab(rest, (1,2)) | def untabify(aString): '''\ Convert indentation tabs to spaces. ''' result='' rest=aString while 1: ts_results = indent_tab.search_group(rest, (1,2)) if ts_results: start, grps = ts_results lnl=len(grps[0]) indent=len(grps[1]) result=result+rest[:start] rest="\n%s%s" % (' ' * ((indent/8+1)*8), rest[start+indent+1+lnl:]... |
def indent_level(aString): | def indent_level(aString, indent_space=ts_regex.compile('\n\( *\)').search_group, ): | def indent_level(aString): '''\ Find the minimum indentation for a string, not counting blank lines. ''' start=0 text='\n'+aString indent=l=len(text) while 1: ts_results = indent_space.search_group(text, (1,2), start) if ts_results: start, grps = ts_results i=len(grps[0]) start=start+i+1 if start < l and text[start] !... |
ts_results = indent_space.search_group(text, (1,2), start) | ts_results = indent_space(text, (1,2), start) | def indent_level(aString): '''\ Find the minimum indentation for a string, not counting blank lines. ''' start=0 text='\n'+aString indent=l=len(text) while 1: ts_results = indent_space.search_group(text, (1,2), start) if ts_results: start, grps = ts_results i=len(grps[0]) start=start+i+1 if start < l and text[start] !... |
bullet=ts_regex.compile('[ \t\n]*[o*-][ \t\n]+\([^\0]*\)') example=ts_regex.compile('[\0- ]examples?:[\0- ]*$').search dl=ts_regex.compile('\([^\n]+\)[ \t]+--[ \t\n]+\([^\0]*\)') nl=ts_regex.compile('\n').search ol=ts_regex.compile('[ \t]*\(\([0-9]+\|[a-zA-Z]+\)[.)]\)+[ \t\n]+\([^\0]*\|$\)') olp=ts_regex.compile('[ \t]... | def structure(list): if not list: return [] i=0 l=len(list) r=[] while i < l: sublen=paragraphs(list,i) i=i+1 r.append((list[i-1][1],structure(list[i:i+sublen]))) i=i+sublen return r | |
def __init__(self, aStructuredString, level=0): | def __init__(self, aStructuredString, level=0, paragraph_divider=regex.compile('\(\n *\)+\n'), ): | def __init__(self, aStructuredString, level=0): '''Convert a structured text string into a structured text object. |
em =ts_regex.compile(ctag_prefix+(ctag_middle % (("*",)*6) )+ctag_suffix) strong=ts_regex.compile(ctag_prefix+(ctag_middl2 % (("*",)*8))+ctag_suffix) under =ts_regex.compile(ctag_prefix+(ctag_middle % (("_",)*6) )+ctag_suffix) code =ts_regex.compile(ctag_prefix+(ctag_middle % (("\'",)*6))+ctag_suffix) | def __str__(self): return str(self.structure) | |
def ctag(s): | def ctag(s, em=regex.compile( ctag_prefix+(ctag_middle % (("*",)*6) )+ctag_suffix), strong=regex.compile( ctag_prefix+(ctag_middl2 % (("*",)*8))+ctag_suffix), under=regex.compile( ctag_prefix+(ctag_middle % (("_",)*6) )+ctag_suffix), code=regex.compile( ctag_prefix+(ctag_middle % (("\'",)*6))+ctag_suffix), ): | def ctag(s): if s is None: s='' s=gsub(strong,'\\1<strong>\\2</strong>\\3',s) s=gsub(under, '\\1<u>\\2</u>\\3',s) s=gsub(code, '\\1<code>\\2</code>\\3',s) s=gsub(em, '\\1<em>\\2</em>\\3',s) return s |
extra_dl=ts_regex.compile("</dl>\n<dl>"), extra_ul=ts_regex.compile("</ul>\n<ul>"), extra_ol=ts_regex.compile("</ol>\n<ol>"), | extra_dl=regex.compile("</dl>\n<dl>"), extra_ul=regex.compile("</ul>\n<ul>"), extra_ol=regex.compile("</ol>\n<ol>"), | def __str__(self, extra_dl=ts_regex.compile("</dl>\n<dl>"), extra_ul=ts_regex.compile("</ul>\n<ul>"), extra_ol=ts_regex.compile("</ol>\n<ol>"), ): '''\ Return an HTML string representation of the structured text data. |
def _str(self,structure,level): | def _str(self,structure,level, bullet=ts_regex.compile('[ \t\n]*[o*-][ \t\n]+\([^\0]*\)' ).match_group, example=ts_regex.compile('[\0- ]examples?:[\0- ]*$' ).search, dl=ts_regex.compile('\([^\n]+\)[ \t]+--[ \t\n]+\([^\0]*\)' ).match_group, nl=ts_regex.compile('\n').search, ol=ts_regex.compile( '[ \t]*\(\([0-9]+\|[a-zA... | def _str(self,structure,level): r='' for s in structure: # print s[0],'\n', len(s[1]), '\n\n' ts_results = bullet.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ul(r,p,self._str(s[1],level)) else: ts_results = ol.match_group(s[0], (3,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],lev... |
ts_results = bullet.match_group(s[0], (1,)) | ts_results = bullet(s[0], (1,)) | def _str(self,structure,level): r='' for s in structure: # print s[0],'\n', len(s[1]), '\n\n' ts_results = bullet.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ul(r,p,self._str(s[1],level)) else: ts_results = ol.match_group(s[0], (3,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],lev... |
ts_results = ol.match_group(s[0], (3,)) | ts_results = ol(s[0], (3,)) | def _str(self,structure,level): r='' for s in structure: # print s[0],'\n', len(s[1]), '\n\n' ts_results = bullet.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ul(r,p,self._str(s[1],level)) else: ts_results = ol.match_group(s[0], (3,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],lev... |
ts_results = olp.match_group(s[0], (1,)) | ts_results = olp(s[0], (1,)) | def _str(self,structure,level): r='' for s in structure: # print s[0],'\n', len(s[1]), '\n\n' ts_results = bullet.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ul(r,p,self._str(s[1],level)) else: ts_results = ol.match_group(s[0], (3,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],lev... |
ts_results = dl.match_group(s[0], (1,2)) | ts_results = dl(s[0], (1,2)) | def _str(self,structure,level): r='' for s in structure: # print s[0],'\n', len(s[1]), '\n\n' ts_results = bullet.match_group(s[0], (1,)) if ts_results: p = ts_results[1] r=self.ul(r,p,self._str(s[1],level)) else: ts_results = ol.match_group(s[0], (3,)) if ts_results: p = ts_results[1] r=self.ol(r,p,self._str(s[1],lev... |
(ts_regex.compile('&'), '&'), (ts_regex.compile("<"), '<' ), (ts_regex.compile(">"), '>' ), (ts_regex.compile('"'), '"'))): | (regex.compile('&'), '&'), (regex.compile("<"), '<' ), (regex.compile(">"), '>' ), (regex.compile('"'), '"') )): | def html_quote(v, character_entities=( (ts_regex.compile('&'), '&'), (ts_regex.compile("<"), '<' ), (ts_regex.compile(">"), '>' ), (ts_regex.compile('"'), '"'))): #" text=str(v) for re,name in character_entities: text=gsub(re,name,text) return text |
if not self._unindex.has_key(id): self._unindex[id] = OOSet() self._unindex[id].insert( (comp,level) ) | def insertEntry(self,comp,id,level): """ k is a path component (generated by splitPath() ) v is the documentId level is the level of the component inside the path """ | |
return self.setBody( | tb=self.setBody( | def exception(self, fatal=0): |
if type(b) is not types.StringType or regex.search('[ \t\n]',b) < 0: return self.setBody( | elif type(b) is not types.StringType or regex.search('[a-zA-Z]>',b) < 0: tb=self.setBody( | def exception(self, fatal=0): |
if self.isHTML(b): return self.setBody(b+self._traceback(t,v,tb)) return self.setBody((str(t),b+self._traceback(t,v,tb))) | elif self.isHTML(b): tb=self.setBody(b+self._traceback(t,v,tb)) else: tb=self.setBody((str(t),b+self._traceback(t,v,tb))) return tb | def exception(self, fatal=0): |
'Invalid cookie attribute, %s' % name) | 'Invalid cookie attribute, <em>%s</em>' % name) | def _cookie_list(self): |
try: roles=self.__roles__ | try: roles=self.aq_self.__roles__ | def selectedRoles(self): |
try: del self.__roles__ except: pass | if hasattr(self,'aq_self'): try: del self.aq_self.__roles__ except: pass | def manage_editRoles(self,REQUEST,acl_type='A',acl_roles=[]): """ """ |
def oldmanage_editRoles(self,REQUEST,roles=[]): try: del self.__roles__ except: pass if not roles: return self.manage_rolesForm(self,REQUEST) if roles==['Public',]: self.__roles__=None return self.manage_rolesForm(self,REQUEST) if ('Acquire' in roles) or ('Public' in roles): raise 'Bad Request',('<EM>Acquired</EM> a... | def oldmanage_editRoles(self,REQUEST,roles=[]): | |
try: del self.__roles__ except: pass | if hasattr(self,'aq_self'): try: del self.aq_self.__roles__ except: pass | def _setRoles(self,acl_type,acl_roles): |
def publish(script,path_info,u=None,p=None,d=None,t=None,e={},s=None): | def publish(script,path_info,u=None,p=None,d=None,t=None,e={},s=None,pm=0): | def publish(script,path_info,u=None,p=None,d=None,t=None,e={},s=None): import sys, os, getopt, string profile=p debug=d timeit=t silent=s if not script: script='+Main' if script[0]=='+': script='../../lib/python/'+script[1:] env=e env['SERVER_NAME']='bobo.server' env['SERVER_PORT']='80' env['REQUEST_METHOD']='GET' ... |
if Globals.DatabaseVersion!='3': return | if not dbVersionEquals('3'): return | def changeClassId(self, newid=None): if Globals.DatabaseVersion!='3': return if newid is None: newid=self._new_class_id() self._unregister() if newid: if not newid[:1] == '*': newid='*'+newid self.setClassAttr('__module__', newid) self._register() |
if Globals.DatabaseVersion!='3': return | if not dbVersionEquals('3'): return | def _register(self): if Globals.DatabaseVersion!='3': return z=self._zclass_ class_id=z.__module__ if not class_id: return |
if Globals.DatabaseVersion!='3': return | if not dbVersionEquals('3'): return | def _unregister(self): if Globals.DatabaseVersion!='3': return class_id=self._zclass_.__module__ if not class_id: return globals=self._p_jar.root()['ZGlobals'] if globals.has_key(class_id): del globals[class_id] |
if Globals.DatabaseVersion!='3': return | if not dbVersionEquals('3'): return | def manage_afterAdd(self, item, container): if Globals.DatabaseVersion!='3': return if not self._zclass_.__module__: self.setClassAttr('__module__', self._new_class_id()) self._register() self.propertysheets.methods.manage_afterAdd(item, container) |
if Globals.DatabaseVersion!='3': return | if not dbVersionEquals('3'): return | def manage_beforeDelete(self, item, container): if Globals.DatabaseVersion!='3': return self._unregister() self.propertysheets.methods.manage_beforeDelete(item, container) |
if rawdata[j:j+2] == "/>": return j + 2 | if next == "/": s = rawdata[j:j+2] if s == "/>": return j + 2 if s == "/": return -1 self.updatepos(i, j + 1) raise HTMLParseError("malformed empty start tag", self.getpos()) | def check_for_whole_start_tag(self, i): rawdata = self.rawdata m = locatestarttagend.match(rawdata, i) if m: j = m.end() next = rawdata[j:j+1] if next == ">": return j + 1 if rawdata[j:j+2] == "/>": return j + 2 if next == "": # end of input return -1 if next in ("abcdefghijklmnopqrstuvwxyz=" "ABCDEFGHIJKLMNOPQRSTUVWXY... |
if next in ("abcdefghijklmnopqrstuvwxyz=" | if next in ("abcdefghijklmnopqrstuvwxyz=/" | def check_for_whole_start_tag(self, i): rawdata = self.rawdata m = locatestarttagend.match(rawdata, i) if m: j = m.end() next = rawdata[j:j+1] if next == ">": return j + 1 if rawdata[j:j+2] == "/>": return j + 2 if next == "": # end of input return -1 if next in ("abcdefghijklmnopqrstuvwxyz=" "ABCDEFGHIJKLMNOPQRSTUVWXY... |
Shared.DC.xml.xmllib.XMLParser.__init__(self) self.root=None self.node=None | pass | def __init__(self): Shared.DC.xml.xmllib.XMLParser.__init__(self) self.root=None self.node=None |
if not data.startswith("<?xml"): data = '<?xml version="1.0" ?>\n' + data self.feed(data) self.close() return self.root def add(self, node): self.node.addNode(node) def push(self, node): self.node.addNode(node) self.node=self.node.__nodes__[-1] def pop(self): self.node=self.node.aq_parent def unknown_starttag(self,... | self.dom=minidom.parseString(data) return Node(self.dom) | def parse(self, data): # prepending a XML preample to make xmllib happy # (Collector #863) if not data.startswith("<?xml"): data = '<?xml version="1.0" ?>\n' + data self.feed(data) self.close() return self.root |
manage_workspace__roles__=('Anonymous',) | manage_workspace__roles__=('Authenticated',) | def filtered_manage_options(self, REQUEST=None): |
from AccessControl.User import nobody if aq_base(getSecurityManager().getUser()) is aq_base(nobody): raise 'Unauthorized', ( 'You are not authorized to view this object.') | def manage_workspace(self, REQUEST): """Dispatch to first interface in manage_options """ from AccessControl.User import nobody if aq_base(getSecurityManager().getUser()) is aq_base(nobody): # No authentication credentials presented. raise 'Unauthorized', ( 'You are not authorized to view this object.') options=self.fi... | |
def manage_cutObjects(self, ids, REQUEST=None): | def manage_cutObjects(self, ids=None, REQUEST=None): | def manage_cutObjects(self, ids, REQUEST=None): """Put a reference to the objects named in ids in the clip board""" if type(ids) is type(''): ids=[ids] oblist=[] for id in ids: ob=self._getOb(id) if not ob.cb_isMoveable(): raise CopyError, eNotSupported % id m=Moniker.Moniker(ob) oblist.append(m.dump()) cp=(1, oblist) ... |
def manage_copyObjects(self, ids, REQUEST=None, RESPONSE=None): | def manage_copyObjects(self, ids=None, REQUEST=None, RESPONSE=None): | def manage_copyObjects(self, ids, REQUEST=None, RESPONSE=None): """Put a reference to the objects named in ids in the clip board""" if type(ids) is type(''): ids=[ids] oblist=[] for id in ids: ob=self._getOb(id) if not ob.cb_isCopyable(): raise CopyError, eNotSupported % id m=Moniker.Moniker(ob) oblist.append(m.dump())... |
return [] | return ['Shared'] | def getRoles(self): |
(path and hasattr(self.aq_explicit, path[-1])) ): | (path and hasattr(self.aq_base, path[-1])) ): | def __before_publishing_traverse__(self, self2, request): path = request['TraversalRequestNameStack'] names = self.getBindingAssignments() if (not names.isNameAssigned('name_subpath') or (path and hasattr(self.aq_explicit, path[-1])) ): return subpath = path[:] path[:] = [] subpath.reverse() request.set('traverse_subpa... |
def constructSessionDataManager(self, id, title='', path=None, automatic=None, | def constructSessionDataManager(self, id, title='', path=None, requestName=None, | def constructSessionDataManager(self, id, title='', path=None, automatic=None, REQUEST=None): """ """ ob = SessionDataManager(id, path, title, automatic) self._setObject(id, ob) if REQUEST is not None: return self.manage_main(self, REQUEST, update_menu=1) |
ob = SessionDataManager(id, path, title, automatic) | ob = SessionDataManager(id, path, title, requestName) | def constructSessionDataManager(self, id, title='', path=None, automatic=None, REQUEST=None): """ """ ob = SessionDataManager(id, path, title, automatic) self._setObject(id, ob) if REQUEST is not None: return self.manage_main(self, REQUEST, update_menu=1) |
def __init__(self, id, path=None, title='', automatic=None): | def __init__(self, id, path=None, title='', requestName=None): | def __init__(self, id, path=None, title='', automatic=None): self.id = id self.setContainerPath(path) self.setTitle(title) |
if automatic: self._requestSessionName='SESSION' | if requestName: self._requestSessionName=requestName | def __init__(self, id, path=None, title='', automatic=None): self.id = id self.setContainerPath(path) self.setTitle(title) |
def manage_changeSDM(self, title, path=None, automatic=None, REQUEST=None): | def manage_changeSDM(self, title, path=None, requestName=None, REQUEST=None): | def manage_changeSDM(self, title, path=None, automatic=None, REQUEST=None): """ """ self.setContainerPath(path) self.setTitle(title) if automatic: self.updateTraversalData('SESSION') else: self.updateTraversalData(None) if REQUEST is not None: return self.manage_sessiondatamgr(self, REQUEST) |
if automatic: self.updateTraversalData('SESSION') | if requestName: self.updateTraversalData(requestName) | def manage_changeSDM(self, title, path=None, automatic=None, REQUEST=None): """ """ self.setContainerPath(path) self.setTitle(title) if automatic: self.updateTraversalData('SESSION') else: self.updateTraversalData(None) if REQUEST is not None: return self.manage_sessiondatamgr(self, REQUEST) |
security.declareProtected(MGMT_SCREEN_PERM, 'getAutomatic') def getAutomatic(self): """ """ if hasattr(self,'_hasTraversalHook'): return 1 return 0 | security.declareProtected(MGMT_SCREEN_PERM, 'getrequestName') def getrequestName(self): """ """ return self._requestSessionName or '' | def _getSessionDataContainer(self): """ Do not cache the results of this call. Doing so breaks the transactions for mounted storages. """ if self.obpath is None: err = 'Session data container is unspecified in %s' % self.getId() if DEBUG: LOG('Session Tracking', 0, err) raise SessionIdManagerErr, err # return an exter... |
for path in self.path2docid.keys(f.name): | for path in list(self.path2docid.keys(f.name)): | def updatefolder(self, f, msgs): self.watchfolders[f.name] = self.getmtime(f.name) for n in msgs: path = "%s/%s" % (f.name, n) docid = self.path2docid.get(path, 0) if docid and self.getmtime(path) == self.doctimes.get(docid, 0): print "unchanged", docid, path continue docid = self.newdocid(path) try: m = f.openmessage(... |
(('&'), '&'), (("<"), '<' ), ((">"), '>' ), (('"'), '"'))): | (('&'), '&'), (('<'), '<' ), (('>'), '>' ), (('\213'), '<' ), (('\233'), '>' ), (('"'), '"'))): | def html_quote(v, name='(Unknown name)', md={}, character_entities=( (('&'), '&'), (("<"), '<' ), ((">"), '>' ), (('"'), '"'))): #" text=str(v) for re,name in character_entities: if find(text, re) >= 0: text=join(split(text,re),name) return text |
def _roles_debug(self,hier,expected_roles,got_roles): | def _roles_debug(self,hier,got_roles,expected_roles): | def _roles_debug(self,hier,expected_roles,got_roles): |
r=apply(HTML.__call__, (self, self, REQUEST), kw) | r=apply(HTML.__call__, (self, bself, REQUEST), kw) | def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments.""" kw['document_id'] =self.id kw['document_title']=self.title if client is None: # Called as subtemplate, so don't need error propigation! r=apply(HTML.__c... |
try: r=apply(HTML.__call__, (self, (client, self), REQUEST), kw) | try: r=apply(HTML.__call__, (self, (client, bself), REQUEST), kw) | def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): """Render the document given a client object, REQUEST mapping, Response, and key word arguments.""" kw['document_id'] =self.id kw['document_title']=self.title if client is None: # Called as subtemplate, so don't need error propigation! r=apply(HTML.__c... |
try: _localzone =_cache._zmap[lower(tzname[0])] except: _localzone='' | try: _localzone=_cache._zmap[lower(tzname[0])] except: try: t=time() localzone=mktime(gmtime(t))-t localzone=int(round(-localzone/(60*60))) if localzone >= 0: zn='+%d' % localzone else: lz=str(localzone) _localzone=_cache._zmap[lower('GMT%s' % lz)] except: _localzone='' | def __init__(self,*args): """Return a new date-time object |
security.declareProtected('Edit ReStructuredText', 'manage_editForm') | security.declareProtected('Edit ReStructuredText', 'manage_main') | def source_txt(self, REQUEST=None): ''' Getting the source text ''' REQUEST.RESPONSE.setHeader('content-type', 'text/plain; charset=%s' % self.input_encoding) return self.source |
if unicode and is8bit(data): | if unicode and encoding and is8bit(data): | def _decode(data, encoding, is8bit=re.compile("[\x80-\xff]").search): # decode non-ascii string (if possible) if unicode and is8bit(data): data = unicode(data, encoding) return data |
__version__ = "0.9.9" | def escape(s, replace=string.replace): s = replace(s, "&", "&") s = replace(s, "<", "<") return replace(s, ">", ">",) MAXINT = 2L**31-1 MININT = -2L**31 if unicode: def _stringify(string): try: return str(string) except UnicodeError: return string else: def _stringify(string): return string __version__ =... | def _decode(data, encoding, is8bit=re.compile("[\x80-\xff]").search): # decode non-ascii string (if possible) if unicode and is8bit(data): data = unicode(data, encoding) return data |
class Error: pass | class Error(Exception): """Base class for client errors.""" def __str__(self): return repr(self) | def _decode(data, encoding, is8bit=re.compile("[\x80-\xff]").search): # decode non-ascii string (if possible) if unicode and is8bit(data): data = unicode(data, encoding) return data |
def datetime(data): value = DateTime() value.decode(data) return value | def encode(self, out): out.write("<value><dateTime.iso8601>") out.write(self.value) out.write("</dateTime.iso8601></value>\n") | |
if sgmlop: class FastParser: | try: import _xmlrpclib FastParser = _xmlrpclib.Parser FastUnmarshaller = _xmlrpclib.Unmarshaller except (AttributeError, ImportError): FastParser = FastUnmarshaller = None try: import sgmlop if not hasattr(sgmlop, "XMLParser"): raise ImportError except ImportError: SgmlopParser = None else: class SgmlopParser... | def encode(self, out): import base64, StringIO out.write("<value><base64>\n") base64.encode(StringIO.StringIO(self.data), out) out.write("</base64></value>\n") |
FastParser = None class SlowParser(xmllib.XMLParser): | class ExpatParser: def __init__(self, target): self._parser = parser = expat.ParserCreate(None, None) self._target = target parser.StartElementHandler = target.start parser.EndElementHandler = target.end parser.CharacterDataHandler = target.data encoding = None if not parser.returns_unicode: encoding = "utf-8" target... | def handle_entityref(self, entity): # <string> entity try: self.handle_data(self.entity[entity]) except KeyError: self.handle_data("&%s;" % entity) |
xmllib.XMLParser.__init__(self) | try: xmllib.XMLParser.__init__(self, accept_utf8=1) except TypeError: xmllib.XMLParser.__init__(self) | def __init__(self, target): self.handle_xml = target.xml self.unknown_starttag = target.start self.handle_data = target.data self.unknown_endtag = target.end xmllib.XMLParser.__init__(self) |
self.write("<value><double>%s</double></value>\n" % value) | self.write("<value><double>%s</double></value>\n" % repr(value)) | def dump_double(self, value): self.write("<value><double>%s</double></value>\n" % value) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.