bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def open_environment(env_path=None, use_cache=False): """Open an existing environment object, and verify that the database is up to date. :param env_path: absolute path to the environment directory; if ommitted, the value of the `TRAC_ENV` environment variable is used :param use_cache: whether the environment should b... | def open_environment(env_path=None, use_cache=False): """Open an existing environment object, and verify that the database is up to date. :param env_path: absolute path to the environment directory; if ommitted, the value of the `TRAC_ENV` environment variable is used :param use_cache: whether the environment should b... | 465,600 |
def get_admin_commands(self): yield ('deploy', '<directory>', 'Extract static resources from Trac and all plugins', None, self._do_deploy) yield ('hotcopy', '<backupdir>', 'Make a hot backup copy of an environment', None, self._do_hotcopy) yield ('upgrade', '', 'Upgrade database to current version', None, self._do_upgr... | def get_admin_commands(self): yield ('deploy', '<directory>', 'Extract static resources from Trac and all plugins', None, self._do_deploy) yield ('hotcopy', '<backupdir> [--no-database]', """Make a hot backup copy of an environment The database is backed up to the 'db' directory of the destination, unless the --no-dat... | 465,601 |
def get_admin_commands(self): yield ('deploy', '<directory>', 'Extract static resources from Trac and all plugins', None, self._do_deploy) yield ('hotcopy', '<backupdir>', 'Make a hot backup copy of an environment', None, self._do_hotcopy) yield ('upgrade', '', 'Upgrade database to current version', None, self._do_upgr... | def get_admin_commands(self): yield ('deploy', '<directory>', 'Extract static resources from Trac and all plugins', None, self._do_deploy) yield ('hotcopy', '<backupdir>', 'Make a hot backup copy of an environment', None, self._do_hotcopy) yield ('upgrade', '', 'Upgrade database to current version', None, self._do_upgr... | 465,602 |
def _do_deploy(self, dest): target = os.path.normpath(dest) chrome_target = os.path.join(target, 'htdocs') script_target = os.path.join(target, 'cgi-bin') | def _do_deploy(self, dest): target = os.path.normpath(dest) chrome_target = os.path.join(target, 'htdocs') script_target = os.path.join(target, 'cgi-bin') | 465,603 |
def _do_hotcopy(self, dest): if os.path.exists(dest): raise TracError(_("hotcopy can't overwrite existing '%(dest)s'", dest=dest)) import shutil | def _do_hotcopy(self, dest): if os.path.exists(dest): raise TracError(_("hotcopy can't overwrite existing '%(dest)s'", dest=dest)) import shutil | 465,604 |
def _do_hotcopy(self, dest): if os.path.exists(dest): raise TracError(_("hotcopy can't overwrite existing '%(dest)s'", dest=dest)) import shutil | def _do_hotcopy(self, dest): if os.path.exists(dest): raise TracError(_("hotcopy can't overwrite existing '%(dest)s'", dest=dest)) import shutil | 465,605 |
def _do_upgrade(self, no_backup=None): if no_backup not in (None, '-b', '--no-backup'): raise AdminCommandError(_("Invalid arguments"), show_usage=True) if not self.env.needs_upgrade(): printout(_("Database is up to date, no upgrade necessary.")) return | def _do_upgrade(self, no_backup=None): if no_backup not in (None, '-b', '--no-backup'): raise AdminCommandError(_("Invalid arguments"), show_usage=True) if not self.env.needs_upgrade(): printout(_("Database is up to date, no upgrade necessary.")) return | 465,606 |
def process_request(self, req): action = req.args.get('action', 'view') pagename = req.args.get('page', 'WikiStart') version = req.args.get('version') old_version = req.args.get('old_version') | def process_request(self, req): action = req.args.get('action', 'view') pagename = req.args.get('page', 'WikiStart') version = req.args.get('version') old_version = req.args.get('old_version') | 465,607 |
def _render_confirm_delete(self, req, page): if page.readonly: req.perm(page.resource).require('WIKI_ADMIN') else: req.perm(page.resource).require('WIKI_DELETE') | def _render_confirm_delete(self, req, page): if page.readonly: req.perm(page.resource).require('WIKI_ADMIN') else: req.perm(page.resource).require('WIKI_DELETE') | 465,608 |
def _render_confirm_delete(self, req, page): if page.readonly: req.perm(page.resource).require('WIKI_ADMIN') else: req.perm(page.resource).require('WIKI_DELETE') | def _render_confirm_delete(self, req, page): if page.readonly: req.perm(page.resource).require('WIKI_ADMIN') else: req.perm(page.resource).require('WIKI_DELETE') | 465,609 |
def __init__(self, default_data=False, enable=None): """Construct a new Environment stub object. | def __init__(self, default_data=False, enable=None): """Construct a new Environment stub object. | 465,610 |
def _do_deploy(self, dest): target = os.path.normpath(dest) chrome_target = os.path.join(target, 'htdocs') script_target = os.path.join(target, 'cgi-bin') | def _do_deploy(self, dest): target = os.path.normpath(dest) chrome_target = os.path.join(target, 'htdocs') script_target = os.path.join(target, 'cgi-bin') | 465,611 |
def save_changes(self, author=None, comment=None, when=None, db=None, cnum=''): """ Store ticket changes in the database. The ticket must already exist in the database. Returns False if there were no changes to save, True otherwise. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exi... | def save_changes(self, author=None, comment=None, when=None, db=None, cnum=''): """ Store ticket changes in the database. The ticket must already exist in the database. Returns False if there were no changes to save, True otherwise. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exi... | 465,612 |
def get_cnx(self, connector, kwargs, timeout=None): num = 1 cnx = None log = kwargs.get('log') key = unicode(kwargs) start = time.time() tid = threading._get_ident() self._available.acquire() try: while True: # First choice: Return the same cnx already used by the thread if (tid, key) in self._active: cnx, num = self._... | def get_cnx(self, connector, kwargs, timeout=None): cnx = None log = kwargs.get('log') key = unicode(kwargs) start = time.time() tid = threading._get_ident() self._available.acquire() try: while True: # First choice: Return the same cnx already used by the thread if (tid, key) in self._active: cnx, num = self._active[(... | 465,613 |
def get_cnx(self, connector, kwargs, timeout=None): num = 1 cnx = None log = kwargs.get('log') key = unicode(kwargs) start = time.time() tid = threading._get_ident() self._available.acquire() try: while True: # First choice: Return the same cnx already used by the thread if (tid, key) in self._active: cnx, num = self._... | def get_cnx(self, connector, kwargs, timeout=None): num = 1 cnx = None log = kwargs.get('log') key = unicode(kwargs) start = time.time() tid = threading._get_ident() self._available.acquire() try: while True: # First choice: Return the same cnx already used by the thread if (tid, key) in self._active: cnx, num = self._... | 465,614 |
def _get_list(self, *sids): if not sids: return check_auth = True check_sid = False if sids[0].lower() == 'anonymous': authenticated = 0 elif sids[0].lower() == 'authenticated': authenticated = 1 elif sids[0] == '*': check_auth = False else: check_auth = False check_sid = True | def _get_list(self, *sids): if not sids: return check_auth = True check_sid = False if sids[0].lower() == 'anonymous': authenticated = 0 elif sids[0].lower() == 'authenticated': authenticated = 1 elif sids[0] == '*': check_auth = False else: check_auth = False check_sid = True | 465,615 |
def activate(self, locale, env_path=None): locale_dir = pkg_resources.resource_filename('trac', 'locale') t = Translations.load(locale_dir, locale or 'en_US') if not t or t.__class__ is NullTranslations: t = self._null_translations elif env_path: self._plugin_domains_lock.acquire() try: domains = list(self._plugin_doma... | def activate(self, locale, env_path=None): try: locale_dir = pkg_resources.resource_filename('trac', 'locale') except pkg_resources.ExtractionError: return t = Translations.load(locale_dir, locale or 'en_US') if not t or t.__class__ is NullTranslations: t = self._null_translations elif env_path: self._plugin_domains_lo... | 465,616 |
def execute(self, sql, args=None): if self.log: self.log.debug('SQL: %r', sql) try: if args: self.log.debug('args: %r', args) r = self.cursor.execute(sql_escape_percent(sql), args) else: r = self.cursor.execute(sql) rows = getattr(self.cursor, 'rows', None) if rows is not None: self.log.debug("prefetch: %d rows", len(r... | def execute(self, sql, args=None): if self.log: self.log.debug('SQL: %s', sql) try: if args: self.log.debug('args: %r', args) r = self.cursor.execute(sql_escape_percent(sql), args) else: r = self.cursor.execute(sql) rows = getattr(self.cursor, 'rows', None) if rows is not None: self.log.debug("prefetch: %d rows", len(r... | 465,617 |
def get_timeline_filters(self, req): if 'TICKET_VIEW' in req.perm: yield ('ticket', _("Opened and closed tickets")) if self.timeline_details: yield ('ticket_details', _("Ticket updates"), False) | def get_timeline_filters(self, req): if 'TICKET_VIEW' in req.perm: yield ('ticket', _("Tickets opened and closed")) if self.timeline_details: yield ('ticket_details', _("Ticket updates"), False) | 465,618 |
def do_rename(db): if model.WikiPage(self.env, new_name, db=db).exists: raise AdminCommandError(_('The page %(name)s already exists', name=new_name)) page = model.WikiPage(self.env, name, db=db) page.rename(new_name, db=db) | def do_rename(db): if model.WikiPage(self.env, new_name, db=db).exists: raise AdminCommandError(_('The page %(name)s already exists.', name=new_name)) page = model.WikiPage(self.env, name, db=db) page.rename(new_name, db=db) | 465,619 |
def test_clean_sync(self): t1 = datetime(2001, 1, 1, 1, 1, 1, 0, utc) t2 = datetime(2002, 1, 1, 1, 1, 1, 0, utc) t3 = datetime(2003, 1, 1, 1, 1, 1, 0, utc) self.preset_cache( (('0', to_timestamp(t1), '', ''), []), (('1', to_timestamp(t2), 'joe', 'Import'), [('trunk', 'D', 'A', None, None), ('trunk/README', 'F', 'A', No... | def test_clean_sync(self): t1 = datetime(2001, 1, 1, 1, 1, 1, 0, utc) t2 = datetime(2002, 1, 1, 1, 1, 1, 0, utc) t3 = datetime(2003, 1, 1, 1, 1, 1, 0, utc) self.preset_cache( (('0', to_timestamp(t1), '', ''), []), (('1', to_timestamp(t2), 'joe', 'Import'), [('trunk', 'D', 'A', None, None), ('trunk/README', 'F', 'A', No... | 465,620 |
def test_clean_sync(self): t1 = datetime(2001, 1, 1, 1, 1, 1, 0, utc) t2 = datetime(2002, 1, 1, 1, 1, 1, 0, utc) t3 = datetime(2003, 1, 1, 1, 1, 1, 0, utc) self.preset_cache( (('0', to_timestamp(t1), '', ''), []), (('1', to_timestamp(t2), 'joe', 'Import'), [('trunk', 'D', 'A', None, None), ('trunk/README', 'F', 'A', No... | def test_clean_sync(self): t1 = datetime(2001, 1, 1, 1, 1, 1, 0, utc) t2 = datetime(2002, 1, 1, 1, 1, 1, 0, utc) t3 = datetime(2003, 1, 1, 1, 1, 1, 0, utc) self.preset_cache( (('0', to_timestamp(t1), '', ''), []), (('1', to_timestamp(t2), 'joe', 'Import'), [('trunk', 'D', 'A', None, None), ('trunk/README', 'F', 'A', No... | 465,621 |
def test_sync_changeset(self): t1 = datetime(2001, 1, 1, 1, 1, 1, 0, utc) t2 = datetime(2002, 1, 1, 1, 1, 1, 0, utc) t3 = datetime(2003, 1, 1, 1, 1, 1, 0, utc) self.preset_cache( (('0', to_timestamp(t1), '', ''), []), (('1', to_timestamp(t2), 'joe', 'Import'), [('trunk', 'D', 'A', None, None), ('trunk/README', 'F', 'A'... | def test_sync_changeset(self): t1 = datetime(2001, 1, 1, 1, 1, 1, 0, utc) t2 = datetime(2002, 1, 1, 1, 1, 1, 0, utc) self.preset_cache( (('0', to_timestamp(t1), '', ''), []), (('1', to_timestamp(t2), 'joe', 'Import'), [('trunk', 'D', 'A', None, None), ('trunk/README', 'F', 'A', None, None)]), ) repos = self.get_repos(g... | 465,622 |
def _do_login(self, req): """Log the remote user in. | def _do_login(self, req): """Log the remote user in. | 465,623 |
def handle_code_block(self, line): if WikiParser.ENDBLOCK not in line and \ WikiParser._startblock_re.match(line): self.in_code_block += 1 elif line.strip() == WikiParser.ENDBLOCK: self.in_code_block -= 1 | def handle_code_block(self, line, startmatch=None): if WikiParser.ENDBLOCK not in line and \ WikiParser._startblock_re.match(line): self.in_code_block += 1 elif line.strip() == WikiParser.ENDBLOCK: self.in_code_block -= 1 | 465,624 |
def format_props(self): tkt = self.ticket fields = [f for f in tkt.fields if f['name'] not in ('summary', 'cc', 'time', 'changetime')] width = [0, 0, 0, 0] i = 0 for f in fields: if f['type'] == 'textarea': continue fname = f['name'] if not fname in tkt.values: continue fval = tkt[fname] or '' if fval.find('\n') != -1:... | def format_props(self): tkt = self.ticket fields = [f for f in tkt.fields if f['name'] not in ('summary', 'cc', 'time', 'changetime')] width = [0, 0, 0, 0] i = 0 for f in fields: if f['type'] == 'textarea': continue fname = f['name'] if not fname in tkt.values: continue fval = tkt[fname] or '' if fval.find('\n') != -1:... | 465,625 |
def format_props(self): tkt = self.ticket fields = [f for f in tkt.fields if f['name'] not in ('summary', 'cc', 'time', 'changetime')] width = [0, 0, 0, 0] i = 0 for f in fields: if f['type'] == 'textarea': continue fname = f['name'] if not fname in tkt.values: continue fval = tkt[fname] or '' if fval.find('\n') != -1:... | def format_props(self): tkt = self.ticket fields = [f for f in tkt.fields if f['name'] not in ('summary', 'cc', 'time', 'changetime')] width = [0, 0, 0, 0] i = 0 for f in fields: if f['type'] == 'textarea': continue fname = f['name'] if not fname in tkt.values: continue fval = tkt[fname] or '' if fval.find('\n') != -1:... | 465,626 |
def format_props(self): tkt = self.ticket fields = [f for f in tkt.fields if f['name'] not in ('summary', 'cc', 'time', 'changetime')] width = [0, 0, 0, 0] i = 0 for f in fields: if f['type'] == 'textarea': continue fname = f['name'] if not fname in tkt.values: continue fval = tkt[fname] or '' if fval.find('\n') != -1:... | def format_props(self): tkt = self.ticket fields = [f for f in tkt.fields if f['name'] not in ('summary', 'cc', 'time', 'changetime')] width = [0, 0, 0, 0] i = 0 for f in fields: if f['type'] == 'textarea': continue fname = f['name'] if not fname in tkt.values: continue fval = tkt[fname] or '' if fval.find('\n') != -1:... | 465,627 |
def format_props(self): tkt = self.ticket fields = [f for f in tkt.fields if f['name'] not in ('summary', 'cc', 'time', 'changetime')] width = [0, 0, 0, 0] i = 0 for f in fields: if f['type'] == 'textarea': continue fname = f['name'] if not fname in tkt.values: continue fval = tkt[fname] or '' if fval.find('\n') != -1:... | def format_props(self): tkt = self.ticket fields = [f for f in tkt.fields if f['name'] not in ('summary', 'cc', 'time', 'changetime')] width = [0, 0, 0, 0] i = 0 for f in fields: if f['type'] == 'textarea': continue fname = f['name'] if not fname in tkt.values: continue fval = tkt[fname] or '' if fval.find('\n') != -1:... | 465,628 |
def flatten(resource): if not resource or not (resource.realm or resource.id): return [] # XXX Due to the mixed functionality in resource we can end up with # ticket, ticket:1, ticket:1@10. This code naively collapses all # subsets of the parent resource into one. eg. ticket:1@10 parent = resource.parent while parent a... | def flatten(resource): if not resource: return ['*:*@*'] if not (resource.realm or resource.id): return ['%s:%s@%s' % (resource.realm or '*', resource.id or '*', resource.version or '*')] # XXX Due to the mixed functionality in resource we can end up with # ticket, ticket:1, ticket:1@10. This code naively collapses all... | 465,629 |
def authz_permissions(self, resource_key, username): # TODO: Handle permission negation in sections. eg. "if in this # ticket, remove TICKET_MODIFY" valid_users = ['*', 'anonymous'] if username and username != 'anonymous': valid_users = ['*', 'authenticated', username] for resource_section in [a for a in self.authz.sec... | def authz_permissions(self, resource_key, username): # TODO: Handle permission negation in sections. eg. "if in this # ticket, remove TICKET_MODIFY" if username and username != 'anonymous': valid_users = ['*', 'authenticated', username] for resource_section in [a for a in self.authz.sections if a != 'groups']: resource... | 465,630 |
def process_request(self, req): go_to_preselected = req.args.get('preselected') if go_to_preselected: req.redirect(go_to_preselected) | def process_request(self, req): go_to_preselected = req.args.get('preselected') if go_to_preselected: req.redirect(go_to_preselected) | 465,631 |
def resolve(subject, done): if subject.startswith('@'): done.add(subject) for members in groups[subject[1:]] - done: for each in resolve(members, done): yield each elif subject.startswith('&'): yield aliases[subject[1:]] else: yield subject | def resolve(subject, done): if subject.startswith('@'): done.add(subject) for members in groups[subject[1:]] - done: for each in resolve(members, done): yield each elif subject.startswith('&'): yield aliases[subject[1:]] else: yield subject | 465,632 |
def iso_time(t): return format_time(t, 'iso8601') | def iso_time(t): return format_time(t, 'iso8601') | 465,633 |
def iso_datetime(dt): return format_datetime(dt, 'iso8601') | def iso_datetime(dt): return format_datetime(dt, 'iso8601') | 465,634 |
def process_request(self, req): go_to_preselected = req.args.get('preselected') if go_to_preselected: req.redirect(go_to_preselected) | def process_request(self, req): go_to_preselected = req.args.get('preselected') if go_to_preselected: req.redirect(go_to_preselected) | 465,635 |
def process_request(self, req): go_to_preselected = req.args.get('preselected') if go_to_preselected: req.redirect(go_to_preselected) | def process_request(self, req): go_to_preselected = req.args.get('preselected') if go_to_preselected: req.redirect(go_to_preselected) | 465,636 |
def process_request(self, req): go_to_preselected = req.args.get('preselected') if go_to_preselected: req.redirect(go_to_preselected) | def process_request(self, req): go_to_preselected = req.args.get('preselected') if go_to_preselected: req.redirect(go_to_preselected) | 465,637 |
def process_request(self, req): go_to_preselected = req.args.get('preselected') if go_to_preselected: req.redirect(go_to_preselected) | def process_request(self, req): go_to_preselected = req.args.get('preselected') if go_to_preselected: req.redirect(go_to_preselected) | 465,638 |
def get_supported_schemes(self): if not have_pysqlite: self.error = _("Cannot load Python bindings for SQLite") elif sqlite_version >= (3, 3, 3): if sqlite.version_info < (1, 1, 7): self.error = _("Need at least PySqlite %(version)s or higher", version='1.1.7') elif sqlite.version_info[0] == 2 and \ sqlite.version_info... | def get_supported_schemes(self): if not have_pysqlite: self.error = _("Cannot load Python bindings for SQLite") elif sqlite_version >= (3, 3, 3) and sqlite.version_info[0] == 2 and \ sqlite.version_info < (2, 0, 7): self.error = _("Need at least PySqlite %(version)s or higher", version='2.0.7') yield ('sqlite', self.er... | 465,639 |
def upgrade_environment(db): """Actually perform an environment upgrade. Implementations of this method don't need to commit any database transactions. This is done implicitly for each participant if the upgrade succeeds without an error being raised. | def upgrade_environment(db): """Actually perform an environment upgrade. Implementations of this method don't need to commit any database transactions. This is done implicitly for each participant if the upgrade succeeds without an error being raised. | 465,640 |
def get_navigation_items(req): """Should return an iterable object over the list of navigation items to add, each being a tuple in the form (category, name, text). """ | def get_navigation_items(req): """Should return an iterable object over the list of navigation items to add, each being a tuple in the form (category, name, text). """ | 465,641 |
def get_navigation_items(req): """Should return an iterable object over the list of navigation items to add, each being a tuple in the form (category, name, text). """ | def get_navigation_items(req): """Should return an iterable object over the list of navigation items to add, each being a tuple in the form (category, name, text). """ | 465,642 |
def resource_exists(self, resource): """ >>> from trac.test import EnvironmentStub >>> from trac.resource import Resource, resource_exists >>> env = EnvironmentStub() | def resource_exists(self, resource): """ >>> from trac.test import EnvironmentStub >>> from trac.resource import Resource, resource_exists >>> env = EnvironmentStub() | 465,643 |
def process_request(self, req): req.perm.require('BROWSER_VIEW') | def process_request(self, req): req.perm.require('BROWSER_VIEW') | 465,644 |
def process_request(self, req): req.perm.require('BROWSER_VIEW') | def process_request(self, req): req.perm.require('BROWSER_VIEW') | 465,645 |
def datetime2epoch(dt) : import time return time.mktime(dt.timetuple()) | def datetime2epoch(dt) : import time return time.mktime(dt.timetuple()) * 1000000 | 465,646 |
def _get_locale(self, req): if Locale: available = [locale_id.replace('_', '-') for locale_id in translation.get_available_locales()] | def _get_locale(self, req): if Locale: available = [locale_id.replace('_', '-') for locale_id in translation.get_available_locales()] | 465,647 |
def format(self, text, out=None, escape_newlines=False): self.reset(text, out) if isinstance(text, basestring): text = text.splitlines() for line in text: # Handle code block if self.in_code_block or WikiParser.ENDBLOCK not in line: match = WikiParser._startblock_re.match(line) if match or self.in_code_block: self.han... | def format(self, text, out=None, escape_newlines=False): self.reset(text, out) if isinstance(text, basestring): text = text.splitlines() for line in text: # Handle code block if self.in_code_block or WikiParser.ENDBLOCK not in line: match = WikiParser._startblock_re.match(line) if match or self.in_code_block: self.han... | 465,648 |
def parse_list(name): return [inc.strip() for inc in kw.get(name, '').split(':') if inc.strip()] | def parse_list(name): return [inc.strip() for inc in kw.get(name, '').split(':') if inc.strip()] | 465,649 |
def _do_search(self, req, terms, filters): results = [] for source in self.search_sources: results += list(source.get_search_results(req, terms, filters)) return sorted(results, key=lambda x: x[2]) | def _do_search(self, req, terms, filters): results = [] for source in self.search_sources: results += list(source.get_search_results(req, terms, filters)) return sorted(results, key=lambda x: x[2]) | 465,650 |
def render_ticket_action_control(self, req, ticket, action): | def render_ticket_action_control(self, req, ticket, action): | 465,651 |
def render_ticket_action_control(self, req, ticket, action): | def render_ticket_action_control(self, req, ticket, action): | 465,652 |
def add_script(req, filename, mimetype='text/javascript'): """Add a reference to an external javascript file to the template. If the filename is absolute (i.e. starts with a slash), the generated link will be based off the application root path. If it is relative, the link will be based off the `/chrome/` path. """ sc... | def add_script(req, filename, mimetype='text/javascript', charset='utf-8'): """Add a reference to an external javascript file to the template. If the filename is absolute (i.e. starts with a slash), the generated link will be based off the application root path. If it is relative, the link will be based off the `/chro... | 465,653 |
def add_script(req, filename, mimetype='text/javascript'): """Add a reference to an external javascript file to the template. If the filename is absolute (i.e. starts with a slash), the generated link will be based off the application root path. If it is relative, the link will be based off the `/chrome/` path. """ sc... | def add_script(req, filename, mimetype='text/javascript'): """Add a reference to an external javascript file to the template. If the filename is absolute (i.e. starts with a slash), the generated link will be based off the application root path. If it is relative, the link will be based off the `/chrome/` path. """ sc... | 465,654 |
def _format_row(self, env, context, text): if text: row_formatter = Formatter(env, context) out = StringIO() row_formatter.format(text, out) text = out.getvalue() text = Markup(text[len('<table class="wiki">\n<tr>') + 1: -len('</tr></table>\n') - 1]) return text | def _format_row(self, env, context, text): if text: row_formatter = Formatter(env, context) out = StringIO() row_formatter.format(text, out) text = out.getvalue() inner_tr_start = text.find('>', 20) + 1 inner_tr_end = text.find('<', len(text) - 15) text = Markup(text[inner_tr_start:inner_tr_end]) return text | 465,655 |
def _do_save(self, req, db, milestone): if milestone.exists: req.perm(milestone.resource).require('MILESTONE_MODIFY') else: req.perm(milestone.resource).require('MILESTONE_CREATE') | def _do_save(self, req, db, milestone): if milestone.exists: req.perm(milestone.resource).require('MILESTONE_MODIFY') else: req.perm(milestone.resource).require('MILESTONE_CREATE') | 465,656 |
def __init__(self, path, log=None, params={}): assert have_pysqlite > 0 self.cnx = None if path != ':memory:': if not os.access(path, os.F_OK): raise TracError(_('Database "%(path)s" not found.', path=path)) | def extensions = params.get('extensions', []) if len(extensions) > 0: cnx.enable_load_extension(True) for ext in extensions: cnx.load_extension(ext) cnx.enable_load_extension(False) __init__(self, extensions = params.get('extensions', []) if len(extensions) > 0: cnx.enable_load_extension(True) for ext in extensions: c... | 465,657 |
def refresh_calcs(self): if self.count < 1: return total_percent = 0 self.done_percent = 0 self.done_count = 0 for interval in self.intervals: interval['percent'] = round(float(interval['count'] / float(self.count) * 100)) total_percent = total_percent + interval['percent'] if interval['overall_completion']: self.done_... | def refresh_calcs(self): if self.count < 1: return total_percent = 0 self.done_percent = 0 self.done_count = 0 for interval in self.intervals: interval['percent'] = round(float(interval['count'] / float(self.count) * 100)) total_percent = total_percent + interval['percent'] if interval['overall_completion']: self.done_... | 465,658 |
def refresh_calcs(self): if self.count < 1: return total_percent = 0 self.done_percent = 0 self.done_count = 0 for interval in self.intervals: interval['percent'] = round(float(interval['count'] / float(self.count) * 100)) total_percent = total_percent + interval['percent'] if interval['overall_completion']: self.done_... | def refresh_calcs(self): if self.count < 1: return total_percent = 0 self.done_percent = 0 self.done_count = 0 for interval in self.intervals: interval['percent'] = round(float(interval['count'] / float(self.count) * 100)) total_percent = total_percent + interval['percent'] if interval['overall_completion']: self.done_... | 465,659 |
def implements(*interfaces): """Can be used in the class definiton of `Component` subclasses to declare the extension points that are extended. """ import sys | def implements(*interfaces): """Can be used in the class definition of `Component` subclasses to declare the extension points that are extended. """ import sys | 465,660 |
def _make_link(self, ns, target, match, label, fullmatch): # first check for an alias defined in trac.ini ns = self.env.config['intertrac'].get(ns, ns) if ns in self.wikiparser.link_resolvers: resolver = self.wikiparser.link_resolvers[ns] if arity(resolver) == 5: return resolver(self, ns, target, escape(label, False), ... | def _make_link(self, ns, target, match, label, fullmatch): # first check for an alias defined in trac.ini ns = self.env.config['intertrac'].get(ns, ns) if ns in self.wikiparser.link_resolvers: resolver = self.wikiparser.link_resolvers[ns] if arity(resolver) == 5: return resolver(self, ns, target, escape(label, False), ... | 465,661 |
def setUp(self): self.filename = os.path.join(tempfile.gettempdir(), 'trac-test.ini') self._write([]) self._orig_registry = Option.registry Option.registry = {} | def setUp(self): tmpdir = os.path.realpath(tempfile.gettempdir()) self.filename = os.path.join(tmpdir, 'trac-test.ini') self._write([]) self._orig_registry = Option.registry Option.registry = {} | 465,662 |
def test_getpath(self): base = os.path.dirname(self.filename) config = self._read() config.set('a', 'path_a', os.path.join(base, 'here', 'absolute.txt')) config.set('a', 'path_b', 'thisdir.txt') config.set('a', 'path_c', os.path.join(os.pardir, 'parentdir.txt')) | def test_getpath(self): base = os.path.dirname(self.filename) config = self._read() config.set('a', 'path_a', os.path.join(base, 'here', 'absolute.txt')) config.set('a', 'path_b', 'thisdir.txt') config.set('a', 'path_c', os.path.join(os.pardir, 'parentdir.txt')) | 465,663 |
def test_getpath(self): base = os.path.dirname(self.filename) config = self._read() config.set('a', 'path_a', os.path.join(base, 'here', 'absolute.txt')) config.set('a', 'path_b', 'thisdir.txt') config.set('a', 'path_c', os.path.join(os.pardir, 'parentdir.txt')) | def test_getpath(self): base = os.path.dirname(self.filename) config = self._read() config.set('a', 'path_a', os.path.join(base, 'here', 'absolute.txt')) config.set('a', 'path_b', 'thisdir.txt') config.set('a', 'path_c', os.path.join(os.pardir, 'parentdir.txt')) | 465,664 |
def test_getpath(self): base = os.path.dirname(self.filename) config = self._read() config.set('a', 'path_a', os.path.join(base, 'here', 'absolute.txt')) config.set('a', 'path_b', 'thisdir.txt') config.set('a', 'path_c', os.path.join(os.pardir, 'parentdir.txt')) | def test_getpath(self): base = os.path.dirname(self.filename) config = self._read() config.set('a', 'path_a', os.path.join(base, 'here', 'absolute.txt')) config.set('a', 'path_b', 'thisdir.txt') config.set('a', 'path_c', os.path.join(os.pardir, 'parentdir.txt')) | 465,665 |
def test_inherit_multiple(self): base = os.path.dirname(self.filename) relsite1 = os.path.join('sub1', 'trac-site1.ini') site1 = os.path.join(base, relsite1) relsite2 = os.path.join('sub2', 'trac-site2.ini') site2 = os.path.join(base, relsite2) os.mkdir(os.path.dirname(site1)) create_file(site1, '[a]\noption1 = x\n' '[... | def test_inherit_multiple(self): base = os.path.dirname(self.filename) relsite1 = os.path.join('sub1', 'trac-site1.ini') site1 = os.path.join(base, relsite1) relsite2 = os.path.join('sub2', 'trac-site2.ini') site2 = os.path.join(base, relsite2) os.mkdir(os.path.dirname(site1)) create_file(site1, '[a]\noption1 = x\n' '[... | 465,666 |
def test_inherit_multiple(self): base = os.path.dirname(self.filename) relsite1 = os.path.join('sub1', 'trac-site1.ini') site1 = os.path.join(base, relsite1) relsite2 = os.path.join('sub2', 'trac-site2.ini') site2 = os.path.join(base, relsite2) os.mkdir(os.path.dirname(site1)) create_file(site1, '[a]\noption1 = x\n' '[... | def test_inherit_multiple(self): base = os.path.dirname(self.filename) relsite1 = os.path.join('sub1', 'trac-site1.ini') site1 = os.path.join(base, relsite1) relsite2 = os.path.join('sub2', 'trac-site2.ini') site2 = os.path.join(base, relsite2) os.mkdir(os.path.dirname(site1)) create_file(site1, '[a]\noption1 = x\n' '[... | 465,667 |
def test_inherit_multiple(self): base = os.path.dirname(self.filename) relsite1 = os.path.join('sub1', 'trac-site1.ini') site1 = os.path.join(base, relsite1) relsite2 = os.path.join('sub2', 'trac-site2.ini') site2 = os.path.join(base, relsite2) os.mkdir(os.path.dirname(site1)) create_file(site1, '[a]\noption1 = x\n' '[... | def test_inherit_multiple(self): base = os.path.dirname(self.filename) relsite1 = os.path.join('sub1', 'trac-site1.ini') site1 = os.path.join(base, relsite1) relsite2 = os.path.join('sub2', 'trac-site2.ini') site2 = os.path.join(base, relsite2) os.mkdir(os.path.dirname(site1)) create_file(site1, '[a]\noption1 = x\n' '[... | 465,668 |
def runTest(self): """Download ticket in CSV format""" summary = random_sentence(5) ticketid = self._tester.create_ticket(summary) self._tester.go_to_ticket(ticketid) tc.follow('Comma-delimited Text') csv = b.get_html() if not csv.startswith('id,summary,'): raise AssertionError('Bad CSV format') | def runTest(self): """Download ticket in CSV format""" summary = random_sentence(5) ticketid = self._tester.create_ticket(summary) self._tester.go_to_ticket(ticketid) tc.follow('Comma-delimited Text') csv = b.get_html() if not csv.startswith('\xef\xbb\xbfid,summary,'): raise AssertionError('Bad CSV format') | 465,669 |
def runTest(self): """Download ticket in Tab-delimitted format""" summary = random_sentence(5) ticketid = self._tester.create_ticket(summary) self._tester.go_to_ticket(ticketid) tc.follow('Tab-delimited Text') tab = b.get_html() if not tab.startswith('id\tsummary\t'): raise AssertionError('Bad tab delimitted format') | def runTest(self): """Download ticket in Tab-delimitted format""" summary = random_sentence(5) ticketid = self._tester.create_ticket(summary) self._tester.go_to_ticket(ticketid) tc.follow('Tab-delimited Text') tab = b.get_html() if not tab.startswith('\xef\xbb\xbfid\tsummary\t'): raise AssertionError('Bad tab delimitte... | 465,670 |
def dispatch(self, req): """Find a registered handler that matches the request and let it process it. In addition, this method initializes the HDF data set and adds the web site chrome. """ self.log.debug('Dispatching %r', req) chrome = Chrome(self.env) | def dispatch(self, req): """Find a registered handler that matches the request and let it process it. In addition, this method initializes the HDF data set and adds the web site chrome. """ self.log.debug('Dispatching %r', req) chrome = Chrome(self.env) | 465,671 |
def _dispatch_request(req, env, env_error): resp = [] # fixup env.abs_href if `[trac] base_url` was not specified if env and not env.abs_href.base: env._abs_href = req.abs_href try: if not env and env_error: raise HTTPInternalError(env_error) try: dispatcher = RequestDispatcher(env) dispatcher.dispatch(req) except Re... | def _dispatch_request(req, env, env_error): resp = [] # fixup env.abs_href if `[trac] base_url` was not specified if env and not env.abs_href.base: env._abs_href = req.abs_href try: if not env and env_error: raise HTTPInternalError(env_error) try: dispatcher = RequestDispatcher(env) dispatcher.dispatch(req) except Re... | 465,672 |
def authz_permissions(self, resource_key, username): # TODO: Handle permission negation in sections. eg. "if in this # ticket, remove TICKET_MODIFY" if username and username != 'anonymous': valid_users = ['*', 'authenticated', username] else: valid_users = ['*', 'anonymous'] for resource_section in [a for a in self.aut... | def authz_permissions(self, resource_key, username): # TODO: Handle permission negation in sections. eg. "if in this # ticket, remove TICKET_MODIFY" if username and username != 'anonymous': valid_users = ['*', 'authenticated', username] else: valid_users = ['*', 'anonymous'] for resource_section in [a for a in self.aut... | 465,673 |
def assertEqual(self, expected_results, output): if not (isinstance(expected_results, basestring) and \ isinstance(output, basestring)): return unittest.TestCase.assertEqual(self, expected_results, output) # Create a useful delta between the output and the expected output output_lines = ['%s\n' % x for x in output.spli... | def assertEqual(self, expected_results, output): if not (isinstance(expected_results, basestring) and \ isinstance(output, basestring)): return unittest.TestCase.assertEqual(self, expected_results, output) # Create a useful delta between the output and the expected output output_lines = ['%s\n' % x for x in output.spli... | 465,674 |
def _wrapped_run(self, result): "Python 2.7 / unittest2 compatibility - there must be a better way..." self.setUp() if hasattr(self, 'fixture'): for test in self._tests: if hasattr(test, 'setFixture'): test.setFixture(self.fixture) unittest.TestSuite._wrapped_run(self, result) self.tearDown() return result | def _wrapped_run(self, *args, **kwargs): "Python 2.7 / unittest2 compatibility - there must be a better way..." self.setUp() if hasattr(self, 'fixture'): for test in self._tests: if hasattr(test, 'setFixture'): test.setFixture(self.fixture) unittest.TestSuite._wrapped_run(self, result) self.tearDown() return result | 465,675 |
def _wrapped_run(self, result): "Python 2.7 / unittest2 compatibility - there must be a better way..." self.setUp() if hasattr(self, 'fixture'): for test in self._tests: if hasattr(test, 'setFixture'): test.setFixture(self.fixture) unittest.TestSuite._wrapped_run(self, result) self.tearDown() return result | def _wrapped_run(self, result): "Python 2.7 / unittest2 compatibility - there must be a better way..." self.setUp() if hasattr(self, 'fixture'): for test in self._tests: if hasattr(test, 'setFixture'): test.setFixture(self.fixture) unittest.TestSuite._wrapped_run(self, *args, **kwargs) self.tearDown() return result | 465,676 |
def _wrapped_run(self, result): "Python 2.7 / unittest2 compatibility - there must be a better way..." self.setUp() if hasattr(self, 'fixture'): for test in self._tests: if hasattr(test, 'setFixture'): test.setFixture(self.fixture) unittest.TestSuite._wrapped_run(self, result) self.tearDown() return result | def _wrapped_run(self, result): "Python 2.7 / unittest2 compatibility - there must be a better way..." self.setUp() if hasattr(self, 'fixture'): for test in self._tests: if hasattr(test, 'setFixture'): test.setFixture(self.fixture) unittest.TestSuite._wrapped_run(self, result) self.tearDown() return result | 465,677 |
def render_admin_panel(self, req, cat, page, path_info): perm = PermissionSystem(self.env) all_permissions = perm.get_all_permissions() all_actions = perm.get_actions() | def render_admin_panel(self, req, cat, page, path_info): perm = PermissionSystem(self.env) all_permissions = perm.get_all_permissions() all_actions = perm.get_actions() | 465,678 |
def render_admin_panel(self, req, cat, page, path_info): perm = PermissionSystem(self.env) all_permissions = perm.get_all_permissions() all_actions = perm.get_actions() | def render_admin_panel(self, req, cat, page, path_info): perm = PermissionSystem(self.env) all_permissions = perm.get_all_permissions() all_actions = perm.get_actions() | 465,679 |
def kind_order(entry): return (not entry[0], embedded_numbers(entry[1])) | def kind_order(entry): return (not entry[0], embedded_numbers(entry[1])) | 465,680 |
def kind_order(entry): return (not entry[0], embedded_numbers(entry[1])) | def kind_order(entry): return (not entry[0], embedded_numbers(entry[1])) | 465,681 |
def kind_order(entry): return (not entry[0], embedded_numbers(entry[1])) | def kind_order(entry): return (not entry[0], embedded_numbers(entry[1])) | 465,682 |
def render_ticket_action_control(self, req, ticket, action): | def render_ticket_action_control(self, req, ticket, action): | 465,683 |
def render_ticket_action_control(self, req, ticket, action): | def render_ticket_action_control(self, req, ticket, action): | 465,684 |
def render_ticket_action_control(self, req, ticket, action): | def render_ticket_action_control(self, req, ticket, action): | 465,685 |
def render_ticket_action_control(self, req, ticket, action): | def render_ticket_action_control(self, req, ticket, action): | 465,686 |
def _render_admin_panel(self, req, cat, page, path_info): data = {'label_singular': gettext(self._label[0]), 'label_plural': gettext(self._label[1])} | def _render_admin_panel(self, req, cat, page, path_info): data = {'label_singular': gettext(self._label[0]), 'label_plural': gettext(self._label[1])} | 465,687 |
def _render_admin_panel(self, req, cat, page, path_info): data = {'label_singular': gettext(self._label[0]), 'label_plural': gettext(self._label[1])} | def _render_admin_panel(self, req, cat, page, path_info): data = {'label_singular': gettext(self._label[0]), 'label_plural': gettext(self._label[1])} | 465,688 |
def _render_admin_panel(self, req, cat, page, path_info): data = {'label_singular': gettext(self._label[0]), 'label_plural': gettext(self._label[1])} | def _render_admin_panel(self, req, cat, page, path_info): data = {'label_singular': gettext(self._label[0]), 'label_plural': gettext(self._label[1])} | 465,689 |
def _render_admin_panel(self, req, cat, page, path_info): data = {'label_singular': gettext(self._label[0]), 'label_plural': gettext(self._label[1])} | def _render_admin_panel(self, req, cat, page, path_info): data = {'label_singular': gettext(self._label[0]), 'label_plural': gettext(self._label[1])} | 465,690 |
def do_remove(db): for name in sel: enum = self._enum_cls(self.env, name, db=db) enum.delete() | def do_remove(db): for name in sel: enum = self._enum_cls(self.env, name, db=db) enum.delete() | 465,691 |
def _format_link(self, formatter, ns, match, label, fullmatch=None): if ns == 'log1': it_log = fullmatch.group('it_log') revs = fullmatch.group('log_revs') path = fullmatch.group('log_path') or '/' target = '%s%s@%s' % (it_log, path, revs) # prepending it_log is needed, as the helper expects it there intertrac = format... | def _format_link(self, formatter, ns, match, label, fullmatch=None): if ns == 'log1': it_log = fullmatch.group('it_log') revs = fullmatch.group('log_revs') path = fullmatch.group('log_path') or '/' target = '%s%s@%s' % (it_log, path, revs) # prepending it_log is needed, as the helper expects it there intertrac = format... | 465,692 |
def _format_link(self, formatter, ns, match, label, fullmatch=None): if ns == 'log1': it_log = fullmatch.group('it_log') revs = fullmatch.group('log_revs') path = fullmatch.group('log_path') or '/' target = '%s%s@%s' % (it_log, path, revs) # prepending it_log is needed, as the helper expects it there intertrac = format... | def _format_link(self, formatter, ns, match, label, fullmatch=None): if ns == 'log1': it_log = fullmatch.group('it_log') revs = fullmatch.group('log_revs') path = fullmatch.group('log_path') or '/' target = '%s%s@%s' % (it_log, path, revs) # prepending it_log is needed, as the helper expects it there intertrac = format... | 465,693 |
def setSeverityList(self, s): """Remove all severities, set them to `s`""" self.assertNoTickets() | def setSeverityList(self, s): """Remove all severities, set them to `s`""" self.assertNoTickets() | 465,694 |
def setPriorityList(self, s): """Remove all priorities, set them to `s`""" self.assertNoTickets() | def setPriorityList(self, s): """Remove all priorities, set them to `s`""" self.assertNoTickets() | 465,695 |
def setComponentList(self, l, key): """Remove all components, set them to `l`""" self.assertNoTickets() | def setComponentList(self, l, key): """Remove all components, set them to `l`""" self.assertNoTickets() | 465,696 |
def setVersionList(self, v, key): """Remove all versions, set them to `v`""" self.assertNoTickets() | def setVersionList(self, v, key): """Remove all versions, set them to `v`""" self.assertNoTickets() | 465,697 |
def setMilestoneList(self, m, key): """Remove all milestones, set them to `m`""" self.assertNoTickets() | def setMilestoneList(self, m, key): """Remove all milestones, set them to `m`""" self.assertNoTickets() | 465,698 |
def addTicket(self, id, time, changetime, component, severity, priority, owner, reporter, cc, version, milestone, status, resolution, summary, description, keywords, customfields): c = self.db().cursor() | def addTicket(self, id, time, changetime, component, severity, priority, owner, reporter, cc, version, milestone, status, resolution, summary, description, keywords, customfields): c = self.db().cursor() | 465,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.