rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self._render_view(req, db, id) | resp = self._render_view(req, db, id) if not resp: return None template, content_type = resp if content_type: return resp | def process_request(self, req): req.perm.assert_permission(perm.REPORT_VIEW) |
if start != 0 and end != 0: | if start != 0 or end != 0: | def _markup_intraline_change(fromlines, tolines): from trac.versioncontrol.diff import _get_change_extent for i in xrange(len(fromlines)): fr, to = fromlines[i], tolines[i] (start, end) = _get_change_extent(fr, to) if start != 0 and end != 0: fromlines[i] = fr[:start] + '\0' + fr[start:end+len(fr)] + \ '\1' + fr[end:] ... |
entry_point.load() | try: entry_point.load() except pkg_resources.DistributionNotFound, e: env.log.warning('Cannot load plugin %s because it ' 'requires "%s"', name, e) | def flatten(dists): for dist in dists: if dist in memo: continue memo.add(dist) try: predecessors = ws.resolve([dist.as_requirement()]) for predecessor in flatten(predecessors): yield predecessor yield dist except pkg_resources.DistributionNotFound, e: env.log.error('Skipping "%s" ("%s" not found)', dist, e) |
return 1 | if mimetype.startswith('text/'): return 1 return 0 | def get_quality_ratio(self, mimetype): return 1 |
if is_binary(content) or mimetype in TREAT_AS_BINARY: | if is_binary(content): | def render(self, req, mimetype, content, filename=None, rev=None): if is_binary(content) or mimetype in TREAT_AS_BINARY: self.env.log.debug("Binary data; no preview available") return |
directory = os.path.dirname(db_name) | directory = os.path.dirname(db_name) or os.curdir | def __init__(self, db_name, create=0): if not create and not os.access(db_name, os.F_OK): raise EnvironmentError, 'Database "%s" not found.' % db_name directory = os.path.dirname(db_name) if not create and not os.access(db_name, os.R_OK + os.W_OK) or \ not os.access(directory, os.R_OK + os.W_OK): tmp = db_name db_name... |
return '<span class="wiki-error">Macro %s(%s) failed: %s</span' \ | return '<span class="error">Macro %s(%s) failed: %s</span' \ | def _macro_formatter(self, match, fullmatch): name = fullmatch.group('macroname') if name in ['br', 'BR']: return '<br />' args = fullmatch.group('macroargs') try: macro = self.load_macro(name) return macro(self.hdf, args) except Exception, e: return '<span class="wiki-error">Macro %s(%s) failed: %s</span' \ % (name, a... |
ticket.update(Ticket(self.db, int(rest_id)).data) | ticket.update(Ticket(self.db, int(rest_id))) | def display_html(self, req, query): req.hdf['title'] = 'Custom Query' |
print "Initenv for '%s' failed.\nDoes an environment already exist?" % self.envname | print "Initenv for '%s' failed." % self.envname print "Does an environment already exist?" | def do_initenv(self, line): if self.env_check(): print "Initenv for '%s' failed.\nDoes an environment already exist?" % self.envname return arg = self.arg_tokenize(line) project_name = None db_str = None repository_dir = None templates_dir = None if len(arg) == 1: returnvals = self.get_initenv_args() project_name, db_s... |
if len(arg) == 1: | if len(arg) == 1 and not arg[0]: | def do_initenv(self, line): if self.env_check(): print "Initenv for '%s' failed.\nDoes an environment already exist?" % self.envname return arg = self.arg_tokenize(line) project_name = None db_str = None repository_dir = None templates_dir = None if len(arg) == 1: returnvals = self.get_initenv_args() project_name, db_s... |
elif len(arg)!= 3: print 'Wrong number of arguments to initenv %d' % len(arg) | elif len(arg) != 4: print 'Wrong number of arguments to initenv: %d' % len(arg) | def do_initenv(self, line): if self.env_check(): print "Initenv for '%s' failed.\nDoes an environment already exist?" % self.envname return arg = self.arg_tokenize(line) project_name = None db_str = None repository_dir = None templates_dir = None if len(arg) == 1: returnvals = self.get_initenv_args() project_name, db_s... |
project_name, db_str, repository_dir, templates_dir = arg[0:3] | project_name, db_str, repository_dir, templates_dir = arg[:4] | def do_initenv(self, line): if self.env_check(): print "Initenv for '%s' failed.\nDoes an environment already exist?" % self.envname return arg = self.arg_tokenize(line) project_name = None db_str = None repository_dir = None templates_dir = None if len(arg) == 1: returnvals = self.get_initenv_args() project_name, db_s... |
match = re.search('^/(ticket|report)(/([0-9]+)/*)?', path_info) | match = re.search('^/(ticket|report)(?:/([0-9]+)/*)?', path_info) | def set_if_missing(fs, name, value): if not fs.has_key(name): fs.list.append(cgi.MiniFieldStorage(name, value)) |
req.write(page.text) | req.write(req.hdf.getValue('wiki.page_source', '')) | def display_txt(self, req): req.send_response(200) req.send_header('Content-Type', 'text/plain;charset=utf-8') req.end_headers() req.write(page.text) |
repos = self.env.get_repository() | repos = self.env.get_repository(req.authname) | def render(self, req): rev = req.args.get('rev') path = req.args.get('path', '/') |
repos = self.env.get_repository() | repos = self.env.get_repository(req.authname) | def render(self, req): self.perm.assert_permission(perm.LOG_VIEW) |
max_diff_bytes = self.max_diff_bytes max_diff_files = self.max_diff_files diff_bytes = diff_files = 0 if max_diff_bytes or max_diff_files: for old_node, new_node, kind, change in get_changes(): if change == Changeset.EDIT and kind == Node.FILE: diff_files += 1 diff_bytes += _estimate_changes(old_node, new_node) show_di... | if req.perm.has_permission('FILE_VIEW'): diff_bytes = diff_files = 0 if self.max_diff_bytes or self.max_diff_files: for old_node, new_node, kind, change in get_changes(): if change == Changeset.EDIT and kind == Node.FILE: diff_files += 1 diff_bytes += _estimate_changes(old_node, new_node) show_diffs = (not self.max_dif... | def _content_changes(old_node, new_node): """Returns the list of differences. |
if change != Changeset.EDIT: show_entry = True else: | show_entry = True if change == Changeset.EDIT and \ req.perm.has_permission('FILE_VIEW'): | def _content_changes(old_node, new_node): """Returns the list of differences. |
if show_files: | if show_files and req.perm.has_permission('BROWSER_VIEW'): | def get_timeline_events(self, req, start, stop, filters): if 'changeset' in filters: format = req.args.get('format') wiki_format = self.wiki_format_messages show_files = self.timeline_show_files db = self.env.get_db_cnx() repos = self.env.get_repository(req.authname) for chgset in repos.get_changesets(start, stop): mes... |
util.sql_to_hdf(self.db, "SELECT name FROM milestone ORDER BY name", | util.sql_to_hdf(self.db, "SELECT name FROM milestone WHERE completed=0 " "ORDER BY name", | def render(self, req): self.perm.assert_permission(perm.TICKET_CREATE) |
if len(path_parts) > 1 and path_parts[1] == 'login': env_name = path_parts[0] | base_path = environ['trac.base_path'] if len(path_parts) > len(base_path)+1 and path_parts[len(base_path)+1] == 'login': env_name = path_parts[len(base_path)] | def handle_one_request(self): environ = self.setup_environ() path_info = environ.get('PATH_INFO', '') path_parts = filter(None, path_info.split('/')) if len(path_parts) > 1 and path_parts[1] == 'login': env_name = path_parts[0] if env_name: auth = self.server.auths.get(env_name, self.server.auths.get('*')) if not auth:... |
line = unicode(line, sys.stdin.encoding) | line = util.to_unicode(line, sys.stdin.encoding) | def onecmd(self, line): """`line` may be a `str` or an `unicode` object""" try: if isinstance(line, str): line = unicode(line, sys.stdin.encoding) rv = cmd.Cmd.onecmd(self, line) or 0 except SystemExit: raise except Exception, e: print>>sys.stderr, 'Command failed: %s' % e rv = 2 if not self.interactive: return rv |
if '\n' in fval: | if '\n' in str(fval): | def format_props(self): tkt = self.ticket tkt['id'] = '%s' % tkt['id'] t = self.modtime or tkt['time'] tkt['modified'] = time.strftime('%c', time.localtime(t)) fields = ['id', 'status', 'component', 'modified', 'severity', 'milestone', 'priority', 'version', 'owner', 'reporter'] fields.extend(filter(lambda... |
cursor.execute('CREATE SCHEMA %s' % cnx.schema) | cursor.execute('CREATE SCHEMA "%s"' % cnx.schema) | 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 ... |
+ ':' + '\\n'.join(re.split(r'[\r\n]+', value)) | + ':' + escape_value(value) | def write_prop(name, value, params={}): text = ';'.join([name] + [k + '=' + v for k, v in params.items()]) \ + ':' + '\\n'.join(re.split(r'[\r\n]+', value)) firstline = 1 while text: if not firstline: text = ' ' + text else: firstline = 0 req.write(text[:75] + CRLF) text = text[75:] |
'order': 0}, | 'order': 0, 'optional': False}, | def test_custom_field_select(self): self.env.config.set('ticket-custom', 'test', 'select') self.env.config.set('ticket-custom', 'test.label', 'Test') self.env.config.set('ticket-custom', 'test.value', '1') self.env.config.set('ticket-custom', 'test.options', 'option1|option2') fields = TicketSystem(self.env).get_custom... |
for path, change in editor.changes.items(): if not (_is_path_within_scope(self.scope, path) and \ self.authz.has_permission(path)): | for key_path, change in editor.changes.items(): if not (_is_path_within_scope(self.scope, key_path) and \ self.authz.has_permission(key_path)): | def get_changes(self): pool = Pool(self.pool) tmp = Pool(pool) root = fs.revision_root(self.fs_ptr, self.rev, pool()) editor = repos.RevisionChangeCollector(self.fs_ptr, self.rev, pool()) e_ptr, e_baton = delta.make_editor(editor, pool()) repos.svn_repos_replay(root, e_ptr, e_baton, pool()) |
deletions[base_path] = idx | deletions[key_path] = idx | def get_changes(self): pool = Pool(self.pool) tmp = Pool(pool) root = fs.revision_root(self.fs_ptr, self.rev, pool()) editor = repos.RevisionChangeCollector(self.fs_ptr, self.rev, pool()) e_ptr, e_baton = delta.make_editor(editor, pool()) repos.svn_repos_replay(root, e_ptr, e_baton, pool()) |
req.write('-- %s\n\n' % '\n-- '.join(row[1].splitlines())) | req.write('-- %s\n\n' % '\n-- '.join(description.splitlines())) | def _render_sql(self, req, id, title, description, sql): req.perm.assert_permission(perm.REPORT_SQL_VIEW) req.send_response(200) req.send_header('Content-Type', 'text/plain;charset=utf-8') req.end_headers() |
for row in rows] or None | for row in rows] or [] | def fetchmany(self, num): rows = sqlite.Cursor.fetchmany(self, num) return rows != None and [self._convert_row(row) for row in rows] or None |
for row in rows] or None | for row in rows] or [] | def fetchall(self): rows = sqlite.Cursor.fetchall(self) return rows != None and [self._convert_row(row) for row in rows] or None |
if not vals: | if type(vals) is ListType: vals = map(lambda x: x.value, filter(None, vals)) elif vals.value: vals = [vals.value] else: | def get_constraints(self): constraints = {} custom_fields = [f['name'] for f in get_custom_fields(self.env)] constrained_fields = [k for k in self.args.keys() if k in Ticket.std_fields or k in custom_fields] for field in constrained_fields: vals = self.args[field] if not vals: continue if type(vals) is ListType: for j ... |
if type(vals) is ListType: for j in range(len(vals)): vals[j] = vals[j].value else: vals = vals.value constraints[field] = vals; | constraints[field] = vals | def get_constraints(self): constraints = {} custom_fields = [f['name'] for f in get_custom_fields(self.env)] constrained_fields = [k for k in self.args.keys() if k in Ticket.std_fields or k in custom_fields] for field in constrained_fields: vals = self.args[field] if not vals: continue if type(vals) is ListType: for j ... |
self.req.hdf.setValue('title', 'Advanced Ticket Query') | self.req.hdf.setValue('title', 'Custom Query') | def _render_editor(self, constraints, order, desc): self.req.hdf.setValue('title', 'Advanced Ticket Query') util.add_to_hdf(constraints, self.req.hdf, 'query.constraints') |
def add_options(field, options, constraints, prefix): | self.req.hdf.setValue('query.order', order) if desc: self.req.hdf.setValue('query.desc', '1') def add_options(field, constraints, prefix, options): | def _render_editor(self, constraints, order, desc): self.req.hdf.setValue('title', 'Advanced Ticket Query') util.add_to_hdf(constraints, self.req.hdf, 'query.constraints') |
def add_db_options(field, db, sql, constraints, prefix): | def add_db_options(field, constraints, prefix, cursor, sql): | def add_db_options(field, db, sql, constraints, prefix): cursor.execute(sql) options = [] while 1: row = cursor.fetchone() if not row: break if row[0]: options.append({'name': row[0]}) add_options(field, options, constraints, prefix) |
add_options(field, options, constraints, prefix) add_options('status', [{'name': 'new'}, {'name': 'assigned'}, {'name': 'reopened'}, {'name': 'closed'}], constraints, 'query.options.') add_options('resolution', [{'name': 'fixed'}, {'name': 'invalid'}, {'name': 'wontfix'}, {'name': 'duplicate'}, {'name': 'worksforme'}]... | add_options(field, constraints, prefix, options) add_options('status', constraints, 'query.options.', [{'name': 'new'}, {'name': 'assigned'}, {'name': 'reopened'}, {'name': 'closed'}]) add_options('resolution', constraints, 'query.options.', [{'name': 'fixed'}, {'name': 'invalid'}, {'name': 'wontfix'}, {'name': 'dupli... | def add_db_options(field, db, sql, constraints, prefix): cursor.execute(sql) options = [] while 1: row = cursor.fetchone() if not row: break if row[0]: options.append({'name': row[0]}) add_options(field, options, constraints, prefix) |
add_db_options('component', cursor, 'SELECT name FROM component ORDER BY name', constraints, 'query.options.') add_db_options('milestone', cursor, 'SELECT name FROM milestone ORDER BY name', constraints, 'query.options.') add_db_options('version', cursor, 'SELECT name FROM version ORDER BY name', constraints, 'query.op... | add_db_options('component', constraints, 'query.options.', cursor, 'SELECT name FROM component ORDER BY name', ) add_db_options('milestone', constraints, 'query.options.', cursor, 'SELECT name FROM milestone ORDER BY name') add_db_options('version', constraints, 'query.options.', cursor, 'SELECT name FROM version ORDER... | def add_db_options(field, db, sql, constraints, prefix): cursor.execute(sql) options = [] while 1: row = cursor.fetchone() if not row: break if row[0]: options.append({'name': row[0]}) add_options(field, options, constraints, prefix) |
options = [option for option in custom['options'] if option] for i in range(len(options)): | for i in range(len(reduce(None, custom['options']))): | def add_db_options(field, db, sql, constraints, prefix): cursor.execute(sql) options = [] while 1: row = cursor.fetchone() if not row: break if row[0]: options.append({'name': row[0]}) add_options(field, options, constraints, prefix) |
for k in [k for k,v in constraints.items() if not type(v) is ListType]: self.req.hdf.setValue('query.%s' % k, constraints[k]) self.req.hdf.setValue('query.order', order) self.req.hdf.setValue('query.desc', str(desc)) | def add_db_options(field, db, sql, constraints, prefix): cursor.execute(sql) options = [] while 1: row = cursor.fetchone() if not row: break if row[0]: options.append({'name': row[0]}) add_options(field, options, constraints, prefix) | |
self.req.hdf.setValue('title', 'Advanced Ticket Query') | self.req.hdf.setValue('title', 'Custom Query') | def _render_results(self, constraints, order, desc): self.req.hdf.setValue('title', 'Advanced Ticket Query') self.req.hdf.setValue('query.edit_href', self.env.href.query(constraints, order, desc, action='edit')) |
if type(v) is ListType: | if len(v) > 1: | def _render_results(self, constraints, order, desc): self.req.hdf.setValue('title', 'Advanced Ticket Query') self.req.hdf.setValue('query.edit_href', self.env.href.query(constraints, order, desc, action='edit')) |
clause.append("%s LIKE '%%%s%%'" % (col, util.sql_escape(v))) else: clause.append("%s = '%s'" % (col, util.sql_escape(v))) | clause.append("%s LIKE '%%%s%%'" % (col, util.sql_escape(v[0]))) else: clause.append("%s = '%s'" % (col, util.sql_escape(v[0]))) | def _render_results(self, constraints, order, desc): self.req.hdf.setValue('title', 'Advanced Ticket Query') self.req.hdf.setValue('query.edit_href', self.env.href.query(constraints, order, desc, action='edit')) |
environ['PATH_INFO'] = request_uri[len(root_uri):] | environ['PATH_INFO'] = urllib.unquote(request_uri[len(root_uri):]) | 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',... |
order = self.args.get('order', 'priority') | order = self.args.get('order') | def render(self): self.perm.assert_permission(perm.TICKET_VIEW) |
if not action and not constraints: | if not (action or constraints or order or desc): | def render(self): self.perm.assert_permission(perm.TICKET_VIEW) |
self.req.hdf.setValue('query.order', order) | self.req.hdf.setValue('query.order', order or 'priority') | def _render_editor(self, constraints, order, desc): self.req.hdf.setValue('title', 'Custom Query') util.add_to_hdf(constraints, self.req.hdf, 'query.constraints') self.req.hdf.setValue('query.order', order) if desc: self.req.hdf.setValue('query.desc', '1') |
properties.append({'name': 'owner', 'type': 'text', 'label': 'Owner'}) | restrict_owner = self.config.get('ticket', 'restrict_owner', '') if restrict_owner.lower() in TRUE: usernames = [escape(u[0]) for u in self.env.get_known_users()] properties.append({'name': 'owner', 'type': 'select', 'label': 'Owner', 'options': usernames}) else: properties.append({'name': 'owner', 'type': 'text', 'lab... | def rows_to_list(sql): list = [] cursor.execute(sql) while 1: row = cursor.fetchone() if not row: break list.append(row[0]) return list |
raise ImportError, 'No module named ' + module_name | raise ImportError, 'No module named ' + head | def load_component(name, path=None, globals=None, locals=None): if '.' in name: i = name.find('.') head, tail = name[:i], name[i + 1:] else: head, tail = name, '' module = _load_module(head, head, None, path) if not module: raise ImportError, 'No module named ' + module_name while tail: i = tail.find('.') if i < 0: i... |
perms = {'resolve': 'TICKET_MODIFY', 'reassign': 'TICKET_CHGPROP', 'accept': 'TICKET_CHGPROP', 'reopen': 'TICKET_CREATE'} | perms = {'resolve': 'TICKET_MODIFY', 'reassign': 'TICKET_MODIFY', 'accept': 'TICKET_MODIFY', 'reopen': 'TICKET_CREATE'} | def get_available_actions(self, ticket, perm_): """Returns the actions that can be performed on the ticket.""" actions = { 'new': ['leave', 'resolve', 'reassign', 'accept'], 'assigned': ['leave', 'resolve', 'reassign' ], 'reopened': ['leave', 'resolve', 'reassign' ], 'closed': ['leave', ... |
users.append(username) | if perm.get_user_permissions(username).get('TICKET_MODIFY'): users.append(username) | def get_ticket_fields(self): """Returns the list of fields available for tickets.""" from trac.ticket import model |
if self.render_unsafe_content and not binary \ and format == 'txt': | if not mime_type or (self.render_unsafe_content and \ not binary and format == 'txt'): | def _render_view(self, req, attachment): perm_map = {'ticket': 'TICKET_VIEW', 'wiki': 'WIKI_VIEW'} req.perm.assert_permission(perm_map[attachment.parent_type]) |
def __init__(self, parent, parent_pool): | def __init__(self, parent, parent_pool=lambda: None): | 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.p... |
self.pool = core.svn_pool_create(parent_pool) | self.pool = core.svn_pool_create(parent_pool()) self.children = [] if parent_pool(): parent_pool.children.append(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.p... |
self.close() | self.close(None) | 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.p... |
return 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.p... | |
self.pool = Pool(self, None) | self.pool = Pool(self) | def __init__(self, path, authz, log): Repository.__init__(self, authz, log) |
self.fs_ptr, self.pool) | self.fs_ptr, self._pool) | def get_changeset(self, rev): return SubversionChangeset(int(rev), self.authz, self.scope, self.fs_ptr, self.pool) |
self.pool) | self._pool) | def get_node(self, path, rev=None): self.authz.assert_permission(self.scope + path) if path and path[-1] == '/': path = path[:-1] |
self.root = fs.revision_root(fs_ptr, rev, pool) | self.root = fs.revision_root(fs_ptr, rev, self.pool) | def __init__(self, path, rev, authz, scope, fs_ptr, pool): self.authz = authz self.scope = scope self.fs_ptr = fs_ptr self.pool = Pool(self, pool) self._requested_rev = rev |
self.rev = fs.node_created_rev(self.root, self.scope + path, pool) | self.rev = fs.node_created_rev(self.root, self.scope + path, self.pool) | def __init__(self, path, rev, authz, scope, fs_ptr, pool): self.authz = authz self.scope = scope self.fs_ptr = fs_ptr self.pool = Pool(self, pool) self._requested_rev = rev |
self.scope, self.fs_ptr, self.pool) | self.scope, self.fs_ptr, self._pool) | def get_entries(self): if self.isfile: return entries = fs.dir_entries(self.root, self.scope + self.path, self.pool) for item in entries.keys(): path = '/'.join((self.path, item)) if not self.authz.has_permission(path): continue yield SubversionNode(path, self._requested_rev, self.authz, self.scope, self.fs_ptr, self.p... |
req.hdf['settings'] = req.session.data | req.hdf['settings'] = req.session | def render(self, req): action = req.args.get('action') if action == 'save': self.save_settings(req) elif action == 'load': self.load_session(req) elif action == 'login': req.redirect(self.env.href.login()) elif action == 'newsession': raise TracError, 'new session' |
def setup_config(self): | def setup_config(self, load_defaults=None): | def setup_config(self): self.config = Configuration(None) |
if tkt.get('description'): | if tkt.values.get('description'): | def parse(self, fp): msg = email.message_from_file(fp) tkt = Ticket(self.env) tkt['status'] = 'new' tkt['reporter'] = msg['from'] tkt['summary'] = msg['subject'] for part in msg.walk(): if part.get_content_type() == 'text/plain': tkt['description'] = part.get_payload(decode=1).strip() |
heading, depth)) | wiki_to_oneliner(heading, self.env, self._db, self._absurls), depth)) | def _heading_formatter(self, match, fullmatch): match = match.strip() self.close_table() self.close_paragraph() self.close_indentation() self.close_list() self.close_def_list() |
users += [username, 'autenticated'] | users += [username, 'authenticated'] | def __init__(self, db, username): self.perm_cache = {} cursor = db.cursor() cursor.execute ("SELECT username, action FROM permission") result = cursor.fetchall() |
for i in range(len(reduce(None, custom['options']))): | options = filter(None, custom['options']) for i in range(len(options)): | def add_db_options(field, constraints, prefix, cursor, sql): cursor.execute(sql) options = [] while 1: row = cursor.fetchone() if not row: break if row[0]: options.append({'name': row[0]}) add_options(field, constraints, prefix, options) |
args = text.split(":",1) language = args[0] if len(args)==2: text = args[1] else: text = "" | language = options.get('language') if not language: args = text.split(':', 1) language = args[0] if len(args) == 2: text = args[1] else: text = '' | def code_role(name, rawtext, text, lineno, inliner, options={}, content=[]): args = text.split(":",1) language = args[0] if len(args)==2: text = args[1] else: text = "" reference = code_formatter(language, text) return [reference], [] |
code_block.options = { | code_role.options = code_block.options = { | def code_block(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """ Create a code-block directive for docutils. |
message = wiki_to_oneliner(message, self.env, db, shorten=True) | if self.timeline_long_messages: message = wiki_to_html(message, self.env, req, db, absurls=True) else: message = wiki_to_oneliner(message, self.env, db, shorten=True) | def get_timeline_events(self, req, start, stop, filters): if 'changeset' in filters: format = req.args.get('format') wiki_format = self.wiki_format_messages show_files = self.timeline_show_files db = self.env.get_db_cnx() repos = self.env.get_repository(req.authname) for chgset in repos.get_changesets(start, stop): mes... |
filtr.writeline('header %s version %d | %s version %d header' % | filtr.writeline('header %s version %d | %s version %d redaeh' % | def generate_diff(self, pagename, version): from Changeset import DiffColorizer cursor = self.db.cursor () cursor.execute ('SELECT text FROM wiki ' 'WHERE name=%s AND (version=%s or version=%s)' 'ORDER BY version ASC', pagename, version - 1, version) res = cursor.fetchall() if (len(res) == 1): old = '' new = res[0][0].... |
req.perm.assert_permission('WIKI_VIEW') | def _render_view(self, req, db, page): req.perm.assert_permission('WIKI_VIEW') | |
sql.append("SELECT time,id,'','new',summary,reporter" | sql.append("SELECT time,id,'','new',summary,reporter,summary" | def get_timeline_events(self, req, start, stop, filters): if 'ticket' in filters: absurls = req.args.get('format') == 'rss' # Kludge sql = [] |
sql.append("SELECT t1.time,t1.ticket,'','reopened',t2.newvalue,t1.author " | sql.append("SELECT t1.time,t1.ticket,'','reopened',t2.newvalue, " " t1.author,t.summary " | def get_timeline_events(self, req, start, stop, filters): if 'ticket' in filters: absurls = req.args.get('format') == 'rss' # Kludge sql = [] |
"t3.newvalue,t1.author" | " t3.newvalue,t1.author,t.summary" | def get_timeline_events(self, req, start, stop, filters): if 'ticket' in filters: absurls = req.args.get('format') == 'rss' # Kludge sql = [] |
for t,id,resolution,type,message,author in cursor: | for t,id,resolution,type,message,author,summary in cursor: | def get_timeline_events(self, req, start, stop, filters): if 'ticket' in filters: absurls = req.args.get('format') == 'rss' # Kludge sql = [] |
title = 'Ticket <em> id, verbs[type], util.escape(author)) | title = 'Ticket <em title="%s"> util.escape(summary), id, verbs[type], util.escape(author)) | def get_timeline_events(self, req, start, stop, filters): if 'ticket' in filters: absurls = req.args.get('format') == 'rss' # Kludge sql = [] |
cursor.execute("SELECT tc.time, tc.ticket, " " tc.field, tc.oldvalue, tc.newvalue, tc.author " | cursor.execute("SELECT tc.time,tc.ticket,tc.field, " " tc.oldvalue,tc.newvalue,tc.author,t.summary " | def get_timeline_events(self, req, start, stop, filters): if 'ticket_details' in filters: db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT tc.time, tc.ticket, " " tc.field, tc.oldvalue, tc.newvalue, tc.author " "FROM ticket_change tc" " LEFT JOIN ticket t ON t.id = tc.ticket " "AND tc.time... |
for time,id,field,oldvalue,newvalue,author in cursor: | for time,id,field,oldvalue,newvalue,author,summary in cursor: this_summary = summary | def get_timeline_events(self, req, start, stop, filters): if 'ticket_details' in filters: db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT tc.time, tc.ticket, " " tc.field, tc.oldvalue, tc.newvalue, tc.author " "FROM ticket_change tc" " LEFT JOIN ticket t ON t.id = tc.ticket " "AND tc.time... |
updates.append((previous_update,field_changes,comment)) | updates.append((previous_update,field_changes,comment, this_summary)) | def get_timeline_events(self, req, start, stop, filters): if 'ticket_details' in filters: db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT tc.time, tc.ticket, " " tc.field, tc.oldvalue, tc.newvalue, tc.author " "FROM ticket_change tc" " LEFT JOIN ticket t ON t.id = tc.ticket " "AND tc.time... |
for (t,id,author),field_changes,comment in updates: | for (t,id,author),field_changes,comment,summary in updates: | def get_timeline_events(self, req, start, stop, filters): if 'ticket_details' in filters: db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT tc.time, tc.ticket, " " tc.field, tc.oldvalue, tc.newvalue, tc.author " "FROM ticket_change tc" " LEFT JOIN ticket t ON t.id = tc.ticket " "AND tc.time... |
title = 'Ticket <em> % (id, util.escape(author)) | title = 'Ticket <em title="%s"> % (util.escape(summary), id, util.escape(author)) | def get_timeline_events(self, req, start, stop, filters): if 'ticket_details' in filters: db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT tc.time, tc.ticket, " " tc.field, tc.oldvalue, tc.newvalue, tc.author " "FROM ticket_change tc" " LEFT JOIN ticket t ON t.id = tc.ticket " "AND tc.time... |
def print_doc(self, doc, decor=False): if not doc: return self.print_listing(['Command', 'Description'], doc, ' --', decor) | def print_doc(self, docs): if not docs: return for cmd, doc in docs: print cmd print '\n\t-- %s\n' % doc | def print_doc(self, doc, decor=False): if not doc: return self.print_listing(['Command', 'Description'], doc, ' --', decor) |
self.authz.assert_permission(os.path.join(self.scope, path)) | self.authz.assert_permission(posixpath.join(self.scope, path)) | def get_node(self, path, rev=None): self.authz.assert_permission(os.path.join(self.scope, path)) if path and path[-1] == '/': path = path[:-1] |
event = {'kind': kind, 'title': title, 'author': author, 'href': href, 'time': time.strftime('%H:%M', t), 'date': time.strftime('%x', t), 'message': message} | event = {'kind': kind, 'title': title, 'author': author or 'anonymous', 'href': href, 'date': time.strftime('%x', t), 'time': time.strftime('%H:%M', t), 'message': message} | def process_request(self, req): req.perm.assert_permission(perm.TIMELINE_VIEW) |
if author.find('@') != -1: event['author.email'] = author elif author in email_map.keys(): event['author.email'] = email_map[author] | if author: if author.find('@') != -1: event['author.email'] = author elif author in email_map.keys(): event['author.email'] = email_map[author] | def process_request(self, req): req.perm.assert_permission(perm.TIMELINE_VIEW) |
if idx > 0: | if idx + 1 < len(self.history): | def previous_rev(self, rev): rev = int(rev) if rev == 0: return None if self.scope == '/': return rev - 1 idx = self.history.index(rev) if idx > 0: return self.history[idx + 1] return None |
ldepth = len(fullmatch.group('ldepth').replace('\t', ' '*8)) match = match.replace('\t', ' '*8) | ldepth = len(fullmatch.group('ldepth')) match = match | def _list_formatter(self, match, fullmatch): ldepth = len(fullmatch.group('ldepth').replace('\t', ' '*8)) match = match.replace('\t', ' '*8) listid = match[ldepth] self.in_list_item = True class_ = start = None if listid in '-*': type_ = 'ul' else: type_ = 'ol' idx = '01iI'.find(listid) if idx >= 0: class_ = ('arabicze... |
idepth = len(fullmatch.group('idepth').replace('\t', ' '*8)) | idepth = len(fullmatch.group('idepth')) | def _indent_formatter(self, match, fullmatch): idepth = len(fullmatch.group('idepth').replace('\t', ' '*8)) if self._list_stack: ltype, ldepth = self._list_stack[-1] if idepth < ldepth: for _, ldepth in self._list_stack: if idepth > ldepth: self.in_list_item = True self._set_list_depth(idepth, None, None, None) return ... |
if depth > 0: self.in_quote = True | def _set_quote_depth(self, depth): if depth > 0: self.in_quote = True def open_quote(depth): self.close_table() self.close_paragraph() self.close_list() def open_one_quote(d): self._quote_stack.append(d) self.out.write('<blockquote>' + os.linesep) open_one_quote(depth) def close_quote(): self.close_table() self.close_p... | |
if depth > self._get_quote_depth(): open_quote(depth) | quote_depth = self._get_quote_depth() if depth > quote_depth: self._set_tab(depth) tabstops = self._tabstops[::-1] while tabstops: tab = tabstops.pop() if tab > quote_depth: open_quote(tab) | def close_quote(): self.close_table() self.close_paragraph() self._quote_stack.pop() self.out.write('</blockquote>' + os.linesep) |
sql = 'SELECT ' + ', '.join(['ticket.%s AS %s' % (header, header) for header in headers]) | def _render_results(self, constraints, order, desc): self.req.hdf.setValue('title', 'Custom Query') self.req.hdf.setValue('query.edit_href', self.env.href.query(constraints, order, desc, action='edit')) | |
if [k for k in constraints.keys() if k in custom_fields]: sql += ", ticket_custom.name AS name, " \ "ticket_custom.value AS value " \ "FROM ticket LEFT OUTER JOIN ticket_custom ON id = ticket" else: sql += " FROM ticket" sql += " INNER JOIN (SELECT name AS priority_name, value AS priority_value " \ " FROM e... | for k in [k for k in constraints.keys() if k in custom_fields]: sql.append(", %s.value AS %s" % (k, k)) sql.append(" FROM ticket") for k in [k for k in constraints.keys() if k in custom_fields]: sql.append(" LEFT OUTER JOIN ticket_custom AS %s ON " \ "(id=%s.ticket AND %s.name='%s')" % (k, k, k, k)) for col in [c for ... | def _render_results(self, constraints, order, desc): self.req.hdf.setValue('title', 'Custom Query') self.req.hdf.setValue('query.edit_href', self.env.href.query(constraints, order, desc, action='edit')) |
clause = [] col = k if not col in Ticket.std_fields: col = 'value' | def _render_results(self, constraints, order, desc): self.req.hdf.setValue('title', 'Custom Query') self.req.hdf.setValue('query.edit_href', self.env.href.query(constraints, order, desc, action='edit')) | |
clause.append("%s IN (%s)" % (col, ", ".join(inlist))) | clauses.append("%s IN (%s)" % (k, ",".join(inlist))) | def _render_results(self, constraints, order, desc): self.req.hdf.setValue('title', 'Custom Query') self.req.hdf.setValue('query.edit_href', self.env.href.query(constraints, order, desc, action='edit')) |
clause.append("%s LIKE '%%%s%%'" % (col, util.sql_escape(v[0]))) else: clause.append("%s = '%s'" % (col, util.sql_escape(v[0]))) if not k in Ticket.std_fields: clauses.append("(name='%s' AND (" % k + " OR ".join(clause) + "))") else: clauses.append(" OR ".join(clause)) | clauses.append("%s LIKE '%%%s%%'" % (k, util.sql_escape(v[0]))) else: clauses.append("%s='%s'" % (k, util.sql_escape(v[0]))) | def _render_results(self, constraints, order, desc): self.req.hdf.setValue('title', 'Custom Query') self.req.hdf.setValue('query.edit_href', self.env.href.query(constraints, order, desc, action='edit')) |
sql += " WHERE " + " AND ".join(clauses) if order in ['priority', 'severity']: sql += " ORDER BY %s_value" % order | sql.append(" WHERE " + " AND ".join(clauses)) if order in ['status', 'resolution', 'priority', 'severity']: sql.append(" ORDER BY %s_value" % order) | def _render_results(self, constraints, order, desc): self.req.hdf.setValue('title', 'Custom Query') self.req.hdf.setValue('query.edit_href', self.env.href.query(constraints, order, desc, action='edit')) |
sql += " ORDER BY " + order | sql.append(" ORDER BY " + order) | def _render_results(self, constraints, order, desc): self.req.hdf.setValue('title', 'Custom Query') self.req.hdf.setValue('query.edit_href', self.env.href.query(constraints, order, desc, action='edit')) |
sql += " DESC" | sql.append(" DESC") sql = "".join(sql) | def _render_results(self, constraints, order, desc): self.req.hdf.setValue('title', 'Custom Query') self.req.hdf.setValue('query.edit_href', self.env.href.query(constraints, order, desc, action='edit')) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.