rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
schema[lower(name)]=i schema[upper(name)]=i | n=lower(name) if n != name: aliases.append((n, SQLAlias(name))) n=upper(name) if n != name: aliases.append((n, SQLAlias(name))) | def __init__(self,file,brains=NoBrains, parent=None, zbrains=None): |
d=r.__dict__ for k, v in aliases: if not hasattr(r,k): d[k]=v | for _def in defs: _def=strip(_def) if not _def: raise ValueError, ('Empty column definition for %s' % names[i]) if defre.match(_def) < 0: raise ValueError, ( 'Invalid column definition for, %s, for %s' % _def, names[i]) type=lower(defre.group(2)) width=defre.group(1) if width: width=atoi(width) else: width=8 | |
self.assertEqual(factory.host, '') | self.assertEqual(factory.host, DEFAULT_HOSTNAME) | def test_ftp_factory(self): factory = self.load_factory("""\ <ftp-server> address 84 </ftp-server> """) self.assert_(isinstance(factory, ZServer.datatypes.FTPServerFactory)) self.assertEqual(factory.host, '') self.assertEqual(factory.port, 84) self.check_prepare(factory) factory.create().close() |
realm=request.environ['BOBO_REALM'] | realm=os.environ['BOBO_REALM'] | def get_module_info(module_name, modules={}, acquire=_l.acquire, release=_l.release, ): if modules.has_key(module_name): return modules[module_name] if module_name[-4:]=='.cgi': module_name=module_name[:-4] acquire() tb=None try: try: module=__import__(module_name, globals(), globals(), ('__doc__',)) realm=module_n... |
columns=result._searchable_result_columns() | columns=result._searchable_result_columns() __traceback_info__=columns | def custom_default_report(id, result, action=''): columns=result._searchable_result_columns() heading=('<tr>\n%s</tr>' % string.joinfields( map(lambda c: '\t<th>%s</th>\n' % nicify(c['name']), columns), '' ) ) row=('<tr>\n%s</tr>' % string.joinfields( map(lambda c: '\t\t<td><!--#var %s%s--></td>\n' % (urllib.quote(c['n... |
self._v_cache={} | self._v_cache={}, IOBTree.Bucket() | def manage_advanced(self, key, max_rows, max_cache, cache_time, |
rec.append(default_value, name) | rec.append(default_value) | def addColumn(self, name, default_value=None): """ adds a row to the meta data schema """ schema = self.schema names = list(self.names) |
del self.data[rid] del self.uids[uid] del self.paths[rid] | try: del self.data[rid] except: pass try: del self.uids[uid] except: pass try: del self.paths[rid] except: pass | def uncatalogObject(self, uid): """ |
if not basic_type(k): | if not basic_type(type(k)): | def sort_sequence(self, sequence): |
for name, who_cares in method.ac_inherited_permissions(1): p=perms.get(getPermissionMapping(name, wrapper), '') a({'permission_name': name, 'class_permission': p}) | for ac_perms in method.ac_inherited_permissions(1): p=perms.get(getPermissionMapping(ac_perms[0], wrapper), '') a({'permission_name': ac_perms[0], 'class_permission': p}) | def manage_getPermissionMapping(self): """Return the permission mapping for the object |
has_key = request.has_key if has_key(cidid): keys = request[cidid] elif has_key(id): keys = request[id] else: return None if type(keys) is not ListType and not TupleType: | if request.has_key(cidid): keys = request[cidid] elif request.has_key(id): keys = request[id] else: return None if not type(keys) in (ListType, TupleType): | def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request |
manage_options=({'label':'Join/Leave', 'action':'manage_main'}, {'label':'Properties', 'action':'manage_editForm'}, {'label':'Security', 'action':'manage_access'}, ) | manage_options=( {'label':'Join/Leave', 'action':'manage_main'}, {'label':'Save/Discard', 'action':'manage_end'}, {'label':'Properties', 'action':'manage_editForm'}, {'label':'Security', 'action':'manage_access'}, ) | def manage_addVersion(self, id, title, REQUEST=None): """ """ self=self.this() self._setObject(id, Version(id,title,REQUEST)) if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main') |
('Join/leave Versions', ('enter','leave','leave_another')), ('Save/discard Version changes', ('save','discard')), | ('Join/leave Versions', ('manage_main', 'enter','leave','leave_another')), ('Save/discard Version changes', ('manage_end', 'save','discard')), | def manage_addVersion(self, id, title, REQUEST=None): """ """ self=self.this() self._setObject(id, Version(id,title,REQUEST)) if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main') |
manage=manage_main=Globals.HTMLFile('version', globals()) | manage_main=Globals.HTMLFile('version', globals()) manage_end=Globals.HTMLFile('versionEnd', globals()) | def __init__(self, id, title, REQUEST): self.id=id self.title=title |
def discard(self, REQUEST=None): | def discard(self, remark='', REQUEST=None): | def discard(self, REQUEST=None): 'Discard changes made during the version' try: db=self._p_jar.db() except: # BoboPOS 2 Globals.VersionBase[self.cookie].abort() else: # ZODB 3 db.abortVersion(self.cookie) |
print 'path', path | def undoable_transactions(self, AUTHENTICATION_PATH=None, first_transaction=None, last_transaction=None, PrincipiaUndoBatchSize=None): | |
if aq_base(accessed) is aq_base(container): raise Unauthorized, name return 0 | raise Unauthorized, name | def validate(self, accessed, container, name, value, *args): if aq_base(accessed) is aq_base(container): raise Unauthorized, name return 0 |
if type(initial) is tt: name, initial = initial else: name=initial.__name__ | def registerClass(self, instance_class=None, meta_type='', permission=None, constructors=(), icon=None, permissions=None, legacy=(), ): """Register a constructor | |
if type(rs) is IIBType: | if sort_index is None and type(rs) is IIBType: | def _indexedSearch(self, args, sort_index, append, used, IIBType=type(IIBucket()), intSType=type(intSet())): """ Iterate through the indexes, applying the query to each one. Do some magic to join result sets. Be intelligent about handling intSets and IIBuckets. """ |
intset=intset.intersection(rs) | if type(rs) is IIBType: intset=rs.intersection(intset) else: intset=intset.intersection(rs) | def _indexedSearch(self, args, sort_index, append, used, IIBType=type(IIBucket()), intSType=type(intSet())): """ Iterate through the indexes, applying the query to each one. Do some magic to join result sets. Be intelligent about handling intSets and IIBuckets. """ |
if m.find('/') >= 0: prefix= m.startswith('/') and REQUEST['BASE0'] or REQUEST['URL1'] raise 'Redirect', ( "%s/%s" % (prefix, m)) | if m.find('/'): raise 'Redirect', ( "%s/%s" % (REQUEST['URL1'], 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.') |
raise TALError("invalid repeat syntax: " + `repeat`, position) | raise TALError("invalid repeat syntax: " + `arg`, position) | def emitRepeat(self, arg, position=(None, None)): m = re.match("(?s)\s*(%s)\s+(.*)\Z" % NAME_RE, arg) if not m: raise TALError("invalid repeat syntax: " + `repeat`, position) name, expr = m.group(1, 2) cexpr = self.compileExpression(expr) program = self.popProgram() self.emit("loop", name, cexpr, program) |
raise METALError("duplicate slot definition: %s" % slotName, | raise METALError("duplicate fill-slot name: %s" % slotName, | def emitFillSlot(self, slotName, position=(None, None)): program = self.popProgram() if self.slots.has_key(slotName): raise METALError("duplicate slot definition: %s" % slotName, position) self.slots[slotName] = program self.emit("fillSlot", slotName, program) |
self._product=product.__dict__ | if hasattr(product,'aq_base'): product=product.aq_base self._product=product | def __init__(self, product, dest, REQUEST): self._product=product.__dict__ self._d=dest v=REQUEST['URL'] v=v[:rfind(v,'/')] self._u=v[:rfind(v,'/')] |
obj = REQUEST.resolve_url(url, REQUEST) | obj = self.resolve_url(url, REQUEST) | def manage_catalogObject(self, REQUEST, urls=None): """ index all Zope objects that 'urls' point to """ if urls: for url in urls: try: # if an error happens here, the catalog will be in # an unstable state. If this happens, ignore the # object. obj = REQUEST.resolve_url(url, REQUEST) except: continue self.catalog_obj... |
obj = REQUEST.resolve_url(url, REQUEST) | obj = self.resolve_url(url, REQUEST) | def manage_uncatalogObject(self, REQUEST, urls=None): """ removes Zope object 'urls' from catalog """ |
self.manage_catalogClear() | self.manage_catalogClear(REQUEST) | def manage_catalogReindex(self, REQUEST): """ clear the catalog, then re-index everything """ |
obj = REQUEST.resolve_url(p) | obj = self.resolve_url(p, REQUEST) | def manage_catalogReindex(self, REQUEST): """ clear the catalog, then re-index everything """ |
url='%s/%s' %(REQUEST.script, self.getpath(rid)) | def getobject(self, rid, REQUEST=None): """ Return a cataloged object given a 'data_record_id_' """ if REQUEST is None: REQUEST=self.REQUEST url='%s/%s' %(REQUEST.script, self.getpath(rid)) | |
obj = REQUEST.resolve_url(url) | obj = self.resolve_url(self.getpath(rid), REQUEST) | def getobject(self, rid, REQUEST=None): """ Return a cataloged object given a 'data_record_id_' """ if REQUEST is None: REQUEST=self.REQUEST url='%s/%s' %(REQUEST.script, self.getpath(rid)) |
if product_name not in ['OFSP','MailHost']: if not lic_check(product_name): continue | if not lic_check(product_name): continue | def install_products(): # Install a list of products into the basic folder class, so # that all folders know about top-level objects, aka products path_join=os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') isdir=os.path.isdir exists=os.path.exists DictType=type({}) meta_types=list(Folder.Folder... |
__import__(m) | try: __import__(m) except: m=s[:p] __import__(m) | def lic_check(product_name): path_join =os.path.join product_dir=path_join(SOFTWARE_HOME,'lib/python/Products') package_dir=path_join(product_dir, product_name) bobobase =Globals.Bobobase try: f=open(path_join(package_dir,'%s.lic' % product_name), 'rb') except: try: product=getattr(__import__("Products.%s" % produc... |
def absolute_url(self, relative=0): """Return an absolute url to the object. Note that the url will reflect the acquisition path of the object if the object has been acquired.""" obj=self url=[] while hasattr(obj, 'aq_parent') and hasattr(obj.aq_parent, 'id'): id=callable(obj.id) and obj.id() or str(obj.id) url.append(... | def absolute_url(self, relative=0): """Return an absolute url to the object. Note that the url will reflect the acquisition path of the object if the object has been acquired.""" obj=self url=[] while hasattr(obj, 'aq_parent') and hasattr(obj.aq_parent, 'id'): id=callable(obj.id) and obj.id() or str(obj.id) url.append(... | |
def absolute_url(self, relative=0): id=quote(self.id) p=getattr(self,'aq_inner', None) if p is not None: url=p.aq_parent.absolute_url(relative) if url: id=url+'/'+id return id | def __len__(self): return 1 | |
['Products/Five/doc', ['Products/ZReST/doc/*']], ['Products/Five/skel', ['Products/ZReST/skel/*']], ['Products/Five/tests', ['Products/ZReST/tests/*']], | ['Products/Five/doc', ['Products/Five/doc/*']], ['Products/Five/skel', ['Products/Five/skel/*']], ['Products/Five/tests', ['Products/Five/tests/*']], | def __init__(self, *attrs): Distribution.__init__(self, *attrs) self.cmdclass['build'] = MyBuilder self.cmdclass['build_ext'] = MyExtBuilder self.cmdclass['install_lib'] = MyLibInstaller |
def reverse_items(self, items): s = list(items) s.reverse() return s | def render(self,md): args=self.args have=args.has_key | |
items=self.reverse_items(items) | items=list(items) items.reverse() | def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): "Render a tree as a table" have_arg=args.has_key exp=0 if level >= 0: urlattr=args['url'] if urlattr and hasattr(self, urlattr): tpUr... |
print obj, dir(obj) | def _checkId(self, id, allow_dup=0): # If allow_dup is false, an error will be raised if an object # with the given id already exists. If allow_dup is true, # only check that the id string contains no illegal chars; # _checkId() will be called again later with allow_dup # set to false before the object is added. if not... | |
mhost.send(self.section(md.this, md), self.mailto, self.mailfrom, self.subject, self.encode) | mhost.send(render_blocks(self.section.blocks, md), self.mailto, self.mailfrom, self.subject, self.encode ) | def render(self, md): args=self.args has_key=args.has_key |
except '': | except: | def log(self, subsystem, severity, summary, detail, error): if _log_dest is None or severity < _log_level: return buf = ["------"] line = ("%s %s %s %s" % (log_time(), severity_string(severity), subsystem, summary)) if not textwrap or len(line) < 80: buf.append(line) else: buf.extend(textwrap.wrap(line, width=79, subse... |
if not self._index.has_key(comp): return [] if not self._index[comp].has_key(level+i): return [] | if not self._index.has_key(comp): return IISet() if not self._index[comp].has_key(level+i): return IISet() | 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). |
results = None | results = IISet() | 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). |
_marker=[] | def PersistentClassDict(doc=None, meta_type=None): # Build new class dict dict={} dict.update(Template.__dict__) if meta_type is not None: dict['meta_type']=dict['__doc__']=meta_type if doc is not None: dict['__doc__']=doc return dict | |
def getClassAttr(self, name): r=self._zclass_.__dict__[name] return r | def getClassAttr(self, name, default=_marker): if default is _marker: return self._zclass_.__dict__[name] try: return self._zclass_.__dict__[name] except KeyError: return default | def getClassAttr(self, name): r=self._zclass_.__dict__[name] return r |
raise InvalidParameter, text | raise ParseError, ('invalid parameter: "%s"' % text, tag) | def parse_params(text, result=None, tag='', unparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)'), parmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)'), qparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]*\)\"\)'), **parms): """Parse tag parameters The format of tag parameters consists of 1 or mor... |
set.remove(k) | set.remove(i) | def unindex_item(self,i): |
td.validate = getSecurityManager().validate | td.validate = validate | def call_with_ns(f, ns, arg=1): td = TemplateDict() td.validate = getSecurityManager().validate td.this = None td._push(ns['request']) td._push(InstanceDict(ns['here'], td)) td._push(ns['var']) try: if arg==2: return f(None, td) else: return f(td) finally: td._pop(3) |
def index_html(self, REQUEST, PARENTS, RESPONSE): """Run the document as a web object with possible HTTP headers""" return decapitate(self(PARENTS[1],REQUEST), RESPONSE) | def initvars(self, mapping, vars): """Hook to override signature so we can detect whether we are running from the web""" HTML.initvars(self, mapping, vars) self.func_code.__init__(('self','REQUEST','RESPONSE')) self.func_defaults=(None,) def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw): r=apply(HTML.__... | def index_html(self, REQUEST, PARENTS, RESPONSE): |
default_html=""" <HTML> <HEAD> <TITLE>New Document</TITLE> </HEAD> <BODY> | default_html="""<!-- | def manage_edit(self,data,title,roles,REQUEST=None): |
</BODY> </HTML>""" | <!-- | def manage_edit(self,data,title,roles,REQUEST=None): |
return self.manage_main(self,REQUEST) | if REQUEST: return self.manage_main(self,REQUEST) | def manage_addDocument(self,id,title,roles,REQUEST,file=''): |
parents = request.PARENTS parents.pop() | def __bobo_traverse__(self, request, name): '''Traversing away''' if name in ('manage_main', 'manage_workspace'): return self.manage_main request.setVirtualRoot([]) stack = request['TraversalRequestNameStack'] stack.append(name) parents = request.PARENTS parents.pop() # I don't belong there return parents.pop() # He'll... | |
if have_arg['leaves']: | if have_arg('leaves'): | def tpRenderTABLE(self, id, root_url, url, state, substate, diff, data, colspan, section, md, treeData, level=0, args=None, simple_type={type(''):0, type(1):0, type(1.0):0}.has_key, ): "Render a tree as a table" have_arg=args.has_key exp=0 if level >= 0: urlattr=args['url'] if urlattr and hasattr(self, urlattr): tpUr... |
'a mailhost...?' manage=HTMLFile('MailHost/manageMailHost') index_html=HTMLFile('MailHost/mailHost') icon="MailHost/MailHost_icon.gif" def __init__(self): 'nothing yet' pass def _init(self, localHost, smtpHost, smtpPort): self.localHost=localHost self.smtpHost=smtpHost self.smtpPort=smtpPort self.sentMessages=0 def ... | 'a mailhost...?' manage=HTMLFile('MailHost/manageMailHost') index_html=HTMLFile('MailHost/mailHost') icon="MailHost/MailHost_icon.gif" def __init__(self): 'nothing yet' pass def _init(self, localHost, smtpHost, smtpPort): self.localHost=localHost self.smtpHost=smtpHost self.smtpPort=smtpPort self.sentMessages=0 def ... | def add(self, id='aMailHost', title='Some mail thing', smtp_host=None, localhost='localhost', smtp_port=25, REQUEST): ' add a MailHost into the system ' i=MailHost() #create new mail host i.id=id #give it id i.title=title #title i._init(localHost=localhost, smtpHost=smtp_host, smtpP... |
blank_re =regex.compile('^[%s]+$' % string.whitespace) header_re=regex.symcomp('^\(<headerName>[^\0- <>:]+\):\(<headerText>.*\)$') linecount=0; headerDict={} maxwell=map(lambda x: string.strip(x),string.split(message,'\n')) for line in maxwell: if not line: break if blank_re.match(line) >= 0: break if header_re.match... | blank_re =regex.compile('^[%s]+$' % string.whitespace) header_re=regex.symcomp('^\(<headerName>[^\0- <>:]+\):\(<headerText>.*\)$') space_re =regex.compile('^[%s]+' % string.whitespace) linecount=0; headerDict={};curHeader={} maxwell=map(lambda x: string.rstrip(x),string.split(message,'\n')) for line in maxwell: if no... | def newDecapitate(message): blank_re =regex.compile('^[%s]+$' % string.whitespace) header_re=regex.symcomp('^\(<headerName>[^\0- <>:]+\):\(<headerText>.*\)$') linecount=0; headerDict={} maxwell=map(lambda x: string.strip(x),string.split(message,'\n')) for line in maxwell: if not line: break if blank_re.match(line) >=... |
error=sys.exc_info()) | exc_info=True) | def check_zglobals(self): if not doInstall(): return |
expand = 1 | expand = 0 | def __of__(self, parent): return parent.pt_macros() |
if hasattr(self, 'aq_base'): self=self.aq_base if default is _marker: return getattr(self, id) try: return getattr(self, id) except: return default | if hasattr(self, 'aq_base'): base=self.aq_base else: base=self if not hasattr(base, id): if default is _marker: raise AttributeError, id return default return getattr(self, id) | def _getOb(self, id, default=_marker): if hasattr(self, 'aq_base'): self=self.aq_base if default is _marker: return getattr(self, id) try: return getattr(self, id) except: return default |
rc=referenceCount_get(roid, txn) if rc: rc=unpack(">i", rc)[0] if rc=='\0\0\0\0': del zeros[roid] | rcs=referenceCount_get(roid, txn) if rcs: rc=unpack(">i", rcs)[0] if rc==0: try: del zeros[roid] except: pass | def _finish(self, tid, u, d, e): txn = self._env.txn_begin() try: zeros={} referenceCount=self._referenceCount referenceCount_get=referenceCount.get referenceCount_put=referenceCount.put oreferences=self._oreferences oreferences_put=oreferences.put serial_put=self._index.put opickle_put=self._opickle.put serial=self._s... |
raise ValueError, ( 'Invalid empty string value for <em>%s</em>' % name) | if args.has_key('optional') and args['optional']: return 'null' else: raise ValueError, ( 'Invalid empty string value for <em>%s</em>' % name) | def render(self, md): name=self.__name__ args=self.args t=args['type'] try: expr=self.expr if type(expr) is type(''): v=md[expr] else: v=expr(md) except: if args.has_key('optional') and args['optional']: return 'null' raise 'Missing Input', 'Missing input variable, <em>%s</em>' % name |
if val is None and have_arg('null'): | if val is None or (not val and val != 0) and have_arg('null'): | def render(self, md): args=self.args have_arg=args.has_key name=self.__name__ |
level=level+1 if level > 3: output('<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) | if level > 3: output('<TD COLSPAN="%s"></TD>' % level) elif level > 1: output('<TD></TD>' * level) | def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite... |
output('<TD COLSPAN="%s" VALIGN="TOP">' % dataspan) | output('<TD%s VALIGN="TOP">' % (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or '')) | def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite... |
if level > 2: h='<TD COLSPAN="%s"></TD>' % (level-1) | dataspan=colspan-level if level > 3: h='<TD COLSPAN="%s"></TD>' % (level-1) | def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite... |
'<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), | '<TD%s VALIGN="TOP">' % (h, (dataspan > 1 and (' COLSPAN="%s"' % dataspan) or ''))), | def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-ite... |
for k, v in product.__aliases__: | for k, v in product.__module_aliases__: | def import_products(): # Try to import each product, checking for and catching errors. path_join=os.path.join product_dir=path_join(SOFTWARE_HOME,'Products') isdir=os.path.isdir exists=os.path.exists DictType=type({}) product_names=os.listdir(product_dir) product_names.sort() global_dict=globals() silly=('__doc__',) ... |
def _delObject(self,id): | def _delObject(self, id, dp=1): | def _delObject(self,id): # Ick! This is necessary to deal with spaces. Waaa! id=strip(id) if id=='acl_users': if hasattr(self, '__allow_groups__') and \ self.__dict__.has_key('__allow_groups__'): delattr(self, '__allow_groups__') |
if r and not user(None, (r,)): | if r and not user(self, (r,)): | def _validateProxy(self, request, roles=None): if roles is None: roles=self._proxy_roles if not roles: return user=u=request.get('AUTHENTICATED_USER',None) if user is not None: user=user.hasRole for r in roles: if r and not user(None, (r,)): user=None break |
def domainSpecValidate(spec): | def domainSpecValidate(self,spec): | def domainSpecValidate(spec): |
if not basic_type(akey): | if not basic_type(type(akey)): | def sort(sequence, sort=(), _=None, mapping=0): """ - sequence is a sequence of objects to be sorted - sort is a sequence of tuples (key,func,direction) that define the sort order: - key is the name of an attribute to sort the objects by - func is the name of a comparison function. This parameter is optional allowe... |
locks = self.wl_lockmapping() locks.clear() | try: locks = self.wl_lockmapping() locks.clear() except: if hasattr(self, '_dav_writelocks'): del self._dav_writelocks if WriteLockInterface.isImplementedBy(self): self._dav_writelocks = PersistentMapping() | def wl_clearLocks(self): # Called by lock management machinery to quickly and effectively # destroy all locks. locks = self.wl_lockmapping() locks.clear() if hasattr(Acquisition.aq_base(self), '__no_valid_write_locks__'): self.__no_valid_write_locks__() |
v = md[name] | try: v = md[name] except KeyError, key: if key==name and self.optional: return '' raise KeyError, key, sys.exc_traceback | def render(self, md): |
$Id: Publish.py,v 1.50 1997/09/09 20:56:12 jim Exp $""" | $Id: Publish.py,v 1.51 1997/09/09 23:00:55 brian Exp $""" | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam |
__version__='$Revision: 1.50 $'[11:-2] | __version__='$Revision: 1.51 $'[11:-2] | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam |
if environ.has_key('HTTP_COOKIE'): parse_cookie(self.environ['HTTP_COOKIE'], form) | def __init__(self, | |
if environ.has_key('HTTP_COOKIE'): d=parse_cookie(self.environ['HTTP_COOKIE']) for k in d.keys(): if not form.has_key(k): form[k]=d[k] | def __init__(self, | |
if Containers(type(object)): | if Containers(type(object)) and Containers(type(v)): | def guarded_getitem(object, index): if type(index) is SliceType: if index.step is not None: v = object[index] else: start = index.start stop = index.stop if start is None: start = 0 if stop is None: v = object[start:] else: v = object[start:stop] # We don't guard slices. return v v = object[index] if Containers(type(ob... |
self.parent.__propsets__=tuple(result) | self.aq_parent.__propsets__=tuple(result) | def delPropertySheet(self, name): result=[] for propset in self.aq_parent.__propsets__: if propset.getId() != name and propset.xml_namespace() != name: result.append(propset) self.parent.__propsets__=tuple(result) |
if seqf: item=[item] | if flags&SEQUENCE: item=[item] | def __init__(self, stdin, environ, response, clean=0, # "static" variables that we want to be local for speed SEQUENCE=1, DEFAULT=2, RECORD=4, RECORDS=8, REC=12, # RECORD|RECORDS EMPTY=16, CONVERTED=32, hasattr=hasattr, getattr=getattr, setattr=setattr, search_type=regex.compile( ':[a-zA-Z][a-zA-Z0-9_]+$' ).search, rfi... |
self._setObject('Help', ProductHelp('Help', '%s Help' % id)) | self._setObject('Help', ProductHelp('Help', id)) | def __init__(self, id, title): self.id=id self.title=title self._setObject('Help', ProductHelp('Help', '%s Help' % id)) |
self._setObject('Help', ProductHelp('Help', '%s Help' % self.id)) | self._setObject('Help', ProductHelp('Help', self.id)) | def getProductHelp(self): """ Returns the ProductHelp object associated with the Product. """ if not hasattr(self, 'Help'): self._setObject('Help', ProductHelp('Help', '%s Help' % self.id)) return self.Help |
for id, v in old.objectValues(): | for id, v in old.objectItems(): | def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, '__import_error__'): ie=productp.__import_error__ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=get... |
class PropertySheet(Persistent, Implicit): | class PropertySheet(Traversable, Persistent, Implicit): | def meta_type(self): try: return self.aq_parent.aq_parent.meta_type except: return '' |
REQUEST.RESPONSE.setHeader('content-type', 'text/html; charset: %s' % self.output_encoding) | REQUEST.RESPONSE.setHeader('content-type', 'text/html; charset=%s' % self.output_encoding) | def index_html(self, REQUEST=None): ''' Getting the formatted text ''' REQUEST.RESPONSE.setHeader('content-type', 'text/html; charset: %s' % self.output_encoding) return self.formatted |
REQUEST.RESPONSE.setHeader('content-type', 'text/plain; charset: %s' % self.input_encoding) | REQUEST.RESPONSE.setHeader('content-type', 'text/plain; charset=%s' % self.input_encoding) | 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 |
def _construct(self, context, id, final): | def _construct(self, context, id): | def _construct(self, context, id, final): """Creates and returns the named folder.""" dispatcher = guarded_getattr(context, 'manage_addProduct')['OFSP'] factory = guarded_getattr(dispatcher, 'manage_addFolder') factory(id) o = context.restrictedTraverse(id) # Commit a subtransaction to assign the new object to # the co... |
logger.warn('ZCache_get() exception', exc_info=sys.exc_info()) | logger.warn('ZCache_get() exception', exc_info=True) | def ZCacheable_get(self, view_name='', keywords=None, mtime_func=None, default=None): '''Retrieves the cached view for the object under the conditions specified by keywords. If the value is not yet cached, returns the default. ''' c = self.ZCacheable_getCache() if c is not None and self.__enabled: ob, view_name = self.... |
logger.warn('ZCache_set() exception', exc_info=sys.exc_info()) | logger.warn('ZCache_set() exception', exc_info=True) | def ZCacheable_set(self, data, view_name='', keywords=None, mtime_func=None): '''Cacheable views should call this method after generating cacheable results. The data argument can be of any Python type. ''' c = self.ZCacheable_getCache() if c is not None and self.__enabled: ob, view_name = self.ZCacheable_getObAndView(v... |
logger.warn('ZCache_invalidate() exception', exc_info=exc) | logger.warn('ZCache_invalidate() exception', exc_info=True) | def ZCacheable_invalidate(self, view_name='', REQUEST=None): '''Called after a cacheable object is edited. Causes all cache entries that apply to the view_name to be removed. Returns a status message. ''' c = self.ZCacheable_getCache() if c is not None: ob, view_name = self.ZCacheable_getObAndView(view_name) try: messa... |
self.__allow_groups__=UserFolder() self._setObject('acl_users', self.__allow_groups__) | uf=UserFolder() self.__allow_groups__=uf self._setObject('acl_users', uf) | def __init__(self): # Initialize users self.__allow_groups__=UserFolder() self._setObject('acl_users', self.__allow_groups__) |
host=socket.gethostbyaddr(addr)[0] | try: host=socket.gethostbyaddr(addr)[0] except: pass | def domainSpecMatch(spec, request): if request.has_key('REMOTE_HOST'): host=request['REMOTE_HOST'] else: host='' if request.has_key('REMOTE_ADDR'): addr=request['REMOTE_ADDR'] else: addr='' if not host and not addr: return 0 if not host: host=socket.gethostbyaddr(addr)[0] if not addr: addr=socket.gethostbyname(host... |
addr=socket.gethostbyname(host) | try: addr=socket.gethostbyname(host) except: pass | def domainSpecMatch(spec, request): if request.has_key('REMOTE_HOST'): host=request['REMOTE_HOST'] else: host='' if request.has_key('REMOTE_ADDR'): addr=request['REMOTE_ADDR'] else: addr='' if not host and not addr: return 0 if not host: host=socket.gethostbyaddr(addr)[0] if not addr: addr=socket.gethostbyname(host... |
if len(vs) > 1: return "%s in (%s)" % (self.column,`vs`[1:-1]) | if len(vs) > 1: vs=join(map(str,vs),', ') return "%s in (%s)" % (self.column,vs) | def render(self, md): |
% (r,src)) | % (r,html_quote(src))) | def manage_test(self, REQUEST): """Test an SQL method.""" # Try to render the query template first so that the rendered # source will be available for the error message in case some # error occurs... try: src=self(REQUEST, src__=1) except: src="Could not render the query template!" result=() t=v=tb=None try: try: sr... |
ZPublisher.Publish.set_default_realm(self.cfg.http_realm) | ZPublisher.Publish.set_default_authentication_realm( self.cfg.http_realm) | def setupPublisher(self): import Globals import ZPublisher.Publish Globals.DevelopmentMode = self.cfg.debug_mode ZPublisher.Publish.set_default_debug_mode(self.cfg.debug_mode) ZPublisher.Publish.set_default_realm(self.cfg.http_realm) |
if not alt: | string='<img src="%s"' % (self.absolute_url()) if alt==None: | def tag(self, height=None, width=None, alt=None, **args): """ Generate an HTML IMG tag for this image, with customization. Arguments to self.tag() can be any valid attributes of an IMG tag. 'src' will always be an absolute pathname, to prevent redundant downloading of images. Defaults are applied intelligently for 'hei... |
string='<img src="%s" alt="%s"' % (self.absolute_url(), alt) if not height: | if alt: string = '%s alt="%s"' % (string, alt) if height==None: | def tag(self, height=None, width=None, alt=None, **args): """ Generate an HTML IMG tag for this image, with customization. Arguments to self.tag() can be any valid attributes of an IMG tag. 'src' will always be an absolute pathname, to prevent redundant downloading of images. Defaults are applied intelligently for 'hei... |
string = "%s height=%s" % (string, height) if not width: | string = '%s height="%s"' % (string, height) if width==None: | def tag(self, height=None, width=None, alt=None, **args): """ Generate an HTML IMG tag for this image, with customization. Arguments to self.tag() can be any valid attributes of an IMG tag. 'src' will always be an absolute pathname, to prevent redundant downloading of images. Defaults are applied intelligently for 'hei... |
string = "%s width=%s" % (string, width) | string = '%s width="%s"' % (string, width) | def tag(self, height=None, width=None, alt=None, **args): """ Generate an HTML IMG tag for this image, with customization. Arguments to self.tag() can be any valid attributes of an IMG tag. 'src' will always be an absolute pathname, to prevent redundant downloading of images. Defaults are applied intelligently for 'hei... |
string = "%s %s=%s" % (string, key, value) | string = '%s %s="%s"' % (string, key, value) | def tag(self, height=None, width=None, alt=None, **args): """ Generate an HTML IMG tag for this image, with customization. Arguments to self.tag() can be any valid attributes of an IMG tag. 'src' will always be an absolute pathname, to prevent redundant downloading of images. Defaults are applied intelligently for 'hei... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.