rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.myReq = weblib.Request(environ={"PATH_INFO":"dummy.py"}) | self.myReq = weblib.Request(method="GET",query={}, form={}, cookie={},content={}) | def setUp(self): # auth requires a PATH_INFO variable.. otherwise, # it doesn't know where to redirect the form. # # @TODO: is PATH_INFO correct? I think standard might be SCRIPT_NAME # self.myReq = weblib.Request(environ={"PATH_INFO":"dummy.py"}) self.myRes = weblib.Response() self.sess = weblib.Sess(weblib.SessPool.I... |
req = weblib.Request(environ = {"PATH_INFO":"sadfaf"}, querystring="auth_check_flag=1", | req = weblib.Request(querystring="auth_check_flag=1", | def check_login_invalid(self): """ Invalid login should show error, display form, and raise SystemExit. """ req = weblib.Request(environ = {"PATH_INFO":"sadfaf"}, querystring="auth_check_flag=1", form={"auth_username":"wrong_username", "auth_password":"wrong_password"}) sess = weblib.Sess(weblib.SessPool.InMemorySessPo... |
req = weblib.Request(environ = {"PATH_INFO":"sadfaf"}, querystring="auth_check_flag=1", | req = weblib.Request(query={"auth_check_flag":"1"}, | def check_login_valid(self): """ Valid login should have no side effects. """ req = weblib.Request(environ = {"PATH_INFO":"sadfaf"}, querystring="auth_check_flag=1", form={"auth_username":"username", "auth_password":"password"}) sess = weblib.Sess(weblib.SessPool.InMemorySessPool(), req, self.myRes) try: auth = Auth(se... |
self.model["includeFilled"]=self.input.get("includeFilled",0) | self.model["includeFilled"]=int(self.input.get("includeFilled",0)) | def list_sale(self): self.model = self.input self.consult("mdl_sale") self.model["includeFilled"]=self.input.get("includeFilled",0) self.model["isSearch"]=0 zebra.show("lst_sale", self.model) |
self._data["country"]="US" | self._data["countryCD"]="US" | def _new(self): self.__super._new(self) self._data["userID"]=0 self._data["fname"]="" self._data["lname"]="" self._data["email"]="" self._data["address1"]="" self._data["address2"]="" self._data["address3"]="" self._data["city"]="" self._data["stateCD"]="" self._data["postal"]="" self._data["country"]="US" self._data["... |
def execute(self, script): | def _execute(self, script): | def execute(self, script): """This is so you can restrict execution in a subclass if you like.""" exec(script, self.globals, self.locals) |
"name='" + name + "' and sid='" + sid + "'" | "name='" + name + "', sid='" + sid + "'" | def putSess(self, name, sid, frozensess): import string |
self.model["card"] = zdc.ObjectView(card) | self.model["card"] = [zdc.ObjectView(card)] | def act_confirm(self): import zebra, zdc #@TODO: make a .fromDict or .consult for zdc.RecordObjects # for now, we'll assume this is okay, since the classes have # already validated everything in here: bill = zikebase.Contact(); bill._data = self.billData ship = zikebase.Contact(); ship._data = self.shipData card = zike... |
return os.environ["HOME"] + os.sep + ".cvspass" | return os.environ.get("HOME","") + os.sep + ".cvspass" | def cvspass_path(): return os.environ["HOME"] + os.sep + ".cvspass" |
"rows should be a sequence of (real value, displayed value, isSelected)" | def selectBox(name, rows, blank=None, extra=''): """rows should be a sequence of (real value, displayed value, isSelected)""" res = '<select name="%s" %s>\n' % (name, extra) if blank is not None: res = res + '<OPTION value="%s"> </OPTION>\n' % blank for row in rows: res = res + '<OPTION value="%s"' % row[0] if row... | |
for ch in s: if _entitymap.has_key(ch): res = res + "&" + _entitymap[ch] + ";" else: res = res + ch | if s is not None: for ch in s: if _entitymap.has_key(ch): res = res + "&" + _entitymap[ch] + ";" else: res = res + ch | def htmlEncode(s): res = "" for ch in s: if _entitymap.has_key(ch): res = res + "&" + _entitymap[ch] + ";" else: res = res + ch return res |
mdl = model["%(series)s"][_] | mdl = scope["%(series)s"][_] | def handle_for(self, model, attrs): res = zebra.trim( """ _ = 0 _max_ = len(scope["%(series)s"]) scope_stack.append(copy.copy(scope)) for _ in range(_max_): # can't do .update if it's a UserDict: mdl = model["%(series)s"][_] for item in mdl.keys(): scope[item]=mdl[item] """ % attrs) res = res + zebra.indent(self.walk(m... |
msg += "QUERYSTRING: %s\n" % self.request.querystring | msg += "QUERYSTRING: %s\n" % self.request.query.string | def sendError(self): SITE_MAIL = self.locals["SITE_MAIL"] SITE_NAME = self.locals["SITE_NAME"] assert SITE_MAIL is not None, "must define SITE_MAIL first!" hr = "-" * 50 + "\n" msg = weblib.trim( """ To: %s From: weblib.cgi <%s> Subject: uncaught exception in %s |
print '<li>querystring: %s</li>' % self.request.querystring | print '<li>querystring: %s</li>' % self.request.query.string | def printException(self): print "<b>uncaught exception while running %s</b><br>" \ % self.getScriptName() print '<pre class="traceback">' \ + weblib.htmlEncode(self.error) + "</pre>" print "<b>script input:</b>" print '<ul>' print '<li>form: %s</li>' % self.request.form print '<li>querystring: %s</li>' % self.request.q... |
for pair in string.split(what, "&"): | for pair in string.split(what, splitter): | def parse(self, what, splitter="&", decode=0): res = {} for pair in string.split(what, "&"): if decode: pair = weblib.urlDecode(pair) l = string.split(pair, "=", 1) k = l[0] if len(l) > 1: v = l[1] else: v = '' if res.has_key(k): res[k] = self._tupleMerge(res[k], v) else: res[k]=v return res |
return self.cur.row_id | return self.cur._insert_id | def _getInsertID(self): return self.cur.row_id |
def __init__(self, key=None, **kw): | def __init__(self, dbc, key=None, **kw): | def __init__(self, key=None, **kw): """Don't override this. override _new() or _fetch() instead.""" self._isLocked = 0 self._locks = self.__class__.locks[:] if key is None: if kw: apply(self.fetch, (), kw) else: self._new() else: self._fetch(key) self._lock() |
self._isLocked = 0 | def __init__(self, key=None, **kw): """Don't override this. override _new() or _fetch() instead.""" self._isLocked = 0 self._locks = self.__class__.locks[:] if key is None: if kw: apply(self.fetch, (), kw) else: self._new() else: self._fetch(key) self._lock() | |
if self.__class__.__dict__.has_key('set_' + name): self.__class__.__dict__['set_' + name](self, value) | meth = self._findmember('set_' + name) if meth is not None: meth(self, value) | def __setattr__(self, name, value): |
elif self.__dict__._isLocked: | elif self._isLocked: | def __setattr__(self, name, value): |
if self.__class__.__dict__.has_key('get_' + name): return self.__class__.__dict__['get_' + name](self) | meth = self._findmember('get_' + name) if meth is not None: return meth(self) | def __getattr__(self, name): |
vals += "'" + val + "'," | vals += "'" + str(val) + "'," | def _insert(self, table, **row): |
def __init__(self, ds, input=None): | def __init__(self, ds, input): | def __init__(self, ds, input=None): self.ds = ds self.__super.__init__(self, input) |
self.consult(zdc.ObjectView(self.userClass())) zebra.show("frm_signup", self.model) | self.consult(zdc.ObjectView(self.userClass(self.ds))) print >> self.out, zebra.fetch(self.tplDir + "/frm_signup", self.model) | def act_signup(self): if self.input.get("action")!="save": self.consult(zdc.ObjectView(self.userClass())) zebra.show("frm_signup", self.model) |
zebra.show("frm_requestpass") | print >> self.out, zebra.fetch(self.tplDir + "/frm_requestpass") | def act_requestpass(self): zebra.show("frm_requestpass") |
import zdc sale.tsSold = zdc.TIMESTAMP | def act_checkout(self): sale = zikeshop.Sale() shop = zikeshop.Store() | |
clean = [line[:-1] for line in open(cvspass_path(), "r").readlines() if not line.startswith(cvspass_key(username, server, cvsroot))] | clean = [] try: file = open(cvspass_path(), "r") clean = [line[:-1] for line in file.readlines() if not line.startswith(cvspass_key(username,server,cvsroot))] except IOError, e: print "couldn't read .cvspass (probably ok):\n ", e | def save_password(username, server, cvsroot, password): """ Emulate the -d:pserver:... login function. """ # @TODO: allow "logout" # remove any old passwords for this key: clean = [line[:-1] for line in open(cvspass_path(), "r").readlines() if not line.startswith(cvspass_key(username, server, cvsroot))] # now save it... |
file.write(line) | print >> file, line | def save_password(username, server, cvsroot, password): """ Emulate the -d:pserver:... login function. """ # @TODO: allow "logout" # remove any old passwords for this key: clean = [line[:-1] for line in open(cvspass_path(), "r").readlines() if not line.startswith(cvspass_key(username, server, cvsroot))] # now save it... |
res = line.split(" ")[1] res = res[1:-1] res = scramble(res)[1:] | res = line.split(" ",1)[1] res = res[1:-1] res = scramble(res)[1:] | def load_password(username, server, cvsroot): """ We read passwords out of the .cvspass file, just like cvs -d:pserver: does. Note that this file could be considered fairly insecure... However, it releives the need for an interactive password prompt, which worked okay with msvcrt.getch(), but not on linux. """ # @TODO... |
def act_get_shipping(self, refresh=1): import zebra, zdc, zikebase if refresh: self.consult(zdc.ObjectView(zikebase.Contact())) | def act_get_shipping(self): import zebra self.consult(self.shipData) | def act_get_shipping(self, refresh=1): import zebra, zdc, zikebase if refresh: self.consult(zdc.ObjectView(zikebase.Contact())) zebra.show('frm_shipping', self.model) |
self.data['bill_addressID']=ed.object.ID | self.data['shipToBilling'] = int(self.input.get('shipToBilling',0)) | def act_add_address(self): #@TODO: this is a lot like userapp.. import zikebase zikebase.load("Contact") context = self.input.get('context','bill') errs = [] required=[ ('fname','first name'), ('lname','last name'), ('email','email'), ('address1','address'), ('city','city'), ('postal','ZIP/postal code')] |
self.data['ship_addressID']=self.data['bill_addressID'] | self.shipData = self.billData.copy() | def act_add_address(self): #@TODO: this is a lot like userapp.. import zikebase zikebase.load("Contact") context = self.input.get('context','bill') errs = [] required=[ ('fname','first name'), ('lname','last name'), ('email','email'), ('address1','address'), ('city','city'), ('postal','ZIP/postal code')] |
self.data['ship_addressID']=ed.object.ID | def act_add_address(self): #@TODO: this is a lot like userapp.. import zikebase zikebase.load("Contact") context = self.input.get('context','bill') errs = [] required=[ ('fname','first name'), ('lname','last name'), ('email','email'), ('address1','address'), ('city','city'), ('postal','ZIP/postal code')] | |
ed = zikebase.ObjectEditor(zikeshop.Card) ed.do("save") self.data['cardID'] = ed.object.ID | ed = zikebase.ObjectEditor(zikeshop.Card, input=self.input) ed.do("update") | def act_add_card(self): # Add a new card to the database: import zikebase, zebra try: ed = zikebase.ObjectEditor(zikeshop.Card) ed.do("save") # use the card for the transaction: self.data['cardID'] = ed.object.ID #@TODO: ought to check expiration date... (prolly in Card.py) #@TODO: resolve - cards with secondary billin... |
self.redirect(action="checkout") except ValueError, errs: self.complain(errs) zebra.show("frm_card", self.model) def act_set_card(self): self.data['cardID'] = int(self.input['cardID']) self.redirect(action = "checkout") | self.next = "checkout" except ValueError, valErrs: errs.extend(valErrs[0]) if ed.object.isExpired(): errs.append("Expired card.") if errs: self.model["errors"] = map(lambda e: {"error":e}, errs) self.next = "get_card" else: self.redirect(action = "checkout") | def act_add_card(self): # Add a new card to the database: import zikebase, zebra try: ed = zikebase.ObjectEditor(zikeshop.Card) ed.do("save") # use the card for the transaction: self.data['cardID'] = ed.object.ID #@TODO: ought to check expiration date... (prolly in Card.py) #@TODO: resolve - cards with secondary billin... |
sale.cardID = self.data.get('cardID', 0) sale.bill_addressID = self.data.get('bill_addressID', 0) sale.ship_addressID = self.data.get('ship_addressID', 0) | bill = zikebase.Contact(); bill._data = self.billData; bill.userID = 0; bill.save() ship = zikebase.Contact(); ship._data = self.shipData; ship.userID = 0; ship.save() card = zikeshop.Card(); card._data = self.cardData; card.customerID= 0; card.save() sale.cardID = card.ID sale.bill_addressID = bill.ID sale.ship_addre... | def act_checkout(self): sale = zikeshop.Sale() shop = zikeshop.Store() |
sed = zikeshop.SaleEditor(zikeshop.Sale) | sed = zikeshop.SaleEditor(zikeshop.Sale, self.input.get("ID")) | def save_sale(self): sed = zikeshop.SaleEditor(zikeshop.Sale) sed.act("save") |
def __init__(self, child_command): self.transport = EnsembleTransport(self.connect(child_command)) | def __init__(self, child_command, debug=False): """ if debug is True, all communication will be logged to sys.stderr """ self.transport = EnsembleTransport( self.connect(child_command, debug)) | def __init__(self, child_command): self.transport = EnsembleTransport(self.connect(child_command)) ServerProxy.__init__(self, "http://ensemble/", # just to avoid error transport=self.transport) |
def connect(self, child_command): | def connect(self, child_command, debug=False): | def connect(self, child_command): child = pexpect.spawn(child_command) child.expect(BANNER) return child |
notfound = "**NOTFOUND**" res = getattr(self.object, name, notfound) if res is notfound: raise KeyError, name | res = getattr(self.object, name) if (type(res) == type([])) or isinstance(res, zdc.LinkSet): lst = [] for item in res: lst.append(zdc.ObjectView(item)) return lst | def __getitem__(self, name): notfound = "**NOTFOUND**" res = getattr(self.object, name, notfound) if res is notfound: raise KeyError, name else: if (type(res) == type([])) or isinstance(res, zdc.LinkSet): lst = [] for item in res: lst.append(zdc.ObjectView(item)) return lst else: return res |
if (type(res) == type([])) or isinstance(res, zdc.LinkSet): lst = [] for item in res: lst.append(zdc.ObjectView(item)) return lst else: return res | return res | def __getitem__(self, name): notfound = "**NOTFOUND**" res = getattr(self.object, name, notfound) if res is notfound: raise KeyError, name else: if (type(res) == type([])) or isinstance(res, zdc.LinkSet): lst = [] for item in res: lst.append(zdc.ObjectView(item)) return lst else: return res |
def delete(self, key=None): """Deletes the specified (default is current) record. """ if key is not None: self.key = key else: pass | def delete(self): """Deletes the record. """ | def delete(self, key=None): """Deletes the specified (default is current) record. """ if key is not None: self.key = key else: pass # because we'll just delete the current record. |
sql = "DELETE FROM " + self.table + \ | sql = "DELETE FROM " + self.table.name + \ | def delete(self, key=None): """Deletes the specified (default is current) record. """ if key is not None: self.key = key else: pass # because we'll just delete the current record. |
raise KeyError, "invalid key for '" + self.table + "' table : " + `self.key` | raise "record not found where" + `where` | def _fetch(self, **where): if not where: raise "don't know which record to fetch" else: for k in where.keys(): if not self.table.fields.has_key(k): raise "no field called ", k |
nID = self.model["nodeID"] = self.input.get("nodeID", 0) | nID = self.model["nodeID"] = int(self.input.get("nodeID", 0)) | def list_product(self): # we want to see products in a particular node # (or in no nodes at all) nID = self.model["nodeID"] = self.input.get("nodeID", 0) import mdl_product mdl_product.nodeID = nID mdl_product.doit() if nID: self.model["path"] = zikebase.Node(ID=self.model["nodeID"]).path self.consult(mdl_product.model... |
SCVS_PORT = 2402 | SCVS_PORT = 2405 | ## def debug(msg): |
buffer = "" | def client_thread(lock, sock): """ Non-blocking I/O on sys.stdin is not allowd in Python for win32 (because select.select() uses winsock, and thus only works for sockets). So we use threads. This thread talks to the local parent cvs process. """ buffer = "" while not sys.stdin.closed: ch = sys.stdin.read(1) #@TODO: hu... | |
buffer += ch if ch == '\n': sock.write(buffer) buffer = "" | while not sock.write(ch): pass | def client_thread(lock, sock): """ Non-blocking I/O on sys.stdin is not allowd in Python for win32 (because select.select() uses winsock, and thus only works for sockets). So we use threads. This thread talks to the local parent cvs process. """ buffer = "" while not sys.stdin.closed: ch = sys.stdin.read(1) #@TODO: hu... |
r,w,e = select.select([raw], [raw], [raw]) | r,w,e = select.select([raw], [], [raw], 0.1) | def server_thread(lock, sock, raw): """ This thread talks to the remote cvs process. sock is a secure socket, raw is the raw tcp/ip socket. """ while lock.locked(): r,w,e = select.select([raw], [raw], [raw]) if raw in r: data = sock.read(1024) ## debug("<< " + repr(data)) sys.stdout.write(data) sys.stdout.flush() |
data = sock.read(1024) | data = sock.read(2048) | def server_thread(lock, sock, raw): """ This thread talks to the remote cvs process. sock is a secure socket, raw is the raw tcp/ip socket. """ while lock.locked(): r,w,e = select.select([raw], [raw], [raw]) if raw in r: data = sock.read(1024) ## debug("<< " + repr(data)) sys.stdout.write(data) sys.stdout.flush() |
else: return "picture.py?ID=%s&size=%s" % (ID, size) | def link_picture(ID, size=None): 'return a link to a picture, optionally thumbnailed' if size: return "picture.py?ID=%s" % ID else: return "picture.py?ID=%s&size=%s" % (ID, size) | |
try: lID = self.owner.ID if lID is not None: rows = self.rClass._table.select("%s=%i" % (self.lKey, int(lID))) for row in rows: self << self.rClass(ID=row["ID"]) except: pass | lID = getattr(self.owner, "ID", None) if lID is not None: rows = self.owner._ds.select(self.rClass._tablename, "%s=%i" % (self.lKey, int(lID))) for row in rows: self << self.rClass(self.owner._ds, ID=row["ID"]) | def load(self): try: lID = self.owner.ID if lID is not None: rows = self.rClass._table.select("%s=%i" % (self.lKey, int(lID))) for row in rows: #@TODO: unhardcode primary key for right hand class self << self.rClass(ID=row["ID"]) except: pass # to make a check_constructor work.. for now.. self._loaded = 1 |
return self.rClass() | return self.rClass(self.owner._ds) | def new(self): return self.rClass() |
res+= '<li>', item, ': ' | res+= '<li>%s: ' % item | def errTraceback(self): res = '<b>uncaught exception while running %s</b><br>\n'\ % self.eng.request.pathInfo res+= '<pre class="traceback">\n' \ + htmlEncode(self.eng.error) + "</pre>\n" res+= "<b>script input:</b>\n" res+= '<ul>\n' res+= '<li>form: %s</li>\n' % self.eng.request.form res+= '<li>querystring: %s</li>\n'... |
self.head ="" self.foot class PHPGenerator(Generator): def __init__(self): self.head = "<?\n" self.foot = "?>\n" def flatten(self, stripeset, depth=0, context="show"): | self.head = trim(""" def fetch(): _res = "" """) self.foot = trim(""" return _res def show(): print fetch() if __name__=="__main__": show() """) self.initialDepth = 1 def flatten(self, stripeset, depth, context="show"): | def __init__(self): self.head ="" self.foot |
if stripe[0] == "\n": stripe = stripe[1:] if stripe[-1] == "\n": stripe = stripe[:-1] | def flatten(self, stripeset, depth=0, context="show"): """Converts a stripe or stripeset into a string""" | |
stripehead = 'print "' | stripehead = '_res = _res + "' | def flatten(self, stripeset, depth=0, context="show"): """Converts a stripe or stripeset into a string""" |
stripefoot = '";' | stripefoot = '"\n' | def flatten(self, stripeset, depth=0, context="show"): """Converts a stripe or stripeset into a string""" |
stripebody = self.flatten(stripe,depth+1) | stripebody = self.flatten(stripe,depth) | def flatten(self, stripeset, depth=0, context="show"): """Converts a stripe or stripeset into a string""" |
stripebody = self.flatten(stripe["content"],depth+1, stripe["context"])[:-1] | stripebody = self.flatten(stripe["content"],depth, stripe["context"]) | def flatten(self, stripeset, depth=0, context="show"): """Converts a stripe or stripeset into a string""" |
res = res + self.flatten_report(stripe, depth+1) | res = res + self.flatten_report(stripe, depth) | def flatten(self, stripeset, depth=0, context="show"): """Converts a stripe or stripeset into a string""" |
conditional = "if" if (test) or (conditional): conditionals = {"if":"if", "ef":"elseif", "el":"else"} if conditional == "": conditional = "if" | raise "Error: test without conditional?!?!?!" if (conditional): conditionals = {"if":"if", "ef":"elif", "el":"else"} stripebody = indent(stripebody) | def flatten(self, stripeset, depth=0, context="show"): """Converts a stripe or stripeset into a string""" |
stripehead = conditionals[conditional] + " (" \ + test + "){\n" \ + " " + stripehead stripefoot = stripefoot + "\n}" | stripehead = stripehead \ + conditionals[conditional] + " (" \ + test + "):\n" \ + stripehead | def flatten(self, stripeset, depth=0, context="show"): """Converts a stripe or stripeset into a string""" |
stripehead = conditionals[conditional] + " {" \ + " " + stripehead stripefoot = stripefoot + "\n}" res = res + stripehead + stripebody + stripefoot + "\n" | stripehead = stripehead \ + conditionals[conditional] + ":" \ + stripehead res = res + stripehead + stripebody + stripefoot | def flatten(self, stripeset, depth=0, context="show"): """Converts a stripe or stripeset into a string""" |
res = res + \ "$__db = new " + report["source"] + ";\n" + \ "$__db->query(\"" + self.flatten(report["query"], context="exec") + "\");\n" res = res + "$__groups=array('all'" buf = "$__showFoot=array(0" | queryobj = self.parsedict['queries'][report['query']] query = self.flatten(queryobj['query'], depth, context="exec") source = self.parsedict['sources'][queryobj['source']] connector = self.flatten(source['connector'], depth, context="exec") res = res + trim(""" import %s %s = %s.connect("%s") %s = %s.cursor() %s.exec... | def flatten_report(self, report, depth=0): |
res = res + ");\n" res = res + buf + ");\n" res = res + "if ($__db->next_record()) {\n"; res = res + " " + self.flatten(report["head"],depth,"show") | res = res + "]\n" res = res + buf + "]\n" res = res + trim(""" _nomore = 0 _flds = {} """) res = res + "if (" + report['query'] + ".rowcount > 0):\n" res = res + indent(self.flatten(report["head"],depth,"show")) | def flatten_report(self, report, depth=0): |
res = res + \ " $__nr = $__db->Record;\n" + \ " while (($__more = $__db->next_record()) or (! $__nomore)){\n" + \ " $__tr = $__nr;\n" + \ " if ($__more) { $__nr = $__db->Record; }\n" + \ " else { $__nomore = 1; }\n" | res = res + indent(trim(""" _nr = %s.fetchone() _pr = [] for _f in range(len(%s.description)): _flds[%s.description[_f][0]] = _f _pr.append(None) """ % (report['query'], report['query'], report['query'], ))) res = res + trim(""" for _i in range(%s.rowcount): _tr = _nr _nr = %s.fetchone() if _nr == None: _nomore = 1 ... | def flatten_report(self, report, depth=0): |
res = res + \ " if ($__tr[\"" + report["groups"][i] + "\"] != $__pr[\"" + \ report["groups"][i] + "\"]){\n" + \ " " + self.flatten(report["grouph"][i],depth,"show") + \ " unset($__pr);\n" + \ " }\n" | res = res + indent(trim(""" if (_tr[_flds["%s"]] != _pr[_flds["%s"]]): %s """ % (report["groups"][i], report["groups"][i], indent(self.flatten(report["grouph"][i],depth,"show"))))) | def flatten_report(self, report, depth=0): |
res = res + " " + self.flatten(report["body"],depth,"show") res = res + \ " if ($__nomore) { $__showFoot[0] = 1; }\n" + \ " $__g=1; while ($__g < sizeof($__showFoot)){ \n" + \ " if (($__nr[$__groups[$__g]] != $__tr[$__groups[$__g]]) " + \ "or ($__showFoot[$__g-1])){\n" + \ " $__show... | res = res + indent(self.flatten(report["body"],depth,"show")) res = res + indent(trim(""" if (_nomore): _showFoot[0] = 1 for _g in range(1, len(_showFoot)): if (_showFoot[_g-1]) \\ or ((_nr[_flds[_groups[_g]]] != _tr[_flds[_groups[_g]]])): _showFoot[_g] = 1 else: _showFoot[_g] = 0 """)) | def flatten_report(self, report, depth=0): |
if report["groupt"][i]: res = res + \ " if ($__showFoot[" + `i+1` + "]){\n" + \ " " + self.flatten(report["groupt"][i],depth,"show") + \ " }\n" | print ":::" + `report["groupf"][i]` + ":::" if report["groupf"][i]: res = res + indent(trim(""" if (_showFoot[%s]): %s """ % (`i+1`, indent(self.flatten(report["groupf"][i],depth,"show"))))) | def flatten_report(self, report, depth=0): |
res = res + \ " $__pr = $__tr;\n" + \ " }\n" + \ " " + self.flatten(report["foot"],depth,"show") | res = res + trim(""" _pr = _tr %s """ % self.flatten(report["foot"],depth,"show")) | def flatten_report(self, report, depth=0): |
res = res + \ "} else {\n" + \ self.flatten(report["none"],depth,"show") res = res + "}\n" | res = res + indent(trim(""" else: %s """ % self.flatten(report["none"],depth,"show"))) | def flatten_report(self, report, depth=0): |
reDepth = re.compile("(\$__\w+)", re.I | re.S ) res = reDepth.sub(r"\1_" + `depth`,res) return res | return indent(res, depth) | def flatten_report(self, report, depth=0): |
def _interpolate(self, match): | def interpolate(self, match): | def _interpolate(self, match): |
return '$__tr[' + token + ']'; | return '" + _tr[_flds[\'' + token + '\']] + "'; | def _interpolate(self, match): |
if member in dir(ancestor): | if member in ancestor.__dict__.keys(): | def _findmember(self, member): """ self._findmember(member) : does self define or inherit member? |
return self.passwordClass(self.__dict__["cryptedpass"]) | return self.passwordClass(self._data["cryptedpass"]) | def get_password(self): """returns a zikebase.Password object for testing against plaintext.""" return self.passwordClass(self.__dict__["cryptedpass"]) |
self._record[f.name] = getattr(self, f.name) | data = getattr(self, f.name) import types if type(data) == types.InstanceType: self._record[f.name] = str(data) else: self._record[f.name] = data | def save(self): # save the data in our record: for f in self._table.fields: self._record[f.name] = getattr(self, f.name) self._record.save() |
def checkbox(name, isChecked, value=1, attrs=''): | def checkbox(name, isChecked, onValue=1, offValue=0, attrs=''): | def checkbox(name, isChecked, value=1, attrs=''): ''' An html checkbox. Also adds a hidden __expect__ variable since the browser doesn\'t often send unchecked checkboxes. ''' return '<input type="hidden" name="__expect__" value="%s;0">' \ '<input type="checkbox" name="%s" %s %s value="%s">' \ % (name, name, attrs, ['',... |
return '<input type="hidden" name="__expect__" value="%s;0">' \ | return '<input type="hidden" name="__expect__" value="%s:%s">' \ | def checkbox(name, isChecked, value=1, attrs=''): ''' An html checkbox. Also adds a hidden __expect__ variable since the browser doesn\'t often send unchecked checkboxes. ''' return '<input type="hidden" name="__expect__" value="%s;0">' \ '<input type="checkbox" name="%s" %s %s value="%s">' \ % (name, name, attrs, ['',... |
% (name, name, attrs, ['','CHECKED'][isChecked], value) | % (name, offValue, name, attrs, ['','CHECKED'][isChecked], onValue) | def checkbox(name, isChecked, value=1, attrs=''): ''' An html checkbox. Also adds a hidden __expect__ variable since the browser doesn\'t often send unchecked checkboxes. ''' return '<input type="hidden" name="__expect__" value="%s;0">' \ '<input type="checkbox" name="%s" %s %s value="%s">' \ % (name, name, attrs, ['',... |
(shorts, longs) = getopt.getopt(sys.argv[1:], "B:Tabc:f:t:v", ["background", "transparent", "audible", "blink", "command=", "font=", "terminal=", "visible"]) | (shorts, longs) = getopt.getopt(sys.argv[1:], "B:Tabc:f:n:t:v", ["background", "transparent", "audible", "blink", "command=", "font=", "scrollback=", "terminal=", "visible"]) | def child_exited_cb(terminal): gtk.mainquit() |
self.process_dir(self.root) self.factory.add_default() self.mainmenu_items.sort() self.mainmenu = Menu.Menu('main', self.mainmenu_items) self.mainmenu.attach(self, self) | self.refresh_menu() | def __init__(self, filename): applet.Applet.__init__(self, filename) |
def icons_yeah(self, name): | def load_icons(self, name): | def icons_yeah(self, name): # Load icons path = self.root+name+'/.DirIcon' pixbuf = g.gdk.pixbuf_new_from_file(path) if not pixbuf: print >>sys.stderr, "Can't load stock icon '%s'" % name g.stock_add([(name, name, 0, 0, "")]) self.factory.add(name, g.IconSet(pixbuf = pixbuf)) |
file = dirname[len(self.root):] self.icons_yeah(file) it = Menu.Action(file, 'run_it', '', file, (dirname,)) self.mainmenu_items.append(it) | offset = len(self.root) file = dirname[offset:] self.load_icons(file) self.mainmenu_items.append((dirname, file)) | def visit(dirname, names): if 'AppRun' in names: file = dirname[len(self.root):] self.icons_yeah(file) it = Menu.Action(file, 'run_it', '', file, (dirname,)) self.mainmenu_items.append(it) #print >>sys.stderr, file else: self.process_dir(dirname) |
factory = g.IconFactory() | def refresh_menu(self): self.mainmenu_items = [] factory = g.IconFactory() self.process_dir(self.root) self.factory.add_default() self.mainmenu = Menu.Menu('main', self.mainmenu_items) self.mainmenu.attach(self, self) | |
self.mainmenu = Menu.Menu('main', self.mainmenu_items) | self.mainmenu_items.sort() self.mainmenu = Menu.Menu('main', self.build_menu()) | def refresh_menu(self): self.mainmenu_items = [] factory = g.IconFactory() self.process_dir(self.root) self.factory.add_default() self.mainmenu = Menu.Menu('main', self.mainmenu_items) self.mainmenu.attach(self, self) |
self._purgeDiffTool() | self._purgeDiffToolSettings() | def _importNode(self, node): if self.environ.shouldPurge(): self._purgeDiffTool() |
field=self._doc.createElement("difftype") | field=self._doc.createElement("field") | def _extractDiffToolSettings(self): node=self._doc.createElement("difftypes") ttool = getToolByName(self.context, "portal_types") for ptype in ttool.listContentTypes(): diffs = self.context.getDiffForPortalType(ptype) if diffs: child=self._doc.createElement("type") child.setAttribute("portal_type", ptype) node.appendCh... |
req.ParseFromString(self.ctrl_socket.recv()) | try: req.ParseFromString(self.ctrl_socket.recv()) except: sleep(1) continue | def run(self): |
versioned_dir_regex=re.compile('[0-9.][0-9.]+') | versioned_dir_regex=re.compile('[0-9]') | def __init__(self, path, file): |
if not bin_info.needed: | if not bin_info.needed and \ not (bin_info.soname and \ ldso_soname_regex.search(bin_info.soname)): | def check(self, pkg, verbose): |
printWarning(pkg, 'shared-lib-without-dependency-information', i[0]) | printError(pkg, 'shared-lib-without-dependency-information', i[0]) | def check(self, pkg, verbose): |
if not libc_regex.search(i[0]): | if not libc_regex.search(i[0]) and \ ( not bin_info.soname or \ ( not libc_regex.search(bin_info.soname) and \ not ldso_soname_regex.search(bin_info.soname))): | def check(self, pkg, verbose): |
printWarning(pkg, 'library-not-linked-against-libc', i[0]) | printError(pkg, 'library-not-linked-against-libc', i[0]) | def check(self, pkg, verbose): |
printWarning(pkg, 'program-not-linked-against-libc', i[0]) | printError(pkg, 'program-not-linked-against-libc', i[0]) | def check(self, pkg, verbose): |
if linktop == lastpop: printWarning(pkg, "lengthy-symlink", f, link) | def check(self, pkg, verbose): | |
addFilter('E: emacs.*el|xemacs.*el no-dependency-on locales-el') | addFilter('E: emacs.*-el|xemacs.*-el no-dependency-on locales-el') | def isFiltered(s): global _filters if not no_exception: for f in _filters: if f.search(s): return 1 return 0 |
print summary | def check(self, pkg): | |
if prog == "/bin/sh" or prog == "/bin/bash" or prog == "/usr/bin/perl" | if prog == "/bin/sh" or prog == "/bin/bash" or prog == "/usr/bin/perl": | def check(self, pkg, verbose): |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.