bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def verify(self): """Verify that the provided path points to a valid Trac environment directory.""" fd = None try: fd = open(os.path.join(self.path, 'VERSION'), 'r') assert fd.read(26) == 'Trac Environment Version 1' finally: if fd: fd.close() | def verify(self): """Verify that the provided path points to a valid Trac environment directory.""" fd = None try: fd = open(os.path.join(self.path, 'VERSION'), 'r') assert fd.read(26) == 'Trac Environment Version 1' finally: if fd: fd.close() | 25,300 |
def __init__(self, loadpaths=[]): """ Creates a new HDF dataset. The loadpaths parameter can be used to specify a sequence of paths under which ClearSilver will search for template files: | def __init__(self, loadpaths=[]): """Create a new HDF dataset. The loadpaths parameter can be used to specify a sequence of paths under which ClearSilver will search for template files: | 25,301 |
def __setitem__(self, name, value): """ Adds data to the HDF dataset. The `name` parameter is the path of the node in dotted syntax. The `value` parameter can be a simple value such as a string or number, but also data structures such as dicts and lists. | def __setitem__(self, name, value): """ Adds data to the HDF dataset. The `name` parameter is the path of the node in dotted syntax. The `value` parameter can be a simple value such as a string or number, but also data structures such as dicts and lists. | 25,302 |
def add_value(prefix, value): if value is None: return elif value in (True, False): self.hdf.setValue(prefix, str(int(value))) elif isinstance(value, (str, unicode)): self.hdf.setValue(prefix, value) elif isinstance(value, dict): for k in value.keys(): add_value('%s.%s' % (prefix, k), value[k]) else: if hasattr(value, ... | def add_value(prefix, value): if value is None: return elif value in (True, False): self.hdf.setValue(prefix, str(int(value))) elif isinstance(value, (str, unicode)): self.hdf.setValue(prefix, value) elif isinstance(value, dict): for k in value.keys(): add_value('%s.%s' % (prefix, k), value[k]) else: if hasattr(value, ... | 25,303 |
def parse(self, string): """ Parses the given string as template text, and returns a neo_cs.CS object. """ import neo_cs cs = neo_cs.CS(self.hdf) cs.parseStr(string) return cs | def parse(self, string): """Parse the given string as template text, and returns a neo_cs.CS object. """ import neo_cs cs = neo_cs.CS(self.hdf) cs.parseStr(string) return cs | 25,304 |
def render(self, template): """ Renders the HDF using the given template. The template parameter can be either an already parse neo_cs.CS object, or a string. In the latter case it is interpreted as name of the template file. """ if isinstance(template, (str, unicode)): filename = template import neo_cs template = neo... | def render(self, template): """Render the HDF using the given template. The template parameter can be either an already parse neo_cs.CS object, or a string. In the latter case it is interpreted as name of the template file. """ if isinstance(template, (str, unicode)): filename = template import neo_cs template = neo_c... | 25,305 |
def render(self, req, mimetype, content, filename=None, rev=None): if is_binary(content): self.env.log.debug("Binary data; no preview available") return | def render(self, req, mimetype, content, filename=None, rev=None): if is_binary(content): self.env.log.debug("Binary data; no preview available") return | 25,306 |
def get_recipients(self, tktid): notify_reporter = self.config.getbool('notification', 'always_notify_reporter') notify_owner = self.config.getbool('notification', 'always_notify_owner') notify_updater = self.config.getbool('notification', 'always_notify_updater') | def get_recipients(self, tktid): notify_reporter = self.config.getbool('notification', 'always_notify_reporter') notify_owner = self.config.getbool('notification', 'always_notify_owner') notify_updater = self.config.getbool('notification', 'always_notify_updater') | 25,307 |
def send_project_index(req, mpr, dir): req.content_type = 'text/html' req.write('<html><head><title>Available Projects</title></head>') req.write('<body><h1>Available Projects</h1><ul>') for project in os.listdir(dir): req.write('<li><a href="%s">%s</a></li>' % (href_join(mpr.idx_location, project), project)) req.write... | def send_project_index(req, mpr, dir, options): from trac.web.clearsilver import HDFWrapper if 'TracEnvIndexTemplate' in options: tmpl_path, template = os.path.split(options['TracEnvIndexTemplate']) from trac.siteconfig import __default_templates_dir__ as def_path mpr.hdf = HDFWrapper(loadpaths=[def_path, tmpl_path]... | 25,308 |
def get_environment(req, mpr, options): global env_cache, env_cache_lock if options.has_key('TracEnv'): env_path = options['TracEnv'] elif options.has_key('TracEnvParentDir'): env_parent_dir = options['TracEnvParentDir'] env_name = mpr.cgi_location.split('/')[-1] env_path = os.path.join(env_parent_dir, env_name) if le... | def get_environment(req, mpr, options): global env_cache, env_cache_lock if options.has_key('TracEnv'): env_path = options['TracEnv'] elif options.has_key('TracEnvParentDir'): env_parent_dir = options['TracEnvParentDir'] env_name = mpr.cgi_location.split('/')[-1] env_path = os.path.join(env_parent_dir, env_name) if le... | 25,309 |
def _make_intertrac_link(self, ns, target, label): url = self.env.config.get('intertrac', ns + '.url') if url: name = self.env.config.get('intertrac', ns + '.title', 'Trac project %s' % ns) sep = target.find(':') if sep != -1: url = '%s/%s/%s' % (url, target[:sep], target[sep + 1:]) else: url = '%s/search?q=%s' % (url,... | def _make_intertrac_link(self, ns, target, label): intertrac_config = self.env.config['intertrac'] url = intertrac_config.get(ns+'.url') if url: name = self.env.config.get('intertrac', ns + '.title', 'Trac project %s' % ns) sep = target.find(':') if sep != -1: url = '%s/%s/%s' % (url, target[:sep], target[sep + 1:]) el... | 25,310 |
def _make_intertrac_link(self, ns, target, label): url = self.env.config.get('intertrac', ns + '.url') if url: name = self.env.config.get('intertrac', ns + '.title', 'Trac project %s' % ns) sep = target.find(':') if sep != -1: url = '%s/%s/%s' % (url, target[:sep], target[sep + 1:]) else: url = '%s/search?q=%s' % (url,... | def _make_intertrac_link(self, ns, target, label): url = self.env.config.get('intertrac', ns + '.url') if url: name = intertrac_config.get(ns+'.title', 'Trac project %s' % ns) compat = intertrac_config.getbool(ns+'.compat', 'true') if compat: sep = target.find(':') if sep != -1: url = '%s/%s/%s' % (url, target[:sep],... | 25,311 |
def usage(): print '\nUsage: %s <database> <command>' % sys.argv[0] print '\n Available commands:' print ' initdb' print ' config list' print ' config set <name> <value>' print ' component list' print ' component add <name> <owner>' print ' component remove <name>' print ' component set owner <name> <new_... | def usage(): print '\nUsage: %s <database> <command>' % sys.argv[0] print '\n Available commands:' print ' initdb' print ' config list' print ' config set <name> <value>' print ' component list' print ' component add <name> <owner>' print ' component remove <name>' print ' component set owner <name> <new_... | 25,312 |
def insert_default_values (cursor): cursor.execute (""" | def insert_default_values (cursor): cursor.execute (""" | 25,313 |
def cmd_initdb(): dbname = sys.argv[1] if os.access(dbname, os.R_OK): print 'database %s already exists' % dbname sys.exit(1) try: cnx = sqlite.connect (dbname) except Exception, e: print 'Failed to create database %s.' % dbname sys.exit(1) try: cursor = cnx.cursor () create_tables (cursor) insert_default_values (curso... | def cmd_initdb(): dbname = sys.argv[1] if os.access(dbname, os.R_OK): print 'database %s already exists' % dbname sys.exit(1) try: cnx = sqlite.connect (dbname) except Exception, e: print 'Failed to create database %s.' % dbname sys.exit(1) try: cursor = cnx.cursor () create_tables (cursor) insert_default_values (curso... | 25,314 |
def main(): if sys.argv[2:] == ['initdb']: cmd_initdb() elif sys.argv[2:] == ['config', 'list']: cmd_config_list() elif sys.argv[2:4] == ['config', 'set'] and len(sys.argv) == 6: cmd_config_set() elif sys.argv[2:] == ['component', 'list']: cmd_component_list() elif sys.argv[2:4] == ['component', 'add'] and len(sys.argv... | def main(): tracadm = TracAdmin() if len (sys.argv) > 1: if sys.argv[1] in ['-h','--help','help']: tracadm.onecmd ("help") elif sys.argv[1] in ['-v','--version','version','about']: tracadm.onecmd ("version") else: tracadm.db_set(sys.argv[1]) if len (sys.argv) > 2: s_args = ' '.join(["'%s'" % c for c in sys.argv[3:]]) c... | 25,315 |
def main(): if sys.argv[2:] == ['initdb']: cmd_initdb() elif sys.argv[2:] == ['config', 'list']: cmd_config_list() elif sys.argv[2:4] == ['config', 'set'] and len(sys.argv) == 6: cmd_config_set() elif sys.argv[2:] == ['component', 'list']: cmd_component_list() elif sys.argv[2:4] == ['component', 'add'] and len(sys.argv... | def main(): if sys.argv[2:] == ['initdb']: cmd_initdb() elif sys.argv[2:] == ['config', 'list']: cmd_config_list() elif sys.argv[2:4] == ['config', 'set'] and len(sys.argv) == 6: cmd_config_set() elif sys.argv[2:] == ['component', 'list']: cmd_component_list() elif sys.argv[2:4] == ['component', 'add'] and len(sys.argv... | 25,316 |
def write_utctime(name, value, params={}): write_prop(name, strftime('%Y%m%dT%H%M%SZ', value), params) | def write_utctime(name, value, params={}): write_prop(name, strftime('%Y%m%dT%H%M%SZ', value), params) | 25,317 |
def render(self, req, mimetype, content, filename=None, rev=None): import SilverCity try: typelang = types[mimetype] lang = typelang[0] module = getattr(SilverCity, lang) generator = getattr(module, lang + "HTMLGenerator") try: allprops = typelang[1] propset = SilverCity.PropertySet() for p in allprops.keys(): propset[... | def render(self, req, mimetype, content, filename=None, rev=None): import SilverCity try: typelang = types[mimetype] lang = typelang[0] module = getattr(SilverCity, lang) generator = getattr(module, lang + "HTMLGenerator") try: allprops = typelang[1] propset = SilverCity.PropertySet() for p in allprops.keys(): propset[... | 25,318 |
def _format_link(self, formatter, ns, target, label, fullmatch=None): intertrac = formatter.shorthand_intertrac_helper(ns, target, label, fullmatch) if intertrac: return intertrac cursor = formatter.db.cursor() cursor.execute("SELECT summary,status FROM ticket WHERE id=%s", (target,)) row = cursor.fetchone() if row: re... | def _format_link(self, formatter, ns, target, label, fullmatch=None): intertrac = formatter.shorthand_intertrac_helper(ns, target, label, fullmatch) if intertrac: return intertrac cursor = formatter.db.cursor() cursor.execute("SELECT summary,status FROM ticket WHERE id=%s", (target,)) row = cursor.fetchone() if row: re... | 25,319 |
def _render_confirm_delete(self, req, db, id): req.perm.assert_permission('REPORT_DELETE') | def _render_confirm_delete(self, req, db, id): req.perm.assert_permission('REPORT_DELETE') | 25,320 |
def _render_confirm_delete(self, req, db, id): req.perm.assert_permission('REPORT_DELETE') | def _render_confirm_delete(self, req, db, id): req.perm.assert_permission('REPORT_DELETE') | 25,321 |
def _head_row(): return tag.re( [tag.th(alabel, class_=atype) for atype, alabel in annotypes] + [tag.th(u'\xa0', class_='content')] ) | def _head_row(): return tag.tr( [tag.th(alabel, class_=atype) for atype, alabel in annotypes] + [tag.th(u'\xa0', class_='content')] ) | 25,322 |
def _do_component_rename(self, name, newname): cnx = self.db_open() cursor = cnx.cursor() cursor.execute("SELECT name FROM component WHERE name=%s", (name,)) if not cursor.fetchone(): raise Exception("No such component '%s'" % name) cursor.execute("UPDATE component SET name=%s WHERE name=%s", (newname, name)) cursor.ex... | def _do_component_rename(self, name, newname): cnx = self.db_open() cursor = cnx.cursor() cursor.execute("SELECT name FROM component WHERE name=%s", (name,)) if not cursor.fetchone(): raise Exception("No such component '%s'" % name) cursor.execute("UPDATE component SET name=%s WHERE name=%s", (newname, name)) cursor.ex... | 25,323 |
def _validate_callback(option, opt_str, value, parser, valid_values): if value not in valid_values: raise OptionValueError('%s must be one of: %s, not %s' % (opt_str, '|'.join(valid_values), value)) setattr(parser.values, option.dest, value) | def _validate_callback(option, opt_str, value, parser, valid_values): if value not in valid_values: raise OptionValueError('%s must be one of: %s, not %s' % (opt_str, '|'.join(valid_values), value)) setattr(parser.values, option.dest, value) | 25,324 |
def process_request(self, req): prefix = req.args.get('prefix') filename = req.args.get('filename') | def process_request(self, req): prefix = req.args.get('prefix') filename = req.args.get('filename') | 25,325 |
def dispatch(self, req): """Find a registered handler that matches the request and let it process it. In addition, this method initializes the HDF data set and adds the web site chrome. """ # For backwards compatibility, should be removed in the future self.env.href = req.href self.env.abs_href = req.abs_href | def dispatch(self, req): """Find a registered handler that matches the request and let it process it. In addition, this method initializes the HDF data set and adds the web site chrome. """ # For backwards compatibility, should be removed in the future self.env.href = req.href self.env.abs_href = req.abs_href | 25,326 |
def init_db(self, path, user=None, password=None, host=None, port=None, params={}): cnx = self.get_connection(path, user, password, host, port, params) cursor = cnx.cursor() if cnx.schema: cursor.execute('CREATE SCHEMA %s' % cnx.schema) cursor.execute('SET search_path TO %s, public', (cnx.schema,)) from trac.db_default... | def init_db(self, path, user=None, password=None, host=None, port=None, params={}): cnx = self.get_connection(path, user, password, host, port, params) cursor = cnx.cursor() if cnx.schema: cursor.execute('CREATE SCHEMA %s' % cnx.schema) cursor.execute('SET search_path TO %s', (cnx.schema,)) from trac.db_default import ... | 25,327 |
def __init__(self, path, user=None, password=None, host=None, port=None, params={}): if path.startswith('/'): path = path[1:] # We support both psycopg and PgSQL but prefer psycopg global psycopg global PgSQL global PGSchemaError if not psycopg and not PgSQL: try: import psycopg2 as psycopg import psycopg2.extensions ... | def __init__(self, path, user=None, password=None, host=None, port=None, params={}): if path.startswith('/'): path = path[1:] # We support both psycopg and PgSQL but prefer psycopg global psycopg global PgSQL global PGSchemaError if not psycopg and not PgSQL: try: import psycopg2 as psycopg import psycopg2.extensions ... | 25,328 |
def finish_send(self): """Clean up after sending all messages. Called after sending all messages.""" pass | def finish_send(self): """Clean up after sending all messages. Called after sending all messages.""" pass | 25,329 |
def process_request(self, req): req.perm.assert_permission('SEARCH_VIEW') | def process_request(self, req): req.perm.assert_permission('SEARCH_VIEW') | 25,330 |
def quickjump(self, req, kwd): # Source quickjump if kwd[0] == '/': return req.href.browser(kwd) link = wiki_to_link(kwd, self.env, req) if isinstance(link, Element): return link | def check_quickjump(self, req, kwd): noquickjump = int(req.args.get('noquickjump', '0')) # Source quickjump if kwd[0] == '/': return req.href.browser(kwd) link = wiki_to_link(kwd, self.env, req) if isinstance(link, Element): return link | 25,331 |
def quickjump(self, req, kwd): # Source quickjump if kwd[0] == '/': return req.href.browser(kwd) link = wiki_to_link(kwd, self.env, req) if isinstance(link, Element): return link | def quickjump(self, req, kwd): # Source quickjump if kwd[0] == '/': return req.href.browser(kwd) link = wiki_to_link(kwd, self.env, req) if isinstance(link, Element): return link | 25,332 |
def get_config_items(self, section): if not self.cfg.has_section(section): return None return self.cfg.items(section) | def get_config_items(self, section): if not self.cfg.has_section(section): return None return self.cfg.items(section) | 25,333 |
def setSeverityList(self, s): """Remove all severities, set them to `s`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM enum WHERE type='severity'""") for i, value in enumerate(s): c.execute("""INSERT INTO enum (type, name, val... | def setSeverityList(self, s): """Remove all severities, set them to `s`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM enum WHERE type='severity'""") for value, i in s: print "inserting severity ", value, " ", i c.execute("""I... | 25,334 |
def setSeverityList(self, s): """Remove all severities, set them to `s`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM enum WHERE type='severity'""") for i, value in enumerate(s): c.execute("""INSERT INTO enum (type, name, val... | def setSeverityList(self, s): """Remove all severities, set them to `s`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM enum WHERE type='severity'""") for i, value in enumerate(s): c.execute("""INSERT INTO enum (type, name, val... | 25,335 |
def setPriorityList(self, s): """Remove all priorities, set them to `s`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM enum WHERE type='priority'""") for i, value in enumerate(s): c.execute("""INSERT INTO enum (type, name, val... | def setPriorityList(self, s): """Remove all priorities, set them to `s`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM enum WHERE type='priority'""") for value, i in s: print "inserting priority ", value, " ", i c.execute("""I... | 25,336 |
def setComponentList(self, l): """Remove all components, set them to `l`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM component""") for value in l: c.execute("""INSERT INTO component (name) VALUES (%s)""", value) self.db().c... | def setComponentList(self, l, key): """Remove all components, set them to `l`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM component""") for value in l: c.execute("""INSERT INTO component (name) VALUES (%s)""", value) self.d... | 25,337 |
def setComponentList(self, l): """Remove all components, set them to `l`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM component""") for value in l: c.execute("""INSERT INTO component (name) VALUES (%s)""", value) self.db().c... | def setComponentList(self, l): """Remove all components, set them to `l`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM component""") for comp in l: print "inserting component ", comp[key] c.execute("""INSERT INTO component (n... | 25,338 |
def setComponentList(self, l): """Remove all components, set them to `l`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM component""") for value in l: c.execute("""INSERT INTO component (name) VALUES (%s)""", value) self.db().c... | def setComponentList(self, l): """Remove all components, set them to `l`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM component""") for value in l: c.execute("""INSERT INTO component (name) VALUES (%s)""", value) self.db().c... | 25,339 |
def setVersionList(self, v): """Remove all versions, set them to `v`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM version""") for value in v: c.execute("""INSERT INTO version (name) VALUES (%s)""", value) self.db().commit() | def setVersionList(self, v): """Remove all versions, set them to `v`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM version""") for vers in v: print "inserting version ", vers[key] c.execute("""INSERT INTO version (name) VALUE... | 25,340 |
def setVersionList(self, v): """Remove all versions, set them to `v`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM version""") for value in v: c.execute("""INSERT INTO version (name) VALUES (%s)""", value) self.db().commit() | def setVersionList(self, v): """Remove all versions, set them to `v`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM version""") for value in v: c.execute("""INSERT INTO version (name) VALUES (%s)""", value) self.db().commit() | 25,341 |
def setMilestoneList(self, m): """Remove all milestones, set them to `m`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM milestone""") for value in m: c.execute("""INSERT INTO milestone (name) VALUES (%s)""", value) self.db().c... | def setMilestoneList(self, m): """Remove all milestones, set them to `m`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM milestone""") for ms in m: print "inserting milestone ", ms[key] c.execute("""INSERT INTO milestone (name)... | 25,342 |
def setMilestoneList(self, m): """Remove all milestones, set them to `m`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM milestone""") for value in m: c.execute("""INSERT INTO milestone (name) VALUES (%s)""", value) self.db().c... | def setMilestoneList(self, m): """Remove all milestones, set them to `m`""" if self.hasTickets(): raise Exception("Will not modify database with existing tickets!") c = self.db().cursor() c.execute("""DELETE FROM milestone""") for value in m: c.execute("""INSERT INTO milestone (name) VALUES (%s)""", ms[key]) self.db()... | 25,343 |
def addTicket(self, time, changetime, component, severity, priority, owner, reporter, cc, version, milestone, status, resolution, summary, description, keywords): c = self.db().cursor() if status.lower() == 'open': if owner != '': status = 'assigned' else: status = 'new' | def addTicket(self, time, changetime, component, severity, priority, owner, reporter, cc, version, milestone, status, resolution, summary, description, keywords): c = self.db().cursor() if status.lower() == 'open': if owner != '': status = 'assigned' else: status = 'new' | 25,344 |
def addTicket(self, time, changetime, component, severity, priority, owner, reporter, cc, version, milestone, status, resolution, summary, description, keywords): c = self.db().cursor() if status.lower() == 'open': if owner != '': status = 'assigned' else: status = 'new' | def addTicket(self, time.strftime('%s'), changetime.strftime('%s'), component, severity, priority, owner, reporter, cc, version, milestone, status, resolution, summary, description, keywords): c = self.db().cursor() if status.lower() == 'open': if owner != '': status = 'assigned' else: status = 'new' | 25,345 |
def addTicketChange(self, ticket, time, author, field, oldvalue, newvalue): c = self.db().cursor() c.execute("""INSERT INTO ticket_change (ticket, time, author, field, oldvalue, newvalue) VALUES (%s, %s, %s, %s, %s, %s)""", ticket, time.strftime('%s'), author, field, oldvalue, newvalue) self.db().commit() | def addTicketChange(self, ticket, time, author, field, oldvalue, newvalue): c = self.db().cursor() c.execute("""INSERT INTO ticket_change (ticket, time, author, field, oldvalue, newvalue) VALUES (%s, %s, %s, %s, %s, %s)""", ticket, time.strftime('%s'), author, field, oldvalue, newvalue) self.db().commit() | 25,346 |
def setVersionList(self, v, key): """Remove all versions, set them to `v`""" self.assertNoTickets() c = self.db().cursor() c.execute("DELETE FROM version") for vers in v: print " inserting version '%s'" % (vers[key]) c.execute("INSERT INTO version (name) VALUES (%s)", (vers[key],)) self.db().commit() | def setVersionList(self, v, key): """Remove all versions, set them to `v`""" self.assertNoTickets() c = self.db().cursor() c.execute("DELETE FROM version") for vers in v: print " inserting version '%s'" % (vers[key]) c.execute("INSERT INTO version (name) VALUES (%s)", (vers[key].encode('utf-8'),)) self.db().commit() | 25,347 |
def create_milestone(self, req, name, due=0, completed=0, description=''): self.perm.assert_permission(perm.MILESTONE_CREATE) if not name: raise TracError('You must provide a name for the milestone.', 'Required Field Missing') cursor = self.db.cursor() self.log.debug("Creating new milestone '%s'" % name) cursor.execute... | def create_milestone(self, req, name, due=0, completed=0, description=''): self.perm.assert_permission(perm.MILESTONE_CREATE) if not name: raise TracError('You must provide a name for the milestone.', 'Required Field Missing') cursor = self.db.cursor() self.log.debug("Creating new milestone '%s'" % name) cursor.execute... | 25,348 |
def trac_get_reference(env, rawtext, text): for (pattern, function) in LINKS: m = pattern.match(text) if m: g = filter(None, m.groups()) missing = False if pattern == WIKI_LINK: if not (env._wiki_pages.has_key(g[0])): missing = True text = text + "?" uri = function(env.href, g) reference = nodes.reference(rawtext, text... | def trac_get_reference(env, rawtext, text): for (pattern, function) in LINKS: m = pattern.match(text) if m: g = filter(None, m.groups()) missing = 0 if pattern == WIKI_LINK: if not (env._wiki_pages.has_key(g[0])): missing = True text = text + "?" uri = function(env.href, g) reference = nodes.reference(rawtext, text) re... | 25,349 |
def trac_get_reference(env, rawtext, text): for (pattern, function) in LINKS: m = pattern.match(text) if m: g = filter(None, m.groups()) missing = False if pattern == WIKI_LINK: if not (env._wiki_pages.has_key(g[0])): missing = True text = text + "?" uri = function(env.href, g) reference = nodes.reference(rawtext, text... | def trac_get_reference(env, rawtext, text): for (pattern, function) in LINKS: m = pattern.match(text) if m: g = filter(None, m.groups()) missing = False if pattern == WIKI_LINK: if not (env._wiki_pages.has_key(g[0])): missing = 1 text = text + "?" uri = function(env.href, g) reference = nodes.reference(rawtext, text) r... | 25,350 |
def setUp(self): self.env = EnvironmentStub() self.ticket_module = TicketModule(self.env) self.mimeview = Mimeview(self.env) self.req = Mock(hdf=HDFWrapper(['./templates']), base_path='/trac.cgi', path_info='', href=Href('/trac.cgi'), abs_href=Href('http://example.org/trac.cgi'), environ={}, perm=None, authname='-', ar... | def setUp(self): self.env = EnvironmentStub() self.ticket_module = TicketModule(self.env) self.mimeview = Mimeview(self.env) self.req = Mock(base_path='/trac.cgi', path_info='', href=Href('/trac.cgi'), abs_href=Href('http://example.org/trac.cgi'), environ={}, perm=None, authname='-', args={}) | 25,351 |
def test_rss_conversion(self): ticket = self._create_a_ticket() content, mimetype, ext = self.mimeview.convert_content( self.req, 'trac.ticket.Ticket', ticket, 'rss') self.assertEqual(("""<rss version="2.0"> | def test_rss_conversion(self): ticket = self._create_a_ticket() content, mimetype, ext = self.mimeview.convert_content( self.req, 'trac.ticket.Ticket', ticket, 'rss') self.assertEqual(("""<rss version="2.0"> | 25,352 |
def delete(self, retarget_to=None, author=None, db=None): if not db: db = self.env.get_db_cnx() handle_ta = True else: handle_ta = False | def delete(self, retarget_to=None, author=None, db=None): if not db: db = self.env.get_db_cnx() handle_ta = True else: handle_ta = False | 25,353 |
def display_csv(self, req, query, sep=','): req.send_response(200) req.send_header('Content-Type', 'text/plain;charset=utf-8') req.end_headers() | def display_csv(self, req, query, sep=','): req.send_response(200) req.send_header('Content-Type', 'text/plain;charset=utf-8') req.end_headers() | 25,354 |
def cast(self, column, type): return 'CAST(%s AS %s)' % (column, type) | def cast(self, column, type): return 'CAST(%s AS %s)' % (column, type) | 25,355 |
def render(self): name = dict_get_with_default(self.args, 'page', 'WikiStart') action = dict_get_with_default(self.args, 'action', 'view') version = dict_get_with_default(self.args, 'version', 0) page = Page(name, version) | def render(self): name = dict_get_with_default(self.args, 'page', 'WikiStart') action = dict_get_with_default(self.args, 'action', 'view') version = dict_get_with_default(self.args, 'version', 0) page = Page(name, version) | 25,356 |
def history_cb(path, rev, pool): if authz.has_permission(path): history.append((path, rev)) | def history_cb(path, rev, pool): if authz.has_permission(path): history.append((path, rev)) | 25,357 |
def history_cb(path, rev, pool): if authz.has_permission(path): history.append((path, rev)) | def history_cb(path, rev, pool): if authz.has_permission(path): history.append((path, rev)) | 25,358 |
def __new__(klass, parent, parent_pool): """ Create a new pool that is a sub-pool of `parent_pool`, and arrange for `self.close` to be called up when the `parent` object is destroyed. The `parent` object must be weak-referenceable. The returned `Pool` instance will have the value of the newly created pool. """ self =... | def __init__(self, parent, parent_pool): """ Create a new pool that is a sub-pool of `parent_pool`, and arrange for `self.close` to be called up when the `parent` object is destroyed. The `parent` object must be weak-referenceable. The returned `Pool` instance will have the value of the newly created pool. """ self =... | 25,359 |
def __new__(klass, parent, parent_pool): """ Create a new pool that is a sub-pool of `parent_pool`, and arrange for `self.close` to be called up when the `parent` object is destroyed. The `parent` object must be weak-referenceable. The returned `Pool` instance will have the value of the newly created pool. """ self =... | def __new__(klass, parent, parent_pool): """ Create a new pool that is a sub-pool of `parent_pool`, and arrange for `self.close` to be called up when the `parent` object is destroyed. The `parent` object must be weak-referenceable. The returned `Pool` instance will have the value of the newly created pool. """ self.p... | 25,360 |
def close(self, x): """ The parent object has been destroyed so it is time for us to go. -- So long, and thanks for all the fish! """ core.svn_pool_destroy(self) | def close(self, x): """ The parent object has been destroyed so it is time for us to go. -- So long, and thanks for all the fish! """ core.svn_pool_destroy(self) | 25,361 |
def close(self, x): """ The parent object has been destroyed so it is time for us to go. -- So long, and thanks for all the fish! """ core.svn_pool_destroy(self) | defpool = property(lambda self: self._pool(), lambda self, pool: setattr(self, '_pool', pool)) close(self,pool = property(lambda self: self._pool(), lambda self, pool: setattr(self, '_pool', pool)) x):pool = property(lambda self: self._pool(), lambda self, pool: setattr(self, '_pool', pool)) """pool = property(lambda s... | 25,362 |
def get_youngest_rev_in_cache(self, db): """ Get the latest stored revision by sorting the revision strings numerically """ cursor = db.cursor() cursor.execute("SELECT rev FROM revision ORDER BY -LENGTH(rev), rev DESC LIMIT 1") row = cursor.fetchone() return row and row[0] or None | defpool = property(lambda self: self._pool(), lambda self, pool: setattr(self, '_pool', pool)) get_youngest_rev_in_cache(self,pool = property(lambda self: self._pool(), lambda self, pool: setattr(self, '_pool', pool)) db):pool = property(lambda self: self._pool(), lambda self, pool: setattr(self, '_pool', pool)) """poo... | 25,363 |
def _get_prop(self, name): return fs.node_prop(self.root, self.scope + self.path, name, self.pool) | defpool = property(lambda self: self._pool(), lambda self, pool: setattr(self, '_pool', pool)) _get_prop(self,pool = property(lambda self: self._pool(), lambda self, pool: setattr(self, '_pool', pool)) name):pool = property(lambda self: self._pool(), lambda self, pool: setattr(self, '_pool', pool)) returnpool = propert... | 25,364 |
def authz_cb(root, path, pool): return 1 | def authz_cb(root, path, pool): return 1 | 25,365 |
def __init__(self, name, data): self.filename = name self.file = StringIO.StringIO(data) | def __init__(self, name, data): self.filename = name self.file = StringIO.StringIO(data) | 25,366 |
def setComponentList(self, l, key): """Remove all components, set them to `l`""" self.assertNoTickets() c = self.db().cursor() c.execute("""DELETE FROM component""") for comp in l: print "inserting component ", comp[key] c.execute("""INSERT INTO component (name) VALUES (%s)""", comp[key].encode('utf-8')) self.db().com... | def setComponentList(self, l, key): """Remove all components, set them to `l`""" self.assertNoTickets() c = self.db().cursor() c.execute("""DELETE FROM component""") for comp in l: print "inserting component '",comp[key],"', owner", comp['owner'] c.execute("""INSERT INTO component (name, owner) VALUES (%s, %s)""", co... | 25,367 |
def addAttachment(self, id, attachment, description, author): print 'inserting attachment for ticket %s -- %s' % (id, description) self.env.create_attachment(self.db(), 'ticket', str(id), attachment, description, author, 'unknown') | def addAttachment(self, id, attachment, description, author): print 'inserting attachment for ticket %s -- %s' % (id, description) attachment.filename = attachment.filename.encode('utf-8') self.env.create_attachment(self.db(), 'ticket', str(id), attachment, description.encode('utf-8'), author, 'unknown') | 25,368 |
def convert(_db, _host, _user, _password, _env, _force): activityFields = FieldTranslator() # account for older versions of bugzilla if BZ_VERSION == '2.11': print 'Using Buzvilla v%s schema.' % BZ_VERSION activityFields['removed'] = 'oldvalue' activityFields['added'] = 'newvalue' # init Bugzilla environment print "B... | def convert(_db, _host, _user, _password, _env, _force): activityFields = FieldTranslator() # account for older versions of bugzilla if BZ_VERSION == '2.11': print 'Using Buzvilla v%s schema.' % BZ_VERSION activityFields['removed'] = 'oldvalue' activityFields['added'] = 'newvalue' # init Bugzilla environment print "B... | 25,369 |
def convert(_db, _host, _user, _password, _env, _force): activityFields = FieldTranslator() # account for older versions of bugzilla if BZ_VERSION == '2.11': print 'Using Buzvilla v%s schema.' % BZ_VERSION activityFields['removed'] = 'oldvalue' activityFields['added'] = 'newvalue' # init Bugzilla environment print "B... | def convert(_db, _host, _user, _password, _env, _force): activityFields = FieldTranslator() # account for older versions of bugzilla if BZ_VERSION == '2.11': print 'Using Buzvilla v%s schema.' % BZ_VERSION activityFields['removed'] = 'oldvalue' activityFields['added'] = 'newvalue' # init Bugzilla environment print "B... | 25,370 |
def convert(_db, _host, _user, _password, _env, _force): activityFields = FieldTranslator() # account for older versions of bugzilla if BZ_VERSION == '2.11': print 'Using Buzvilla v%s schema.' % BZ_VERSION activityFields['removed'] = 'oldvalue' activityFields['added'] = 'newvalue' # init Bugzilla environment print "B... | def convert(_db, _host, _user, _password, _env, _force): activityFields = FieldTranslator() # account for older versions of bugzilla if BZ_VERSION == '2.11': print 'Using Buzvilla v%s schema.' % BZ_VERSION activityFields['removed'] = 'oldvalue' activityFields['added'] = 'newvalue' # init Bugzilla environment print "B... | 25,371 |
def convert(_db, _host, _user, _password, _env, _force): activityFields = FieldTranslator() # account for older versions of bugzilla if BZ_VERSION == '2.11': print 'Using Buzvilla v%s schema.' % BZ_VERSION activityFields['removed'] = 'oldvalue' activityFields['added'] = 'newvalue' # init Bugzilla environment print "B... | def convert(_db, _host, _user, _password, _env, _force): activityFields = FieldTranslator() # account for older versions of bugzilla if BZ_VERSION == '2.11': print 'Using Buzvilla v%s schema.' % BZ_VERSION activityFields['removed'] = 'oldvalue' activityFields['added'] = 'newvalue' # init Bugzilla environment print "B... | 25,372 |
def process_request(self, req): req.perm.assert_permission('SEARCH_VIEW') | def process_request(self, req): req.perm.assert_permission('SEARCH_VIEW') | 25,373 |
def process_request(self, req): req.perm.assert_permission('SEARCH_VIEW') | def process_request(self, req): req.perm.assert_permission('SEARCH_VIEW') | 25,374 |
def process_request(self, req): req.perm.assert_permission('SEARCH_VIEW') | def process_request(self, req): req.perm.assert_permission('SEARCH_VIEW') | 25,375 |
def process_request(self, req): req.perm.assert_permission('SEARCH_VIEW') | def process_request(self, req): req.perm.assert_permission('SEARCH_VIEW') | 25,376 |
def render_macro(self, req, name, content): from trac.wiki.formatter import wiki_to_html from trac.wiki import WikiSystem buf = StringIO() buf.write("<dl>") | def render_macro(self, req, name, content): from trac.wiki.formatter import wiki_to_html from trac.wiki import WikiSystem buf = StringIO() buf.write("<dl>") | 25,377 |
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * ' ' + mod * ' ' | 25,378 |
def dispatch_request(environ, start_response): """Main entry point for the Trac web interface. @param environ: the WSGI environment dict @param start_response: the WSGI callback for starting the response """ if 'mod_python.options' in environ: options = environ['mod_python.options'] environ.setdefault('trac.env_path',... | def dispatch_request(environ, start_response): """Main entry point for the Trac web interface. @param environ: the WSGI environment dict @param start_response: the WSGI callback for starting the response """ if 'mod_python.options' in environ: options = environ['mod_python.options'] environ.setdefault('trac.env_path',... | 25,379 |
def _isdst(self, dt): tt = (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) stamp = time.mktime(tt) tt = time.localtime(stamp) return tt.tm_isdst > 0 | def _isdst(self, dt): tt = (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) stamp = time.mktime(tt) tt = time.localtime(stamp) return tt.tm_isdst > 0 | 25,380 |
def test_base_url_proxy(self): environ = self._make_environ(HTTP_HOST='localhost', HTTP_X_FORWARDED_HOST='example.com') req = Request(environ, None) self.assertEqual('http://example.com/trac', req.base_url) | def test_base_url_proxy(self): environ = self._make_environ(HTTP_HOST='localhost', HTTP_X_FORWARDED_HOST='example.com') req = Request(environ, None) self.assertEqual('http://example.com/trac', req.base_url) | 25,381 |
def __init__(self, server_address, env_parent_dir, env_paths, auths): HTTPServer.__init__(self, server_address, TracHTTPRequestHandler) | def __init__(self, server_address, env_parent_dir, env_paths, auths): HTTPServer.__init__(self, server_address, TracHTTPRequestHandler) | 25,382 |
def save(self): """Write the configuration options to the primary file.""" if not self.filename: return | def save(self): """Write the configuration options to the primary file.""" if not self.filename: return | 25,383 |
def save(self): """Write the configuration options to the primary file.""" if not self.filename: return | def save(self): """Write the configuration options to the primary file.""" if not self.filename: return | 25,384 |
def save(self): """Write the configuration options to the primary file.""" if not self.filename: return | def save(self): """Write the configuration options to the primary file.""" if not self.filename: return | 25,385 |
def close_tag(self, tag): tmp = s = '' while self._open_tags != [] and tag != tmp: tmp = self._open_tags.pop() s += tmp return s | def close_tag(self, tag): tmp = s = '' while self._open_tags != [] and tag != tmp: tmp = self._open_tags.pop() s += tmp return s | 25,386 |
def simple_tag_handler(self, open_tag, close_tag): """Generic handler for simple binary style tags""" if self.tag_open_p(close_tag): return self.close_tag(close_tag) else: self.open_tag(close_tag) return open_tag | def simple_tag_handler(self, open_tag, close_tag): """Generic handler for simple binary style tags""" if self.tag_open_p(close_tag): return self.close_tag(close_tag) else: self.open_tag(close_tag) return open_tag | 25,387 |
def process(self, req, text, in_paragraph=False): if self.error: return system_message(Markup('Error: Failed to load processor ' '<code>%s</code>', self.name), self.error) text = self.processor(req, text) if in_paragraph: content_for_span = None interrupt_paragraph = False if isinstance(text, Element): tagname = text.t... | def process(self, req, text, in_paragraph=False): if self.error: return system_message(Markup('Error: Failed to load processor ' '<code>%s</code>', self.name), self.error) text = self.processor(req, text) if in_paragraph: content_for_span = None interrupt_paragraph = False if isinstance(text, Element): tagname = text.t... | 25,388 |
def populate_hdf(self, req, handler): """Add chrome-related data to the HDF.""" | def populate_hdf(self, req, handler): """Add chrome-related data to the HDF.""" | 25,389 |
def perform_query(self, req, query, changeset, tickets, wiki, page=0): if not query: return ([], 0) keywords = query.split(' ') | def perform_query(self, req, query, changeset, tickets, wiki, page=0): if not query: return ([], 0) keywords = query.split(' ') | 25,390 |
def perform_query(self, req, query, changeset, tickets, wiki, page=0): if not query: return ([], 0) keywords = query.split(' ') | def perform_query(self, req, query, changeset, tickets, wiki, page=0): if not query: return ([], 0) keywords = query.split(' ') | 25,391 |
def perform_query(self, req, query, changeset, tickets, wiki, page=0): if not query: return ([], 0) keywords = query.split(' ') | def perform_query(self, req, query, changeset, tickets, wiki, page=0): if not query: return ([], 0) keywords = query.split(' ') | 25,392 |
def populate_page_dict(): """Extract wiki page names. This is used to detect broken wiki-links""" global page_dict page_dict = {} cnx = get_connection() cursor = cnx.cursor() cursor.execute('SELECT DISTINCT name FROM wiki') while 1: row = cursor.fetchone() if not row: break page_dict[row[0]] = 1 | def populate_page_dict(): """Extract wiki page names. This is used to detect broken wiki-links""" global page_dict page_dict = {'TitleIndex': 1} cnx = get_connection() cursor = cnx.cursor() cursor.execute('SELECT DISTINCT name FROM wiki') while 1: row = cursor.fetchone() if not row: break page_dict[row[0]] = 1 | 25,393 |
def populate_page_dict(): """Extract wiki page names. This is used to detect broken wiki-links""" global page_dict page_dict = {} cnx = get_connection() cursor = cnx.cursor() cursor.execute('SELECT DISTINCT name FROM wiki') while 1: row = cursor.fetchone() if not row: break page_dict[row[0]] = 1 | def populate_page_dict(): """Extract wiki page names. This is used to detect broken wiki-links""" global page_dict page_dict = {} cnx = get_connection() cursor = cnx.cursor() cursor.execute('SELECT DISTINCT name FROM wiki') while 1: row = cursor.fetchone() if not row: break page_dict[row[0]] = 1 | 25,394 |
def _tickethref_formatter(self, match, fullmatch): number = int(match[2:]) return '<a href="%s">#%d</a>' % (href.ticket(number), number) | def _tickethref_formatter(self, match, fullmatch): number = int(match[1:]) return '<a href="%s">#%d</a>' % (href.ticket(number), number) | 25,395 |
def sortkey(row): val = row[colIndex] if isinstance(val, basestring): val = val.lower() return val | def sortkey(row): val = row[colIndex] if isinstance(val, basestring): val = val.lower() return val | 25,396 |
def get_ticket (self, id): global fields cnx = db.get_connection () cursor = cnx.cursor () | def get_ticket (self, id): global fields cnx = db.get_connection () cursor = cnx.cursor () | 25,397 |
def has_node(self, path, rev): """ Tell if there's a node at the specified (path,rev) combination. """ try: self.get_node() return True except TracError: return False | def has_node(self, path, rev=None): """ Tell if there's a node at the specified (path,rev) combination. """ try: self.get_node() return True except TracError: return False | 25,398 |
def has_node(self, path, rev): """ Tell if there's a node at the specified (path,rev) combination. """ try: self.get_node() return True except TracError: return False | def has_node(self, path, rev): """ Tell if there's a node at the specified (path,rev) combination. """ try: self.get_node(path, rev) return True except TracError: return False | 25,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.