rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
if server_port!='80': server_url="%s:%s" % (server_url,server_port) | if server_port!='80': server_url=server_url+':'+server_port | def __init__(self,environ,form,stdin): self.environ=environ self.other=form self.stdin=stdin have_env=environ.has_key |
raise ParseError, "%s, for tag %s, on line %s of %s<p>" % ( | raise ParseError, "%s, for tag %s, on line %s of %s" % ( | def parse_error(self, mess, tag, text, start): raise ParseError, "%s, for tag %s, on line %s of %s<p>" % ( mess, self.errQuote(tag), len(text[:start].split('\n')), self.errQuote(self.__name__)) |
def query(self, ignored): | def query(self, *ignored): | def query(self, ignored): |
ServerError'bci.ServerError | ServerError='bci.ServerError | def marshal_tuple(n,l): return join(map(lambda v, n=n: "%s:tuple=%s" % (n,quote(v)),l),'&') |
if code >= 400 && code < 500: return NotFound if code >= 500 && code < 600: return ServerError | if code >= 400 and code < 500: return NotFound if code >= 500 and code < 600: return ServerError | def ErrorTypes(code): if code >= 400 && code < 500: return NotFound if code >= 500 && code < 600: return ServerError return 'HTTP_Error_%s' % code |
jar=Globals.VersionBase[version].jar | jar=Globals.VersionBase[self._version].jar | def __bobo_traverse__(self, REQUEST, name): if name[-9:]=='__draft__': return getattr(self, name) |
'manage_findResult', 'manage_findOpt')), | 'manage_findResult')), | def manage_addFolder(self,id,title='',createPublic=0,createUserF=0, REQUEST=None): """Add a new Folder object with id *id*. If the 'createPublic' and 'createUserF' parameters are set to any true value, an 'index_html' and a 'UserFolder' objects are created respectively in the new folder. """ i=self.folderClass()() i.i... |
def manage_importObject(self,file,REQUEST=None): "Import an object from a file" if find(file,'..') != -1: raise ValueError, 'Bad file name %s' % file f=os.path.join(INSTANCE_HOME,'Import',file) o=self._p_jar.import_file(f) id=o.id if hasattr(id,'im_func'): id=id() self._setObject(id,o) | def manage_importObject(self, file, REQUEST=None): """Import an object from a file""" dirname, file=os.path.split(file) if dirname: raise 'Bad Request', 'Invalid file name %s' % file file=os.path.join(INSTANCE_HOME, 'import', file) if not os.path.exists(file): raise 'Bad Request', 'File does not exist: %s' % file ob=se... | def manage_importObject(self,file,REQUEST=None): "Import an object from a file" if find(file,'..') != -1: raise ValueError, 'Bad file name %s' % file f=os.path.join(INSTANCE_HOME,'Import',file) o=self._p_jar.import_file(f) id=o.id if hasattr(id,'im_func'): id=id() self._setObject(id,o) if REQUEST is not None: return Me... |
_URL_AND_PUNC = r'((http|https|ftp|mailto|file|about)[:/]+?[%s0-9_\@\.\,\?\!\/\:\;\-\ | _ABSOLUTE_URL=r'((http|https|ftp|mailto|file|about)[:/]+?[%s0-9_\@\.\,\?\!\/\:\;\-\ _ABS_AND_RELATIVE_URL=r'([%s0-9_\@\.\,\?\!\/\:\;\-\ | def doc_strong(self, s, expr = re.compile(r'\*\*([%s%s%s\s]+?)\*\*' % (letters, digits, strongem_punc)).search #expr = re.compile(r'\s*\*\*([ \n\r%s0-9.:/;,\'\"\?\-\_\/\=\-\>\<\(\)]+)\*\*(?!\*|-)' % letters).search, # old expr, inconsistent punc, failed to cross newlines. ): |
expr1 = re.compile(_DQUOTEDTEXT + "(:)" + _URL_AND_PUNC + _SPACES).search, expr2 = re.compile(_DQUOTEDTEXT + r'(\,\s+)' + _URL_AND_PUNC + _SPACES).search): | expr1 = re.compile(_DQUOTEDTEXT + "(:)" + _ABS_AND_RELATIVE_URL + _SPACES).search, expr2 = re.compile(_DQUOTEDTEXT + r'(\,\s+)' + _ABSOLUTE_URL + _SPACES).search): | def doc_href(self, s, expr1 = re.compile(_DQUOTEDTEXT + "(:)" + _URL_AND_PUNC + _SPACES).search, expr2 = re.compile(_DQUOTEDTEXT + r'(\,\s+)' + _URL_AND_PUNC + _SPACES).search): punctuation = re.compile(r"[\,\.\?\!\;]+").match r=expr1(s) or expr2(s) |
transaction().abort() | transaction.abort() | def install_product(app, product_dir, product_name, meta_types, folder_permissions, raise_exc=0, log_exc=1): path_join=os.path.join isdir=os.path.isdir exists=os.path.exists global_dict=globals() silly=('__doc__',) if 1: # Preserve indentation for diff :-) package_dir=path_join(product_dir, product_name) __traceback... |
save_empty_tuple(object) | self.save_empty_tuple(object) | def save(self, object, pers_save = 0): memo = self.memo |
save_tuple(object) | self.save_tuple(object) | def save(self, object, pers_save = 0): memo = self.memo |
def load_binfloat(self): self.append(newstruct.unpack('>d', self.read(8))[0]) dispatch[BINFLOAT] = load_binfloat | def load_float(self): self.append(string.atof(self.readline()[:-1])) | |
"Python 'cgi' module':http://www.python.org/doc/current/lib/Functions_in_cgi_module.html | "Python 'cgi' module":http://www.python.org/doc/current/lib/Functions_in_cgi_module.html | def html_quote(s): """ Convert characters that have special meaning in HTML to HTML character entities. See Also "Python 'cgi' module':http://www.python.org/doc/current/lib/Functions_in_cgi_module.html 'escape' function. """ |
cols=max(40,int(dtpref_cols)+dc) | cols=max(35,int(dtpref_cols)+dc) | def _er(self,data,title,SUBMIT,dtpref_cols,dtpref_rows,REQUEST): dr,dc = self._size_changes[SUBMIT] rows=max(1,int(dtpref_rows)+dr) cols=max(40,int(dtpref_cols)+dc) e=(DateTime('GMT') + 365).rfc822() resp=REQUEST['RESPONSE'] resp.setCookie('dtpref_rows',str(rows),path='/',expires=e) resp.setCookie('dtpref_cols',str(co... |
def manage_edit(self,data,title,SUBMIT='Change',dtpref_cols='50', | def manage_edit(self,data,title,SUBMIT='Change',dtpref_cols='70', | def manage_edit(self,data,title,SUBMIT='Change',dtpref_cols='50', dtpref_rows='20',REQUEST=None): """ Replaces a Documents contents with Data, Title with Title. |
return 0 | return 1 | def __nonzero__(self): return 0 |
if isinstance(v, Exception): if isinstance(v, TALESError): raise v, None, v.takeTraceback() raise v | def evaluate(self, expression, isinstance=isinstance, StringType=StringType): if isinstance(expression, StringType): expression = self._engine.compile(expression) try: v = expression(self) if isinstance(v, Exception): if isinstance(v, TALESError): raise v, None, v.takeTraceback() raise v except TALESError, err: err.set... | |
if severity < 0: return | def stupid_log_write(subsystem, severity, summary, detail, error): if severity < 0: return global _stupid_dest if _stupid_dest is None: import os if os.environ.has_key('STUPID_LOG_FILE'): f=os.environ['STUPID_LOG_FILE'] if f: _stupid_dest=open(f,'a') else: import sys _stupid_dest=sys.stderr else: _stupid_dest=_no_stu... | |
if hasattr(self.obj, self._p): delattr(self.obj, self._p) | if hasattr(obj, self._p): delattr(obj, self._p) | def setRoles(self, roles): |
setattr(self.obj, self._p, roles) | setattr(obj, self._p, roles) | def setRoles(self, roles): |
if name=='': attr=self.obj else: attr=getattr(self.obj, name) | if name=='': attr=obj else: attr=getattr(obj, name) | def setRoles(self, roles): |
__basicnew__=__call__ | def __basicnew__(self): return Inst(self, None) | def __call__(self, *args): return Inst(self, args) |
from pickle import INST, GLOBAL, MARK, BUILD, OBJ | from pickle import INST, GLOBAL, MARK, BUILD, OBJ, REDUCE | def __setstate__(self, state): self._state=state |
args=object._args write(MARK) | def save_inst(self, object): d = id(object) cls = object.__class__ | |
if args: for arg in args: save(arg) | save(object._args) | def save_inst(self, object): d = id(object) cls = object.__class__ |
write(OBJ + self.put(len(memo))) | write(REDUCE + self.put(memo_len)) | def save_inst(self, object): d = id(object) cls = object.__class__ |
t,v,tb=sys.exc_type, sys.exc_value, sys.exc_traceback | t,v=sys.exc_type, sys.exc_value | def query(self,REQUEST,RESPONSE): |
d['attr']=careful_getattr | def obsolete_attr(self, inst, name, md): return careful_getattr(md, inst, name) d['attr']=obsolete_attr | def test(self, *args): l=len(args) for i in range(1, l, 2): if args[i-1]: return args[i] if l%2: return args[-1] |
host=request.get('REMOTE_HOST', '') addr=request.get('REMOTE_ADDR', '') if host or addr: if not host: try: host=socket.gethostbyaddr(addr)[0] request.set('REMOTE_HOST', host) except: pass if not addr: try: addr=socket.gethostbyname(host) request.set('REMOTE_ADDR', addr) except: pass | def validate(self,request,auth='',roles=None): | |
current object\'s day, in the object\'s timezone context | current object's day, in the object's timezone context Permission -- Always available | def earliestTime(): """ |
current object\'s day, in the object\'s timezone context | current object's day, in the object's timezone context Permission -- Always available | def latestTime(): """ |
object\'s timezone) is a leap year | object's timezone) is a leap year Permission -- Always available | def isLeapYear(): """ |
""" | Permission -- Always available """ | def year(): """ |
""" | Permission -- Always available """ | def aDay(): """ |
""" | Permission -- Always available """ | def pDay(): """ |
""" | Permission -- Always available """ | def Day_(): """ |
""" | Permission -- Always available """ | def dow(): """ |
"""Return the object in the format used in the HTML4.0 specification, one of the standard forms in ISO8601. See http://www.w3.org/TR/NOTE-datetime | """ Return the object in the format used in the HTML4.0 specification, one of the standard forms in ISO8601. See "HTML 4.0 Specification":http://www.w3.org/TR/NOTE-datetime | def HTML4(): """Return the object in the format used in the HTML4.0 specification, one of the standard forms in ISO8601. See http://www.w3.org/TR/NOTE-datetime |
T, Z are literal characters. The time is in UTC. """ | T, Z are literal characters. The time is in UTC. Permission -- Always available """ | def HTML4(): """Return the object in the format used in the HTML4.0 specification, one of the standard forms in ISO8601. See http://www.w3.org/TR/NOTE-datetime |
n=lower(name) if n != name: aliases.append((n, SQLAlias(name))) n=upper(name) if n != name: aliases.append((n, SQLAlias(name))) | schema[lower(name)]=i schema(upper(name)]=i | 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 | |
if REQUEST: return self.manage_main(self,REQUEST) | if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main') | def add(self, id, title='', smtp_host=None, smtp_port=25, REQUEST=None): ' add a MailHost into the system ' id=str(id) title=str(title) if smtp_host is not None: smtp_host=str(smtp_host) if type(smtp_port) is not type(1): smtp_port=string.atoi(smtp_port) i=MailHost() #create new mail host i.id=id ... |
if file: | if file and (type(file) is type('') or hasattr(file, 'content-type')): | def manage_edit(self, meta_type='', icon='', file='', REQUEST=None): """Set basic item properties. """ if meta_type: self.setClassAttr('meta_type', meta_type) |
return "text/" + (html_re.search(s) >= 0 and 'html' or 'plain') | if (lower(strip(s)[:6]) == '<html>' or find(s, '</') > 0): return 'text/html' return 'text/plain' | def text_type(s): return "text/" + (html_re.search(s) >= 0 and 'html' or 'plain') |
ex=fn[(rfind(fn,'.')+1):] if self._extmap.has_key(ex): ct=self._extmap[ex] else: ct=self._extmap[''] | ex=lower(fn[(rfind(fn,'.')+1):]) if self._extmap.has_key(ex): ct=self._extmap[ex] else: ct=self._extmap[''] | def __init__(self,*args): c=len(args) if c==1: name,val=None,args[0] elif c==2: name,val=args[0],args[1] else: raise ValueError, 'Invalid arguments' |
else: v=open(v) | else: v=open(v, 'rb') | def main(): import getopt from string import split user=None try: optlist, args = getopt.getopt(sys.argv[1:],'u:') url=args[0] u =filter(lambda o: o[0]=='-u', optlist) if u: [user, pw] = split(u[0][1],':') kw={} for arg in args[1:]: [name,v]=split(arg,'=') if name[-5:]==':file': name=name[:-5] if v=='-': v=sys.stdin... |
f = self.quick_dispatch[t] | f = self.dispatch[t] | def save(self, object, pers_save = 0): memo = self.memo |
if memo.has_key(d): self.write(self.get(memo[d])) | pid = self.inst_persistent_id(object) if pid is not None: self.save_pers(pid) | def save(self, object, pers_save = 0): memo = self.memo |
f = self.dispatch[t] | reduce = dispatch_table[t] | def save(self, object, pers_save = 0): memo = self.memo |
pid = self.inst_persistent_id(object) if pid is not None: self.save_pers(pid) return | def save(self, object, pers_save = 0): memo = self.memo | |
reduce = dispatch_table[t] except KeyError: try: reduce = object.__reduce__ except AttributeError: raise PicklingError, \ "can't pickle %s objects" % `t.__name__` else: tup = reduce() | reduce = object.__reduce__ except AttributeError: raise PicklingError, \ "can't pickle %s objects" % `t.__name__` | def save(self, object, pers_save = 0): memo = self.memo |
tup = reduce(object) if (type(tup) is not TupleType): raise PicklingError, "Value returned by %s must be a " \ "tuple" % reduce l = len(tup) | tup = reduce() else: tup = reduce(object) if (type(tup) is not TupleType): raise PicklingError, "Value returned by %s must be a " \ "tuple" % reduce l = len(tup) | def save(self, object, pers_save = 0): memo = self.memo |
quick_dispatch = {} | def save_reduce(self, callable, arg_tup, state = None): write = self.write save = self.save | |
quick_dispatch[NoneType] = save_none | dispatch[NoneType] = save_none | def save_none(self, object): self.write(NONE) |
quick_dispatch[IntType] = save_int | dispatch[IntType] = save_int | def save_int(self, object): if (self.bin): i = mdumps(object)[1:] if (i[-2:] == '\000\000'): if (i[-3] == '\000'): self.write(BININT1 + i[:-3]) return |
quick_dispatch[FloatType] = save_float | dispatch[FloatType] = save_float | def save_float(self, object): self.write(FLOAT + `object` + '\n') |
d = id(object) | def save_tuple(self, object): d = id(object) | |
write(POP * len(object)) write(self.get(memo[d])) | write(POP * len(object) + self.get(memo[d])) | def save_tuple(self, object): d = id(object) |
using_appends = (self.bin and (len(object) > 1)) if (using_appends): write(MARK + LIST + MARK) | if (self.bin): write(EMPTY_LIST) | def save_list(self, object): d = id(object) |
using_setitems = (self.bin and (len(object) > 1)) if (using_setitems): write(MARK + DICT + MARK) | if (self.bin): write(EMPTY_DICT) | def save_dict(self, object): d = id(object) |
if name != '__main__' and \ hasattr(module, clsname) and \ getattr(module, clsname) is cls: | if hasattr(module, clsname) and \ getattr(module, clsname) is cls: | def whichmodule(cls, clsname): """Figure out the module in which a class occurs. Search sys.modules for the module. Cache in classmap. Return a module name. If the class cannot be found, return __main__. """ if classmap.has_key(cls): return classmap[cls] import sys for name, module in sys.modules.items(): if name != ... |
len = mloads('i' + self.read(1)) | len = mloads('i' + self.read(1) + '\000\000\000') | def load_short_binstring(self): len = mloads('i' + self.read(1)) self.append(self.read(len)) |
(8, Dummy('g', date(2034,2,5))), (9, Dummy('h', datetime(2034,2,5,15,17,5))), | (8, Dummy('g', date(2034,2,5))), (9, Dummy('h', datetime(2034,2,5,15,20,5))), | def setUp(self): self._values = ( (0, Dummy('a', None)), # None (1, Dummy('b', DateTime(0))), # 1055335680 (2, Dummy('c', DateTime('2002-05-08 15:16:17'))), # 1072667236 (3, Dummy('d', DateTime('2032-05-08 15:16:17'))), # 1088737636 (4, Dummy('e', DateTime('2062-05-08 15:1... |
if bobobase is None: return 1 | safe=bobobase.has_key('Application') | 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 if bobobase is None: return 1 try: f=open(path_join(package_dir,'%s.lic' % product_name), 'rb') except: try: product=getattr(__im... |
get_transaction().commit() | if safe: get_transaction().commit() | 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 if bobobase is None: return 1 try: f=open(path_join(package_dir,'%s.lic' % product_name), 'rb') except: try: product=getattr(__im... |
buf = ("------\n" "%s %s %s %s\n%s" % (log_time(), severity_string(severity), subsystem, summary, detail)) else: buf = ("------\n" "%s %s %s %s" % (log_time(), severity_string(severity), subsystem, summary)) print >> _log_dest, buf | buf.append(str(detail)) | def log(self, subsystem, severity, summary, detail, error): if _log_dest is None or severity < _log_level: return |
print >> _log_dest, ''.join(lines) except: print >> _log_dest, "%s: %s" % error[:2] | buf.append(''.join(lines)) except '': buf.append("%s: %s" % error[:2]) buf.append("") _log_dest.write("\n".join(buf)) | def log(self, subsystem, severity, summary, detail, error): if _log_dest is None or severity < _log_level: return |
DocBookBook=DocBookClass.DocBookBook | DocBookBook=DocBookClass.DocBookBook() | def HTML(src, level=0, type=type, StringType=type('')): if type(src) is StringType: return ClassicHTML(src, level) return HTMLNG(src, level) |
copy=self.__class__(self.id, self.title, bases) | copy=self.__class__(self.id, self.title, bases, hasattr(self._zclass_, '_p_deactivate') ) | def _setBasesHoldOnToYourButts(self, bases): # Eeeek copy=self.__class__(self.id, self.title, bases) |
URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, | URLmatch=regex.compile('URL[0-9]+$').match, BASEmatch=regex.compile('BASE[0-9]+$').match, | def __getitem__(self,key, default=_marker, # Any special internal marker will do URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ): """Get a variable value |
n=ord(key[3])-ord('0') | n=atoi(key[3:]) | def __getitem__(self,key, default=_marker, # Any special internal marker will do URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ): """Get a variable value |
n=ord(key[4])-ord('0') | n=atoi(key[4:]) | def __getitem__(self,key, default=_marker, # Any special internal marker will do URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ): """Get a variable value |
if self.environ.get('SCRIPT_NAME',''): n=n-1 | n=n-1 | def __getitem__(self,key, default=_marker, # Any special internal marker will do URLmatch=regex.compile('URL[0-9]$').match, BASEmatch=regex.compile('BASE[0-9]$').match, ): """Get a variable value |
lasturl = "" for n in "0123456789": key = "URL%s"%n try: if lasturl != self[key]: keys[key] = 1 lasturl = self[key] else: break except KeyError: pass for n in "0123456789": key = "BASE%s"%n try: if lasturl != self[key]: keys[key] = 1 lasturl = self[key] else: break except KeyError: pass return keys.keys() | keys=keys.keys() keys.sort() return keys | def keys(self): keys = {} keys.update(self.common) |
except AttributeError, KeyError: akey = None | except (AttributeError, KeyError): akey = None | 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... |
for i in query(key,self).keys(): rr.insert(i) | for i,score in query(key,self).items(): if score: rr.insert(i) | def _apply_index(self, request, cid='', ListType=[]): |
d=lp=len(p) | d=lp=9999 | def near(self, x): result = {} |
def get_operands(q, i, index, ListType=type([])): | def get_operands(q, i, index, ListType=type([]), StringType=type('')): | def get_operands(q, i, index, ListType=type([])): '''Evaluate and return the left and right operands for an operator''' try: left = q[i - 1] right = q[i + 1] except IndexError: raise QueryError, "Malformed query" if (type(left) is ListType): left = evaluate(left, index) else: left=index[left] if (type(right) is List... |
if (type(left) is ListType): left = evaluate(left, index) else: left=index[left] if (type(right) is ListType): right = evaluate(right, index) else: right = index[right] | t=type(left) if t is ListType: left = evaluate(left, index) elif t is StringType: left=index[left] t=type(right) if t is ListType: right = evaluate(right, index) elif t is StringType: right=index[right] | def get_operands(q, i, index, ListType=type([])): '''Evaluate and return the left and right operands for an operator''' try: left = q[i - 1] right = q[i + 1] except IndexError: raise QueryError, "Malformed query" if (type(left) is ListType): left = evaluate(left, index) else: left=index[left] if (type(right) is List... |
'ours', 'ourselves', 'out', 'over', 'own', 'part', 'per', 'perhaps', | 'ours', 'ourselves', 'out', 'over', 'own', 'per', 'perhaps', | def evaluate(q, index,ListType=type([])): '''Evaluate a parsed query''' if (len(q) == 1): if (type(q[0]) is ListType): return evaluate(q[0], index) return index[q[0]] i = 0 while (i < len(q)): if q[i] is AndNot: left, right = get_operands(q, i, index) val = left.and_not(right) q[(i - 1) : (i + 2)] = [ val ] else: i ... |
get_size=getSize | def getSize(self): """Get the size of a file or image. | |
self.base="%s/%s" % (server_url,b) | if b: self.base="%s/%s" % (server_url,b) else: self.base=server_url | def __init__(self, stdin, environ, response, clean=0): # Avoid the overhead of scrubbing the environment in the # case of request cloning for traversal purposes. If the # clean flag is set, we know we can use the passed in # environ dict directly. |
self=self.__of__(container) | if vocab_id is not None and container is None: raise CatalogError, ("You cannot specify a vocab_id without " "also specifying a container.") if container is not None: self=self.__of__(container) | def __init__(self, id, title='', vocab_id=None, container=None): self=self.__of__(container) self.id=id self.title=title self.threshold = 10000 self._v_total = 0 |
pid=product.id | def _manage_add_product_permission( self, product, permission, methods=(), default=('Manager',) ): | |
if not d.has_key('product'): d['product']=pid if d['product'] != pid: raise 'Type Exists', ( 'The permission <em>%s</em> is already defined.' % permission) d['methods']=methods d['default']=default return d={'name': permission, 'methods': methods, 'default': default} if permission: d['permission']=permission self._se... | raise 'Type Exists', ( 'The permission <em>%s</em> is already defined.' % permission) d={'name': permission, 'methods': methods, 'permission': permission, 'default': default, 'product': product.id} self._setProductRegistryData('permissions', permissions + (d,)) | def _manage_add_product_permission( self, product, permission, methods=(), default=('Manager',) ): |
def field2text(v, nl=re.compile('\r\n\|\n\r').search): | def field2text(v, nl=re.compile('\r\n|\n\r').search): | def field2text(v, nl=re.compile('\r\n\|\n\r').search): if hasattr(v,'read'): v=v.read() else: v=str(v) mo = nl(v) if mo is None: return v l = mo.start(0) r=[] s=0 while l >= s: r.append(v[s:l]) s=l+2 mo=nl(v,s) if mo is None: l=-1 else: l=mo.start(0) r.append(v[s:]) return join(r,'\n') |
return '\n <n:lockentry>\n' \ ' <d:lockscope><d:exclusive/></d:lockscope>\n' \ ' <d:locktype><d:write/></d:locktype>\n' \ ' </n:lockentry>\n ' | vself = self.v_self() out = '\n' if WriteLockInterface.isImplementedBy(vself): out += (' <n:lockentry>\n' ' <d:lockscope><d:exclusive/></d:lockscope>\n' ' <d:locktype><d:write/></d:locktype>\n' ' </n:lockentry>\n ') return out | def dav__supportedlock(self): return '\n <n:lockentry>\n' \ ' <d:lockscope><d:exclusive/></d:lockscope>\n' \ ' <d:locktype><d:write/></d:locktype>\n' \ ' </n:lockentry>\n ' |
path=REQUEST['SCRIPT_NAME'], | path=(REQUEST['BASEPATH1'] or '/'), | def enter(self, REQUEST, RESPONSE): """Begin working in a version""" RESPONSE.setCookie( Globals.VersionNameName, self.cookie, path=REQUEST['SCRIPT_NAME'], ) if (REQUEST.has_key('SERVER_SOFTWARE') and REQUEST['SERVER_SOFTWARE'][:9]=='Microsoft'): # IIS doesn't handle redirect headers correctly return MessageDialog( act... |
func_defaults = ComputedAttribute(lambda self: self._v_func_defaults) func_code = ComputedAttribute(lambda self: self._v_func_code) | func_defaults = ComputedAttribute(lambda self: self.getFuncDefaults()) func_code = ComputedAttribute(lambda self: self.getFuncCode()) | def manage_addExternalMethod(self, id, title, module, function, REQUEST=None): """Add an external method to a folder Un addition to the standard object-creation arguments, 'id' and title, the following arguments are defined: function -- The name of the python function. This can be a an ordinary Python function, or a ... |
def reloadIfChanged(self): ts=os.stat(self.filepath())[stat.ST_MTIME] if (not hasattr(self, '_v_last_read') or (ts != self._v_last_read)): self._v_f=self.getFunction(1) self._v_last_read=ts if DevelopmentMode: def getFuncDefaults(self): self.reloadIfChanged() if not hasattr(self, '_v_func_defaults'): self._v_f = se... | def getFunction(self, reload=0): | |
ts=os.stat(self.filepath())[stat.ST_MTIME] if (not hasattr(self, '_v_last_read') or (ts != self._v_last_read)): self._v_f=self.getFunction(1) self._v_last_read=ts | self.reloadIfChanged() | def __call__(self, *args, **kw): """Call an ExternalMethod |
def version_txt(self): | def version_txt(): | def version_txt(self): try: return open(os.path.join(SOFTWARE_HOME,'version.txt')).read() except: return '(unreleased version)' return self._v_version_txt |
CreateFactory=1) | CreateAFactory=1) | def __class_init__(self): pass |
if CreateFactory and meta_type: | if CreateAFactory and meta_type: | def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateAFactory=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]) else: base=find_class(self, b) bases.append(base) Z=ZClass(id,title,bases) if meta_typ... |
$Id: Publish.py,v 1.17 1996/08/30 17:08:53 jfulton Exp $""" | $Id: Publish.py,v 1.18 1996/08/30 23:40:40 jfulton Exp $""" | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam |
__version__='$Revision: 1.17 $'[11:-2] | __version__='$Revision: 1.18 $'[11:-2] | def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam |
result.write('<d:response>\n<d:href>%s</d:href>\n' % url) | result.write('<d:response>\n<d:href>%s</d:href>\n' % quote(url)) | def apply(self, obj, url=None, depth=0, result=None, top=1): if result is None: result=StringIO() depth=self.depth url=urlfix(self.request['URL'], 'PROPFIND') url=urlbase(url) result.write('<?xml version="1.0" encoding="utf-8"?>\n' \ '<d:multistatus xmlns:d="DAV:">\n') iscol=hasattr(obj, '__dav_collection__') if iscol ... |
'<d:href>%s</d:href>\n' % url) | '<d:href>%s</d:href>\n' % quote(url)) | def apply(self, obj): url=urlfix(self.request['URL'], 'PROPPATCH') if hasattr(obj, '__dav_collection__'): url=url+'/' result=StringIO() errors=[] result.write('<?xml version="1.0" encoding="utf-8"?>\n' \ '<d:multistatus xmlns:d="DAV:">\n' \ '<d:response>\n' \ '<d:href>%s</d:href>\n' % url) propsets=obj.propertysheets f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.