bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def get_reports(db): owner = db.concat('owner', "' *'") return (
def get_reports(db): owner = db.concat('owner', "' *'") return (
26,500
def get_reports(db): owner = db.concat('owner', "' *'") return (
def get_reports(db): owner = db.concat('owner', "' *'") return (
26,501
def render(self, context, mimetype, content, filename=None, rev=None): # -n to ignore php.ini so we're using default colors cmdline = '%s -sn' % self.path self.env.log.debug("PHP command line: %s" % cmdline)
def render(self, context, mimetype, content, filename=None, rev=None): # -n to ignore php.ini so we're using default colors cmdline = '%s -sn' % self.path self.env.log.debug("PHP command line: %s" % cmdline)
26,502
def is_binary(str): """Detect binary content by checking the first thousand bytes for zeroes.""" if detect_unicode(str): return False for i in range(0, min(len(str), 1000)): if str[i] == '\0': return True return False
def is_binary(str): """Detect binary content by checking the first thousand bytes for zeroes.""" if detect_unicode(str): return False return '\0' in str[:1000]
26,503
def get_quality_ratio(self, mimetype): if mimetype.startswith('text/'): return 1 return 0
def get_quality_ratio(self, mimetype): if mimetype.startswith('text/'): return 1 return 0
26,504
def render(self, req, mimetype, content, filename=None, rev=None): try: from docutils import nodes from docutils.core import publish_string from docutils.parsers import rst from docutils import __version__ except ImportError: raise TracError, 'Docutils not found' if StrictVersion(__version__) < StrictVersion('0.3.3'): ...
def render(self, req, mimetype, content, filename=None, rev=None): try: from docutils import nodes from docutils.core import publish_string from docutils.parsers import rst from docutils import __version__ except ImportError: raise TracError, 'Docutils not found' if StrictVersion(__version__) < StrictVersion('0.3.9'): ...
26,505
def render(self, req, mimetype, content, filename=None, rev=None): try: from docutils import nodes from docutils.core import publish_string from docutils.parsers import rst from docutils import __version__ except ImportError: raise TracError, 'Docutils not found' if StrictVersion(__version__) < StrictVersion('0.3.3'): ...
def render(self, req, mimetype, content, filename=None, rev=None): try: from docutils import nodes from docutils.core import publish_string from docutils.parsers import rst from docutils import __version__ except ImportError: raise TracError, 'Docutils not found' if StrictVersion(__version__) < StrictVersion('0.3.3'): ...
26,506
def code_block(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """ Create a code-block directive for docutils.
def code_block(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """ Create a code-block directive for docutils.
26,507
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))
26,508
def _mark_weakpool_invalid(weakpool): if weakpool(): weakpool()._mark_invalid()
def _mark_weakpool_invalid(weakpool): if weakpool(): weakpool()._mark_invalid()
26,509
def add_directory(self, path, parent_baton, copyfrom_path, copyfrom_revision, dir_pool): self.cursor.execute('INSERT INTO node_change (rev, name, change) ' 'VALUES (%s, %s, \'A\')', self.rev, path) return [None, path, dir_pool]
def add_directory(self, path, parent_baton, copyfrom_path, copyfrom_revision, dir_pool): self.cursor.execute('INSERT INTO node_change (rev, name, change) ' 'VALUES (%s, %s, \'A\')', self.rev, path) return [None, path, dir_pool]
26,510
def export_rss(self, req, ticket): db = self.env.get_db_cnx() changelog = ticket.get_changelog(db=db) curr_author = None curr_date = 0 changes = [] change_summary = {}
def export_rss(self, req, ticket): db = self.env.get_db_cnx() changes = [] change_summary = {}
26,511
def update_title(): if not changes: return title = '; '.join(['%s %s' % (', '.join(v), k) for k, v in change_summary.iteritems()]) changes[-1]['title'] = title
def update_title(): if not changes: return title = '; '.join(['%s %s' % (', '.join(v), k) for k, v in change_summary.iteritems()]) changes[-1]['title'] = title
26,512
def update_title(): if not changes: return title = '; '.join(['%s %s' % (', '.join(v), k) for k, v in change_summary.iteritems()]) changes[-1]['title'] = title
def update_title(): if not changes: return title = '; '.join(['%s %s' % (', '.join(v), k) for k, v in change_summary.iteritems()]) changes[-1]['title'] = title
26,513
def quote_original(author, original, link): if not 'comment' in req.args: # i.e. the comment was not yet edited req.hdf['ticket.comment'] = '\n'.join( ['Replying to [%s %s]:' % (link, author)] + ['> %s' % line for line in original.splitlines()] + [''])
def quote_original(author, original, link): if not 'comment' in req.args: # i.e. the comment was not yet edited req.hdf['ticket.comment'] = '\n'.join( ['Replying to [%s %s]:' % (link, author)] + ['> %s' % line for line in original.splitlines()] + [''])
26,514
def quote_original(author, original, link): if not 'comment' in req.args: # i.e. the comment was not yet edited req.hdf['ticket.comment'] = '\n'.join( ['Replying to [%s %s]:' % (link, author)] + ['> %s' % line for line in original.splitlines()] + [''])
def quote_original(author, original, link): if not 'comment' in req.args: # i.e. the comment was not yet edited req.hdf['ticket.comment'] = '\n'.join( ['Replying to [%s %s]:' % (link, author)] + ['> %s' % line for line in original.splitlines()] + [''])
26,515
def quote_original(author, original, link): if not 'comment' in req.args: # i.e. the comment was not yet edited req.hdf['ticket.comment'] = '\n'.join( ['Replying to [%s %s]:' % (link, author)] + ['> %s' % line for line in original.splitlines()] + [''])
def quote_original(author, original, link): if not 'comment' in req.args: # i.e. the comment was not yet edited req.hdf['ticket.comment'] = '\n'.join( ['Replying to [%s %s]:' % (link, author)] + ['> %s' % line for line in original.splitlines()] + [''])
26,516
def process_request(self, req): path = req.args.get('path', '/') rev = req.args.get('rev')
def process_request(self, req): path = req.args.get('path', '/') rev = req.args.get('rev')
26,517
def process_request(self, req): path = req.args.get('path', '/') rev = req.args.get('rev')
def process_request(self, req): path = req.args.get('path', '/') rev = req.args.get('rev')
26,518
def _render_directory(self, req, repos, node, rev=None): req.perm.assert_permission('BROWSER_VIEW')
def _render_directory(self, req, repos, node, rev=None): req.perm.assert_permission('BROWSER_VIEW')
26,519
def _render_file(self, req, repos, node, rev=None): req.perm.assert_permission('FILE_VIEW') try: changeset = repos.get_changeset(node.rev) # created rev except NoSuchChangeset: changeset = repos.get_changeset(rev) # requested rev req.hdf['file'] = { 'rev': node.rev, 'changeset_href': req.href.changeset(node.rev), 'date...
def _render_file(self, req, repos, node, rev=None): req.perm.assert_permission('FILE_VIEW') try: changeset = repos.get_changeset(node.rev) # created rev except NoSuchChangeset: changeset = repos.get_changeset(rev) # requested rev req.hdf['file'] = { 'rev': node.rev, 'changeset_href': req.href.changeset(node.rev), 'date...
26,520
def get_mime_type(content=None): mime_type = node.content_type if not mime_type or mime_type == 'application/octet-stream': mime_type = get_mimetype(node.name, content) or \ mime_type or 'text/plain' return mime_type
def get_mime_type(content=None): mime_type = node.content_type if not mime_type or mime_type == 'application/octet-stream': mime_type = get_mimetype(node.name, content) or \ mime_type or 'text/plain' return mime_type
26,521
def get_mime_type(content=None): mime_type = node.content_type if not mime_type or mime_type == 'application/octet-stream': mime_type = get_mimetype(node.name, content) or \ mime_type or 'text/plain' return mime_type
def get_mime_type(content=None): mime_type = node.content_type if not mime_type or mime_type == 'application/octet-stream': mime_type = get_mimetype(node.name, content) or \ mime_type or 'text/plain' return mime_type
26,522
def get_mime_type(content=None): mime_type = node.content_type if not mime_type or mime_type == 'application/octet-stream': mime_type = get_mimetype(node.name, content) or \ mime_type or 'text/plain' return mime_type
def get_mime_type(content=None): mime_type = node.content_type if not mime_type or mime_type == 'application/octet-stream': mime_type = get_mimetype(node.name, content) or \ mime_type or 'text/plain' return mime_type
26,523
def siteconfig(self): templates_dir = os.path.join(self.prefix, 'share','trac','templates') htdocs_dir = os.path.join(self.prefix, 'share','trac','htdocs') wiki_dir = os.path.join(self.prefix, 'share','trac','wiki-default') f = open(_p('trac/siteconfig.py'),'w') f.write("""
def siteconfig(self): templates_dir = os.path.join(self.prefix, 'share','trac','templates') htdocs_dir = os.path.join(self.prefix, 'share','trac','htdocs') wiki_dir = os.path.join(self.prefix, 'share','trac','wiki-default') f = open(_p('trac/siteconfig.py'),'w') f.write("""
26,524
def __init__(self, env, tkt_id=None, db=None): self.env = env self.fields = TicketSystem(self.env).get_ticket_fields() self.values = {} if tkt_id: self._fetch_ticket(tkt_id, db) else: self._init_defaults(db) self.id = self.time_created = self.time_changed = None self._old = {}
def __init__(self, env, tkt_id=None, db=None): self.env = env self.fields = TicketSystem(self.env).get_ticket_fields() self.values = {} if tkt_id is not None: self._fetch_ticket(tkt_id, db) else: self._init_defaults(db) self.id = self.time_created = self.time_changed = None self._old = {}
26,525
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')
26,526
def save_changes(self, db, author, comment, when = 0): """Store ticket changes in the database. The ticket must already exist in the database.""" assert self.has_key('id') cursor = db.cursor() if not when: when = int(time.time()) id = self['id']
def save_changes(self, db, author, comment, when = 0): """Store ticket changes in the database. The ticket must already exist in the database.""" assert self.has_key('id') cursor = db.cursor() if not when: when = int(time.time()) id = self['id']
26,527
def get_info(self, req, start, stop, maxrows, filters=('tickets', 'changeset', 'wiki', 'milestone')): perm_map = {'tickets': perm.TICKET_VIEW, 'changeset': perm.CHANGESET_VIEW, 'wiki': perm.WIKI_VIEW, 'milestone': perm.MILESTONE_VIEW} for k,v in perm_map.items(): if not self.perm.has_permission(v): filters.remove(k) if...
def get_info(self, req, start, stop, maxrows, filters=AVAILABLE_FILTERS): perm_map = {'tickets': perm.TICKET_VIEW, 'changeset': perm.CHANGESET_VIEW, 'wiki': perm.WIKI_VIEW, 'milestone': perm.MILESTONE_VIEW} for k,v in perm_map.items(): if not self.perm.has_permission(v): filters.remove(k) if not filters: return []
26,528
def render(self, req): self.perm.assert_permission(perm.TIMELINE_VIEW)
def render(self, req): self.perm.assert_permission(perm.TIMELINE_VIEW)
26,529
def display_rss(self, req): base_url = self.env.get_config('trac', 'base_url', '') req.hdf.setValue('baseurl', base_url) req.display(self.template_rss_name, 'text/xml')
def display_rss(self, req): base_url = self.env.get_config('trac', 'base_url', '') req.hdf.setValue('baseurl', base_url) req.display(self.template_rss_name, 'text/xml')
26,530
def c_processor(hdf, text, env): return env.mimeview.display(text, 'text/x-csrcl')
def c_processor(hdf, text, env): return env.mimeview.display(text, 'text/x-csrcl')
26,531
def __getattr__(self, name): return getattr(self.cnx, name)
def __getattr__(self, name): return getattr(self.cnx, name)
26,532
def cursor(self): return IterableCursor(self.cnx.cursor())
def cursor(self): return IterableCursor(self.cnx.cursor())
26,533
def close(self): try: self.cnx.rollback() except: pass self.__pool._return_cnx(self)
def close(self): try: self.cnx.rollback() except: pass self.__pool._return_cnx(self)
26,534
def __del__(self): try: self.close() except: pass
def __del__(self): try: self.close() except: pass
26,535
def __del__(self): try: self.close() except: pass
def __del__(self): try: self.close() except: pass
26,536
def __init__(self, maxsize, cnx_class, **args): self.__cnxs = [] self.__lock = Lock() self.__available = Condition(self.__lock) self.__maxsize = maxsize self.__cursize = 0 self.__cnx_class = cnx_class self.__args = args
def __init__(self, maxsize, cnx_class, **args): self.__cnxs = [] self.__lock = Lock() self.__available = Condition(self.__lock) self.__maxsize = maxsize self.__cursize = 0 self.__cnx_class = cnx_class self.__args = args
26,537
def get_cnx(self, timeout=None): start = time.time() self.__lock.acquire() try: while True: if self.__cnxs: cnx = self.__cnxs.pop(0) break elif self.__maxsize and self.__cursize <= self.__maxsize: cnx = PooledConnection(self, self.__cnx_class(**self.__args)) self.__cursize += 1 break else: if timeout: self.__available....
def get_cnx(self, timeout=None): start = time.time() self._available.acquire() try: while True: if self.__cnxs: cnx = self.__cnxs.pop(0) break elif self.__maxsize and self.__cursize <= self.__maxsize: cnx = PooledConnection(self, self.__cnx_class(**self.__args)) self.__cursize += 1 break else: if timeout: self.__availa...
26,538
def get_cnx(self, timeout=None): start = time.time() self.__lock.acquire() try: while True: if self.__cnxs: cnx = self.__cnxs.pop(0) break elif self.__maxsize and self.__cursize <= self.__maxsize: cnx = PooledConnection(self, self.__cnx_class(**self.__args)) self.__cursize += 1 break else: if timeout: self.__available....
def get_cnx(self, timeout=None): start = time.time() self.__lock.acquire() try: while True: if self._cnxs: cnx = self._cnxs.pop() break elif self.__maxsize and self.__cursize <= self.__maxsize: cnx = PooledConnection(self, self.__cnx_class(**self.__args)) self.__cursize += 1 break else: if timeout: self.__available.wai...
26,539
def get_cnx(self, timeout=None): start = time.time() self.__lock.acquire() try: while True: if self.__cnxs: cnx = self.__cnxs.pop(0) break elif self.__maxsize and self.__cursize <= self.__maxsize: cnx = PooledConnection(self, self.__cnx_class(**self.__args)) self.__cursize += 1 break else: if timeout: self.__available....
def get_cnx(self, timeout=None): start = time.time() self.__lock.acquire() try: while True: if self.__cnxs: cnx = self.__cnxs.pop(0) break elif self._maxsize and self._cursize < self._maxsize: cnx = self._cnx_class(**self._args) self._cursize += 1 break else: if timeout: self.__available.wait(timeout) if (time.time() -...
26,540
def get_cnx(self, timeout=None): start = time.time() self.__lock.acquire() try: while True: if self.__cnxs: cnx = self.__cnxs.pop(0) break elif self.__maxsize and self.__cursize <= self.__maxsize: cnx = PooledConnection(self, self.__cnx_class(**self.__args)) self.__cursize += 1 break else: if timeout: self.__available....
def get_cnx(self, timeout=None): start = time.time() self.__lock.acquire() try: while True: if self.__cnxs: cnx = self.__cnxs.pop(0) break elif self.__maxsize and self.__cursize <= self.__maxsize: cnx = PooledConnection(self, self.__cnx_class(**self.__args)) self.__cursize += 1 break else: if timeout: self._available.w...
26,541
def get_cnx(self, timeout=None): start = time.time() self.__lock.acquire() try: while True: if self.__cnxs: cnx = self.__cnxs.pop(0) break elif self.__maxsize and self.__cursize <= self.__maxsize: cnx = PooledConnection(self, self.__cnx_class(**self.__args)) self.__cursize += 1 break else: if timeout: self.__available....
def get_cnx(self, timeout=None): start = time.time() self.__lock.acquire() try: while True: if self.__cnxs: cnx = self.__cnxs.pop(0) break elif self.__maxsize and self.__cursize <= self.__maxsize: cnx = PooledConnection(self, self.__cnx_class(**self.__args)) self.__cursize += 1 break else: if timeout: self.__available....
26,542
def get_cnx(self, timeout=None): start = time.time() self.__lock.acquire() try: while True: if self.__cnxs: cnx = self.__cnxs.pop(0) break elif self.__maxsize and self.__cursize <= self.__maxsize: cnx = PooledConnection(self, self.__cnx_class(**self.__args)) self.__cursize += 1 break else: if timeout: self.__available....
def get_cnx(self, timeout=None): start = time.time() self.__lock.acquire() try: while True: if self.__cnxs: cnx = self.__cnxs.pop(0) break elif self.__maxsize and self.__cursize <= self.__maxsize: cnx = PooledConnection(self, self.__cnx_class(**self.__args)) self.__cursize += 1 break else: if timeout: self.__available....
26,543
def _return_cnx(self, cnx): self.__lock.acquire() try: self.__cnxs.append(cnx) self.__cursize -= 1 self.__available.notify() finally: self.__lock.release()
def _return_cnx(self, cnx): self._available.acquire() try: self.__cnxs.append(cnx) self.__cursize -= 1 self.__available.notify() finally: self.__lock.release()
26,544
def _return_cnx(self, cnx): self.__lock.acquire() try: self.__cnxs.append(cnx) self.__cursize -= 1 self.__available.notify() finally: self.__lock.release()
def _return_cnx(self, cnx): self.__lock.acquire() try: if cnx not in self._cnxs: self._cnxs.append(cnx) self._available.notify() finally: self.__lock.release()
26,545
def _return_cnx(self, cnx): self.__lock.acquire() try: self.__cnxs.append(cnx) self.__cursize -= 1 self.__available.notify() finally: self.__lock.release()
def _return_cnx(self, cnx): self.__lock.acquire() try: self.__cnxs.append(cnx) self.__cursize -= 1 self.__available.notify() finally: self.__lock.release()
26,546
def shutdown(self): self.__lock.acquire() try: for con in self.__cnxs: con.cnx.close() finally: self.__lock.release()
def shutdown(self): self._available.acquire() try: for con in self.__cnxs: con.cnx.close() finally: self.__lock.release()
26,547
def shutdown(self): self.__lock.acquire() try: for con in self.__cnxs: con.cnx.close() finally: self.__lock.release()
def shutdown(self): self.__lock.acquire() try: for con in self._cnxs: con.cnx.close() finally: self.__lock.release()
26,548
def shutdown(self): self.__lock.acquire() try: for con in self.__cnxs: con.cnx.close() finally: self.__lock.release()
def shutdown(self): self.__lock.acquire() try: for con in self.__cnxs: con.cnx.close() finally: self.__lock.release()
26,549
def get_tickets_for_milestone(env, db, milestone, field='component'): custom = field not in Ticket.std_fields cursor = db.cursor() sql = 'SELECT ticket.id AS id, ticket.status AS status, ' if custom: sql += 'ticket_custom.value AS %s ' \ 'FROM ticket LEFT OUTER JOIN ticket_custom ON id = ticket ' \ 'WHERE name = \'%s\'...
def get_tickets_for_milestone(env, db, milestone, field='component'): custom = field not in Ticket.std_fields cursor = db.cursor() sql = 'SELECT ticket.id AS id, ticket.status AS status, ' if custom: sql += 'ticket_custom.value AS %s ' \ 'FROM ticket LEFT OUTER JOIN ticket_custom ON id = ticket ' \ 'WHERE name = \'%s\'...
26,550
def get_tickets_for_milestone(env, db, milestone, field='component'): custom = field not in Ticket.std_fields cursor = db.cursor() sql = 'SELECT ticket.id AS id, ticket.status AS status, ' if custom: sql += 'ticket_custom.value AS %s ' \ 'FROM ticket LEFT OUTER JOIN ticket_custom ON id = ticket ' \ 'WHERE name = \'%s\'...
def get_tickets_for_milestone(env, db, milestone, field='component'): custom = field not in Ticket.std_fields cursor = db.cursor() sql = 'SELECT ticket.id AS id, ticket.status AS status, ' if custom: sql += 'ticket_custom.value AS %s ' \ 'FROM ticket LEFT OUTER JOIN ticket_custom ON id = ticket ' \ 'WHERE name = \'%s\'...
26,551
def render_macro(self, req, name, content): module = self._load_macro(name) try: return module.execute(req and req.hdf, content, self.env) except Exception, e: self.log.error('Wiki macro failed', e) raise e
def render_macro(self, req, name, content): module = self._load_macro(name) try: return module.execute(req and req.hdf, content, self.env) except Exception, e: self.log.error('Wiki macro %s failed (%s)' % (name, e)) raise e
26,552
def _reconstruct_url(self): """Reconstruct the absolute base URL of the application.""" host = self.get_header('Host') if self.get_header('X-Forwarded-Host'): host = self.get_header('X-Forwarded-Host') if not host: # Missing host header, so reconstruct the host from the # server name and port default_port = {'http': 80...
def _reconstruct_url(self): """Reconstruct the absolute base URL of the application.""" host = self.get_header('Host') if not host: # Missing host header, so reconstruct the host from the # server name and port default_port = {'http': 80, 'https': 443} if self.server_port and self.server_port != default_port[self.schem...
26,553
def render(self, req): self.perm.assert_permission (perm.TICKET_VIEW)
def render(self, req): self.perm.assert_permission (perm.TICKET_VIEW)
26,554
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: print>>sys.stderr, "Skipping '%s' ('%s' not found)" \ % (dist, str(...
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: print>>sys.stderr, "Skipping '%s' ('%s' not found)" \ % (dist, str(...
26,555
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: print>>sys.stderr, "Skipping '%s' ('%s' not found)" \ % (dist, str(...
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: print>>sys.stderr, "Skipping '%s' ('%s' not found)" \ % (dist, str(...
26,556
def get_href(self, format=None): return self.env.href.query(order=self.order, desc=self.desc and 1 or None, group=self.group, groupdesc=self.groupdesc and 1 or None, verbose=self.verbose and 1 or None, format=format, **self.constraints)
def get_href(self, format=None): return self.env.href.query(order=self.order, desc=self.desc and 1 or None, group=self.group or None, groupdesc=self.groupdesc and 1 or None, verbose=self.verbose and 1 or None, format=format, **self.constraints)
26,557
def add_cols(*args): for col in args: if not col in cols: cols.append(col)
def add_cols(*args): for col in args: if not col in cols: cols.append(col)
26,558
def get_constraint_sql(name, value, mode, neg): value = sql_escape(value[len(mode and '!' or '' + mode):]) if name not in custom_fields: name = 't.' + name if mode == '~' and value: return "COALESCE(%s,'') %sLIKE '%%%s%%'" % ( name, neg and 'NOT ' or '', value) elif mode == '^' and value: return "COALESCE(%s,'') %sLIKE...
def get_constraint_sql(name, value, mode, neg): value = sql_escape(value[len(mode and '!' or '' + mode):]) if name not in custom_fields: name = 't.' + name if mode == '~' and value: return "COALESCE(%s,'') %sLIKE '%%%s%%'" % ( name, neg and 'NOT ' or '', value) elif mode == '^' and value: return "COALESCE(%s,'') %sLIKE...
26,559
def get_constraint_sql(name, value, mode, neg): value = sql_escape(value[len(mode and '!' or '' + mode):]) if name not in custom_fields: name = 't.' + name if mode == '~' and value: return "COALESCE(%s,'') %sLIKE '%%%s%%'" % ( name, neg and 'NOT ' or '', value) elif mode == '^' and value: return "COALESCE(%s,'') %sLIKE...
def get_constraint_sql(name, value, mode, neg): value = sql_escape(value[len(mode and '!' or '' + mode):]) if name not in custom_fields: name = 't.' + name if mode == '~' and value: return "COALESCE(%s,'') %sLIKE '%%%s%%'" % ( name, neg and 'NOT ' or '', value) elif mode == '^' and value: return "COALESCE(%s,'') %sLIKE...
26,560
def _get_constraints(self, req): constraints = {} ticket_fields = [f['name'] for f in TicketSystem(self.env).get_ticket_fields()]
def _get_constraints(self, req): constraints = {} ticket_fields = [f['name'] for f in TicketSystem(self.env).get_ticket_fields()]
26,561
def display_html(self, req, query): req.hdf['title'] = 'Custom Query' add_stylesheet(req, 'common/css/report.css')
def display_html(self, req, query): req.hdf['title'] = 'Custom Query' add_stylesheet(req, 'common/css/report.css')
26,562
def display_html(self, req, query): req.hdf['title'] = 'Custom Query' add_stylesheet(req, 'common/css/report.css')
def display_html(self, req, query): req.hdf['title'] = 'Custom Query' add_stylesheet(req, 'common/css/report.css')
26,563
def display_html(self, req, query): req.hdf['title'] = 'Custom Query' add_stylesheet(req, 'common/css/report.css')
def display_html(self, req, query): req.hdf['title'] = 'Custom Query' add_stylesheet(req, 'common/css/report.css')
26,564
def render(self): self.perm.assert_permission(perm.TICKET_VIEW)
def render(self): self.perm.assert_permission(perm.TICKET_VIEW)
26,565
def save_changes(self, author, comment, when=0, db=None): """ Store ticket changes in the database. The ticket must already exist in the database. """ assert self.exists, 'Cannot update a new ticket'
def save_changes(self, author, comment, when=0, db=None): """ Store ticket changes in the database. The ticket must already exist in the database. """ assert self.exists, 'Cannot update a new ticket'
26,566
def get_search_filters(self, req): """ Return a list of filters that this search source supports. Each filter must be a (name, label) tuple, where `name` is the internal name, and `label` is a human-readable name for display. """
def get_search_filters(self, req): """ Return a list of filters that this search source supports. Each filter must be a (name, label[, default]) tuple, where `name` is the internal name, `label` is a human-readable name for display and `default` is an optional boolean for determining whether this filter is searchable b...
26,567
def process_request(self, req): req.perm.assert_permission('SEARCH_VIEW')
def process_request(self, req): req.perm.assert_permission('SEARCH_VIEW')
26,568
def process(self, req, text, inline=False): if self.error: return system_message('Error: Failed to load processor <code>%s</code>' % self.name, self.error) text = self.processor(req, text) if inline: code_block_start = re.compile('^<div class="code-block">') code_block_end = re.compile('</div>$') text, nr = code_block_...
def process(self, req, text, inline=False): if self.error: return system_message('Error: Failed to load processor <code>%s</code>' % self.name, self.error) text = self.processor(req, text) if inline: code_block_start = re.compile('^<div class="code-block">') code_block_end = re.compile('</div>$') text, nr = code_block_...
26,569
def process(self, req, text, inline=False): if self.error: return system_message('Error: Failed to load processor <code>%s</code>' % self.name, self.error) text = self.processor(req, text) if inline: code_block_start = re.compile('^<div class="code-block">') code_block_end = re.compile('</div>$') text, nr = code_block_...
def process(self, req, text, inline=False): if self.error: return system_message('Error: Failed to load processor <code>%s</code>' % self.name, self.error) text = self.processor(req, text) if inline: code_block_start = re.compile('^<div class="code-block">') code_block_end = re.compile('</div>$') text, nr = code_block_...
26,570
def _lhref_formatter(self, match, fullmatch): ns = fullmatch.group('lns') target = fullmatch.group('ltgt') if target and target[0] in "'\"": target = target[1:-1] label = fullmatch.group('label') or target rel = fullmatch.group('rel') if rel: return self._make_relative_link(rel, label or rel) else: return self._make_li...
def _lhref_formatter(self, match, fullmatch): ns = fullmatch.group('lns') target = fullmatch.group('ltgt') if target and target[0] in ("'",'"'): target = target[1:-1] label = fullmatch.group('label') or target rel = fullmatch.group('rel') if rel: return self._make_relative_link(rel, label or rel) else: return self._mak...
26,571
def _lhref_formatter(self, match, fullmatch): ns = fullmatch.group('lns') target = fullmatch.group('ltgt') if target and target[0] in "'\"": target = target[1:-1] label = fullmatch.group('label') or target rel = fullmatch.group('rel') if rel: return self._make_relative_link(rel, label or rel) else: return self._make_li...
def _lhref_formatter(self, match, fullmatch): ns = fullmatch.group('lns') target = fullmatch.group('ltgt') if target and target[0] in "'\"": target = target[1:-1] label = fullmatch.group('label') if not label: if target: if target.startswith('//'): label = ns+':'+target else: label = target else: label = ns if label an...
26,572
def get_bool_option(name, default=0): pref = int(session.get('diff_' + name, default)) arg = args.has_key(name) if args.has_key('update') and arg != pref: session.set_var('diff_' + name, arg) else: arg = pref return arg
def get_bool_option(session, args, name, default=0): pref = int(session.get('diff_' + name, default)) arg = args.has_key(name) if args.has_key('update') and arg != pref: session.set_var('diff_' + name, arg) else: arg = pref return arg
26,573
def get_bool_option(name, default=0): pref = int(session.get('diff_' + name, default)) arg = args.has_key(name) if args.has_key('update') and arg != pref: session.set_var('diff_' + name, arg) else: arg = pref return arg
def get_bool_option(name, default=0): pref = int(session.get('diff_' + name, default)) arg = args.has_key(name) if args.has_key('update') and arg != pref: session.set_var('diff_' + name, arg) else: arg = pref return arg
26,574
def get_bool_option(name, default=0): pref = int(session.get('diff_' + name, default)) arg = args.has_key(name) if args.has_key('update') and arg != pref: session.set_var('diff_' + name, arg) else: arg = pref return arg
def get_bool_option(name, default=0): pref = int(session.get('diff_' + name, default)) arg = args.has_key(name) if args.has_key('update') and arg != pref: session.set_var('diff_' + name, arg) else: arg = pref return arg
26,575
def get_bool_option(name, default=0): pref = int(session.get('diff_' + name, default)) arg = args.has_key(name) if args.has_key('update') and arg != pref: session.set_var('diff_' + name, arg) else: arg = pref return arg
def get_bool_option(name, default=0): pref = int(session.get('diff_' + name, default)) arg = args.has_key(name) if args.has_key('update') and arg != pref: session.set_var('diff_' + name, arg) else: arg = pref return arg
26,576
def get_wiki_syntax(self): yield (r"(?:\A|[^&])#\d+", # #123 but not &#123; (HTML entity) lambda x, y, z: self._format_link(x, 'ticket', y[1:], y))
def get_wiki_syntax(self): yield (r"(?:\A|[^&])#\d+", # #123 but not &#123; (HTML entity) lambda x, y, z: self._format_link(x, 'ticket', y[1:], y))
26,577
def sortkey(row): val = row[idx] if isinstance(val, basestring): val = val.lower() return val
def sortkey(row): val = row[idx] if isinstance(val, basestring): val = val.lower() return val
26,578
def sortkey(row): val = row[idx] if isinstance(val, basestring): val = val.lower() return val
def sortkey(row): val = row[idx] if isinstance(val, basestring): val = val.lower() return val
26,579
def _send_csv(self, req, cols, rows, sep=',', mimetype='text/plain'): req.send_response(200) req.send_header('Content-Type', mimetype + ';charset=utf-8') req.end_headers()
def _send_csv(self, req, cols, rows, sep=',', mimetype='text/plain', filename=None): req.send_response(200) req.send_header('Content-Type', mimetype + ';charset=utf-8') req.end_headers()
26,580
def __mkreports(reps): """Utility function used to create report data in same syntax as the default data. This extra step is done to simplify editing the default reports.""" result = [] i = 1 for r in reps: result.append ((i, None, r[0], r[2], r[1])) i = i + 1 return result
def __mkreports(reps): """Utility function used to create report data in same syntax as the default data. This extra step is done to simplify editing the default reports.""" result = [] i = 1 for r in reps: result.append ((i, None, r[0], r[2], r[1])) i = i + 1 return result
26,581
def __call__(self, environ, start_response): from sys import stderr path = environ['SCRIPT_NAME'] + environ.get('PATH_INFO', '') environ['PATH_INFO'] = path[len(self.base_path):] environ['SCRIPT_NAME'] = self.base_path print >>stderr, path, self.base_path return self.application(environ, start_response)
def __call__(self, environ, start_response): path = environ['SCRIPT_NAME'] + environ.get('PATH_INFO', '') environ['PATH_INFO'] = path[len(self.base_path):] environ['SCRIPT_NAME'] = self.base_path print >>stderr, path, self.base_path return self.application(environ, start_response)
26,582
def __call__(self, environ, start_response): from sys import stderr path = environ['SCRIPT_NAME'] + environ.get('PATH_INFO', '') environ['PATH_INFO'] = path[len(self.base_path):] environ['SCRIPT_NAME'] = self.base_path print >>stderr, path, self.base_path return self.application(environ, start_response)
def __call__(self, environ, start_response): from sys import stderr path = environ['SCRIPT_NAME'] + environ.get('PATH_INFO', '') environ['PATH_INFO'] = path[len(self.base_path):] environ['SCRIPT_NAME'] = self.base_path return self.application(environ, start_response)
26,583
def next_rev(self, rev, path='', find_initial_rev=False): rev = self.normalize_rev(rev) next = rev + 1 youngest = self.youngest_rev while next <= youngest: try: for _, next in self._history(path, rev+1, next, limit=1): return next except (SystemError, # "null arg to internal routine" in 1.2.x core.SubversionException):...
def next_rev(self, rev, path='', find_initial_rev=False): rev = self.normalize_rev(rev) next = rev + 1 youngest = self.youngest_rev while next <= youngest: try: for _, next in self._history(path, rev+1, next, limit=1, pool=subpool): return next except (SystemError, # "null arg to internal routine" in 1.2.x core.Subvers...
26,584
def _format_changeset_link(self, formatter, ns, chgset, label, fullmatch=None): intertrac = formatter.shorthand_intertrac_helper(ns, chgset, label, fullmatch) if intertrac: return intertrac sep = chgset.find('/') if sep > 0: rev, path = chgset[:sep], chgset[sep:] else: rev, path = chgset, None repos = self.env.get_repo...
def _format_changeset_link(self, formatter, ns, chgset, label, fullmatch=None): intertrac = formatter.shorthand_intertrac_helper(ns, chgset, label, fullmatch) if intertrac: return intertrac sep = chgset.find('/') if sep > 0: rev, path = chgset[:sep], chgset[sep:] else: rev, path = chgset, None cursor = formatter.db.cur...
26,585
def _format_changeset_link(self, formatter, ns, chgset, label, fullmatch=None): intertrac = formatter.shorthand_intertrac_helper(ns, chgset, label, fullmatch) if intertrac: return intertrac sep = chgset.find('/') if sep > 0: rev, path = chgset[:sep], chgset[sep:] else: rev, path = chgset, None repos = self.env.get_repo...
def _format_changeset_link(self, formatter, ns, chgset, label, fullmatch=None): intertrac = formatter.shorthand_intertrac_helper(ns, chgset, label, fullmatch) if intertrac: return intertrac sep = chgset.find('/') if sep > 0: rev, path = chgset[:sep], chgset[sep:] else: rev, path = chgset, None repos = self.env.get_repo...
26,586
def _format_changeset_link(self, formatter, ns, chgset, label, fullmatch=None): intertrac = formatter.shorthand_intertrac_helper(ns, chgset, label, fullmatch) if intertrac: return intertrac sep = chgset.find('/') if sep > 0: rev, path = chgset[:sep], chgset[sep:] else: rev, path = chgset, None repos = self.env.get_repo...
def _format_changeset_link(self, formatter, ns, chgset, label, fullmatch=None): intertrac = formatter.shorthand_intertrac_helper(ns, chgset, label, fullmatch) if intertrac: return intertrac sep = chgset.find('/') if sep > 0: rev, path = chgset[:sep], chgset[sep:] else: rev, path = chgset, None repos = self.env.get_repo...
26,587
def _format_changeset_link(self, formatter, ns, chgset, label, fullmatch=None): intertrac = formatter.shorthand_intertrac_helper(ns, chgset, label, fullmatch) if intertrac: return intertrac sep = chgset.find('/') if sep > 0: rev, path = chgset[:sep], chgset[sep:] else: rev, path = chgset, None repos = self.env.get_repo...
def _format_changeset_link(self, formatter, ns, chgset, label, fullmatch=None): intertrac = formatter.shorthand_intertrac_helper(ns, chgset, label, fullmatch) if intertrac: return intertrac sep = chgset.find('/') if sep > 0: rev, path = chgset[:sep], chgset[sep:] else: rev, path = chgset, None repos = self.env.get_repo...
26,588
def process_request(self, req): req.perm.assert_permission('TICKET_VIEW')
def process_request(self, req): req.perm.assert_permission('TICKET_VIEW')
26,589
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 have_psycopg2 if not psycopg and not PgSQL: try: try: import psycopg2 as psycopg import psycopg2.extens...
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 have_psycopg2 if not psycopg and not PgSQL: try: try: import psycopg2 as psycopg import psycopg2.extens...
26,590
def render_report_list(self, id): """ uses a user specified sql query to extract some information from the database and presents it as a html table. """ if self.perm.has_permission(perm.REPORT_CREATE): self.req.hdf.setValue('report.create_href', self.env.href.report(None, 'new')) if id != -1: self.add_alternate_links(...
def render_report_list(self, id): """ uses a user specified sql query to extract some information from the database and presents it as a html table. """ if self.perm.has_permission(perm.REPORT_CREATE): self.req.hdf.setValue('report.create_href', self.env.href.report(None, 'new')) if id != -1: self.add_alternate_links(...
26,591
def _render_confirm(self, req, db, page): if page.readonly: req.perm.assert_permission('WIKI_ADMIN') else: req.perm.assert_permission('WIKI_DELETE')
def _render_confirm(self, req, db, page): if page.readonly: req.perm.assert_permission('WIKI_ADMIN') else: req.perm.assert_permission('WIKI_DELETE')
26,592
def __init__ (self, driver, app): """ Constructor. """ gtk.Frame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = gtk.Table(2, 2) execLabel = gtk.Label ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = gtk.Entry() if app.executable ...
def __init__ (self, driver, app): """ Constructor. """ gtk.Frame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = gtk.Table(2, 2) self.execCheck = WrappingCheckButton ("Executable") self.execCheck.set_sensitive (app.device.config.writable) self.execCheck.show() table.attach (self....
26,593
def __init__ (self, driver, app): """ Constructor. """ gtk.Frame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = gtk.Table(2, 2) execLabel = gtk.Label ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = gtk.Entry() if app.executable ...
def __init__ (self, driver, app): """ Constructor. """ gtk.Frame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = gtk.Table(2, 2) execLabel = gtk.Label ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = gtk.Entry() if app.executable ...
26,594
def __init__ (self, driver, app): """ Constructor. """ gtk.Frame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = gtk.Table(2, 2) execLabel = gtk.Label ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = gtk.Entry() if app.executable ...
def __init__ (self, driver, app): """ Constructor. """ gtk.Frame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = gtk.Table(2, 2) execLabel = gtk.Label ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = gtk.Entry() if app.executable ...
26,595
def commit (self): """ Commit changes to the configuration. """ executable = self.execEntry.get_text() if executable == "": if self.app.executable != None: self.app.executable = None self.app.modified(self.app) elif executable != self.app.executable: self.app.executable = executable self.app.modified(self.app) for sect...
def commit (self): """ Commit changes to the configuration. """ executable = self.execEntry.get_text() if not self.execCheck.get_active(): if self.app.executable != None: self.app.executable = None self.app.modified(self.app) elif executable != self.app.executable: self.app.executable = executable self.app.modified(sel...
26,596
def nodeModified (self, node, b=TRUE): if node.__class__ == dri.DRIConfig: config = node elif node.__class__ == dri.DeviceConfig: config = node.config elif node.__class__ == dri.AppConfig: config = node.device.config if config.isModified != b: config.isModified = b if node.__class__ == dri.DRIConfig: mainWindow.activat...
def nodeModified (self, node, b=TRUE): if node.__class__ == dri.DRIConfig: config = node elif node.__class__ == dri.DeviceConfig: config = node.config elif node.__class__ == dri.AppConfig: config = node.device.config if config.isModified != b: config.isModified = b if node.__class__ == dri.DRIConfig: mainWindow.activat...
26,597
def __init__ (self, configList): gtk.Window.__init__ (self) self.set_title ("DRI Configuration") self.connect ("destroy", gtk.mainquit) self.connect ("delete_event", self.exitHandler) self.vbox = gtk.VBox() self.paned = gtk.HPaned() self.configTree = ConfigTreeView (configList) self.configTree.show() scrolledWindow = g...
def __init__ (self, configList): gtk.Window.__init__ (self) self.set_title ("DRI Configuration") self.connect ("destroy", gtk.main_quit) self.connect ("delete_event", self.exitHandler) self.vbox = gtk.VBox() self.paned = gtk.HPaned() self.configTree = ConfigTreeView (configList) self.configTree.show() scrolledWindow = ...
26,598
def exitHandler (self, widget, event=None): modified = FALSE for config in self.configTree.getConfigList(): if config.isModified: modified = TRUE break if modified: dialog = gtk.MessageDialog ( mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, "There are unsaved modi...
def exitHandler (self, widget, event=None): modified = FALSE for config in self.configTree.getConfigList(): if config.isModified: modified = TRUE break if modified: dialog = gtk.MessageDialog ( mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, "There are unsaved modi...
26,599