bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def _mark_valid(self): """Mark pool as valid""" if self._parent_pool: # Refer to self using a weakreference so that we don't # create a reference cycle weakself = weakref.ref(self) | def _mark_valid(self): """Mark pool as valid""" if self._parent_pool: # Refer to self using a weakreference so that we don't # create a reference cycle weakself = weakref.ref(self) | 26,200 |
def __init__(self, path, authz, log): Repository.__init__(self, authz, log) | def __init__(self, path, authz, log): Repository.__init__(self, authz, log) | 26,201 |
def __init__(self, path, authz, log): Repository.__init__(self, authz, log) | def __init__(self, path, authz, log): Repository.__init__(self, authz, log) | 26,202 |
def get_youngest_rev_in_cache(self, db): """ Get the latest stored revision by sorting the revision strings numerically """ cursor = db.cursor() cursor.execute("SELECT rev FROM revision ORDER BY -LENGTH(rev), rev DESC LIMIT 1") row = cursor.fetchone() return row and row[0] or None | def get_youngest_rev_in_cache(self, db): """Get the latest stored revision by sorting the revision strings numerically """ cursor = db.cursor() cursor.execute("SELECT rev FROM revision ORDER BY -LENGTH(rev), rev DESC LIMIT 1") row = cursor.fetchone() return row and row[0] or None | 26,203 |
def get_youngest_rev_in_cache(self, db): """ Get the latest stored revision by sorting the revision strings numerically """ cursor = db.cursor() cursor.execute("SELECT rev FROM revision ORDER BY -LENGTH(rev), rev DESC LIMIT 1") row = cursor.fetchone() return row and row[0] or None | def get_youngest_rev_in_cache(self, db): """ Get the latest stored revision by sorting the revision strings numerically """ cursor = db.cursor() cursor.execute("SELECT rev FROM revision " "ORDER BY -LENGTH(rev), rev DESC LIMIT 1") row = cursor.fetchone() return row and row[0] or None | 26,204 |
def get_path_history(self, path, rev=None, limit=None): path = self.normalize_path(path) rev = self.normalize_rev(rev) expect_deletion = False subpool = Pool(self.pool) while rev: subpool.clear() rev_root = fs.revision_root(self.fs_ptr, rev, subpool()) node_type = fs.check_path(rev_root, path, subpool()) if node_type i... | def get_path_history(self, path, rev=None, limit=None): path = self.normalize_path(path) rev = self.normalize_rev(rev) expect_deletion = False subpool = Pool(self.pool) while rev: subpool.clear() rev_root = fs.revision_root(self.fs_ptr, rev, subpool()) node_type = fs.check_path(rev_root, pat... | 26,205 |
def get_path_history(self, path, rev=None, limit=None): path = self.normalize_path(path) rev = self.normalize_rev(rev) expect_deletion = False subpool = Pool(self.pool) while rev: subpool.clear() rev_root = fs.revision_root(self.fs_ptr, rev, subpool()) node_type = fs.check_path(rev_root, path, subpool()) if node_type i... | def get_path_history(self, path, rev=None, limit=None): path = self.normalize_path(path) rev = self.normalize_rev(rev) expect_deletion = False subpool = Pool(self.pool) while rev: subpool.clear() rev_root = fs.revision_root(self.fs_ptr, rev, subpool()) node_type = fs.check_path(rev_root, path, subpool()) if node_type i... | 26,206 |
def get_path_history(self, path, rev=None, limit=None): path = self.normalize_path(path) rev = self.normalize_rev(rev) expect_deletion = False subpool = Pool(self.pool) while rev: subpool.clear() rev_root = fs.revision_root(self.fs_ptr, rev, subpool()) node_type = fs.check_path(rev_root, path, subpool()) if node_type i... | def get_path_history(self, path, rev=None, limit=None): path = self.normalize_path(path) rev = self.normalize_rev(rev) expect_deletion = False subpool = Pool(self.pool) while rev: subpool.clear() rev_root = fs.revision_root(self.fs_ptr, rev, subpool()) node_type = fs.check_path(rev_root, path, subpool()) if node_type i... | 26,207 |
def get_path_history(self, path, rev=None, limit=None): path = self.normalize_path(path) rev = self.normalize_rev(rev) expect_deletion = False subpool = Pool(self.pool) while rev: subpool.clear() rev_root = fs.revision_root(self.fs_ptr, rev, subpool()) node_type = fs.check_path(rev_root, path, subpool()) if node_type i... | def get_path_history(self, path, rev=None, limit=None): path = self.normalize_path(path) rev = self.normalize_rev(rev) expect_deletion = False subpool = Pool(self.pool) while rev: subpool.clear() rev_root = fs.revision_root(self.fs_ptr, rev, subpool()) node_type = fs.check_path(rev_root, path, subpool()) if node_type i... | 26,208 |
def __init__(self, path, rev, authz, scope, fs_ptr, pool=None): self.authz = authz self.scope = scope if scope != '/': self.scoped_path = scope + path else: self.scoped_path = path self.fs_ptr = fs_ptr self.pool = Pool(pool) self._requested_rev = rev | def __init__(self, path, rev, authz, scope, fs_ptr, pool=None): self.authz = authz self.scope = scope if scope != '/': self.scoped_path = scope + path else: self.scoped_path = path self.fs_ptr = fs_ptr self.pool = Pool(pool) self._requested_rev = rev | 26,209 |
def get_history(self,limit=None): newer = None # 'newer' is the previously seen history tuple older = None # 'older' is the currently examined history tuple pool = Pool(self.pool) for path, rev in _get_history(self.scoped_path, self.authz, self.fs_ptr, pool, 0, self._requested_rev, limit): if rev > 0 and path.startswit... | def get_history(self,limit=None): newer = None # 'newer' is the previously seen history tuple older = None # 'older' is the currently examined history tuple pool = Pool(self.pool) for path, rev in _get_history(self.scoped_path, self.authz, self.fs_ptr, pool, 0, self._requested_rev, limit): if rev > 0 and path.startswit... | 26,210 |
def render(self, req, mimetype, content, filename=None, rev=None): cmdline = self.config.get('mimeviewer', 'php_path') # -n to ignore php.ini so we're using default colors cmdline += ' -sn' self.env.log.debug("PHP command line: %s" % cmdline) | def render(self, req, mimetype, content, filename=None, rev=None): cmdline = self.config.get('mimeviewer', 'php_path') # -n to ignore php.ini so we're using default colors cmdline += ' -sn' self.env.log.debug("PHP command line: %s" % cmdline) | 26,211 |
def send_project_index(req, options, env_paths=None): from trac.web.clearsilver import HDFWrapper if 'TRAC_ENV_INDEX_TEMPLATE' in options: tmpl_path, template = os.path.split(options['TRAC_ENV_INDEX_TEMPLATE']) from trac.config import default_dir req.hdf = HDFWrapper(loadpaths=[default_dir('templates'), tmpl_path]) ... | def send_project_index(req, options, env_paths=None): from trac.web.clearsilver import HDFWrapper if 'TRAC_ENV_INDEX_TEMPLATE' in options: tmpl_path, template = os.path.split(options['TRAC_ENV_INDEX_TEMPLATE']) from trac.config import default_dir req.hdf = HDFWrapper(loadpaths=[default_dir('templates'), tmpl_path]) ... | 26,212 |
def __init__(self, env, perm_=None, name=None, db=None): self.env = env self.old_name = name self.perm = perm_ if name: self._fetch(name, db) else: self.name = None self.due = 0 self.completed = 0 self.description = '' | def __init__(self, env, perm_=None, name=None, db=None): self.env = env self.perm = perm_ if name: self._fetch(name, db) else: self.name = None self.due = 0 self.completed = 0 self.description = '' | 26,213 |
def __init__(self, env, perm_=None, name=None, db=None): self.env = env self.old_name = name self.perm = perm_ if name: self._fetch(name, db) else: self.name = None self.due = 0 self.completed = 0 self.description = '' | def __init__(self, env, perm_=None, name=None, db=None): self.env = env self.old_name = name self.perm = perm_ if name: self._fetch(name, db) self.old_name = name else: self.name = self.old_name = None self.due = self.completed = 0 self.description = '' | 26,214 |
def _do_save(self, req, db, milestone): if req.args.has_key('save'): if not 'name' in req.args.keys(): raise TracError('You must provide a name for the milestone.', 'Required Field Missing') milestone.name = req.args.get('name') | def _do_save(self, req, db, milestone): if req.args.has_key('save'): if not 'name' in req.args.keys(): raise TracError('You must provide a name for the milestone.', 'Required Field Missing') milestone.name = req.args.get('name') | 26,215 |
def populate_hdf(self, req, handler): """Add chrome-related data to the HDF.""" | def populate_hdf(self, req, handler): """Add chrome-related data to the HDF.""" | 26,216 |
def process(self, req, text, in_paragraph=False): if self.error: text = system_message(Markup('Error: Failed to load processor ' '<code>%s</code>', self.name), self.error) else: text = self.processor(req, text) if in_paragraph: content_for_span = None interrupt_paragraph = False if isinstance(text, Element): tagname = ... | def process(self, req, text, in_paragraph=False): if self.error: text = system_message(Markup('Error: Failed to load processor ' '<code>%s</code>', self.name), self.error) else: text = self.processor(req, text) if in_paragraph: content_for_span = None interrupt_paragraph = False if isinstance(text, Element): tagname = ... | 26,217 |
def process(self, req, text, in_paragraph=False): if self.error: text = system_message(Markup('Error: Failed to load processor ' '<code>%s</code>', self.name), self.error) else: text = self.processor(req, text) if in_paragraph: content_for_span = None interrupt_paragraph = False if isinstance(text, Element): tagname = ... | def process(self, req, text, in_paragraph=False): if self.error: text = system_message(Markup('Error: Failed to load processor ' '<code>%s</code>', self.name), self.error) else: text = self.processor(req, text) if in_paragraph: content_for_span = None interrupt_paragraph = False if isinstance(text, Element): tagname = ... | 26,218 |
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() | 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() | 26,219 |
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() | 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() | 26,220 |
def shorten_line(text, maxlen = 75): if not text: return '' elif len(text) < maxlen: shortline = text else: last_cut = i = j = -1 cut = 0 while cut < maxlen and cut > last_cut: last_cut = cut i = text.find('[[BR]]', i+1) j = text.find('\n', j+1) cut = max(i,j) if last_cut > 0: shortline = text[:last_cut]+' ...' else: i... | def shorten_line(text, maxlen = 75): if len(text) < maxlen: return text shortline = text[:maxlen] cut = shortline.rfind(' ') + 1 or shortline.rfind('\n') + 1 or maxlen shortline = text[:cut]+' ...' return shortline | 26,221 |
def populate_hdf(hdf, env, req=None): """Populate the HDF data set with various information, such as common URLs, project information and request-related information. FIXME: do we really have req==None at times? """ from trac import __version__ hdf['trac'] = { 'version': __version__, 'time': format_datetime(), 'time.gm... | def populate_hdf(hdf, env, req=None): """Populate the HDF data set with various information, such as common URLs, project information and request-related information. FIXME: do we really have req==None at times? """ from trac import __version__ hdf['trac'] = { 'version': __version__, 'time': format_datetime(), 'time.gm... | 26,222 |
def get_db_cnx(self): return db | def get_db_cnx(self): return db | 26,223 |
def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW') | def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW') | 26,224 |
def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW') | def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW') | 26,225 |
def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW') | def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW') | 26,226 |
def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW') | def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW') | 26,227 |
def open_table(self): if not self.in_table: self.in_table = 1 self.close_paragraph() self.close_indentation() self.close_list() self.out.write('<table class="wiki">' + os.linesep) | def open_table(self): if not self.in_table: self.close_paragraph() self.close_indentation() self.close_list() self.out.write('<table class="wiki">' + os.linesep) | 26,228 |
def close(self): self.cnx.rollback() self.__pool._return_cnx(self.cnx) | def close(self): self.__pool._return_cnx(self.cnx) | 26,229 |
def test_base_url_proxy(self): environ = {'SCRIPT_NAME': '/trac', 'SERVER_NAME': 'some_proxy.org', 'HTTP_X_FORWARDED_FOR': 'example.org'} req = CGIRequest(environ) req.base_url = _reconstruct_base_url(req) self.assertEqual('http://example.org/trac', req.base_url) | def test_base_url_proxy(self): environ = {'SCRIPT_NAME': '/trac', 'SERVER_NAME': 'some_proxy.org', 'HTTP_X_FORWARDED_HOST': 'example.org'} req = CGIRequest(environ) req.base_url = _reconstruct_base_url(req) self.assertEqual('http://example.org/trac', req.base_url) | 26,230 |
def SubversionAuthorizer(env, authname): authz_file = env.config.get('trac','authz_file') if not authz_file: return Authorizer() module_name = env.config.get('trac','authz_module_name','') db = env.get_db_cnx() return RealSubversionAuthorizer(db, authname, module_name, authz_file) | def SubversionAuthorizer(env, authname): authz_file = env.config.get('trac', 'authz_file') if not authz_file: return Authorizer() module_name = env.config.get('trac','authz_module_name','') db = env.get_db_cnx() return RealSubversionAuthorizer(db, authname, module_name, authz_file) | 26,231 |
def SubversionAuthorizer(env, authname): authz_file = env.config.get('trac','authz_file') if not authz_file: return Authorizer() module_name = env.config.get('trac','authz_module_name','') db = env.get_db_cnx() return RealSubversionAuthorizer(db, authname, module_name, authz_file) | def SubversionAuthorizer(env, authname): authz_file = env.config.get('trac','authz_file') if not authz_file: return Authorizer() module_name = env.config.get('trac', 'authz_module_name') db = env.get_db_cnx() return RealSubversionAuthorizer(db, authname, module_name, authz_file) | 26,232 |
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. """ req.authname = self.authenticate(req) req.perm = PermissionCache(self.env, req.authname) | 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. """ req.authname = self.authenticate(req) req.perm = PermissionCache(self.env, req.authname) | 26,233 |
def get_initenv_args(self): returnvals = [] print 'Creating a new Trac environment at %s' % self.envname print print 'Trac will first ask a few questions about your environment ' print 'in order to initalize and prepare the project database.' print print " Please enter the name of your project." print " This name will ... | def get_initenv_args(self): returnvals = [] print 'Creating a new Trac environment at %s' % self.envname print print 'Trac will first ask a few questions about your environment ' print 'in order to initalize and prepare the project database.' print print " Please enter the name of your project." print " This name will ... | 26,234 |
def get_initenv_args(self): returnvals = [] print 'Creating a new Trac environment at %s' % self.envname print print 'Trac will first ask a few questions about your environment ' print 'in order to initalize and prepare the project database.' print print " Please enter the name of your project." print " This name will ... | def get_initenv_args(self): returnvals = [] print 'Creating a new Trac environment at %s' % self.envname print print 'Trac will first ask a few questions about your environment ' print 'in order to initalize and prepare the project database.' print print " Please enter the name of your project." print " This name will ... | 26,235 |
def get_initenv_args(self): returnvals = [] print 'Creating a new Trac environment at %s' % self.envname print print 'Trac will first ask a few questions about your environment ' print 'in order to initalize and prepare the project database.' print print " Please enter the name of your project." print " This name will ... | def get_initenv_args(self): returnvals = [] print 'Creating a new Trac environment at %s' % self.envname print print 'Trac will first ask a few questions about your environment ' print 'in order to initalize and prepare the project database.' print print " Please enter the name of your project." print " This name will ... | 26,236 |
def get_initenv_args(self): returnvals = [] print 'Creating a new Trac environment at %s' % self.envname print print 'Trac will first ask a few questions about your environment ' print 'in order to initalize and prepare the project database.' print print " Please enter the name of your project." print " This name will ... | def get_initenv_args(self): returnvals = [] print 'Creating a new Trac environment at %s' % self.envname print print 'Trac will first ask a few questions about your environment ' print 'in order to initalize and prepare the project database.' print print " Please enter the name of your project." print " This name will ... | 26,237 |
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... | 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... | 26,238 |
def render(self): self.perm.assert_permission (perm.BROWSER_VIEW) rev = self.args.get('rev', None) path = self.args.get('path', '/') order = self.args.get('order', 'name').lower() desc = self.args.has_key('desc') self.authzperm.assert_permission (path) if not rev: rev_specified = 0 rev = svn.fs.youngest_rev(self.fs_... | def render(self): self.perm.assert_permission (perm.BROWSER_VIEW) rev = self.args.get('rev', None) path = self.args.get('path', '/') order = self.args.get('order', 'name').lower() desc = self.args.has_key('desc') self.authzperm.assert_permission (path) if not rev: rev_specified = rev.lower() in ['head', 'latest', 't... | 26,239 |
def _do_wiki_import(self, filename, title, cursor=None): if not os.path.isfile(filename): raise Exception, '%s is not a file' % filename | def _do_wiki_import(self, filename, title, cursor=None): if not os.path.isfile(filename): raise Exception, '%s is not a file' % filename | 26,240 |
def _do_wiki_export(self, page, filename=''): data = self.db_query("SELECT text FROM wiki WHERE name=%s " "ORDER BY version DESC LIMIT 1", params=[page]) text = data.next()[0] if not filename: print text else: if os.path.isfile(filename): raise Exception("File '%s' exists" % filename) f = open(filename,'w') f.write(tex... | def _do_wiki_export(self, page, filename=''): data = self.db_query("SELECT text FROM wiki WHERE name=%s " "ORDER BY version DESC LIMIT 1", params=[page]) text = data.next()[0] if not filename: print text else: if os.path.isfile(filename): raise Exception("File '%s' exists" % filename) f = open(filename,'w') f.write(tex... | 26,241 |
def delete_report(self, id): self.perm.assert_permission(perm.REPORT_DELETE) | def delete_report(self, id): self.perm.assert_permission(perm.REPORT_DELETE) | 26,242 |
def commit_changes(self, id): """ saves report changes to the database """ self.perm.assert_permission(perm.REPORT_MODIFY) | def commit_changes(self, id): """ saves report changes to the database """ self.perm.assert_permission(perm.REPORT_MODIFY) | 26,243 |
def render_confirm_delete(self, id): self.perm.assert_permission(perm.REPORT_DELETE) cursor = self.db.cursor() | def render_confirm_delete(self, id): self.perm.assert_permission(perm.REPORT_DELETE) cursor = self.db.cursor() | 26,244 |
def render_report_editor(self, id, action='commit', copy=0): self.perm.assert_permission(perm.REPORT_MODIFY) cursor = self.db.cursor() | def render_report_editor(self, id, action='commit', copy=0): self.perm.assert_permission(perm.REPORT_MODIFY) cursor = self.db.cursor() | 26,245 |
def render(self): self.perm.assert_permission(perm.REPORT_VIEW) # did the user ask for any special report? id = int(self.args.get('id', -1)) action = self.args.get('action', 'list') | def render(self): self.perm.assert_permission(perm.REPORT_VIEW) # did the user ask for any special report? id = int(self.args.get('id', -1)) action = self.args.get('action', 'list') | 26,246 |
def render_html(self, req, repos, chgset, diff_options): """HTML version""" | def render_html(self, req, repos, chgset, diff_options): """HTML version""" | 26,247 |
def render_html(self, req, repos, chgset, diff_options): """HTML version""" | def render_html(self, req, repos, chgset, diff_options): """HTML version""" | 26,248 |
def get_changelog(self, when=0, db=None): """Return the changelog as a list of tuples of the form (time, author, field, oldvalue, newvalue). """ if not db: db = self.env.get_db_cnx() cursor = db.cursor() if when: cursor.execute("SELECT time,author,field,oldvalue,newvalue " "FROM ticket_change WHERE ticket=%s AND time=%... | def get_changelog(self, when=0, db=None): """Return the changelog as a list of tuples of the form (time, author, field, oldvalue, newvalue). """ if not db: db = self.env.get_db_cnx() cursor = db.cursor() if when: cursor.execute("SELECT time,author,field,oldvalue,newvalue " "FROM ticket_change WHERE ticket=%s AND time=%... | 26,249 |
def get_changelog(self, when=0, db=None): """Return the changelog as a list of tuples of the form (time, author, field, oldvalue, newvalue). """ if not db: db = self.env.get_db_cnx() cursor = db.cursor() if when: cursor.execute("SELECT time,author,field,oldvalue,newvalue " "FROM ticket_change WHERE ticket=%s AND time=%... | def get_changelog(self, when=0, db=None): """Return the changelog as a list of tuples of the form (time, author, field, oldvalue, newvalue). """ if not db: db = self.env.get_db_cnx() cursor = db.cursor() if when: cursor.execute("SELECT time,author,field,oldvalue,newvalue " "FROM ticket_change WHERE ticket=%s AND time=%... | 26,250 |
def send_pretty_error(e, env, req=None): import util import Href import os.path import traceback import StringIO tb = StringIO.StringIO() traceback.print_exc(file=tb) if not req: req = CGIRequest() req.authname = '' req.init_request() try: if not env: env = open_environment() env.href = Href.Href(req.cgi_location) cnx ... | def send_pretty_error(e, env, req=None): import util import Href import os.path import traceback import StringIO tb = StringIO.StringIO() traceback.print_exc(file=tb) if not req: req = CGIRequest() req.authname = '' req.init_request() try: if not env: env = open_environment() env.href = Href.Href(req.cgi_location) cnx ... | 26,251 |
def _isdst(self, dt): tt = (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) stamp = time.mktime(tt) tt = time.localtime(stamp) return tt.tm_isdst > 0 | def _isdst(self, dt): tt = (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) stamp = time.mktime(tt) tt = time.localtime(stamp) return tt.tm_isdst > 0 | 26,252 |
def get_changes(self): pool = Pool(self.pool) root = fs.revision_root(self.fs_ptr, self.rev, pool()) if self.rev > 0: prev_root = fs.revision_root(self.fs_ptr, self.rev - 1, pool()) editor = repos.RevisionChangeCollector(self.fs_ptr, self.rev, pool()) e_ptr, e_baton = delta.make_editor(editor, pool()) repos.svn_repos_r... | def get_changes(self): pool = Pool(self.pool) root = fs.revision_root(self.fs_ptr, self.rev, pool()) if self.rev > 0: prev_root = fs.revision_root(self.fs_ptr, self.rev - 1, pool()) editor = repos.RevisionChangeCollector(self.fs_ptr, self.rev, pool()) e_ptr, e_baton = delta.make_editor(editor, pool()) repos.svn_repos_r... | 26,253 |
def update_milestone(self, id, name, date, descr): self.perm.assert_permission(perm.MILESTONE_MODIFY) cursor = self.db.cursor() self.env.log.debug("Updating milestone '%s'" % id) if self.args.has_key('save'): if self.args.has_key('updatetickets'): self.env.log.info('Updating milestone field of all tickets ' 'associated... | def update_milestone(self, id, name, date, descr): self.perm.assert_permission(perm.MILESTONE_MODIFY) cursor = self.db.cursor() self.env.log.debug("Updating milestone '%s'" % id) if self.args.has_key('save'): self.env.log.info('Updating milestone field of all tickets ' 'associated with milestone %s' % id) cursor.execut... | 26,254 |
def render (self): self.perm.assert_permission(perm.TIMELINE_VIEW) | def render (self): self.perm.assert_permission(perm.TIMELINE_VIEW) | 26,255 |
def process_request(self, req): req.perm.assert_permission('TICKET_CREATE') | def process_request(self, req): req.perm.assert_permission('TICKET_CREATE') | 26,256 |
def _format_link(self, formatter, ns, page, label, ignore_missing): anchor = '' if page.find('#') != -1: anchor = page[page.find('#'):] page = page[:page.find('#')] page = urllib.unquote(page) label = urllib.unquote(label) | def _format_link(self, formatter, ns, page, label, ignore_missing): anchor = '' if page.find('#') != -1: anchor = page[page.find('#'):] page = page[:page.find('#')] page = urllib.unquote(page) label = urllib.unquote(label) | 26,257 |
def get_wiki_syntax(self): yield (r"!?(^|(?<=[^A-Za-z]))[A-Z][a-z]+(?:[A-Z][a-z]*[a-z/])+" "(?:#[A-Za-z0-9]+)?(?=\Z|\s|[.,;:!?\)}\]])", lambda x, y, z: self._format_link(x, 'wiki', y, y)) | def get_wiki_syntax(self): yield (r"!?(^|(?<=[^A-Za-z/]))[A-Z][a-z]+(?:[A-Z][a-z]*[a-z/])+" "(?:#[A-Za-z0-9]+)?(?=\Z|\s|[.,;:!?\)}\]])", lambda x, y, z: self._format_link(x, 'wiki', y, y)) | 26,258 |
def _do_permission_remove(self, user, action): sql = "DELETE FROM permission" clauses = [] if action != '*': clauses.append("action='%s'" % action) if user != '*': clauses.append("username='%s'" % user) if clauses: sql += " WHERE " + " AND ".join(clauses) self.db_update(sql) | def _do_permission_remove(self, user, action): sql = "DELETE FROM permission" clauses = [] if action != '*': clauses.append("action='%s'" % action) if user != '*': clauses.append("username='%s'" % user) if clauses: sql += " WHERE " + " AND ".join(clauses) self.db_update(sql) | 26,259 |
def do_initdb(self, line): self.do_initenv(line) | def do_initdb(self, line): self.do_initenv(line) | 26,260 |
def process(self, req, text, inline=False): if self.error: return system_message(util.Markup('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, n... | def process(self, req, text, inline=False): if self.error: return system_message(util.Markup('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(?:\s+class="([^"]+)")?>') code_block_end = re.compile('</div>$') tex... | 26,261 |
def process(self, req, text, inline=False): if self.error: return system_message(util.Markup('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, n... | def process(self, req, text, inline=False): if self.error: return system_message(util.Markup('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>$') match =... | 26,262 |
def _macro_formatter(self, match, fullmatch): name = fullmatch.group('macroname') if name in ['br', 'BR']: return '<br />' args = fullmatch.group('macroargs') try: macro = WikiProcessor(self.env, name) return macro.process(self.req, args, 1) except Exception, e: self.env.log.error('Macro %s(%s) failed' % (name, args), ... | def _macro_formatter(self, match, fullmatch): name = fullmatch.group('macroname') if name in ['br', 'BR']: return '<br />' args = fullmatch.group('macroargs') try: macro = WikiProcessor(self.env, name) return macro.process(self.req, args, True) except Exception, e: self.env.log.error('Macro %s(%s) failed' % (name, args... | 26,263 |
def escape(cls, text, quotes=True): """Create a Markup instance from a string and escape special characters it may contain (<, >, & and \"). If the `quotes` parameter is set to `False`, the \" character is left as is. Escaping quotes is generally only required for strings that are to be used in attribute values. """ i... | def escape(cls, text, quotes=True): """Create a Markup instance from a string and escape special characters it may contain (<, >, & and \"). If the `quotes` parameter is set to `False`, the \" character is left as is. Escaping quotes is generally only required for strings that are to be used in attribute values. """ i... | 26,264 |
def __str__(self): return Markup(''.join(self.serialize())) | def __str__(self): return Markup(''.join(self.serialize())) | 26,265 |
def format_props(self): tkt = self.ticket fields = [f for f in tkt.fields if f['type'] != 'textarea' and f['name'] not in ('summary', 'cc')] t = self.modtime or tkt.time_changed width = [0, 0, 0, 0] for i, f in enum([f['name'] for f in fields]): if not tkt.values.has_key(f): continue fval = tkt[f] if fval.find('\n') > ... | def format_props(self): tkt = self.ticket fields = [f for f in tkt.fields if f['type'] != 'textarea' and f['name'] not in ('summary', 'cc')] t = self.modtime or tkt.time_changed width = [0, 0, 0, 0] for i, f in enum([f['name'] for f in fields]): if not tkt.values.has_key(f): continue fval = tkt[f] if fval.find('\n') > ... | 26,266 |
def insert(self, filename, fileobj, size, t=None, db=None): if not db: db = self.env.get_db_cnx() handle_ta = True else: handle_ta = False | def insert(self, filename, fileobj, size, t=None, db=None): if not db: db = self.env.get_db_cnx() handle_ta = True else: handle_ta = False | 26,267 |
def render (self): self.perm.assert_permission(perm.TIMELINE_VIEW) | def render (self): self.perm.assert_permission(perm.TIMELINE_VIEW) | 26,268 |
def _render_diff(self, req, db, page): req.perm.assert_permission(perm.WIKI_VIEW) | def _render_diff(self, req, db, page): req.perm.assert_permission(perm.WIKI_VIEW) | 26,269 |
def __call__(self, *args): self.dummy() | def __call__(self, *args): self.dummy() | 26,270 |
def __dummy(self, *args): pass | def__dummy(self,*args):pass | 26,271 |
def get_groups(self, by='component'): cursor = self.db.cursor () groups = [] if by in ['status', 'resolution', 'severity', 'priority']: cursor.execute("SELECT name FROM enum WHERE type = %s " "AND name != '' ORDER BY value", by) elif by in ['component', 'milestone', 'version']: cursor.execute("SELECT name FROM %s " "WH... | def get_groups(self, by='component'): cursor = self.db.cursor () groups = [] if by in ['status', 'resolution', 'severity', 'priority']: cursor.execute("SELECT name FROM enum WHERE type = %s " "AND IFNULL(name,'') != '' ORDER BY value", by) elif by in ['component', 'milestone', 'version']: cursor.execute("SELECT name FR... | 26,272 |
def get_groups(self, by='component'): cursor = self.db.cursor () groups = [] if by in ['status', 'resolution', 'severity', 'priority']: cursor.execute("SELECT name FROM enum WHERE type = %s " "AND name != '' ORDER BY value", by) elif by in ['component', 'milestone', 'version']: cursor.execute("SELECT name FROM %s " "WH... | def get_groups(self, by='component'): cursor = self.db.cursor () groups = [] if by in ['status', 'resolution', 'severity', 'priority']: cursor.execute("SELECT name FROM enum WHERE type = %s " "AND name != '' ORDER BY value", by) elif by in ['component', 'milestone', 'version']: cursor.execute("SELECT name FROM %s " "WH... | 26,273 |
def get_groups(self, by='component'): cursor = self.db.cursor () groups = [] if by in ['status', 'resolution', 'severity', 'priority']: cursor.execute("SELECT name FROM enum WHERE type = %s " "AND name != '' ORDER BY value", by) elif by in ['component', 'milestone', 'version']: cursor.execute("SELECT name FROM %s " "WH... | def get_groups(self, by='component'): cursor = self.db.cursor () groups = [] if by in ['status', 'resolution', 'severity', 'priority']: cursor.execute("SELECT name FROM enum WHERE type = %s " "AND name != '' ORDER BY value", by) elif by in ['component', 'milestone', 'version']: cursor.execute("SELECT name FROM %s " "WH... | 26,274 |
def get_groups(self, by='component'): cursor = self.db.cursor () groups = [] if by in ['status', 'resolution', 'severity', 'priority']: cursor.execute("SELECT name FROM enum WHERE type = %s " "AND name != '' ORDER BY value", by) elif by in ['component', 'milestone', 'version']: cursor.execute("SELECT name FROM %s " "WH... | def get_groups(self, by='component'): cursor = self.db.cursor () groups = [] if by in ['status', 'resolution', 'severity', 'priority']: cursor.execute("SELECT name FROM enum WHERE type = %s " "AND name != '' ORDER BY value", by) elif by in ['component', 'milestone', 'version']: cursor.execute("SELECT name FROM %s " "WH... | 26,275 |
def _do_create(self, req, db): if not req.args.get('summary'): raise TracError('Tickets must contain a summary.') | def _do_create(self, req, db): if not req.args.get('summary'): raise TracError('Tickets must contain a summary.') | 26,276 |
def _do_save(self, req, db, ticket): if req.perm.has_permission(perm.TICKET_CHGPROP): # TICKET_CHGPROP gives permission to edit the ticket if not req.args.get('summary'): raise TracError('Tickets must contain summary.') | def _do_save(self, req, db, ticket): if req.perm.has_permission(perm.TICKET_CHGPROP): # TICKET_CHGPROP gives permission to edit the ticket if not req.args.get('summary'): raise TracError('Tickets must contain summary.') | 26,277 |
def process_request(self, req): req.perm.assert_permission(perm.LOG_VIEW) | def process_request(self, req): req.perm.assert_permission(perm.LOG_VIEW) | 26,278 |
def run(self): self.interactive = True print 'Welcome to trac-admin %(ver)s\n' \ 'Interactive Trac adminstration console.\n' \ '%(copy)s\n\n' \ "Type: '?' or 'help' for help on commands.\n" % \ {'ver':trac.__version__,'copy':__copyright__} self.cmdloop() | def run(self): self.interactive = True print 'Welcome to trac-admin %(ver)s\n' \ 'Interactive Trac administration console.\n' \ '%(copy)s\n\n' \ "Type: '?' or 'help' for help on commands.\n" % \ {'ver':trac.__version__,'copy':__copyright__} self.cmdloop() | 26,279 |
def handle_match(self, fullmatch): for itype, match in fullmatch.groupdict().items(): if match and not itype in self.wiki.helper_patterns: # Check for preceding escape character '!' if match[0] == '!': return match[1:] if itype in self.wiki.external_handlers: external_handler = self.wiki.external_handlers[itype] return... | def handle_match(self, fullmatch): for itype, match in fullmatch.groupdict().items(): if match and not itype in self.wiki.helper_patterns: # Check for preceding escape character '!' if match[0] == '!': return escape(match[1:]) if itype in self.wiki.external_handlers: external_handler = self.wiki.external_handlers[itype... | 26,280 |
def _render_view(self, req, pagename): self.perm.assert_permission(perm.WIKI_VIEW) | def _render_view(self, req, pagename): self.perm.assert_permission(perm.WIKI_VIEW) | 26,281 |
def _do_save(self, req, attachment): perm_map = {'ticket': 'TICKET_APPEND', 'wiki': 'WIKI_MODIFY'} req.perm.require(perm_map[attachment.parent_type]) | def _do_save(self, req, attachment): perm_map = {'ticket': 'TICKET_APPEND', 'wiki': 'WIKI_MODIFY'} req.perm.require(perm_map[attachment.parent_type]) | 26,282 |
def process_request(self, req): milestone_id = req.args.get('id') if not milestone_id: req.redirect(req.href.roadmap()) | def process_request(self, req): milestone_id = req.args.get('id') if not milestone_id: req.redirect(req.href.roadmap()) | 26,283 |
def _do_save(self, req, db, milestone): if milestone.exists: req.perm.require('MILESTONE_MODIFY') else: req.perm.require('MILESTONE_CREATE') | def _do_save(self, req, db, milestone): if milestone.exists: req.perm.require('MILESTONE_MODIFY') else: req.perm.require('MILESTONE_CREATE') | 26,284 |
def _render_view(self, req, db, milestone): data = {'milestone': milestone} | def _render_view(self, req, db, milestone): data = {'milestone': milestone} | 26,285 |
def _render_view(self, req, db, milestone): data = {'milestone': milestone} | def _render_view(self, req, db, milestone): data = {'milestone': milestone} | 26,286 |
def load_components(env): configured_components = [] # Load configured modules for section in env.config.sections(): for name,value in env.config.options(section): if name == 'module': configured_components.append(value) path = env.config.get(section, 'path') env.log.debug('Loading component module %s from %s' % (name... | def load_components(env): configured_components = [] # Load configured modules for section in env.config.sections(): for name, value in env.config.options(section): if name == 'module': configured_components.append(value) path = env.config.get(section, 'path') env.log.debug('Loading component module %s from %s' % (nam... | 26,287 |
def load_components(env): configured_components = [] # Load configured modules for section in env.config.sections(): for name,value in env.config.options(section): if name == 'module': configured_components.append(value) path = env.config.get(section, 'path') env.log.debug('Loading component module %s from %s' % (name... | def load_components(env): configured_components = [] # Load configured modules for section in env.config.sections(): for name,value in env.config.options(section): if name == 'module': configured_components.append(value) path = env.config.get(section, 'path') or None env.log.debug('Loading component module %s from %s'... | 26,288 |
def load_components(env): configured_components = [] # Load configured modules for section in env.config.sections(): for name,value in env.config.options(section): if name == 'module': configured_components.append(value) path = env.config.get(section, 'path') env.log.debug('Loading component module %s from %s' % (name... | def load_components(env): configured_components = [] # Load configured modules for section in env.config.sections(): for name,value in env.config.options(section): if name == 'module': configured_components.append(value) path = env.config.get(section, 'path') env.log.debug('Loading component module %s from %s' % (valu... | 26,289 |
def load_components(env): configured_components = [] # Load configured modules for section in env.config.sections(): for name,value in env.config.options(section): if name == 'module': configured_components.append(value) path = env.config.get(section, 'path') env.log.debug('Loading component module %s from %s' % (name... | def load_components(env): configured_components = [] # Load configured modules for section in env.config.sections(): for name,value in env.config.options(section): if name == 'module': configured_components.append(value) path = env.config.get(section, 'path') env.log.debug('Loading component module %s from %s' % (name... | 26,290 |
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 ' + head while tail: i = tail.find('.') if i < 0: i = len(... | def load_component(name, path=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 ' + head while tail: i = tail.find('.') if i < 0: i = len(tail) head, tail = tail[:i]... | 26,291 |
def render (self): perm.assert_permission (perm.CHANGESET_VIEW) if self.args.has_key('rev'): self.rev = int(self.args['rev']) else: self.rev = fs.youngest_rev(self.fs_ptr, self.pool) | def render (self): perm.assert_permission (perm.CHANGESET_VIEW) if self.args.has_key('rev'): self.rev = int(self.args['rev']) else: self.rev = fs.youngest_rev(self.fs_ptr, self.pool) | 26,292 |
def test_logo(self): env = EnvironmentStub() req = Mock(hdf=HDFWrapper(), cgi_location='/trac.cgi', path_info='') | def test_logo(self): env = EnvironmentStub() req = Mock(hdf=HDFWrapper(), cgi_location='/trac.cgi', path_info='') | 26,293 |
def process_request(self, req): milestone_id = req.args.get('id') if not milestone_id: req.redirect(req.href.roadmap()) | def process_request(self, req): milestone_id = req.args.get('id') if not milestone_id: req.redirect(req.href.roadmap()) | 26,294 |
def do_hotcopy(self, line): arg = self.arg_tokenize(line) if arg[0]: dest = arg[0] else: self.do_help('hotcopy') return | def do_hotcopy(self, line): arg = self.arg_tokenize(line) if arg[0]: dest = arg[0] else: self.do_help('hotcopy') return | 26,295 |
def get_ticket_fields(self): """Returns the list of fields available for tickets.""" from trac.ticket import model | def get_ticket_fields(self): """Returns the list of fields available for tickets.""" from trac.ticket import model | 26,296 |
def get_ticket_fields(self): """Returns the list of fields available for tickets.""" from trac.ticket import model | def get_ticket_fields(self): """Returns the list of fields available for tickets.""" from trac.ticket import model | 26,297 |
def __init__(self, pool, cnx): ConnectionWrapper.__init__(self, cnx) self._pool = pool | def __init__(self, pool, cnx, tid): ConnectionWrapper.__init__(self, cnx) self._pool = pool | 26,298 |
def close(self): if self.cnx: self._pool._return_cnx(self.cnx) self.cnx = None | def close(self): if self.cnx: self._pool._return_cnx(self.cnx, self._tid) self.cnx = None | 26,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.