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:] tolines[i] = to[:start] + '\0' + to[start:end+len(to)] + \ '\1' + to[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 = None raise EnvironmentError, \ 'The web server user requires read _and_ write permission\n' \ 'to the database %s and the directory this file is located in.' % tmp self.db_name = db_name sqlite.Connection.__init__(self, db_name, timeout=10000)
|
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, args, e)
|
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_str, repository_dir, templates_dir = returnvals elif len(arg)!= 3: print 'Wrong number of arguments to initenv %d' % len(arg) return else: project_name, db_str, repository_dir, templates_dir = arg[0:3]
|
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_str, repository_dir, templates_dir = returnvals elif len(arg)!= 3: print 'Wrong number of arguments to initenv %d' % len(arg) return else: project_name, db_str, repository_dir, templates_dir = arg[0:3]
|
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_str, repository_dir, templates_dir = returnvals elif len(arg)!= 3: print 'Wrong number of arguments to initenv %d' % len(arg) return else: project_name, db_str, repository_dir, templates_dir = arg[0:3]
|
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_str, repository_dir, templates_dir = returnvals elif len(arg)!= 3: print 'Wrong number of arguments to initenv %d' % len(arg) return else: project_name, db_str, repository_dir, templates_dir = arg[0:3]
|
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_diffs = (not max_diff_files or diff_files <= max_diff_files) and \ (not max_diff_bytes or diff_bytes <= max_diff_bytes or \ diff_files == 1)
|
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_diff_files or \ diff_files <= self.max_diff_files) and \ (not self.max_diff_bytes or \ diff_bytes <= self.max_diff_bytes or \ diff_files == 1) else: show_diffs = False
|
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): message = chgset.message or '--' if wiki_format: shortlog = wiki_to_oneliner(message, self.env, db, shorten=True) else: shortlog = shorten_line(message)
|
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: self.send_error(500, 'Authentication not enabled for %s. ' 'Please use the tracd --auth option.' % env_name) return remote_user = auth.do_auth(self) if not remote_user: return environ['REMOTE_USER'] = remote_user
|
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 f: f.startswith('custom_'), self.ticket.keys())) i = 1 width = [0,0,0,0] for f in fields: if not tkt.has_key(f) or str(tkt[f]).find('\n') > -1: continue fname = f.startswith('custom_') and f[7:] or f idx = 2*(i % 2) if len(fname) > width[idx]: width[idx] = len(fname) if len(tkt[f]) > width[idx+1]: width[idx+1] = len(tkt[f]) i += 1 format = (' %%%is: %%-%is%s' % (width[0], width[1], CRLF), '%%%is: %%-%is | ' % (width[2], width[3])) i = 1 l = (width[2] + width[3] + 5) sep = l*'-' + '+' + (self.COLS-l)*'-' txt = sep + CRLF big=[] for f in fields: if not tkt.has_key(f): continue fval = tkt[f] fname = f.startswith('custom_') and f[7:] or f if '\n' in fval: big.append((fname.capitalize(), fval)) else: txt += format[i%2] % (fname.capitalize(), fval) i += 1 if i % 2 == 0: txt += '\n' if big: txt += sep for k,v in big: txt += '\n%s:\n%s\n\n' % (k,v) txt += sep return txt
|
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 schema for table in schema: for stmt in self.to_sql(table): cursor.execute(stmt) cnx.commit()
|
+ ':' + '\\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_fields() self.assertEqual({'name': 'test', 'type': 'select', 'label': 'Test', 'value': '1', 'options': ['option1', 'option2'], 'order': 0}, fields[0])
|
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 in range(len(vals)): vals[j] = vals[j].value else: vals = vals.value constraints[field] = vals; return constraints
|
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 in range(len(vals)): vals[j] = vals[j].value else: vals = vals.value constraints[field] = vals; return constraints
|
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'}], constraints, 'query.options.')
|
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': 'duplicate'}, {'name': 'worksforme'}])
|
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.options.') add_db_options('priority', cursor, 'SELECT name FROM enum WHERE type=\'priority\'', constraints, 'query.options.') add_db_options('severity', cursor, 'SELECT name FROM enum WHERE type=\'severity\'', constraints, 'query.options.')
|
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 BY name') add_db_options('priority', constraints, 'query.options.', cursor, 'SELECT name FROM enum WHERE type=\'priority\'') add_db_options('severity', constraints, 'query.options.', cursor, 'SELECT name FROM enum WHERE type=\'severity\'')
|
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', options.get('TracEnv')) environ.setdefault('trac.env_parent_dir', options.get('TracEnvParentDir')) environ.setdefault('trac.env_index_template', options.get('TracEnvIndexTemplate')) environ.setdefault('trac.template_vars', options.get('TracTemplateVars')) environ.setdefault('trac.locale', options.get('TracLocale')) if 'TracUriRoot' in options: # Special handling of SCRIPT_NAME/PATH_INFO for mod_python, which # tends to get confused for whatever reason root_uri = options['TracUriRoot'].rstrip('/') request_uri = environ['REQUEST_URI'].split('?', 1)[0] if not request_uri.startswith(root_uri): raise ValueError('TracUriRoot set to %s but request URL ' 'is %s' % (root_uri, request_uri)) environ['SCRIPT_NAME'] = root_uri environ['PATH_INFO'] = request_uri[len(root_uri):] else: environ.setdefault('trac.env_path', os.getenv('TRAC_ENV')) environ.setdefault('trac.env_parent_dir', os.getenv('TRAC_ENV_PARENT_DIR')) environ.setdefault('trac.env_index_template', os.getenv('TRAC_ENV_INDEX_TEMPLATE')) environ.setdefault('trac.template_vars', os.getenv('TRAC_TEMPLATE_VARS')) environ.setdefault('trac.locale', '') locale.setlocale(locale.LC_ALL, environ['trac.locale']) # Allow specifying the python eggs cache directory using SetEnv if 'mod_python.subprocess_env' in environ: egg_cache = environ['mod_python.subprocess_env'].get('PYTHON_EGG_CACHE') if egg_cache: os.environ['PYTHON_EGG_CACHE'] = egg_cache # Determine the environment env_path = environ.get('trac.env_path') if not env_path: env_parent_dir = environ.get('trac.env_parent_dir') env_paths = environ.get('trac.env_paths') if env_parent_dir or env_paths: # The first component of the path is the base name of the # environment path_info = environ.get('PATH_INFO', '').lstrip('/').split('/') env_name = path_info.pop(0) if not env_name: # No specific environment requested, so render an environment # index page send_project_index(environ, start_response, env_parent_dir, env_paths) return [] # To make the matching patterns of request handlers work, we append # the environment name to the `SCRIPT_NAME` variable, and keep only # the remaining path in the `PATH_INFO` variable. environ['SCRIPT_NAME'] = Href(environ['SCRIPT_NAME'])(env_name) environ['PATH_INFO'] = '/'.join([''] + path_info) if env_parent_dir: env_path = os.path.join(env_parent_dir, env_name) else: env_path = get_environments(environ).get(env_name) if not env_path or not os.path.isdir(env_path): start_response('404 Not Found', []) return ['Environment not found'] if not env_path: raise EnvironmentError('The environment options "TRAC_ENV" or ' '"TRAC_ENV_PARENT_DIR" or the mod_python ' 'options "TracEnv" or "TracEnvParentDir" are ' 'missing. Trac requires one of these options ' 'to locate the Trac environment(s).') env = _open_environment(env_path, run_once=environ['wsgi.run_once']) base_url = env.config.get('trac', 'base_url') if base_url: environ['trac.base_url'] = base_url req = Request(environ, start_response) try: db = env.get_db_cnx() try: try: dispatcher = RequestDispatcher(env) dispatcher.dispatch(req) except RequestDone: pass return req._response or [] finally: db.close() except HTTPException, e: env.log.warn(e) if req.hdf: req.hdf['title'] = e.reason or 'Error' req.hdf['error'] = { 'title': e.reason or 'Error', 'type': 'TracError', 'message': e.message } try: req.send_error(sys.exc_info(), status=e.code) except RequestDone: return [] except Exception, e: env.log.exception(e) import traceback from StringIO import StringIO tb = StringIO() traceback.print_exc(file=tb) if req.hdf: req.hdf['title'] = str(e) or 'Error' req.hdf['error'] = { 'title': str(e) or 'Error', 'type': 'internal', 'traceback': tb.getvalue() } try: req.send_error(sys.exc_info(), status=500) except RequestDone: return []
|
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', 'label': 'Owner'})
|
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 = len(tail) head, tail = tail[:i], tail[i + 1:] module_name = '%s.%s' % (module.__name__, head) module = _load_module(head, module_name, module, path) if not module: raise ImportError, 'No module named ' + module_name
|
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', 'reopen'] } perms = {'resolve': 'TICKET_MODIFY', 'reassign': 'TICKET_CHGPROP', 'accept': 'TICKET_CHGPROP', 'reopen': 'TICKET_CREATE'} return [action for action in actions.get(ticket['status'], ['leave']) if action not in perms or perm_.has_permission(perms[action])]
|
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.pool = core.svn_pool_create(parent_pool) try: parent._pool_closer = weakref.ref(parent, self.close) except TypeError: self.close() raise return self
|
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.pool = core.svn_pool_create(parent_pool) try: parent._pool_closer = weakref.ref(parent, self.close) except TypeError: self.close() raise return self
|
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.pool = core.svn_pool_create(parent_pool) try: parent._pool_closer = weakref.ref(parent, self.close) except TypeError: self.close() raise return self
|
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.pool = core.svn_pool_create(parent_pool) try: parent._pool_closer = weakref.ref(parent, self.close) except TypeError: self.close() raise return self
|
|
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.pool)
|
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): message = chgset.message or '--' if wiki_format: shortlog = wiki_to_oneliner(message, self.env, db, shorten=True) else: shortlog = util.shorten_line(message)
|
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].splitlines() elif (len(res) == 2): old = res[0][0].splitlines() new = res[1][0].splitlines() else: raise TracError('Version %d of page "%s" not found.' % (version, pagename), 'Page Not Found') filtr = DiffColorizer(self.req.hdf, 'wiki.diff') filtr.writeline('header %s version %d | %s version %d header' % (pagename, version - 1, pagename, version)) try: for line in difflib.Differ().compare(old, new): if line != ' ': filtr.writeline(escape(line)) except AttributeError: raise TracError('Python >= 2.2 is required for diff support.') filtr.close()
|
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>=%s AND tc.time<=%s ORDER BY tc.time" % (start, stop)) previous_update = None updates = [] for time,id,field,oldvalue,newvalue,author in cursor: if (time,id,author) != previous_update: if previous_update: updates.append((previous_update,field_changes,comment)) field_changes = [] comment = '' previous_update = (time,id,author) if field == 'comment': comment = newvalue else: field_changes.append(field) if previous_update: updates.append((previous_update,field_changes,comment))
|
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>=%s AND tc.time<=%s ORDER BY tc.time" % (start, stop)) previous_update = None updates = [] for time,id,field,oldvalue,newvalue,author in cursor: if (time,id,author) != previous_update: if previous_update: updates.append((previous_update,field_changes,comment)) field_changes = [] comment = '' previous_update = (time,id,author) if field == 'comment': comment = newvalue else: field_changes.append(field) if previous_update: updates.append((previous_update,field_changes,comment))
|
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>=%s AND tc.time<=%s ORDER BY tc.time" % (start, stop)) previous_update = None updates = [] for time,id,field,oldvalue,newvalue,author in cursor: if (time,id,author) != previous_update: if previous_update: updates.append((previous_update,field_changes,comment)) field_changes = [] comment = '' previous_update = (time,id,author) if field == 'comment': comment = newvalue else: field_changes.append(field) if previous_update: updates.append((previous_update,field_changes,comment))
|
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>=%s AND tc.time<=%s ORDER BY tc.time" % (start, stop)) previous_update = None updates = [] for time,id,field,oldvalue,newvalue,author in cursor: if (time,id,author) != previous_update: if previous_update: updates.append((previous_update,field_changes,comment)) field_changes = [] comment = '' previous_update = (time,id,author) if field == 'comment': comment = newvalue else: field_changes.append(field) if previous_update: updates.append((previous_update,field_changes,comment))
|
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>=%s AND tc.time<=%s ORDER BY tc.time" % (start, stop)) previous_update = None updates = [] for time,id,field,oldvalue,newvalue,author in cursor: if (time,id,author) != previous_update: if previous_update: updates.append((previous_update,field_changes,comment)) field_changes = [] comment = '' previous_update = (time,id,author) if field == 'comment': comment = newvalue else: field_changes.append(field) if previous_update: updates.append((previous_update,field_changes,comment))
|
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_ = ('arabiczero', None, 'lowerroman', 'upperroman')[idx] elif listid.isdigit(): start = match[ldepth:match.find('.')] elif listid.islower(): class_ = 'loweralpha' elif listid.isupper(): class_ = 'upperalpha' self._set_list_depth(ldepth, type_, class_, start) return ''
|
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 '' elif idepth <= ldepth + (ltype == 'ol' and 3 or 2): self.in_list_item = True return '' if not self.in_def_list: self._set_quote_depth(idepth) 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_paragraph() self._quote_stack.pop() self.out.write('</blockquote>' + os.linesep) if depth > self._get_quote_depth(): open_quote(depth) else: while self._quote_stack: deepest_offset = self._quote_stack[-1] if depth >= deepest_offset: break close_quote() if depth > 0: if self._quote_stack: old_offset = self._quote_stack[-1] if old_offset != depth: # adjust last depth self._quote_stack[-1] = depth else: open_quote(depth)
|
|
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 enum WHERE type = 'priority') AS p" \ " ON priority_name = priority"
|
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 c in ['status', 'resolution', 'priority', 'severity'] if c in cols]: sql.append(" INNER JOIN (SELECT name AS %s_name, value AS %s_value " \ "FROM enum WHERE type='%s')" \ " ON %s_name=%s" % (col, col, col, col, col))
|
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.