rem
stringlengths 0
322k
| add
stringlengths 0
2.05M
| context
stringlengths 8
228k
|
---|---|---|
if hasattr(self, 'aq_base') and hasattr(self.aq_base, 'index_html'): | if hasattr(self, 'index_html'): | def HEAD(self, REQUEST, RESPONSE): """Retrieve resource information without a response body.""" self.dav__init(REQUEST, RESPONSE) if hasattr(self, 'aq_base') and hasattr(self.aq_base, 'index_html'): if hasattr(self.index_html, 'HEAD'): return self.index_html.HEAD(REQUEST, RESPONSE) raise 'Method Not Allowed', ( 'Method not supported for this resource.' ) raise 'Not Found', 'The requested resource does not exist.' |
prev_id=Moniker.absattr(obj.id) | try: r=obj.aq_parent._reserved_names except: r=() if prev_id in special: raise 'NotSupported', eNotSupported | def manage_paste(self, moniker, clip_id, REQUEST=None): """ """ |
if type(keys) is not ListType: keys=[keys] | if type(keys) is type(''): if not keys or not strip(keys): return None keys=[keys] | def _apply_index(self, request, cid='', ListType=[]): |
return intSet(), (id,) | def _apply_index(self, request, cid='', ListType=[]): |
|
if password is not None and self.encrypt_passwords: | if password is not None and self.encrypt_passwords \ and not self._isPasswordEncrypted(password): | def _doAddUser(self, name, password, roles, domains, **kw): """Create a new user""" if password is not None and self.encrypt_passwords: password = self._encryptPassword(password) self.data[name]=User(name,password,roles,domains) |
try: if hasattr(object,'__bobo_traverse__'): | if hasattr(object,'__bobo_traverse__'): try: | def publishTraverse(self, request, name): object = self.context URL=request['URL'] |
parents[-1:] = list(subobject[:-1]) object, subobject = subobject[-2:] | request['PARENTS'][-1:] = list(subobject[:-1]) object, subobject = subobject[-2:] except (AttributeError, KeyError, NotFound), e: subobject = queryMultiAdapter((object, request), Interface, name) if subobject is not None: request.response.setStatus(200) return subobject.__of__(object) raise e else: if hasattr(aq_base(object), name): subobject = getattr(object, name) | def publishTraverse(self, request, name): object = self.context URL=request['URL'] |
if hasattr(aq_base(object), name): subobject = getattr(object, name) else: subobject=object[name] except (AttributeError, KeyError, NotFound), e: subobject = queryMultiAdapter((object, request), Interface, name) if subobject is not None: request.response.setStatus(200) return subobject.__of__(object) | subobject = queryMultiAdapter((object, request), Interface, name) if subobject is not None: return subobject.__of__(object) | def publishTraverse(self, request, name): object = self.context URL=request['URL'] |
if not hasattr(object,'__bobo_traverse__'): | def publishTraverse(self, request, name): object = self.context URL=request['URL'] |
|
raise e | subobject = object[name] | def publishTraverse(self, request, name): object = self.context URL=request['URL'] |
return whrandom.choice(salt_choices) | return whrandom.choice(salt_choices)+whrandom.choice(salt_choices) | def generate_salt(): """Generate a salt value for the crypt function.""" salt_choices = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ "abcdefghijklmnopqrstuvwxyz" \ "0123456789./" return whrandom.choice(salt_choices) |
def availableSplitter(self): | def availableSplitters(self): | def availableSplitter(self): """ splitter we can add """ return Splitter.availableSplitters |
result=self(REQUEST) | try: result=self(REQUEST) result=custom_default_report(self.id, result) except: result=( '<hr><strong>Error, <em>%s</em>:</strong> %s' % (sys.exc_type, sys.exc_value)) | def manage_test(self, REQUEST): |
% custom_default_report(self.id, result)) | % result) | def manage_test(self, REQUEST): |
self._run_check("""<a a.b='v' c:d='v' e-f='v'/>""", [ ("starttag", "a", ["a.b", "v", "c:d", "v", "e-f", "v"]), | self._run_check("""<a a.b='v' e-f='v'/>""", [ ("starttag", "a", ["a.b", "v", "e-f", "v"]), | def check_attr_funky_names(self): self._run_check("""<a a.b='v' c:d='v' e-f='v'/>""", [ ("starttag", "a", ["a.b", "v", "c:d", "v", "e-f", "v"]), ("endtag", "a"), ]) |
if v!=key: raise AttributeError, v | if str(v) != key: raise AttributeError, v | def __bobo_traverse__(self, REQUEST, key): name=self._name da=self.__dict__['_da'] args=self._args if name: if args.has_key(name): v=args[name] if type(v) is not ListType: v=[v] v.append(key) key=v |
except 'Unauthorized', vv: | except Unauthorized, vv: | def __getitem__(self,index): |
self.title = str(item.children[0]) | self.title = item.children[0].astext() | def render(self): ''' Render the source to HTML ''' # format with strings pub = docutils.core.Publisher() pub.set_reader('standalone', None, 'restructuredtext') pub.set_writer('html') |
lg = logger.syslog_logger(string.split(os.environ['ZSYSLOG_SERVER'], ':')) | (addr, port) = string.split(os.environ['ZSYSLOG_SERVER'], ':') lg = logger.syslog_logger((addr, int(port)) | def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' 'To use localization options, you must ensure\n' 'that the locale module is compiled into your\n' 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The specified locale is not supported by your system.\n' 'See your operating system documentation for more\n' 'information on locale support.' ) |
return '<a href="http://www.zope.org/Credits"><img ' \ | return '<a href="http://www.zope.org/Credits" target="_top"><img ' \ | def ZopeAttributionButton(self): """Returns an HTML fragment that displays the 'powered by zope' button along with a link to the Zope site.""" return '<a href="http://www.zope.org/Credits"><img ' \ 'src="%s/p_/ZopeButton" width="115" height="50" ' \ 'border="0" alt="Powered by Zope"></a>' % self.REQUEST.BASE1 |
if path: path=[script]+path else: path=[script] | if script: path=[script]+path if not path: return '' | def tabs_path_info(self, script, path): url=script out=[] while path[:1]=='/': path=path[1:] while path[-1:]=='/': path=path[:-1] while script[:1]=='/': script=script[1:] while script[-1:]=='/': script=script[:-1] path=split(path,'/')[:-1] if path: path=[script]+path else: path=[script] script='' last=path[-1] del path[-1] for p in path: script="%s/%s" % (script, p) out.append('<a href="%s/manage_main">%s</a>' % (script, p)) out.append(last) return join(out,' / ') |
return parse(text[l:],prefix,result) | return parse(text[l:],result) | def parse(text, result=None, unparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)'), parmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)'), qparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]+\)\"\)'), ): if result is None: result = {} __traceback_info__=text if parmre.match(text) >= 0: name=parmre.group(2) value={'default':parmre.group(3)} l=len(parmre.group(1)) elif qparmre.match(text) >= 0: name=qparmre.group(2) value={'default':qparmre.group(3)} l=len(qparmre.group(1)) elif unparmre.match(text) >= 0: name=unparmre.group(2) l=len(unparmre.group(1)) value={} else: if not text or not strip(text): return result raise InvalidParameter, text lt=string.find(name,':') if lt > 0: value['type']=name[lt+1:] name=name[:lt] result[name]=value return parse(text[l:],prefix,result) |
if hasattr(self.aq_base,'manage_FTPget'): | if hasattr(self.aq_base,'manage_FTPget') and \ hasattr(self.manage_FTPget, '__roles__'): | def manage_FTPstat(self,REQUEST): "psuedo stat, used by FTP for directory listings" from AccessControl.User import nobody mode=0100000 # check read permissions if hasattr(self.aq_base,'manage_FTPget'): if REQUEST['AUTHENTICATED_USER'].allowed(self.manage_FTPget, self.manage_FTPget.__roles__): mode=mode | 0440 if nobody.allowed(self.manage_FTPget, self.manage_FTPget.__roles__): mode=mode | 0004 # check write permissions if hasattr(self.aq_base,'PUT'): if REQUEST['AUTHENTICATED_USER'].allowed(self.PUT, self.PUT.__roles__): mode=mode | 0220 if nobody.allowed(self.PUT, self.PUT.__roles__): mode=mode | 0002 # get size if hasattr(self,'manage_FTPget'): size=len(self.manage_FTPget()) else: size=0 # get modification time mtime=self.bobobase_modification_time().timeTime() return marshal.dumps((mode,0,0,1,0,0,size,mtime,mtime,mtime)) |
if hasattr(self.aq_base,'PUT'): | if hasattr(self.aq_base,'PUT') and hasattr(self.PUT, '__roles__'): | def manage_FTPstat(self,REQUEST): "psuedo stat, used by FTP for directory listings" from AccessControl.User import nobody mode=0100000 # check read permissions if hasattr(self.aq_base,'manage_FTPget'): if REQUEST['AUTHENTICATED_USER'].allowed(self.manage_FTPget, self.manage_FTPget.__roles__): mode=mode | 0440 if nobody.allowed(self.manage_FTPget, self.manage_FTPget.__roles__): mode=mode | 0004 # check write permissions if hasattr(self.aq_base,'PUT'): if REQUEST['AUTHENTICATED_USER'].allowed(self.PUT, self.PUT.__roles__): mode=mode | 0220 if nobody.allowed(self.PUT, self.PUT.__roles__): mode=mode | 0002 # get size if hasattr(self,'manage_FTPget'): size=len(self.manage_FTPget()) else: size=0 # get modification time mtime=self.bobobase_modification_time().timeTime() return marshal.dumps((mode,0,0,1,0,0,size,mtime,mtime,mtime)) |
if v=='-': v='' Zpid=v | if v in ('-', '0', ''): USE_DAEMON=0 elif sys.platform != 'win32': USE_DAEMON = 1 | def server_info(old, v, offset=0): # interpret v as a port or address/port and get new value if v == '-': v='' l=v.find(':') if l >= 0: a=v[:l] v=v[l+1:] else: a=IP_ADDRESS if not v: return v try: v=int(v) if v < 0: raise 'Invalid port', v v=v+offset except: raise 'Invalid port', v if isinstance(old, IntType): old=[(a,v)] else: old.append((a,v)) return old |
if sys.platform=='win32': Zpid='' | def server_info(old, v, offset=0): # interpret v as a port or address/port and get new value if v == '-': v='' l=v.find(':') if l >= 0: a=v[:l] v=v[l+1:] else: a=IP_ADDRESS if not v: return v try: v=int(v) if v < 0: raise 'Invalid port', v v=v+offset except: raise 'Invalid port', v if isinstance(old, IntType): old=[(a,v)] else: old.append((a,v)) return old |
|
if Zpid and not READ_ONLY: | PID_FILE=os.path.join(CLIENT_HOME, 'Z2.pid') if USE_DAEMON and not READ_ONLY: | def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' 'To use localization options, you must ensure\n' 'that the locale module is compiled into your\n' 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The specified locale is not supported by your system.\n' 'See your operating system documentation for more\n' 'information on locale support.' ) |
zdaemon.run(sys.argv, os.path.join(CLIENT_HOME, Zpid)) | zdaemon.run(sys.argv, os.path.join(CLIENT_HOME, PID_FILE)) | def set_locale(val): try: import locale except: raise SystemExit, ( 'The locale module could not be imported.\n' 'To use localization options, you must ensure\n' 'that the locale module is compiled into your\n' 'Python installation.' ) try: locale.setlocale(locale.LC_ALL, val) except: raise SystemExit, ( 'The specified locale is not supported by your system.\n' 'See your operating system documentation for more\n' 'information on locale support.' ) |
PID_FILE=os.path.join(CLIENT_HOME, 'Z2.pid') | def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") ) |
|
if not READ_ONLY: | if not USE_DAEMON and not READ_ONLY: | def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") ) |
pid=str(os.getpid()) try: pid=str(os.getppid())+' '+pid except: pass | pid='%s\n' % os.getpid() | def _warn_nobody(): zLOG.LOG("z2", zLOG.INFO, ("Running Zope as 'nobody' can compromise " "your Zope files; consider using a " "dedicated user account for Zope") ) |
if (hasattr(parent, 'aq_inContextOf') and not parent.aq_inContextOf(self.aq_parent.aq_parent,1)): | if not parent.aq_inContextOf(self.aq_parent.aq_parent,1): | def allowed(self, parent, roles=None): """Check whether the user has access to parent, assuming that parent.__roles__ is the given roles.""" if roles is None or 'Anonymous' in roles: return 1 usr_roles=self.getRolesInContext(parent) for role in roles: if role in usr_roles: if (hasattr(self,'aq_parent') and hasattr(self.aq_parent,'aq_parent')): if parent is None: return 1 if (not hasattr(parent, 'aq_inContextOf') and hasattr(parent, 'im_self')): # This is a method, grab it's self. parent=parent.im_self if (hasattr(parent, 'aq_inContextOf') and not parent.aq_inContextOf(self.aq_parent.aq_parent,1)): if 'Shared' in roles: # Damn, old role setting. Waaa roles=self._shared_roles(parent) if 'Anonymous' in roles: return 1 return None return 1 |
f = open(os.path.join(here, name), 'rb') | f = open(os.path.join(here, name), 'r') | def read_file(name): f = open(os.path.join(here, name), 'rb') res = f.read() f.close() return res |
assert res == expected, res | self.assertEqual(res,expected) | def __init__(self,key,**kw): for k in kw.keys(): self.__dict__[k]=kw[k] |
<dtml-var "ImageObject.tag(border=5, align=left)"> | <dtml-var "ImageObject.tag(border='5', align='left')"> | def manage_addImage(id, file, title='', precondition='', content_type=''): """ Add a new Image object. Creates a new Image object 'id' with the contents of 'file'. """ |
class ExpressionTests(unittest.TestCase): | class ExpressionTests(zope.component.testing.PlacelessSetup, unittest.TestCase): | def __call__(self): return 'dummy' |
def tearDown(self): del self.e, self.ec | def setUp(self): self.e = e = Expressions.getEngine() self.ec = e.getContext( one = 1, d = {'one': 1, 'b': 'b', '': 'blank', '_': 'under'}, blank = '', dummy = Dummy() ) |
|
$Id: Publish.py,v 1.55 1997/09/26 19:15:47 jim Exp $""" | $Id: Publish.py,v 1.56 1997/10/10 19:34:20 jim Exp $""" | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam |
__version__='$Revision: 1.55 $'[11:-2] | __version__='$Revision: 1.56 $'[11:-2] | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam |
except: roles=UNSPECIFIED_ROLES | except: pass | def get_module_info(self, server_name, module_name, module): |
URL=self.script | def publish(self, module_name, after_list, published='web_objects', |
|
ignore.append(start,end-1) | ignore.append((start,end-1)) | def doc_table(self, paragraph, expr = re.compile(r'\s*\|[-]+\|').match): text = paragraph.getColorizableTexts()[0] m = expr(text) subs = paragraph.getSubparagraphs() if not (m): return None rows = [] spans = [] ROWS = [] COLS = [] indexes = [] ignore = [] TDdivider = re.compile("[\-]+").match THdivider = re.compile("[\=]+").match col = re.compile('\|').search innertable = re.compile('\|([-]+|[=]+)\|').search text = strip(text) rows = split(text,'\n') foo = "" for row in range(len(rows)): rows[row] = strip(rows[row]) # have indexes store if a row is a divider # or a cell part for index in range(len(rows)): tmpstr = rows[index][1:len(rows[index])-1] if TDdivider(tmpstr): indexes.append("TDdivider") elif THdivider(tmpstr): indexes.append("THdivider") else: indexes.append("cell") |
cols.append(row[index][0],row[index][1],align,valign,row[index][2]) | cols.append((row[index][0],row[index][1],align,valign,row[index][2])) | def doc_table(self, paragraph, expr = re.compile(r'\s*\|[-]+\|').match): text = paragraph.getColorizableTexts()[0] m = expr(text) subs = paragraph.getSubparagraphs() if not (m): return None rows = [] spans = [] ROWS = [] COLS = [] indexes = [] ignore = [] TDdivider = re.compile("[\-]+").match THdivider = re.compile("[\=]+").match col = re.compile('\|').search innertable = re.compile('\|([-]+|[=]+)\|').search text = strip(text) rows = split(text,'\n') foo = "" for row in range(len(rows)): rows[row] = strip(rows[row]) # have indexes store if a row is a divider # or a cell part for index in range(len(rows)): tmpstr = rows[index][1:len(rows[index])-1] if TDdivider(tmpstr): indexes.append("TDdivider") elif THdivider(tmpstr): indexes.append("THdivider") else: indexes.append("cell") |
response.setHeader('Date', rfc1123_date(), 1) | if not hasattr(response, '_server_version'): response.setHeader('Connection', 'close') response.setHeader('Date', rfc1123_date(), 1) | def dav__init(self, request, response): # Init expected HTTP 1.1 / WebDAV headers which are not # currently set by the response object automagically. # Note we set an borg-specific header for ie5 :( response.setHeader('Date', rfc1123_date(), 1) response.setHeader('MS-Author-Via', 'DAV') |
index_html_=HTML("""\ | def index_html(self, REQUEST=None): """ View the STX Help Topic """ if Globals.DevelopmentMode: try: mtime=os.stat(self.file) except: mtime=0 if mtime != self._v_last_read: self.obj = open(self.file).read() self._v_last_read=mtime self.reindex_object() return self.htmlfile(self, REQUEST) htmlfile = HTML("""\ | def SearchableText(self): "The full text of the Help Topic, for indexing purposes" return '%s %s' % (self.title, self.obj) |
def index_html(self, REQUEST): """ """ return self.index_html_(self, REQUEST) | def index_html(self, REQUEST): """ """ return self.index_html_(self, REQUEST) |
|
def getUser(self, name): | def getUser(name): | def getUser(self, name): """ Returns the user object specified by name. If there is no user named 'name' in the user folder, return None. |
def getUsers(self): | def getUsers(): | def getUsers(self): """ Returns a sequence of all user objects which reside in the user folder. |
def getUserNames(self): | def getUserNames(): | def getUserNames(self): """ Returns a sequence of names of the users which reside in the user folder. |
def manage_addUser(self, name, password, roles, domains): | def manage_addUser(name, password, roles, domains): | def manage_addUser(self, name, password, roles, domains): """ API method for creating a new user object. Note that not all user folder implementations support dynamic creation of user objects. Implementations that do not support dynamic creation of user objects will raise an error for this method. |
def manage_editUser(self, name, password, roles, domains): | def manage_editUser(name, password, roles, domains): | def manage_addUser(self, name, password, roles, domains): """ API method for creating a new user object. Note that not all user folder implementations support dynamic creation of user objects. Implementations that do not support dynamic creation of user objects will raise an error for this method. |
def manage_delUsers(self, names): | def manage_delUsers(names): | def manage_editUser(self, name, password, roles, domains): """ API method for changing user object attributes. Note that not all user folder implementations support changing of user object attributes. Implementations that do not support changing of user object attributes will raise an error for this method. |
return _signals.get(n, 'unknown') | return _signals.get(n, 'signal %d' % n) | def get_signal_name(n): """Return the symbolic name for signal n. Returns 'unknown' if there is no SIG name bound to n in the signal module. """ global _signals if _signals is None: _signals = {} for k, v in signal.__dict__.items(): startswith = getattr(k, 'startswith', None) if startswith is None: continue if startswith('SIG') and not startswith('SIG_'): _signals[v] = k return _signals.get(n, 'unknown') |
{'label':'Contents', 'action':'manage_main'}, {'label':'Import/Export', 'action':'manage_importExportForm'}, {'label':'Undo', 'action':'manage_UndoForm'}, | ObjectManager.manage_options + Item.manage_options | def tpId(self): return self.id |
def manage_addZCatalog(self,id,title,REQUEST=None): | def manage_addZCatalog(self, id, title, vocab='', vocab_id='', REQUEST=None): | def manage_addZCatalog(self,id,title,REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id,title) self._setObject(id,c) if REQUEST is not None: return self.manage_main(self,REQUEST) |
c=ZCatalog(id,title) self._setObject(id,c) | c=ZCatalog(id, title, vocab, vocab_id, self) self._setObject(id, c) | def manage_addZCatalog(self,id,title,REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id,title) self._setObject(id,c) if REQUEST is not None: return self.manage_main(self,REQUEST) |
return self.manage_main(self,REQUEST) | return self.manage_main(self, REQUEST) def VocabularyIDs(self): """ returns a list of acquireable vocabularies. Stole this from ZSQLMethods """ ids={} have_id=ids.has_key StringType=type('') while self is not None: if hasattr(self, 'objectValues'): for o in self.objectValues(): if (hasattr(o,'_isAVocabulary') and o._isAVocabulary and hasattr(o,'id')): id=o.id if type(id) is not StringType: id=id() if not have_id(id): if hasattr(o,'title_and_id'): o=o.title_and_id() else: o=id ids[id]=id if hasattr(self, 'aq_parent'): self=self.aq_parent else: self=None ids=map(lambda item: (item[1], item[0]), ids.items()) ids.sort() return ids | def manage_addZCatalog(self,id,title,REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id,title) self._setObject(id,c) if REQUEST is not None: return self.manage_main(self,REQUEST) |
def __init__(self,id,title=''): | _v_vocabulary = None def __init__(self, id, title='', vocab=0, vocab_id='', container=None): | def manage_addZCatalog(self,id,title,REQUEST=None): """Add a ZCatalog object """ c=ZCatalog(id,title) self._setObject(id,c) if REQUEST is not None: return self.manage_main(self,REQUEST) |
self._catalog = Catalog() | if not vocab: v = Vocabulary('Vocabulary', 'Vocabulary', globbing=1) self._setObject('Vocabulary', v) v = 'Vocabulary' else: v = vocab_id self._catalog = Catalog(vocabulary=v) | def __init__(self,id,title=''): self.id=id self.title=title self.threshold = 10000 self._v_total = 0 self._catalog = Catalog() |
self._catalog.addColumn('absolute_url') self._catalog.addIndex('absolute_url', 'FieldIndex') def getVocabulary(self): """ more ack! """ return getattr(self, self.vocab_id) | def __init__(self,id,title=''): self.id=id self.title=title self.threshold = 10000 self._v_total = 0 self._catalog = Catalog() |
|
apply_func(ob, (apply_path+'/'+p)) | if apply_path: apply_func(ob, (apply_path+'/'+p)) else: apply_func(ob, p) | def ZopeFindAndApply(self, obj, obj_ids=None, obj_metatypes=None, obj_searchterm=None, obj_expr=None, obj_mtime=None, obj_mspec=None, obj_permission=None, obj_roles=None, search_sub=0, REQUEST=None, result=None, pre='', apply_func=None, apply_path=''): """Zope Find interface and apply |
if val is None or (not val and val != 0) and have_arg('null'): | if have_arg('null') and not val and val != 0: | def render(self, md): args=self.args have_arg=args.has_key name=self.__name__ |
return nobody | if roles is None: return nobody return None | def validate(self,request,auth='',roles=None): |
state=translate(state, tplus) | def encode_seq(state): "Convert a sequence to an encoded string" state=compress(str(state)) l=len(state) if l > 57: states=[] for i in range(0,l,57): states.append(b2a_base64(state[i:i+57])[:-1]) state=join(states,'') else: state=b2a_base64(state)[:-1] l=find(state,'=') if l >= 0: state=state[:l] return state |
|
state=translate(state, tminus) | def decode_seq(state): "Convert an encoded string to a sequence" l=len(state) if l > 76: states=[] j=0 for i in range(l/76): k=j+76 states.append(a2b_base64(state[j:k])) j=k if j < l: state=state[j:] l=len(state) k=l%4 if k: state=state+'='*(4-k) states.append(a2b_base64(state)) state=join(states,'') else: l=len(state) k=l%4 if k: state=state+'='*(4-k) state=a2b_base64(state) state=decompress(state) if find(state,'*') >= 0: raise 'Illegal State', state try: return list(eval(state,{'__builtins__':{}})) except: return [] |
|
elif hasattr(self, b): bases.append(getattr(self, b)) | def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateFactory=0, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) elif hasattr(self, b): bases.append(getattr(self, b)) else: # If self is the "methods" propertysheet # of a ZClass, get the class from the # propertysheet. bases.append(self._getOb(b)) Z=ZClass(id,title,bases) if meta_type: Z._zclass_.meta_type=meta_type self._setObject(id, Z) if CreateFactory and meta_type: self.manage_addDTMLMethod( id+'_addForm', id+' constructor input form', addFormDefault % {'id': id, 'meta_type': meta_type}, ) self.manage_addDTMLMethod( id+'_add', id+' constructor', addDefault % {'id': id}, ) self.manage_addPrincipiaFactory( id+'_factory', id+' factory', meta_type, id+'_addForm', ) if REQUEST is not None: return self.manage_main(self,REQUEST) |
|
bases.append(self._getOb(b)) | base=find_class(self, b) bases.append(base) | def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateFactory=0, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) elif hasattr(self, b): bases.append(getattr(self, b)) else: # If self is the "methods" propertysheet # of a ZClass, get the class from the # propertysheet. bases.append(self._getOb(b)) Z=ZClass(id,title,bases) if meta_type: Z._zclass_.meta_type=meta_type self._setObject(id, Z) if CreateFactory and meta_type: self.manage_addDTMLMethod( id+'_addForm', id+' constructor input form', addFormDefault % {'id': id, 'meta_type': meta_type}, ) self.manage_addDTMLMethod( id+'_add', id+' constructor', addDefault % {'id': id}, ) self.manage_addPrincipiaFactory( id+'_factory', id+' factory', meta_type, id+'_addForm', ) if REQUEST is not None: return self.manage_main(self,REQUEST) |
timeDict = {} timesort(timeDict,requests) | def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch, desc = tup if computed_start is None: computed_start = fromepoch computed_end = fromepoch if start is not None and fromepoch < start: continue if end is not None and fromepoch > end: break if code == 'U': finished.extend(unfinished.values()) unfinished.clear() request = StartupRequest() request.url = desc request.start = int(fromepoch) finished.append(request) continue request = unfinished.get(id) if request is None: if code != "B": continue # garbage at beginning of file request = Request() for pending_req in unfinished.values(): pending_req.active = pending_req.active + 1 unfinished[id] = request t = int(fromepoch) try: request.put(code, t, desc) except: print "Unable to handle entry: %s %s %s"%(code, t, desc) if request.isfinished(): del unfinished[id] finished.append(request) finished.extend(unfinished.values()) requests = finished if mode == 'cumulative': for request in requests: url = request.url stats = cumulative.get(url) if stats is None: stats = Cumulative(url) cumulative[url] = stats stats.put(request) cumulative = cumulative.values() if mode == 'cumulative': dict = cumulative elif mode == 'detailed': dict = requests elif mode == 'timed': dict = requests else: raise "Invalid mode." if mode=='timed': timeDict = {} timesort(timeDict,requests) if start and end: timewrite(timeDict,start,end,resolution) if start and not end: timewrite(timeDict,start,computed_end,resolution) if end and not start: timewrite(timeDict,computed_start,end,resolution) if not end and not start: timewrite(timeDict,computed_start,computed_end,resolution) else: dict.sort(sortf) write(dict, top) |
|
timewrite(timeDict,start,end,resolution) | timewrite(requests,start,end,resolution) | def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch, desc = tup if computed_start is None: computed_start = fromepoch computed_end = fromepoch if start is not None and fromepoch < start: continue if end is not None and fromepoch > end: break if code == 'U': finished.extend(unfinished.values()) unfinished.clear() request = StartupRequest() request.url = desc request.start = int(fromepoch) finished.append(request) continue request = unfinished.get(id) if request is None: if code != "B": continue # garbage at beginning of file request = Request() for pending_req in unfinished.values(): pending_req.active = pending_req.active + 1 unfinished[id] = request t = int(fromepoch) try: request.put(code, t, desc) except: print "Unable to handle entry: %s %s %s"%(code, t, desc) if request.isfinished(): del unfinished[id] finished.append(request) finished.extend(unfinished.values()) requests = finished if mode == 'cumulative': for request in requests: url = request.url stats = cumulative.get(url) if stats is None: stats = Cumulative(url) cumulative[url] = stats stats.put(request) cumulative = cumulative.values() if mode == 'cumulative': dict = cumulative elif mode == 'detailed': dict = requests elif mode == 'timed': dict = requests else: raise "Invalid mode." if mode=='timed': timeDict = {} timesort(timeDict,requests) if start and end: timewrite(timeDict,start,end,resolution) if start and not end: timewrite(timeDict,start,computed_end,resolution) if end and not start: timewrite(timeDict,computed_start,end,resolution) if not end and not start: timewrite(timeDict,computed_start,computed_end,resolution) else: dict.sort(sortf) write(dict, top) |
timewrite(timeDict,start,computed_end,resolution) | timewrite(requests,start,computed_end,resolution) | def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch, desc = tup if computed_start is None: computed_start = fromepoch computed_end = fromepoch if start is not None and fromepoch < start: continue if end is not None and fromepoch > end: break if code == 'U': finished.extend(unfinished.values()) unfinished.clear() request = StartupRequest() request.url = desc request.start = int(fromepoch) finished.append(request) continue request = unfinished.get(id) if request is None: if code != "B": continue # garbage at beginning of file request = Request() for pending_req in unfinished.values(): pending_req.active = pending_req.active + 1 unfinished[id] = request t = int(fromepoch) try: request.put(code, t, desc) except: print "Unable to handle entry: %s %s %s"%(code, t, desc) if request.isfinished(): del unfinished[id] finished.append(request) finished.extend(unfinished.values()) requests = finished if mode == 'cumulative': for request in requests: url = request.url stats = cumulative.get(url) if stats is None: stats = Cumulative(url) cumulative[url] = stats stats.put(request) cumulative = cumulative.values() if mode == 'cumulative': dict = cumulative elif mode == 'detailed': dict = requests elif mode == 'timed': dict = requests else: raise "Invalid mode." if mode=='timed': timeDict = {} timesort(timeDict,requests) if start and end: timewrite(timeDict,start,end,resolution) if start and not end: timewrite(timeDict,start,computed_end,resolution) if end and not start: timewrite(timeDict,computed_start,end,resolution) if not end and not start: timewrite(timeDict,computed_start,computed_end,resolution) else: dict.sort(sortf) write(dict, top) |
timewrite(timeDict,computed_start,end,resolution) | timewrite(requests,computed_start,end,resolution) | def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch, desc = tup if computed_start is None: computed_start = fromepoch computed_end = fromepoch if start is not None and fromepoch < start: continue if end is not None and fromepoch > end: break if code == 'U': finished.extend(unfinished.values()) unfinished.clear() request = StartupRequest() request.url = desc request.start = int(fromepoch) finished.append(request) continue request = unfinished.get(id) if request is None: if code != "B": continue # garbage at beginning of file request = Request() for pending_req in unfinished.values(): pending_req.active = pending_req.active + 1 unfinished[id] = request t = int(fromepoch) try: request.put(code, t, desc) except: print "Unable to handle entry: %s %s %s"%(code, t, desc) if request.isfinished(): del unfinished[id] finished.append(request) finished.extend(unfinished.values()) requests = finished if mode == 'cumulative': for request in requests: url = request.url stats = cumulative.get(url) if stats is None: stats = Cumulative(url) cumulative[url] = stats stats.put(request) cumulative = cumulative.values() if mode == 'cumulative': dict = cumulative elif mode == 'detailed': dict = requests elif mode == 'timed': dict = requests else: raise "Invalid mode." if mode=='timed': timeDict = {} timesort(timeDict,requests) if start and end: timewrite(timeDict,start,end,resolution) if start and not end: timewrite(timeDict,start,computed_end,resolution) if end and not start: timewrite(timeDict,computed_start,end,resolution) if not end and not start: timewrite(timeDict,computed_start,computed_end,resolution) else: dict.sort(sortf) write(dict, top) |
timewrite(timeDict,computed_start,computed_end,resolution) | timewrite(requests,computed_start,computed_end,resolution) | def analyze(files, top, sortf, start=None, end=None, mode='cumulative', resolution=60): beginrequests = {} cumulative = {} finished = [] unfinished = {} decidelines = {} # filename to filepos computed_start = None computed_end = None while 1: tup = get_earliest_file_data(files) if tup is None: break code, id, fromepoch, desc = tup if computed_start is None: computed_start = fromepoch computed_end = fromepoch if start is not None and fromepoch < start: continue if end is not None and fromepoch > end: break if code == 'U': finished.extend(unfinished.values()) unfinished.clear() request = StartupRequest() request.url = desc request.start = int(fromepoch) finished.append(request) continue request = unfinished.get(id) if request is None: if code != "B": continue # garbage at beginning of file request = Request() for pending_req in unfinished.values(): pending_req.active = pending_req.active + 1 unfinished[id] = request t = int(fromepoch) try: request.put(code, t, desc) except: print "Unable to handle entry: %s %s %s"%(code, t, desc) if request.isfinished(): del unfinished[id] finished.append(request) finished.extend(unfinished.values()) requests = finished if mode == 'cumulative': for request in requests: url = request.url stats = cumulative.get(url) if stats is None: stats = Cumulative(url) cumulative[url] = stats stats.put(request) cumulative = cumulative.values() if mode == 'cumulative': dict = cumulative elif mode == 'detailed': dict = requests elif mode == 'timed': dict = requests else: raise "Invalid mode." if mode=='timed': timeDict = {} timesort(timeDict,requests) if start and end: timewrite(timeDict,start,end,resolution) if start and not end: timewrite(timeDict,start,computed_end,resolution) if end and not start: timewrite(timeDict,computed_start,end,resolution) if not end and not start: timewrite(timeDict,computed_start,computed_end,resolution) else: dict.sort(sortf) write(dict, top) |
def timesort(dict,requests): for r in requests: if not r.t_end: r.t_end=r.start for t in range(r.start,r.t_end+1): if not dict.has_key(t): dict[t] = 0 dict[t]=dict[t]+1 def timewrite(dict,start,end,resolution): | def getTimeslice(period, utime): low = int(math.floor(utime)) - period + 1 high = int(math.ceil(utime)) + 1 for x in range(low, high): if x % period == 0: return x def timewrite(requests, start, end, resolution): | def getdate(val): try: val = string.strip(val) year, month, day = int(val[:4]), int(val[5:7]), int(val[8:10]) hour,minute,second=int(val[11:13]),int(val[14:16]),int(val[17:19]) t = time.mktime((year, month, day, hour, minute, second, 0, 0, -1)) return t except: raise ProfileException, "bad date %s" % val |
for t in range(start,end,resolution): s = tick2str(t) num = 0 for tick in range(t,t+resolution): if dict.has_key(tick): num = num + dict[tick] if num>max_requests: max_requests = num | d = {} for r in requests: t = r.start slice = getTimeslice(resolution,t) if d.has_key(slice): d[slice] = d[slice] + 1 else: d[slice] = 1 num = 0 hits = 0 avg_requests = None slices = d.keys() slices.sort() for slice in slices: num = d[slice] if num>max_requests: max_requests = num hits = hits + num if avg_requests is None: avg_requests = num else: avg_requests = (avg_requests + num) / 2 s = tick2str(slice) | def timewrite(dict,start,end,resolution): max_requests = 0 print "Start: %s End: %s Resolution: %d secs" % \ (tick2str(start),tick2str(end),resolution) print "-" * 78 print print "Date/Time #requests requests/second" for t in range(start,end,resolution): s = tick2str(t) num = 0 for tick in range(t,t+resolution): if dict.has_key(tick): num = num + dict[tick] if num>max_requests: max_requests = num s = s + " %6d %4.2lf" % (num,num*1.0/resolution) print s print '='*78 print "Peak: %6d %4.2lf" % \ (max_requests,max_requests*1.0/resolution) |
print " Avg: %6d %4.2lf" % \ (avg_requests,avg_requests*1.0/resolution) print "Total: %6d n/a " % (hits) | def timewrite(dict,start,end,resolution): max_requests = 0 print "Start: %s End: %s Resolution: %d secs" % \ (tick2str(start),tick2str(end),resolution) print "-" * 78 print print "Date/Time #requests requests/second" for t in range(start,end,resolution): s = tick2str(t) num = 0 for tick in range(t,t+resolution): if dict.has_key(tick): num = num + dict[tick] if num>max_requests: max_requests = num s = s + " %6d %4.2lf" % (num,num*1.0/resolution) print s print '='*78 print "Peak: %6d %4.2lf" % \ (max_requests,max_requests*1.0/resolution) |
|
sortf = timesort | sortf = None | def usage(basic=1): usage = ( """ |
def value(self): return str(self._v)[:-1] | def value(self): result = str(self._v) if result[-1:] == 'L': return result[:-1] return result | def value(self): return str(self._v)[:-1] |
from timing import start, finish, milli | def time(function,*args,**kwargs): from timing import start, finish, milli repeat_range=range(repeat_count) apply(function,args,kwargs) start() for i in repeat_range: apply(function,args,kwargs) finish() return float(milli())/len(repeat_range) |
|
start() | t=time.clock() | def time(function,*args,**kwargs): from timing import start, finish, milli repeat_range=range(repeat_count) apply(function,args,kwargs) start() for i in repeat_range: apply(function,args,kwargs) finish() return float(milli())/len(repeat_range) |
finish() return float(milli())/len(repeat_range) | t=(time.clock()-t)/1000.0 return float(t)/len(repeat_range) | def time(function,*args,**kwargs): from timing import start, finish, milli repeat_range=range(repeat_count) apply(function,args,kwargs) start() for i in repeat_range: apply(function,args,kwargs) finish() return float(milli())/len(repeat_range) |
if has(o, 'im_self'): | if aq_base(o) is not o: container = aq_parent(aq_inner(o)) elif has(o, 'im_self'): | def restrictedTraverse(self, path, securityManager, get=getattr, has=hasattr, N=None, M=[], TupleType=type(()) ): REQUEST = {'path': path} REQUEST['TraversalRequestNameStack'] = path = path[:] # Copy! if not path[0]: # If the path starts with an empty string, go to the root first. self = self.getPhysicalRoot() if not securityManager.validateValue(self): raise Unauthorized, name path.pop(0) path.reverse() validate = securityManager.validate object = self while path: __traceback_info__ = REQUEST name = path.pop() if isinstance(name, TupleType): object = apply(object, name) continue if name[0] == '_': # Never allowed in a URL. raise AttributeError, name if name=='..': o = get(object, 'aq_parent', M) if o is not M: if not validate(object, object, name, o): raise Unauthorized, name object=o continue t=get(object, '__bobo_traverse__', N) if t is not N: o=t(REQUEST, name) container = None if has(o, 'im_self'): container = o.im_self elif (has(get(object, 'aq_base', object), name) and get(object, name) == o): container = object if not validate(object, container, name, o): raise Unauthorized, name else: # Try an attribute. o = get(object, name, M) if o is not M: # Check access to the attribute. if has(object, 'aq_acquire'): object.aq_acquire( name, validate2, validate) else: if not validate(object, object, name, o): raise Unauthorized, name else: # Try an item. try: # XXX maybe in Python 2.2 we can just check whether # the object has the attribute "__getitem__" # instead of blindly catching exceptions. o = object[name] except AttributeError, exc: if str(exc).find('__getitem__') >= 0: # The object does not support the item interface. # Try to re-raise the original attribute error. # XXX I think this only happens with # ExtensionClass instances. get(object, name) raise except TypeError, exc: if str(exc).find('unsubscriptable') >= 0: # The object does not support the item interface. # Try to re-raise the original attribute error. # XXX This is sooooo ugly. get(object, name) raise else: # Check access to the item. if not validate(object, object, name, o): raise Unauthorized, name object = o return object |
_r=None | def manage_product_zclass_info(self): r=[] Z=self._zclass Z=getattr(Z, 'aq_self', Z) for d in self.aq_acquire('_getProductRegistryData')('zclasses'): z=d['meta_class'] if hasattr(z._zclass_,'_p_deactivate'): # Eek, persistent continue x={} x.update(d) x['selected'] = (z is Z) and 'selected' or '' del x['meta_class'] r.append(x) |
|
expr = re.compile(r'(\s*[%s]+\.)|(\s*[0-9]+\.)|(\s*[0-9]+\s+)' % letters).match): | expr = re.compile(r'(\s*[%s]\.)|(\s*[0-9]+\.)|(\s*[0-9]+\s+)' % letters).match): | def doc_numbered( self, paragraph, expr = re.compile(r'(\s*[%s]+\.)|(\s*[0-9]+\.)|(\s*[0-9]+\s+)' % letters).match): # This is the old expression. It had a nasty habit # of grabbing paragraphs that began with a single # letter word even if there was no following period. #expr = re.compile('\s*' # '(([a-zA-Z]|[0-9]+|[ivxlcdmIVXLCDM]+)\.)*' # '([a-zA-Z]|[0-9]+|[ivxlcdmIVXLCDM]+)\.?' # '\s+').match): top=paragraph.getColorizableTexts()[0] m=expr(top) if not m: return None subs=paragraph.getSubparagraphs() if top[-2:]=='::': subs=[StructuredTextExample(subs)] top=top[:-1] return StructuredTextNumbered(top[m.span()[1]:], subs, indent=paragraph.indent, number=top[:m.span()[1]]) |
def doc_header(self, paragraph, expr=re.compile(r'[ %s0-9.:/,-_*<>\?\'\"]+' % letters).match): | def doc_header(self, paragraph): | def doc_header(self, paragraph, expr=re.compile(r'[ %s0-9.:/,-_*<>\?\'\"]+' % letters).match): subs=paragraph.getSubparagraphs() if not subs: return None top=paragraph.getColorizableTexts()[0] if not strip(top): return None if top[-2:]=='::': subs=StructuredTextExample(subs) if strip(top)=='::': return subs # copy attrs when returning a paragraph kw = {} atts = getattr(paragraph, '_attributes', []) for att in atts: kw[att] = getattr(paragraph, att) return apply(ST.StructuredTextParagraph, (top[:-1], [subs]), kw) |
expr=re.compile( r"(?:\s|^)'" r"([^ \t\n\r\f\v']|[^ \t\n\r\f\v'][^\n']*[^ \t\n\r\f\v'])" r"'(?:\s|[,.;:!?]|$)" ).search): | expr = re.compile(r"'([%s%s%s\s]+)'[%s]+" % (letters, digits, literal_punc, phrase_delimiters)).search): | def doc_literal( self, s, expr=re.compile( r"(?:\s|^)'" # open r"([^ \t\n\r\f\v']|[^ \t\n\r\f\v'][^\n']*[^ \t\n\r\f\v'])" # contents r"'(?:\s|[,.;:!?]|$)" # close ).search): r=expr(s) if r: start, end = r.span(1) return (StructuredTextLiteral(s[start:end]), start-1, end+1) else: return None |
expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search | expr = re.compile(r'\*([%s%s%s\s]+?)\*' % (letters, digits, strongem_punc)).search | def doc_emphasize( self, s, expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search ): |
expr2 = re.compile(r"\[[%s0-9]+\]" % letters ).search): | expr2 = re.compile(r"\[[%s%s]+\]" % (letters, digits) ).search): | def doc_inner_link(self, s, expr1 = re.compile(r"\.\.\s*").search, expr2 = re.compile(r"\[[%s0-9]+\]" % letters ).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 |
expr=re.compile(r"\_([%s0-9\s\.,\?]+)\_" % letters).search): | expr=re.compile(r'_([%s%s%s\s]+)_' % (letters, digits, under_punc)).search): | def doc_underline(self, s, expr=re.compile(r"\_([%s0-9\s\.,\?]+)\_" % letters).search): result = expr(s) if result: start,end = result.span(1) st,e = result.span() return (StructuredTextUnderline(s[start:end]),st,e) else: return None |
expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search | expr = re.compile(r'\*\*([%s%s%s\s]+?)\*\*' % (letters, digits, strongem_punc)).search | def doc_strong(self, s, expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search ): |
_DQUOTEDTEXT = r'("[ %s0-9\n\-\.\,\;\(\)\/\:\/\*\']+")' % letters _URL_AND_PUNC = r'([%s0-9_\@\.\,\?\!\/\:\;\-\ | _DQUOTEDTEXT = r'("[ %s0-9\n\r\-\.\,\;\(\)\/\:\/\*\']+")' % letters _URL_AND_PUNC = r'((http|https|ftp|mailto|file|about)[:/]+?[%s0-9_\@\.\,\?\!\/\:\;\-\ | def doc_strong(self, s, expr = re.compile(r'\s*\*([ \n%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*(?!\*|-)' % letters).search ): |
expr = re.compile('\[([%s0-9\-.:/;,\n\~]+)\]' % letters).search | expr = re.compile('\[([%s0-9\-.:/;,\n\r\~]+)\]' % letters).search | def doc_xref(self, s, expr = re.compile('\[([%s0-9\-.:/;,\n\~]+)\]' % letters).search ): r = expr(s) if r: start, end = r.span(1) return (StructuredTextXref(s[start:end]), start-1, end+1) else: return None |
return "%s in (%s)" % (self.column,vs) | if self.op == '<>': return "%s not in (%s)" % (self.column, vs) else: return "%s in (%s)" % (self.column, vs) | def render(self, md): |
def manage_addZCatalog(self, id, title, vocab_id='', REQUEST=None): | def manage_addZCatalog(self, id, title, vocab_id=None, REQUEST=None): | def manage_addZCatalog(self, id, title, vocab_id='', REQUEST=None): """Add a ZCatalog object """ id=str(id) title=str(title) vocab_id=str(vocab_id) c=ZCatalog(id, title, vocab_id, self) self._setObject(id, c) if REQUEST is not None: return self.manage_main(self, REQUEST) |
def __init__(self, id, title='', vocab_id='', container=None): | def __init__(self, id, title='', vocab_id=None, container=None): | def __init__(self, id, title='', vocab_id='', container=None): self.id=id self.title=title self.vocab_id = vocab_id self.threshold = 10000 self._v_total = 0 |
return not not self.evaluate(expr) | bool = self.evaluate(expr) if bool is Undefined: return bool return not not bool | def evaluateBoolean(self, expr): return not not self.evaluate(expr) |
if text is not None: | if text not in (None, Undefined): | def evaluateText(self, expr): text = self.evaluate(expr) if text is not None: text = str(text) return text |
sources=[PYEXPAT_DIR + '/expat/xmlparse/xmlparse.c', PYEXPAT_DIR + '/expat/xmlparse/hashtable.c', PYEXPAT_DIR + '/expat/xmltok/xmlrole.c', PYEXPAT_DIR + '/expat/xmltok/xmltok.c', PYEXPAT_DIR + '/dcpyexpat.c'])] | sources=[DCPYEXPAT_DIR + '/expat/xmlparse/xmlparse.c', DCPYEXPAT_DIR + '/expat/xmlparse/hashtable.c', DCPYEXPAT_DIR + '/expat/xmltok/xmlrole.c', DCPYEXPAT_DIR + '/expat/xmltok/xmltok.c', DCPYEXPAT_DIR + '/dcpyexpat.c'])] | def __init__(self, attrs): distutils.core.Distribution.__init__(self, attrs) self.cmdclass["install"] = ZopeInstall self.cmdclass["install_data"] = ZopeInstallData |
{'label': 'Subobjects', 'action' :'propertysheets/subobjects'}, | {'label': 'Subobjects', 'action' :'propertysheets/subobjects/manage'}, | def all_meta_types(self): return self.meta_types |
try: from types import BooleanType except ImportError: BooleanType = None | from types import BooleanType | def guarded_getitem(object, index): v = object[index] if getSecurityManager().validate(object, object, index, v): return v raise Unauthorized, 'unauthorized access to element %s' % `i` |
if BooleanType and isinstance(v, BooleanType): | if isinstance(v, BooleanType): | def simple_marshal(v): if isinstance(v, StringType): return '' if BooleanType and isinstance(v, BooleanType): return ':boolean' if isinstance(v, IntType): return ':int' if isinstance(v, FloatType): return ':float' if isinstance(v, DateTime): return ':date' return '' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.