rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
config.read([os.path.join(home_dir, self.INI_FILE)]) | config.read([config_path]) | def load_ini(self, config_path, defaults=None): """Set options from config.ini file in given home_dir |
init.initialise(self.dirname, 'sekrit') self.instance = instance.open(self.dirname) | self.instance = tracker = instance.open(self.dirname) if tracker.exists(): tracker.nuke() tracker.init(password.Password('sekrit')) | def setUp(self): MailgwTestCase.count = MailgwTestCase.count + 1 self.dirname = '_test_mailgw_%s'%self.count try: shutil.rmtree(self.dirname) except OSError, error: if error.errno not in (errno.ENOENT, errno.ESRCH): raise # create the instance init.install(self.dirname, 'templates/classic') init.write_select_db(self.di... |
Content-Type: multipart/mixed; boundary="bCsyhTFzCvuiizWE" Content-Disposition: inline Content-Type: text/plain; charset=us-ascii Content-Disposition: inline test attachment binary Content-Type: application/octet-stream Content-Disposition: attachment; filename="main.dvi" xxxxxx | Content-Type: multipart/mixed; boundary="bCsyhTFzCvuiizWE" Content-Disposition: inline --bCsyhTFzCvuiizWE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline test attachment binary --bCsyhTFzCvuiizWE Content-Type: application/octet-stream Content-Disposition: attachment; filename="main.dvi" xxxx... | def testContentDisposition(self): self.doNewIssue() self._handle_mail('''Content-Type: text/plain; |
if self.value is None: value = '' | if self._value is None: value = '' | def email(self, escape=1): ''' fudge email ''' if self.value is None: value = '' else: value = str(self._value) value = value.replace('@', ' at ') value = value.replace('.', ' ') if escape: value = cgi.escape(value) return value |
data = part.fp.read() | def handle_message(self, message): ''' message - a Message instance | |
data = binascii.a2b_base64(data) | data = binascii.a2b_base64(part.fp.read()) | def handle_message(self, message): ''' message - a Message instance |
data = quopri.decode(data) | decoded = cStringIO.StringIO() quopri.decode(part.fp, decoded) data = decoded.getvalue() | def handle_message(self, message): ''' message - a Message instance |
data = binascii.a2b_uu(data) | data = binascii.a2b_uu(part.fp.read()) | def handle_message(self, message): ''' message - a Message instance |
sys.stdout.write('Importing %s - %d\r'%(classname, n)) sys.stdout.flush() | if self.verbose : sys.stdout.write('Importing %s - %d\r'%(classname, n)) sys.stdout.flush() | def do_import(self, args): ""'''Usage: import import_dir Import a database from the directory containing CSV files, two per class to import. |
opts, args = getopt.getopt(sys.argv[1:], 'i:u:hcdsS:v') | opts, args = getopt.getopt(sys.argv[1:], 'i:u:hcdsS:vV') | def main(self): try: opts, args = getopt.getopt(sys.argv[1:], 'i:u:hcdsS:v') except getopt.GetoptError, e: self.usage(str(e)) return 1 |
return str(psycopg.QuotedString(str(value)))[1:-1] | return str(QuotedString(str(value)))[1:-1] | def sql_stringquote(self, value): ''' psycopg.QuotedString returns a "buffer" object with the single-quotes around it... ''' return str(psycopg.QuotedString(str(value)))[1:-1] |
if os.path.isfile(schemafile): if os.path.getmtime(schemafile) < dbtm: self.fastopen = 1 else: | if os.path.isfile(schemafile) \ and (os.path.getmtime(schemafile) < dbtm): | def __open(self): ''' Open the metakit database ''' # make the database dir if it doesn't exist if not os.path.exists(self.config.DATABASE): os.makedirs(self.config.DATABASE) |
nodeid = int(nodeid) journaldate = date.Date(journaldate) params = eval(params) | journaldate = str(date.Date(journaldate)) | def add_new_columns_v2(self): '''While we're adding the actor column, we need to update the tables to have the correct datatypes.''' for klass in self.classes.values(): cn = klass.classname properties = klass.getprops() old_spec = self.database_schema['tables'][cn] |
cl = self.db.classes[cn] if not isinstance(cl, hyperdb.FileClass): continue if not props.get('content', ''): del all_props[(cn, id)] | if isinstance(self.db.classes[cn], hyperdb.FileClass): if id == '-1': if not props.get('content', ''): del all_props[(cn, id)] elif props.has_key('content') and not props['content']: raise ValueError, _('File is empty') | propdef = all_propdef[cn] |
def indexargs_href(self, url, args): | def indexargs_url(self, url, args): | def indexargs_href(self, url, args): ''' embed the current index args in a URL ''' l = ['%s=%s'%(k,v) for k,v in args.items()] if self.columns and not args.has_key(':columns'): l.append(':columns=%s'%(','.join(self.columns))) if self.sort[1] is not None and not args.has_key(':sort'): if self.sort[0] == '-': val = '-'+s... |
def length(self): self.sequence_length = l = len(self._sequence) return l | def length(self): self.sequence_length = l = len(self._sequence) return l | |
return DateHTMLProperty(self._client, self._nodeid, self._prop, self._formname, self._value.local(offset)) | return DateHTMLProperty(self._client, self._classname, self._nodeid, self._prop, self._formname, self._value.local(offset)) | def local(self, offset): ''' Return the date/time as a local (timezone offset) date/time. ''' self.view_check() |
raise KeyErorr, item | raise KeyError, item | def __getitem__(self, item): ''' return an HTMLProperty instance ''' #print 'HTMLItem.getitem', (self, item) if item == 'id': return self._nodeid |
cell.append('%s: <a href="%s%s">%s</a>\n'%(k, classname, args[k], label)) | old = '<a href="%s%s">%s</a>'%(classname, args[k], label) | def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] comments = {} history = self._klass.history(self._nodeid) his... |
cell.append('%s: %s' % (k,label)) | old = label; cell.append('%s: %s' % (k,old)) if k in current: cell[-1] += ' -> %s'%current[k] current[k] = old | def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] comments = {} history = self._klass.history(self._nodeid) his... |
cell.append('%s: (no value)\n'%k) | if k not in current: cell.append('%s: (no value)'%k) else: cell.append('%s: %s'%(k, current[k])) current[k] = '(no value)' | def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] comments = {} history = self._klass.history(self._nodeid) his... |
cell.append('%s: %s\n'%(k, str(args[k]))) | cell.append('%s: %s'%(k, str(args[k]))) if k in current: cell[-1] += ' -> %s'%current[k] current[k] = str(args[k]) | def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] comments = {} history = self._klass.history(self._nodeid) his... |
if file is None: | if index is None or file is None: | def html(context=5): etype, evalue = sys.exc_type, sys.exc_value if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + string.split(sys.version)[0] + '<br>' + sys.executable head = pydoc.html.heading( '<font size=+1><strong>%s</strong>: %s</font>'%(str(etype), str(evalue)), '#ffffff', '#aa55cc',... |
interval = now - self.get(sessid, '__timestamp', default=time.time()) | sess = self.get(sessid, '__timestamp', None) if sess is None: sess=time.time() self.updateTimestamp(sessid) interval = now - sess | def clean(self, now): """Age sessions, remove when they haven't been used for a week. """ week = 60*60*24*7 for sessid in self.list(): interval = now - self.get(sessid, '__timestamp', default=time.time()) if interval > week: self.destroy(sessid) |
filename = os.path.join(self.instance.config.TEMPLATES, file) | prefix = getattr(self.instance.config, 'STATIC_FILES', self.instance.config.TEMPLATES) filename = os.path.normpath(os.path.join(prefix, file)) if not filename.startswith(prefix): raise NotFound, file | def serve_static_file(self, file): ''' Serve up the file named from the templates dir ''' filename = os.path.join(self.instance.config.TEMPLATES, file) |
if filterspec: | if self.classname and filterspec: | def indexargs_form(self, columns=1, sort=1, group=1, filter=1, filterspec=1): ''' return the current index args as form elements ''' l = [] sc = self.special_char s = self.input(type="hidden",name="%s",value="%s") if columns and self.columns: l.append(s%(sc+'columns', ','.join(self.columns))) if sort and self.sort[1] i... |
props = self.client.db.getclass(self.classname).getprops() q = urllib.quote for k,v in self.filterspec.items(): if not args.has_key(k): if type(v) == type([]): if isinstance(props[k], hyperdb.String): l.append('%s=%s'%(k, '%20'.join([q(i) for i in v]))) | if self.classname and self.filterspec: props = self.client.db.getclass(self.classname).getprops() q = urllib.quote for k,v in self.filterspec.items(): if not args.has_key(k): if type(v) == type([]): if isinstance(props[k], hyperdb.String): l.append('%s=%s'%(k, '%20'.join([q(i) for i in v]))) else: l.append('%s=%s'%(k, ... | def indexargs_url(self, url, args): ''' Embed the current index args in a URL ''' sc = self.special_char l = ['%s=%s'%(k,v) for k,v in args.items()] |
l.append('%s=%s'%(k, ','.join([q(i) for i in v]))) else: l.append('%s=%s'%(k, q(v))) | l.append('%s=%s'%(k, q(v))) | def indexargs_url(self, url, args): ''' Embed the current index args in a URL ''' sc = self.special_char l = ['%s=%s'%(k,v) for k,v in args.items()] |
props, changed = parsePropsFromForm(self.db, cl, self.form, self.nodeid) | props = parsePropsFromForm(self.db, cl, self.form, self.nodeid) | def shownode(self, message=None): ''' display an item ''' cn = self.classname cl = self.db.classes[cn] |
if changed: | if props: | def shownode(self, message=None): ''' display an item ''' cn = self.classname cl = self.db.classes[cn] |
', '.join(changed.keys())} | ', '.join(props.keys())} | def shownode(self, message=None): ''' display an item ''' cn = self.classname cl = self.db.classes[cn] |
props, dummy = parsePropsFromForm(self.db, cl, self.form) | props = parsePropsFromForm(self.db, cl, self.form) print props | def newuser(self, message=None): ''' Add a new user to the database. |
props, changed = parsePropsFromForm(self.db, user, self.form, | props = parsePropsFromForm(self.db, user, self.form, | def showuser(self, message=None): '''Display a user page for editing. Make sure the user is allowed to edit this node, and also check for password changes. ''' if self.user == 'anonymous': raise Unauthorised |
if self.nodeid == self.getuid() and changed.has_key('password'): | if props.has_key('password'): | def showuser(self, message=None): '''Display a user page for editing. Make sure the user is allowed to edit this node, and also check for password changes. ''' if self.user == 'anonymous': raise Unauthorised |
if password: set_cookie = password else: | if not password: | def showuser(self, message=None): '''Display a user page for editing. Make sure the user is allowed to edit this node, and also check for password changes. ''' if self.user == 'anonymous': raise Unauthorised |
del changed['password'] | elif self.nodeid == self.getuid(): set_cookie = password | def showuser(self, message=None): '''Display a user page for editing. Make sure the user is allowed to edit this node, and also check for password changes. ''' if self.user == 'anonymous': raise Unauthorised |
', '.join(changed.keys())} | ', '.join(props.keys())} | def showuser(self, message=None): '''Display a user page for editing. Make sure the user is allowed to edit this node, and also check for password changes. ''' if self.user == 'anonymous': raise Unauthorised |
props, dummy = parsePropsFromForm(self.db, cl, self.form) | props = parsePropsFromForm(self.db, cl, self.form) | def newuser_action(self, message=None): '''Attempt to create a new user based on the contents of the form and then set the cookie. |
changed = {} | def parsePropsFromForm(db, cl, form, nodeid=0): '''Pull properties for the given class out of the form. ''' props = {} changed = {} keys = form.keys() num_re = re.compile('^\d+$') for key in keys: if not cl.properties.has_key(key): continue proptype = cl.properties[key] if isinstance(proptype, hyperdb.String): value = ... | |
props[key] = value | def parsePropsFromForm(db, cl, form, nodeid=0): '''Pull properties for the given class out of the form. ''' props = {} changed = {} keys = form.keys() num_re = re.compile('^\d+$') for key in keys: if not cl.properties.has_key(key): continue proptype = cl.properties[key] if isinstance(proptype, hyperdb.String): value = ... | |
if nodeid and value != existing: changed[key] = value | if value != existing: props[key] = value else: | def parsePropsFromForm(db, cl, form, nodeid=0): '''Pull properties for the given class out of the form. ''' props = {} changed = {} keys = form.keys() num_re = re.compile('^\d+$') for key in keys: if not cl.properties.has_key(key): continue proptype = cl.properties[key] if isinstance(proptype, hyperdb.String): value = ... |
return props, changed | return props | def parsePropsFromForm(db, cl, form, nodeid=0): '''Pull properties for the given class out of the form. ''' props = {} changed = {} keys = form.keys() num_re = re.compile('^\d+$') for key in keys: if not cl.properties.has_key(key): continue proptype = cl.properties[key] if isinstance(proptype, hyperdb.String): value = ... |
class Class: | class Class(hyperdb.Class): | def setid(self, classname, maxid): ''' No-op in metakit ''' pass |
x = open(fnm, 'rb').read() | f = open(fnm, 'rb') | def get(self, nodeid, propname, default=_marker, cache=1): x = Class.get(self, nodeid, propname, default) poss_msg = 'Possibly an access right configuration problem.' if propname == 'content': if x.startswith('file:'): fnm = x[5:] try: x = open(fnm, 'rb').read() except IOError, (strerror): # XXX by catching this we don... |
if not self.db.security.hasPermission('Edit', author, classname): raise Unauthorized, 'You are not permitted to edit %s.'%classname | if nodeid: if not self.db.security.hasPermission('Edit', author, classname): raise Unauthorized, 'You are not permitted to edit %s.'%classname else: if not self.db.security.hasPermission('Create', author, classname): raise Unauthorized, 'You are not permitted to create %s.'%classname | def handle_message(self, message): ''' message - a Message instance |
prop = props[k] except: | prop = self.props[k] except KeyError: | def history(self, direction='descending'): l = ['<table width=100% border=0 cellspacing=0 cellpadding=2>', '<tr class="list-header">', _('<th align=left><span class="list-item">Date</span></th>'), _('<th align=left><span class="list-item">User</span></th>'), _('<th align=left><span class="list-item">Action</span></th>'... |
hrefable = os.path.exists( os.path.join(self.db.config.TEMPLATES, classname+'.item')) | def history(self, direction='descending'): l = ['<table width=100% border=0 cellspacing=0 cellpadding=2>', '<tr class="list-header">', _('<th align=left><span class="list-item">Date</span></th>'), _('<th align=left><span class="list-item">User</span></th>'), _('<th align=left><span class="list-item">Action</span></th>'... | |
subml.append('<a href="%s%s">%s</a>'%( classname, linkid, label)) | if hrefable: subml.append('<a href="%s%s">%s</a>'%( classname, linkid, label)) | def history(self, direction='descending'): l = ['<table width=100% border=0 cellspacing=0 cellpadding=2>', '<tr class="list-header">', _('<th align=left><span class="list-item">Date</span></th>'), _('<th align=left><span class="list-item">User</span></th>'), _('<th align=left><span class="list-item">Action</span></th>'... |
if value: value = str(linkcl.get(value, k)) else: value = _('[unselected]') | if value: value = '<a href="%s%s">%s</a>'%(propclass.classname, value, linkcl.get(value, k)) else: value = _('[unselected]') | def do_plain(self, property, escape=0): ''' display a String property directly; |
value = ', '.join([linkcl.get(i, k) for i in value]) | value = ', '.join(['<a href="%s%s">%s</a>'%(propclass.classname, i, linkcl.get(i, k)) for i in value]) | def do_plain(self, property, escape=0): ''' display a String property directly; |
setup( name = "roundup", version = __version__, description = "A simple-to-use and -install issue-tracking system" | setup_args = { 'name': "roundup", 'version': __version__, 'description': "A simple-to-use and -install issue-tracking system" | def main(): # build list of scripts from their implementation modules roundup_scripts = map(scriptname, glob('roundup/scripts/[!_]*.py')) # template munching packagelist = [ 'roundup', 'roundup.cgi', 'roundup.cgi.PageTemplates', 'roundup.cgi.TAL', 'roundup.cgi.ZTUtils', 'roundup.backends', 'roundup.scripts', ] install... |
long_description = | 'long_description': | def main(): # build list of scripts from their implementation modules roundup_scripts = map(scriptname, glob('roundup/scripts/[!_]*.py')) # template munching packagelist = [ 'roundup', 'roundup.cgi', 'roundup.cgi.PageTemplates', 'roundup.cgi.TAL', 'roundup.cgi.ZTUtils', 'roundup.backends', 'roundup.scripts', ] install... |
author = "Richard Jones", author_email = "richard@users.sourceforge.net", url = 'http://roundup.sourceforge.net/', download_url = 'http://sourceforge.net/project/showfiles.php?group_id=31577', packages = packagelist, py_modules = py_modules, classifiers = [ | 'author': "Richard Jones", 'author_email': "richard@users.sourceforge.net", 'url': 'http://roundup.sourceforge.net/', 'download_url': 'http://sourceforge.net/project/showfiles.php?group_id=31577', 'packages': packagelist, 'classifiers': [ | def main(): # build list of scripts from their implementation modules roundup_scripts = map(scriptname, glob('roundup/scripts/[!_]*.py')) # template munching packagelist = [ 'roundup', 'roundup.cgi', 'roundup.cgi.PageTemplates', 'roundup.cgi.TAL', 'roundup.cgi.ZTUtils', 'roundup.backends', 'roundup.scripts', ] install... |
cmdclass = { | 'cmdclass': { | def main(): # build list of scripts from their implementation modules roundup_scripts = map(scriptname, glob('roundup/scripts/[!_]*.py')) # template munching packagelist = [ 'roundup', 'roundup.cgi', 'roundup.cgi.PageTemplates', 'roundup.cgi.TAL', 'roundup.cgi.ZTUtils', 'roundup.backends', 'roundup.scripts', ] install... |
scripts = roundup_scripts, data_files = installdatafiles ) | 'scripts': roundup_scripts, 'data_files': installdatafiles } if sys.version_info[:2] > (2, 2): setup_args['py_modules'] = py_modules setup(**setup_args) | def main(): # build list of scripts from their implementation modules roundup_scripts = map(scriptname, glob('roundup/scripts/[!_]*.py')) # template munching packagelist = [ 'roundup', 'roundup.cgi', 'roundup.cgi.PageTemplates', 'roundup.cgi.TAL', 'roundup.cgi.ZTUtils', 'roundup.backends', 'roundup.scripts', ] install... |
self.hour, self.minute, self.second, 0, 0, 0)) | self.hour, self.minute, int(self.second), 0, 0, 0)) | def pretty(self, format='%d %B %Y'): ''' print up the date date using a pretty format... |
self._nodeid, classname) | self._nodeid, classname, property, itemid) | def hasPermission(self, permission, classname=_marker, property=None, itemid=None): '''Determine if the user has the Permission. |
return reduce(operator.add, [len(x) for x in stores], 0) | return len(self.items()) def has_key(self, key): for store in self.stores: if store.has_key(key): return 1 return 0 | def __len__(self): return reduce(operator.add, [len(x) for x in stores], 0) |
self.stores.append(store) | self.stores = [store] + self.stores | def push(self, store): self.stores.append(store) |
try: self.handle_message(message) except MailUsageError, value: fulldoc = '\n'.join(string.split(__doc__, '\n')[2:]) sendto = [message.getaddrlist('from')[0][1]] m = ['Subject: Failed issue tracker submission', ''] m.append(str(value)) m.append('\n\nMail Gateway Help\n=================') m.append(fulldoc) except: sen... | sendto = message.getaddrlist('from') if sendto: try: self.handle_message(message) return except MailUsageError, value: fulldoc = '\n'.join(string.split(__doc__, '\n')[2:]) sendto = [sendto[0][1]] m = ['Subject: Failed issue tracker submission', ''] m.append(str(value)) m.append('\n\nMail Gateway Help\n================... | def handle_Message(self, message): '''Handle an RFC822 Message |
m.append('---- traceback of failure ----') s = cStringIO.StringIO() import traceback traceback.print_exc(None, s) m.append(s.getvalue()) | m.append('The mail gateway retrieved a message which has no From:') m.append('line, indicating that it is corrupt. Please check your') m.append('mail gateway source.') m.append('') | def handle_Message(self, message): '''Handle an RFC822 Message |
if m: try: smtp = smtplib.SMTP(self.MAILHOST) smtp.sendmail(self.ADMIN_EMAIL, sendto, '\n'.join(m)) except socket.error, value: return "Couldn't send confirmation email: mailhost %s"%value except smtplib.SMTPException, value: return "Couldn't send confirmation email: %s"%value | try: smtp = smtplib.SMTP(self.MAILHOST) smtp.sendmail(self.ADMIN_EMAIL, sendto, '\n'.join(m)) except socket.error, value: raise MailGWError, "Couldn't send confirmation email: "\ "mailhost %s"%value except smtplib.SMTPException, value: raise MailGWError, "Couldn't send confirmation email: %s"%value | def handle_Message(self, message): '''Handle an RFC822 Message |
props[key] = date.Date(value) | try: props[key] = date.Date(value) except ValueError, message: raise UsageError, ''' Subject argument list contains an invalid date for %s. Error was: %s Subject was: "%s" '''%(key, message, subject) | def handle_message(self, message): ''' message - a Message instance |
props[key] = date.Interval(value) | try: props[key] = date.Interval(value) except ValueError, message: raise UsageError, ''' Subject argument list contains an invalid date interval for %s. Error was: %s Subject was: "%s" '''%(key, message, subject) | def handle_message(self, message): ''' message - a Message instance |
cl.set(nodeid, **props) | try: cl.set(nodeid, **props) except (TypeError, IndexError, ValueError), message: raise MailUsageError, ''' There was a problem with the message you sent: %s '''%message | def handle_message(self, message): ''' message - a Message instance |
props['status'] = '1' | try: unread_id = self.db.status.lookup('unread') except KeyError: pass else: props['status'] = '1' | def handle_message(self, message): ''' message - a Message instance |
nodeid = cl.create(**props) | try: nodeid = cl.create(**props) except (TypeError, IndexError, ValueError), message: raise MailUsageError, ''' There was a problem with the message you sent: %s '''%message | def handle_message(self, message): ''' message - a Message instance |
for cl in 'issue', 'file', 'msg', 'keyword': | for cl in 'issue', 'file', 'msg', 'keyword', 'priority', 'status': | def open(name=None): ''' as from the roundupdb method openDB ''' from roundup.hyperdb import String, Password, Date, Link, Multilink from roundup.hyperdb import Interval, Boolean, Number # open the database db = Database(config, name) # # Now initialise the schema. Must do this each time the database is # opened. # ... |
return self.user.lookup(self.journaltag) | if (self.journal_uid is None or self.journal_uid[0] != self.journaltag): uid = self.user.lookup(self.journaltag) self.journal_uid = (self.journaltag, uid) return self.journal_uid[1] | def getuid(self): """Return the id of the "user" node associated with the user that owns this connection to the hyperdatabase.""" if self.journaltag is None: return None elif self.journaltag == 'admin': # admin user may not exist, but always has ID 1 return '1' else: return self.user.lookup(self.journaltag) |
ZRoundup.manage_addZRoundupForm, ZRoundup.manage_addZRoundup | manage_addZRoundupForm, manage_addZRoundup | def initialize(context): context.registerClass( ZRoundup, meta_type = 'Z Roundup', constructors = ( ZRoundup.manage_addZRoundupForm, ZRoundup.manage_addZRoundup ) ) |
self.additional_headers['Expires'] = 'Thu, 1 Jan 1970 00:00:00 GMT' | date = rfc822.formatdate(time.time() + 5) self.additional_headers['Expires'] = date | def inner_main(self): ''' Process a request. |
mt = mimetypes.guess_type(str(file))[0] | file = str(file) mt = mimetypes.guess_type(file)[0] | def serve_static_file(self, file): ims = None # see if there's an if-modified-since... if hasattr(self.request, 'headers'): ims = self.request.headers.getheader('if-modified-since') elif self.env.has_key('HTTP_IF_MODIFIED_SINCE'): # cgi will put the header in the env var ims = self.env['HTTP_IF_MODIFIED_SINCE'] filenam... |
mt = 'text/plain' | if file.endswith('.css'): mt = 'text/css' else: mt = 'text/plain' | def serve_static_file(self, file): ims = None # see if there's an if-modified-since... if hasattr(self.request, 'headers'): ims = self.request.headers.getheader('if-modified-since') elif self.env.has_key('HTTP_IF_MODIFIED_SINCE'): # cgi will put the header in the env var ims = self.env['HTTP_IF_MODIFIED_SINCE'] filenam... |
self.form = {} for name, value in cgi.parse_qsl(url): if self.form.has_key(name): if isinstance(self.form[name], type([])): self.form[name].append(cgi.MiniFieldStorage(name, value)) else: self.form[name] = [self.form[name], cgi.MiniFieldStorage(name, value)] else: self.form[name] = cgi.MiniFieldStorage(name, value) | env = {'QUERY_STRING': url} self.form = cgi.FieldStorage(environ=env) | def updateFromURL(self, url): ''' Parse the URL for query args, and update my attributes using the values. ''' self.form = {} for name, value in cgi.parse_qsl(url): if self.form.has_key(name): if isinstance(self.form[name], type([])): self.form[name].append(cgi.MiniFieldStorage(name, value)) else: self.form[name] = [se... |
roundup_server.RoundupRequestHandler.TRACKER_HOMES = {'demo': home} | def run_demo(home): """Run the demo tracker installed in ``home``""" roundup_server.RoundupRequestHandler.TRACKER_HOMES = {'demo': home} cfg = configuration.CoreConfig(home) url = cfg["TRACKER_WEB"] hostname, port = urlparse.urlparse(url)[1].split(':') port = int(port) success_message = '''Server running - connect to: ... | |
sys.argv = sys.argv[:1] roundup_server.run(port=port, success_message=success_message) | sys.argv = sys.argv[:1] + ['-p', str(port), 'demo=' + home] roundup_server.run(success_message=success_message) | def run_demo(home): """Run the demo tracker installed in ``home``""" roundup_server.RoundupRequestHandler.TRACKER_HOMES = {'demo': home} cfg = configuration.CoreConfig(home) url = cfg["TRACKER_WEB"] hostname, port = urlparse.urlparse(url)[1].split(':') port = int(port) success_message = '''Server running - connect to: ... |
path_components = url[2].split( '/' ) | path = url[2] path_components = path.split( '/' ) | def _opendb(self): '''Open the roundup instance database for a transaction. ''' instance = roundup.instance.open(self.instance_home) request = RequestWrapper(self.REQUEST['RESPONSE']) env = self.REQUEST.environ |
where.append(' or '.join(l)) | if l: where.append(' or '.join(l)) | def filter(self, search_matches, filterspec, sort=(None,None), group=(None,None)): '''Return a list of the ids of the active nodes in this class that match the 'filter' spec, sorted by the group spec and then the sort spec |
def ngettext(self, singular, plural, count): | def ungettext(self, singular, plural, count): | def ngettext(self, singular, plural, count): if count == 1: _msg = singular else: _msg = plural return self.gettext(_msg) |
return self.gettext(_msg) | return self.ugettext(_msg) | def ngettext(self, singular, plural, count): if count == 1: _msg = singular else: _msg = plural return self.gettext(_msg) |
try: _fallback = translation(domain=domain, languages=["en"], class_=RoundupTranslations) except IOError: | if language == "en": | def get_translation(language=None, domain=DOMAIN): """Return Translation object for given language and domain""" if language: _languages = [language] else: # use OS environment _languages = None # except for english ("en") language, add english fallback if available try: _fallback = translation(domain=domain, languages... |
elif have_datetime and isinstance(spec, datetime.datetime): | elif isinstance(spec, datetime.datetime): | def __init__(self, spec='.', offset=0, add_granularity=0, translator=i18n): """Construct a date given a specification and a time zone offset. |
ts = calendar.timegm((y,m,d,H+offset,M,S,0,0,0)) | def __init__(self, spec='.', offset=0, add_granularity=0, translator=i18n): """Construct a date given a specification and a time zone offset. | |
self.second, x, x, x = time.gmtime(ts) | self.second = _local_to_utc(y, m, d, H, M, S, offset) | def __init__(self, spec='.', offset=0, add_granularity=0, translator=i18n): """Construct a date given a specification and a time zone offset. |
H = -offset | H = 0 | def set(self, spec, offset=0, date_re=date_re, serialised_re=serialised_date_re, add_granularity=0): ''' set the date to the value in spec ''' |
H = int(info['H']) - offset | H = int(info['H']) | def set(self, spec, offset=0, date_re=date_re, serialised_re=serialised_date_re, add_granularity=0): ''' set the date to the value in spec ''' |
self.second, x, x, x = time.gmtime(ts) | self.second = y, m, d, H, M, S | def set(self, spec, offset=0, date_re=date_re, serialised_re=serialised_date_re, add_granularity=0): ''' set the date to the value in spec ''' |
return Date((self.year, self.month, self.day, self.hour + offset, self.minute, self.second, 0, 0, 0), translator=self.translator) | y, m, d, H, M, S = _utc_to_local(self.year, self.month, self.day, self.hour, self.minute, self.second, offset) return Date((y, m, d, H, M, S, 0, 0, 0), translator=self.translator) | def local(self, offset): """ Return this date as yyyy-mm-dd.hh:mm:ss in a local time zone. """ return Date((self.year, self.month, self.day, self.hour + offset, self.minute, self.second, 0, 0, 0), translator=self.translator) |
def _serve_file(self, last_modified, mime_type, content): | def _serve_file(self, lmt, mime_type, content): | def _serve_file(self, last_modified, mime_type, content): ''' guts of serve_file() and serve_static_file() ''' ims = None # see if there's an if-modified-since... if hasattr(self.request, 'headers'): ims = self.request.headers.getheader('if-modified-since') elif self.env.has_key('HTTP_IF_MODIFIED_SINCE'): # cgi will pu... |
lmt = rfc822.formatdate(last_modified) | lmt = rfc822.formatdate(lmt) | def _serve_file(self, last_modified, mime_type, content): ''' guts of serve_file() and serve_static_file() ''' ims = None # see if there's an if-modified-since... if hasattr(self.request, 'headers'): ims = self.request.headers.getheader('if-modified-since') elif self.env.has_key('HTTP_IF_MODIFIED_SINCE'): # cgi will pu... |
smtp = smtplib.SMTP(self.MAILHOST) smtp.sendmail(self.ADMIN_EMAIL, sendto, message.getvalue()) | if ROUNDUPDBSENDMAILDEBUG: print 'From: %s\nTo: %s\n%s\n=-=-=-=-=-=-=-='%( self.ADMIN_EMAIL, sendto, message.getvalue()) else: smtp = smtplib.SMTP(self.MAILHOST) smtp.sendmail(self.ADMIN_EMAIL, sendto, message.getvalue()) | def sendmessage(self, nodeid, msgid, change_note): """Send a message to the members of an issue's nosy list. |
elif hqre.match(c): | elif hqre.match(c) and c != '_': | def encode_header(header, charset='utf-8'): """ Will encode in quoted-printable encoding only if header contains non latin characters """ # Return empty headers unchanged if not header: return header # return plain header if it is not contains non-ascii characters if hqre.match(header): return header quoted = '' #ma... |
if extension: filename = '%s.%s'%(name, extension) else: filename = name src = os.path.join(self.dir, filename) if not os.path.exists(src): filename = filename + '.html' src = os.path.join(self.dir, filename) if not os.path.exists(src): if not extension: raise NoTemplate, 'Template file "%s" doesn\'t exist'%name gen... | src, filename = find_template(self.dir, name, extension) | def get(self, name, extension=None): ''' Interface to get a template, possibly loading a compiled template. |
if os.path.exists(os.path.join(self._db.config.TEMPLATES, classname + '.item')): current[prop_n] = '<a href="%s%s">%s</a>'%(classname, self._klass.get(self._nodeid, prop_n, None), current[prop_n]) | try: find_template(self._db.config.TEMPLATES, classname, 'item') except NoTemplate: pass else: id = self._klass.get(self._nodeid, prop_n, None) current[prop_n] = '<a href="%s%s">%s</a>'%( classname, id, current[prop_n]) | def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... |
DEBUG = open(DEBUG, 'a') | if DEBUG == 'stdout': DEBUG = sys.stdout else: DEBUG = open(DEBUG, 'a') | def write(self, content): pass |
TRACE = open(TRACE, 'w') | if TRACE == 'stdout': TRACE = sys.stdout else: TRACE = open(TRACE, 'w') | def write(self, content): pass |
def getnodeids(self, classname, db=None): '''Retrieve all the ids of the nodes for a particular Class. ''' raise NotImplementedError | def getnodeids(self, classname, db=None): '''Retrieve all the ids of the nodes for a particular Class. ''' raise NotImplementedError | |
fid, name = event['old_value'].split(':') | fid, name = event['old_value'].split(':', 1) | def to_date(ts): return date.Date(time.gmtime(float(ts))) |
if (properties.has_key('creation') or properties.has_key('activity') or properties.has_key('creator')): raise ValueError, '"creation", "activity" and "creator" are '\ 'reserved' if hasattr(db, classname): raise ValueError, "Class %s already exists"%classname | def __init__(self, db, classname, **properties): #self.db = weakref.proxy(db) self.db = db self.classname = classname self.keyname = None self.ruprops = properties self.privateprops = { 'id' : hyperdb.String(), 'activity' : hyperdb.Date(), 'creation' : hyperdb.Date(), 'creator' : hyperdb.Link('user') } | |
self.keyname = None | self.key = None | def __init__(self, db, classname, **properties): #self.db = weakref.proxy(db) self.db = db self.classname = classname self.keyname = None self.ruprops = properties self.privateprops = { 'id' : hyperdb.String(), 'activity' : hyperdb.Date(), 'creation' : hyperdb.Date(), 'creator' : hyperdb.Link('user') } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.