bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
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,700
def addTicketCustomField(self, ticket_id, field_name, field_value): c = self.db().cursor()
def addTicketCustomField(self, ticket_id, field_name, field_value): c = self.db().cursor()
465,701
def addTicketComment(self, ticket, time, author, value): comment = value.encode('utf-8')
def addTicketComment(self, ticket, time, author, value): comment = value.encode('utf-8')
465,702
def addTicketChange(self, ticket, time, author, field, oldvalue, newvalue): c = self.db().cursor()
def addTicketChange(self, ticket, time, author, field, oldvalue, newvalue): c = self.db().cursor()
465,703
def addAttachment(self, author, a): if a['filename'] != '': description = a['description'].encode('utf-8') id = a['bug_id'] filename = a['filename'].encode('utf-8') filedata = StringIO.StringIO(a['thedata']) filesize = len(filedata.getvalue()) time = a['creation_ts'] print " ->inserting attachment '%s' for ticket %s...
def addAttachment(self, author, a): if a['filename'] != '': description = a['description'] id = a['bug_id'] filename = a['filename'].encode('utf-8') filedata = StringIO.StringIO(a['thedata']) filesize = len(filedata.getvalue()) time = a['creation_ts'] print " ->inserting attachment '%s' for ticket %s -- %s" % \ (fil...
465,704
def addAttachment(self, author, a): if a['filename'] != '': description = a['description'].encode('utf-8') id = a['bug_id'] filename = a['filename'].encode('utf-8') filedata = StringIO.StringIO(a['thedata']) filesize = len(filedata.getvalue()) time = a['creation_ts'] print " ->inserting attachment '%s' for ticket %s...
def addAttachment(self, author, a): if a['filename'] != '': description = a['description'].encode('utf-8') id = a['bug_id'] filename = a['filename'] filedata = StringIO.StringIO(a['thedata']) filesize = len(filedata.getvalue()) time = a['creation_ts'] print " ->inserting attachment '%s' for ticket %s -- %s" % \ (fil...
465,705
def convert(_db, _host, _user, _password, _env, _force): activityFields = FieldTranslator() # account for older versions of bugzilla print "Using Bugzilla v%s schema." % BZ_VERSION if BZ_VERSION == 2110: activityFields['removed'] = "oldvalue" activityFields['added'] = "newvalue" # init Bugzilla environment print "Bug...
def convert(_db, _host, _user, _password, _env, _force): activityFields = FieldTranslator() # account for older versions of bugzilla print "Using Bugzilla v%s schema." % BZ_VERSION if BZ_VERSION == 2110: activityFields['removed'] = "oldvalue" activityFields['added'] = "newvalue" # init Bugzilla environment print "Bug...
465,706
def get_ticket_changes(self, req, ticket, action): this_action = self.actions[action]
def get_ticket_changes(self, req, ticket, action): this_action = self.actions[action]
465,707
def get_ticket_changes(self, req, ticket, action): this_action = self.actions[action]
def get_ticket_changes(self, req, ticket, action): this_action = self.actions[action]
465,708
def sync_changeset(self, rev): cset = self.repos.get_changeset(rev) db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT time,author,message FROM revision " "WHERE repos=%s AND rev=%s", (self.id, str(cset.rev))) old_changeset = None for time, author, message in cursor: date = datetime.fromtimestamp(ti...
def sync_changeset(self, rev): cset = self.repos.get_changeset(rev) db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT time,author,message FROM revision " "WHERE repos=%s AND rev=%s", (self.id, str(cset.rev))) old_cset = None for time, author, message in cursor: date = datetime.fromtimestamp(time, u...
465,709
def sync_changeset(self, rev): cset = self.repos.get_changeset(rev) db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT time,author,message FROM revision " "WHERE repos=%s AND rev=%s", (self.id, str(cset.rev))) old_changeset = None for time, author, message in cursor: date = datetime.fromtimestamp(ti...
def sync_changeset(self, rev): cset = self.repos.get_changeset(rev) db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT time,author,message FROM revision " "WHERE repos=%s AND rev=%s", (self.id, str(cset.rev))) old_changeset = None for time, author, message in cursor: date = datetime.fromtimestamp(ti...
465,710
def sync_changeset(self, rev): cset = self.repos.get_changeset(rev) db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT time,author,message FROM revision " "WHERE repos=%s AND rev=%s", (self.id, str(cset.rev))) old_changeset = None for time, author, message in cursor: date = datetime.fromtimestamp(ti...
def sync_changeset(self, rev): cset = self.repos.get_changeset(rev) db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT time,author,message FROM revision " "WHERE repos=%s AND rev=%s", (self.id, str(cset.rev))) old_changeset = None for time, author, message in cursor: date = datetime.fromtimestamp(ti...
465,711
def get(self, id, retriever, instance): """Get cached or fresh data for the given id.""" # Get cache metadata local_meta = self._local.meta local_cache = self._local.cache if local_meta is None: # First cache usage in this request, retrieve cache metadata # from the database and make a thread-local copy of the cache me...
def get(self, id, retriever, instance): """Get cached or fresh data for the given id.""" # Get cache metadata local_meta = self._local.meta local_cache = self._local.cache if local_meta is None: # First cache usage in this request, retrieve cache metadata # from the database and make a thread-local copy of the cache me...
465,712
def invalidate(self, id): """Invalidate cached data for the given id.""" with self.env.db_transaction as db: with self._lock: # Invalidate in other processes
def invalidate(self, id): """Invalidate cached data for the given id.""" with self.env.db_transaction as db: with self._lock: # Invalidate in other processes
465,713
def _notify(self, ticket, date): """Send a ticket update notification.""" if not self.notify: return try: tn = TicketNotifyEmail(self.env) tn.notify(ticket, newticket=False, modtime=date) except Exception, e: self.log.error("Failure sending notification on change to " "ticket #%s: %s", ticket.id, exception_to_unicode(e...
def _notify(self, ticket, date): """Send a ticket update notification.""" if not self.notify: return try: tn = TicketNotifyEmail(self.env) tn.notify(ticket, newticket=False, modtime=date) except Exception, e: self.log.error("Failure sending notification on change to " "ticket #%s: %s", ticket.id, exception_to_unicode(e...
465,714
def convert(_db, _host, _user, _password, _env, _force): activityFields = FieldTranslator() # account for older versions of bugzilla print "Using Bugzilla v%s schema." % BZ_VERSION if BZ_VERSION == 2110: activityFields['removed'] = "oldvalue" activityFields['added'] = "newvalue" # init Bugzilla environment print "Bug...
def convert(_db, _host, _user, _password, _env, _force): activityFields = FieldTranslator() # account for older versions of bugzilla print "Using Bugzilla v%s schema." % BZ_VERSION if BZ_VERSION == 2110: activityFields['removed'] = "oldvalue" activityFields['added'] = "newvalue" # init Bugzilla environment print "Bug...
465,715
def process_request(self, req): req.perm.require('MILESTONE_VIEW')
def process_request(self, req): req.perm.require('MILESTONE_VIEW')
465,716
def process_request(self, req): req.perm.require('MILESTONE_VIEW')
def process_request(self, req): req.perm.require('MILESTONE_VIEW')
465,717
def process_request(self, req): req.perm.require('MILESTONE_VIEW')
def process_request(self, req): req.perm.require('MILESTONE_VIEW')
465,718
def process_request(self, req): req.perm.require('MILESTONE_VIEW')
def process_request(self, req): req.perm.require('MILESTONE_VIEW')
465,719
def write_utctime(name, value, params={}): write_prop(name, format_datetime(value, '%Y%m%dT%H%M%SZ', utc), params)
defwrite_utctime(name,value,params={}):write_prop(name,format_datetime(value,'%Y%m%dT%H%M%SZ',utc),params)
465,720
def _validate_xhtml(func_name, *args, **kwargs): page = b.get_html() if "xhtml1-strict.dtd" not in page: return etree.clear_error_log() try: etree.parse(StringIO(page), base_url=b.get_url()) except etree.XMLSyntaxError, e: raise twill.errors.TwillAssertionError( _format_error_log(page, e.error_log))
def _validate_xhtml(func_name, *args, **kwargs): page = b.get_html() if "xhtml1-strict.dtd" not in page: return etree.clear_error_log() try: url = b.get_url() if isinstance(url, str): url = unicode(url, 'latin1') etree.parse(StringIO(page), base_url=url) except etree.XMLSyntaxError, e: raise twill.errors.TwillAsserti...
465,721
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,722
def _render_list(self, req): """Render the list of available reports.""" sort = req.args.get('sort', 'report') asc = bool(int(req.args.get('asc', 1))) format = req.args.get('format') rows = self.env.db_query(""" SELECT id, title, description FROM report ORDER BY %s %s """ % ('title' if sort == 'title' else 'id', '' if...
def _render_list(self, req): """Render the list of available reports.""" sort = req.args.get('sort', 'report') asc = bool(int(req.args.get('asc', 1))) format = req.args.get('format') rows = self.env.db_query(""" SELECT id, title, description FROM report ORDER BY %s %s """ % ('title' if sort == 'title' else 'id', '' if...
465,723
def _render_list(self, req): """Render the list of available reports.""" sort = req.args.get('sort', 'report') asc = bool(int(req.args.get('asc', 1))) format = req.args.get('format') rows = self.env.db_query(""" SELECT id, title, description FROM report ORDER BY %s %s """ % ('title' if sort == 'title' else 'id', '' if...
def _render_list(self, req): """Render the list of available reports.""" sort = req.args.get('sort', 'report') asc = bool(int(req.args.get('asc', 1))) format = req.args.get('format') rows = self.env.db_query(""" SELECT id, title, description FROM report ORDER BY %s %s """ % ('title' if sort == 'title' else 'id', '' if...
465,724
def template_data(self, context, tickets, orig_list=None, orig_time=None, req=None): clauses = [] for clause in self.constraints: constraints = {} for k, v in clause.items(): constraint = {'values': [], 'mode': ''} for val in v: neg = val.startswith('!') if neg: val = val[1:] mode = '' if val[:1] in ('~', '^', '$') \ a...
def template_data(self, context, tickets, orig_list=None, orig_time=None, req=None): clauses = [] for clause in self.constraints: constraints = {} for k, v in clause.items(): constraint = {'values': [], 'mode': ''} for val in v: neg = val.startswith('!') if neg: val = val[1:] mode = '' if val[:1] in ('~', '^', '$') \ a...
465,725
def id_is_valid(num): return 0 < int(num) <= 1L << 31
def id_is_valid(num): return 0 < int(num) <= 1L << 31
465,726
def get_value_or_default(self, name): """Return the value of a field or the default value if it is undefined """ try: value = self.values[name] if value is not empty: return value field = [field for field in self.fields if field['name'] == name] if field: return field[0].get('value', '') except KeyError: pass
def get_value_or_default(self, name): """Return the value of a field or the default value if it is undefined """ try: value = self.values[name] if value is not empty: return value field = [field for field in self.fields if field['name'] == name] if field: return field[0].get('value', '') except KeyError: pass
465,727
def insert(self, when=None, db=None): """Add ticket to database. The `db` argument is deprecated in favor of `with_transaction()`. """ assert not self.exists, 'Cannot insert an existing ticket'
def insert(self, when=None, db=None): """Add ticket to database. The `db` argument is deprecated in favor of `with_transaction()`. """ assert not self.exists, 'Cannot insert an existing ticket'
465,728
def insert(self, when=None, db=None): """Add ticket to database. The `db` argument is deprecated in favor of `with_transaction()`. """ assert not self.exists, 'Cannot insert an existing ticket'
def insert(self, when=None, db=None): """Add ticket to database. The `db` argument is deprecated in favor of `with_transaction()`. """ assert not self.exists, 'Cannot insert an existing ticket'
465,729
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,730
def do_save(db): cursor = db.cursor()
def do_save(db): cursor = db.cursor()
465,731
def do_save(db): cursor = db.cursor()
def do_save(db): cursor = db.cursor()
465,732
def get_changelog(self, when=None, db=None): """Return the changelog as a list of tuples of the form (time, author, field, oldvalue, newvalue, permanent).
def get_changelog(self, when=None, db=None): """Return the changelog as a list of tuples of the form (time, author, field, oldvalue, newvalue, permanent).
465,733
def delete(self, db=None): """Delete the ticket. The `db` argument is deprecated in favor of `with_transaction()`. """ @self.env.with_transaction(db) def do_delete(db): Attachment.delete_all(self.env, 'ticket', self.id, db) cursor = db.cursor() cursor.execute("DELETE FROM ticket WHERE id=%s", (self.id,)) cursor.execut...
def delete(self, db=None): """Delete the ticket. The `db` argument is deprecated in favor of `with_transaction()`. """ @self.env.with_transaction(db) def do_delete(db): Attachment.delete_all(self.env, 'ticket', self.id, db) cursor = db.cursor() cursor.execute("DELETE FROM ticket WHERE id=%s", (self.id,)) cursor.execut...
465,734
def do_delete(db): cursor = db.cursor() row = self._find_change(cnum, db) if not row: return ts = row[0] custom_fields = set(f['name'] for f in self.fields if f.get('custom'))
def do_delete(db): cursor = db.cursor() row = self._find_change(cnum, db) if not row: return ts = row[0] custom_fields = set(f['name'] for f in self.fields if f.get('custom'))
465,735
def do_delete(db): cursor = db.cursor() row = self._find_change(cnum, db) if not row: return ts = row[0] custom_fields = set(f['name'] for f in self.fields if f.get('custom'))
def do_delete(db): cursor = db.cursor() row = self._find_change(cnum, db) if not row: return ts = row[0] custom_fields = set(f['name'] for f in self.fields if f.get('custom'))
465,736
def do_delete(db): cursor = db.cursor() row = self._find_change(cnum, db) if not row: return ts = row[0] custom_fields = set(f['name'] for f in self.fields if f.get('custom'))
def do_delete(db): cursor = db.cursor() row = self._find_change(cnum, db) if not row: return ts = row[0] custom_fields = set(f['name'] for f in self.fields if f.get('custom'))
465,737
def do_delete(db): cursor = db.cursor() row = self._find_change(cnum, db) if not row: return ts = row[0] custom_fields = set(f['name'] for f in self.fields if f.get('custom'))
def do_delete(db): cursor = db.cursor() row = self._find_change(cnum, db) if not row: return ts = row[0] custom_fields = set(f['name'] for f in self.fields if f.get('custom'))
465,738
def do_modify(db): cursor = db.cursor() # Find the current value of the comment cursor.execute(""" SELECT newvalue FROM ticket_change WHERE ticket=%s AND time=%s AND field='comment' """, (self.id, ts)) old_comment = False for old_comment, in cursor: break if comment == (old_comment or ''): return # Comment history is ...
def do_modify(db): cursor = db.cursor() # Find the current value of the comment cursor.execute(""" SELECT newvalue FROM ticket_change WHERE ticket=%s AND time=%s AND field='comment' """, (self.id, ts)) old_comment = False for old_comment, in cursor: break if comment == (old_comment or ''): return # Comment history is ...
465,739
def _find_change(self, cnum, db): """Find a comment by its number.""" scnum = str(cnum) cursor = db.cursor() cursor.execute(""" SELECT time,author,newvalue FROM ticket_change WHERE ticket=%%s AND field='comment' AND (oldvalue=%%s OR oldvalue %s) """ % db.like(), (self.id, scnum, '%' + db.like_escape('.' + scnum))) for ...
def _find_change(self, cnum, db): """Find a comment by its number.""" scnum = str(cnum) cursor = db.cursor() cursor.execute(""" SELECT time,author,newvalue FROM ticket_change WHERE ticket=%%s AND field='comment' AND (oldvalue=%%s OR oldvalue %s) """ % db.like(), (self.id, scnum, '%' + db.like_escape('.' + scnum))) for ...
465,740
def _find_change(self, cnum, db): """Find a comment by its number.""" scnum = str(cnum) cursor = db.cursor() cursor.execute(""" SELECT time,author,newvalue FROM ticket_change WHERE ticket=%%s AND field='comment' AND (oldvalue=%%s OR oldvalue %s) """ % db.like(), (self.id, scnum, '%' + db.like_escape('.' + scnum))) for ...
def _find_change(self, cnum, db): """Find a comment by its number.""" scnum = str(cnum) cursor = db.cursor() cursor.execute(""" SELECT time,author,newvalue FROM ticket_change WHERE ticket=%%s AND field='comment' AND (oldvalue=%%s OR oldvalue %s) """ % db.like(), (self.id, scnum, '%' + db.like_escape('.' + scnum))) for ...
465,741
def _find_change(self, cnum, db): """Find a comment by its number.""" scnum = str(cnum) cursor = db.cursor() cursor.execute(""" SELECT time,author,newvalue FROM ticket_change WHERE ticket=%%s AND field='comment' AND (oldvalue=%%s OR oldvalue %s) """ % db.like(), (self.id, scnum, '%' + db.like_escape('.' + scnum))) for ...
def_find_change(self,cnum,db):"""Findacommentbyitsnumber."""scnum=str(cnum)cursor=db.cursor()cursor.execute("""SELECTtime,author,newvalueFROMticket_changeWHEREticket=%%sANDfield='comment'AND(oldvalue=%%sORoldvalue%s)"""%db.like(),(self.id,scnum,'%'+db.like_escape('.'+scnum)))forrowincursor:returnrow#Fallbackwhencomment...
465,742
def delete(self, db=None): """Delete the enum value. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exists, 'Cannot delete non-existent %s' % self.type
def delete(self, db=None): """Delete the enum value. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exists, 'Cannot delete non-existent %s' % self.type
465,743
def insert(self, db=None): """Add a new enum value. The `db` argument is deprecated in favor of `with_transaction()`. """ assert not self.exists, 'Cannot insert existing %s' % self.type self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid %(type)s name.', type=self.type))
def insert(self, db=None): """Add a new enum value. The `db` argument is deprecated in favor of `with_transaction()`. """ assert not self.exists, 'Cannot insert existing %s' % self.type self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid %(type)s name.', type=self.type))
465,744
def update(self, db=None): """Update the enum value. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exists, 'Cannot update non-existent %s' % self.type self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid %(type)s name.', type=self.type))
def update(self, db=None): """Update the enum value. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exists, 'Cannot update non-existent %s' % self.type self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid %(type)s name.', type=self.type))
465,745
def select(cls, env, db=None): for state in TicketSystem(env).get_all_status(): status = cls(env) status.name = state yield status
defselect(cls,env,db=None):forstateinTicketSystem(env).get_all_status():status=cls(env)status.name=stateyieldstatus
465,746
def delete(self, db=None): """Delete the component. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exists, 'Cannot delete non-existent component'
def delete(self, db=None): """Delete the component. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exists, 'Cannot delete non-existent component'
465,747
def insert(self, db=None): """Insert a new component. The `db` argument is deprecated in favor of `with_transaction()`. """ assert not self.exists, 'Cannot insert existing component' self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid component name.'))
def insert(self, db=None): """Insert a new component. The `db` argument is deprecated in favor of `with_transaction()`. """ assert not self.exists, 'Cannot insert existing component' self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid component name.'))
465,748
def update(self, db=None): """Update the component. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exists, 'Cannot update non-existent component' self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid component name.'))
def update(self, db=None): """Update the component. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exists, 'Cannot update non-existent component' self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid component name.'))
465,749
def select(cls, env, db=None): if not db: db = env.get_read_db() cursor = db.cursor() cursor.execute(""" SELECT name,owner,description FROM component ORDER BY name """) for name, owner, description in cursor: component = cls(env) component.name = component._old_name = name component.owner = owner or None component.desc...
defselect(cls,env,db=None):ifnotdb:db=env.get_read_db()cursor=db.cursor()cursor.execute("""SELECTname,owner,descriptionFROMcomponentORDERBYname""")forname,owner,descriptionincursor:component=cls(env)component.name=component._old_name=namecomponent.owner=ownerorNonecomponent.description=descriptionor''yieldcomponent
465,750
def delete(self, retarget_to=None, author=None, db=None): """Delete the milestone. The `db` argument is deprecated in favor of `with_transaction()`. """ @self.env.with_transaction(db) def do_delete(db): cursor = db.cursor() self.env.log.info('Deleting milestone %s' % self.name) cursor.execute("DELETE FROM milestone WH...
def delete(self, retarget_to=None, author=None, db=None): """Delete the milestone. The `db` argument is deprecated in favor of `with_transaction()`. """ @self.env.with_transaction(db) def do_delete(db): cursor = db.cursor() self.env.log.info('Deleting milestone %s' % self.name) cursor.execute("DELETE FROM milestone WH...
465,751
def insert(self, db=None): """Insert a new milestone. The `db` argument is deprecated in favor of `with_transaction()`. """ self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid milestone name.'))
def insert(self, db=None): """Insert a new milestone. The `db` argument is deprecated in favor of `with_transaction()`. """ self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid milestone name.'))
465,752
def update(self, db=None): """Update the milestone. The `db` argument is deprecated in favor of `with_transaction()`. """ self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid milestone name.'))
def update(self, db=None): """Update the milestone. The `db` argument is deprecated in favor of `with_transaction()`. """ self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid milestone name.'))
465,753
def category(m): return m.is_completed and 1 or m.due and 2 or 3
defcategory(m):returnm.is_completedand1orm.dueand2or3
465,754
def delete(self, db=None): """Delete the version. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exists, 'Cannot delete non-existent version'
def delete(self, db=None): """Delete the version. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exists, 'Cannot delete non-existent version'
465,755
def insert(self, db=None): """Insert a new version. The `db` argument is deprecated in favor of `with_transaction()`. """ assert not self.exists, 'Cannot insert existing version' self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid version name.'))
def insert(self, db=None): """Insert a new version. The `db` argument is deprecated in favor of `with_transaction()`. """ assert not self.exists, 'Cannot insert existing version' self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid version name.'))
465,756
def update(self, db=None): """Update the version. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exists, 'Cannot update non-existent version' self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid version name.'))
def update(self, db=None): """Update the version. The `db` argument is deprecated in favor of `with_transaction()`. """ assert self.exists, 'Cannot update non-existent version' self.name = simplify_whitespace(self.name) if not self.name: raise TracError(_('Invalid version name.'))
465,757
def get_admin_commands(self): yield ('config get', '<section> <option>', 'Get the value of the given option in "trac.ini"', self._complete_config, self._do_get) yield ('config remove', '<section> <option>', 'Remove the specified option from "trac.ini"', self._complete_config, self._do_remove) yield ('config set', '<sec...
def get_admin_commands(self): yield ('config get', '<section> <option>', 'Get the value of the given option in "trac.ini"', self._complete_config, self._do_get) yield ('config remove', '<section> <option>', 'Remove the specified option from "trac.ini"', self._complete_config, self._do_remove) yield ('config set', '<sec...
465,758
def _do_get(self, section, option): printout(self.config.get(section, option))
def _do_get(self, section, option): printout(self.config.get(section, option))
465,759
def test_resource_doesnt_exists(self): r = Resource('wiki', 'WikiStart').child('attachment', 'file.txt') self.assertEqual(False, AttachmentModule(self.env).resource_exists(r))
def test_resource_doesnt_exist(self): r = Resource('wiki', 'WikiStart').child('attachment', 'file.txt') self.assertEqual(False, AttachmentModule(self.env).resource_exists(r))
465,760
def test_resource_doesnt_exists(self): att = Attachment(self.env, 'wiki', 'WikiStart') att.insert('file.txt', StringIO(''), 1) self.assertTrue(resource_exists(self.env, att.resource))
def test_resource_exists(self): att = Attachment(self.env, 'wiki', 'WikiStart') att.insert('file.txt', StringIO(''), 1) self.assertTrue(resource_exists(self.env, att.resource))
465,761
def test_resource_doesnt_exists(self): att = Attachment(self.env, 'wiki', 'WikiStart') att.insert('file.txt', StringIO(''), 1) self.assertTrue(resource_exists(self.env, att.resource))
deftest_resource_doesnt_exists(self):att=Attachment(self.env,'wiki','WikiStart')att.insert('file.txt',StringIO(''),1)self.assertTrue(resource_exists(self.env,att.resource))
465,762
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * '&nbsp; ' + mod * '&nbsp;'
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * '&nbsp; ' + mod * '&nbsp;'
465,763
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * '&nbsp; ' + mod * '&nbsp;'
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * '&nbsp; ' + mod * '&nbsp;'
465,764
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * '&nbsp; ' + mod * '&nbsp;'
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * '&nbsp; ' + mod * '&nbsp;'
465,765
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * '&nbsp; ' + mod * '&nbsp;'
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * '&nbsp; ' + mod * '&nbsp;'
465,766
def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW')
def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW')
465,767
def get_resource_description(self, resource, format=None, **kwargs): if resource.realm == 'changeset': reponame, id = resource.parent.id, resource.id if reponame: return _("Changeset %(rev)s in %(repo)s", rev=id, repo=reponame) else: return _("Changeset %(rev)s", rev=id) elif resource.realm == 'source': reponame, id = ...
def get_resource_description(self, resource, format=None, **kwargs): if resource.realm == 'changeset': reponame, id = resource.parent.id, resource.id if reponame: return _("Changeset %(rev)s in %(repo)s", rev=id, repo=reponame) else: return _("Changeset %(rev)s", rev=id) elif resource.realm == 'source': reponame, id = ...
465,768
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,769
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,770
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,771
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,772
def export_page(self, page, filename, cursor=None): if cursor is None: db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT text FROM wiki WHERE name=%s " "ORDER BY version DESC LIMIT 1", (page,)) text = cursor.fetchone()[0] if not filename: printout(text) else: if os.path.isfile(filename): raise Admi...
def export_page(self, page, filename, cursor=None): if cursor is None: db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT text FROM wiki WHERE name=%s " "ORDER BY version DESC LIMIT 1", (page,)) for text, in cursor: break else: raise AdminCommandError(_("Page '%(page)s' not found", page=page)) if no...
465,773
def reset(self): if self.content is not None: self.content.seek(0)
def reset(self): if self.content is not None: self.content.seek(0)
465,774
def get_session(self, sid, authenticated=False): self.env.log.debug('Retrieving session for ID %r', sid)
def get_session(self, sid, authenticated=False): self.env.log.debug('Retrieving session for ID %r', sid)
465,775
def get_session(self, sid, authenticated=False): self.env.log.debug('Retrieving session for ID %r', sid)
def get_session(self, sid, authenticated=False): self.env.log.debug('Retrieving session for ID %r', sid)
465,776
def delete_session_cookie(db): cursor = db.cursor() if self._new: self.last_visit = now self._new = False # The session might already exist even if _new is True since # it could have been created by a concurrent request (#3563). try: cursor.execute("INSERT INTO session " " (sid,last_visit,authenticated)" " VALUES (%s,%...
def delete_session_cookie(db): cursor = db.cursor() if self._new: self.last_visit = now self._new = False # The session might already exist even if _new is True since # it could have been created by a concurrent request (#3563). try: cursor.execute(""" INSERT INTO session (sid,last_visit,authenticated) VALUES (%s,%s,%s...
465,777
def delete_session_cookie(db): cursor = db.cursor() if self._new: self.last_visit = now self._new = False # The session might already exist even if _new is True since # it could have been created by a concurrent request (#3563). try: cursor.execute("INSERT INTO session " " (sid,last_visit,authenticated)" " VALUES (%s,%...
def delete_session_cookie(db): cursor = db.cursor() if self._new: self.last_visit = now self._new = False # The session might already exist even if _new is True since # it could have been created by a concurrent request (#3563). try: cursor.execute("INSERT INTO session " " (sid,last_visit,authenticated)" " VALUES (%s,%...
465,778
def delete_session_cookie(db): cursor = db.cursor() if self._new: self.last_visit = now self._new = False # The session might already exist even if _new is True since # it could have been created by a concurrent request (#3563). try: cursor.execute("INSERT INTO session " " (sid,last_visit,authenticated)" " VALUES (%s,%...
def delete_session_cookie(db): cursor = db.cursor() if self._new: self.last_visit = now self._new = False # The session might already exist even if _new is True since # it could have been created by a concurrent request (#3563). try: cursor.execute("INSERT INTO session " " (sid,last_visit,authenticated)" " VALUES (%s,%...
465,779
def delete_session_cookie(db): cursor = db.cursor() if self._new: self.last_visit = now self._new = False # The session might already exist even if _new is True since # it could have been created by a concurrent request (#3563). try: cursor.execute("INSERT INTO session " " (sid,last_visit,authenticated)" " VALUES (%s,%...
def delete_session_cookie(db): cursor = db.cursor() if self._new: self.last_visit = now self._new = False # The session might already exist even if _new is True since # it could have been created by a concurrent request (#3563). try: cursor.execute("INSERT INTO session " " (sid,last_visit,authenticated)" " VALUES (%s,%...
465,780
def delete_session_cookie(db): cursor = db.cursor() if self._new: self.last_visit = now self._new = False # The session might already exist even if _new is True since # it could have been created by a concurrent request (#3563). try: cursor.execute("INSERT INTO session " " (sid,last_visit,authenticated)" " VALUES (%s,%...
def delete_session_cookie(db): cursor = db.cursor() if self._new: self.last_visit = now self._new = False # The session might already exist even if _new is True since # it could have been created by a concurrent request (#3563). try: cursor.execute("INSERT INTO session " " (sid,last_visit,authenticated)" " VALUES (%s,%...
465,781
def delete_session_cookie(db): cursor = db.cursor() if self._new: self.last_visit = now self._new = False # The session might already exist even if _new is True since # it could have been created by a concurrent request (#3563). try: cursor.execute("INSERT INTO session " " (sid,last_visit,authenticated)" " VALUES (%s,%...
def delete_session_cookie(db): cursor = db.cursor() if self._new: self.last_visit = now self._new = False # The session might already exist even if _new is True since # it could have been created by a concurrent request (#3563). try: cursor.execute("INSERT INTO session " " (sid,last_visit,authenticated)" " VALUES (%s,%...
465,782
def get_session(self, sid, authenticated=False): refresh_cookie = False
def get_session(self, sid, authenticated=False): refresh_cookie = False
465,783
def update_session_id(db): cursor = db.cursor() cursor.execute("SELECT sid FROM session WHERE sid=%s", (new_sid,)) if cursor.fetchone(): raise TracError(Markup('Session "%s" already exists.<br />' 'Please choose a different session ID.') % new_sid, 'Error renaming session') self.env.log.debug('Changing session ID %s to...
def update_session_id(db): cursor = db.cursor() cursor.execute("SELECT sid FROM session WHERE sid=%s", (new_sid,)) if cursor.fetchone(): raise TracError(Markup('Session "%s" already exists.<br />' 'Please choose a different session ID.') % new_sid, 'Error renaming session') self.env.log.debug('Changing session ID %s to...
465,784
def update_session_id(db): cursor = db.cursor() cursor.execute("SELECT authenticated FROM session " "WHERE sid=%s OR sid=%s ", (sid, self.req.authname)) authenticated_flags = [row[0] for row in cursor.fetchall()] if len(authenticated_flags) == 2: # There's already an authenticated session for the user, # we simply del...
def update_session_id(db): cursor = db.cursor() cursor.execute(""" SELECT authenticated FROM session WHERE sid=%s OR sid=%s """, (sid, self.req.authname)) authenticated_flags = [row[0] for row in cursor.fetchall()] if len(authenticated_flags) == 2: # There's already an authenticated session for the user, # we simply d...
465,785
def update_session_id(db): cursor = db.cursor() cursor.execute("SELECT authenticated FROM session " "WHERE sid=%s OR sid=%s ", (sid, self.req.authname)) authenticated_flags = [row[0] for row in cursor.fetchall()] if len(authenticated_flags) == 2: # There's already an authenticated session for the user, # we simply del...
def update_session_id(db): cursor = db.cursor() cursor.execute("SELECT authenticated FROM session " "WHERE sid=%s OR sid=%s ", (sid, self.req.authname)) authenticated_flags = [row[0] for row in cursor.fetchall()] if len(authenticated_flags) == 2: # There's already an authenticated session for the user, # we simply del...
465,786
def update_session_id(db): cursor = db.cursor() cursor.execute("SELECT authenticated FROM session " "WHERE sid=%s OR sid=%s ", (sid, self.req.authname)) authenticated_flags = [row[0] for row in cursor.fetchall()] if len(authenticated_flags) == 2: # There's already an authenticated session for the user, # we simply del...
def update_session_id(db): cursor = db.cursor() cursor.execute("SELECT authenticated FROM session " "WHERE sid=%s OR sid=%s ", (sid, self.req.authname)) authenticated_flags = [row[0] for row in cursor.fetchall()] if len(authenticated_flags) == 2: # There's already an authenticated session for the user, # we simply del...
465,787
def update_session_id(db): cursor = db.cursor() cursor.execute("SELECT authenticated FROM session " "WHERE sid=%s OR sid=%s ", (sid, self.req.authname)) authenticated_flags = [row[0] for row in cursor.fetchall()] if len(authenticated_flags) == 2: # There's already an authenticated session for the user, # we simply del...
def update_session_id(db): cursor = db.cursor() cursor.execute("SELECT authenticated FROM session " "WHERE sid=%s OR sid=%s ", (sid, self.req.authname)) authenticated_flags = [row[0] for row in cursor.fetchall()] if len(authenticated_flags) == 2: # There's already an authenticated session for the user, # we simply del...
465,788
def _do_add(self, sid, *args): if list(self._get_list(sid)): raise AdminCommandError(_('Session alread exists. Unable to add ' 'a duplicate session.')) self._add_session(sid, *args)
def _do_add(self, sid, *args): if list(self._get_list(sid)): raise AdminCommandError(_("Session alread exists. Unable to add " "a duplicate session.")) self._add_session(sid, *args)
465,789
def _do_set(self, attr, sid, val): exists = [r for r in self._get_list(sid)] if not exists: raise AdminCommandError(_('Unable to set session attribute on a ' 'non-existent SID')) self._set_attr(sid, attr, val)
def _do_set(self, attr, sid, val): exists = [r for r in self._get_list(sid)] if not exists: raise AdminCommandError(_("Unable to set session attribute on a " "non-existent SID")) self._set_attr(sid, attr, val)
465,790
def add_session(db): cursor = db.cursor() cursor.execute("INSERT INTO session VALUES (%s, 1, %s)", (sid, time.time())) if name is not None: cursor.execute("INSERT INTO session_attribute VALUES " "(%s, 1, 'name', %s)", (sid, name)) if email is not None: cursor.execute("INSERT INTO session_attribute VALUES " "(%s, 1, 'em...
def add_session(db): cursor = db.cursor() cursor.execute("INSERT INTO session VALUES (%s, 1, %s)", (sid, time.time())) if name is not None: cursor.execute(""" INSERT INTO session_attribute VALUES (%s, 1, 'name', %s) """, (sid, name)) if email is not None: cursor.execute("INSERT INTO session_attribute VALUES " "(%s, 1, ...
465,791
def add_session(db): cursor = db.cursor() cursor.execute("INSERT INTO session VALUES (%s, 1, %s)", (sid, time.time())) if name is not None: cursor.execute("INSERT INTO session_attribute VALUES " "(%s, 1, 'name', %s)", (sid, name)) if email is not None: cursor.execute("INSERT INTO session_attribute VALUES " "(%s, 1, 'em...
def add_session(db): cursor = db.cursor() cursor.execute("INSERT INTO session VALUES (%s, 1, %s)", (sid, time.time())) if name is not None: cursor.execute("INSERT INTO session_attribute VALUES " "(%s, 1, 'name', %s)", (sid, name)) if email is not None: cursor.execute("INSERT INTO session_attribute VALUES " "(%s, 1, 'em...
465,792
def set_attr(db): cursor = db.cursor() cursor.execute("SELECT authenticated FROM session WHERE " "sid = %s", (sid,)) for authenticated, in cursor: cursor.execute(""" SELECT name, value FROM session_attribute WHERE sid = %s AND authenticated = %s AND name = %s """, (sid, authenticated, attr)) for row in cursor: cursor.e...
def set_attr(db): cursor = db.cursor() cursor.execute(""" SELECT authenticated FROM session WHERE sid = %s """, (sid,)) for authenticated, in cursor: cursor.execute(""" SELECT name, value FROM session_attribute WHERE sid = %s AND authenticated = %s AND name = %s """, (sid, authenticated, attr)) for row in cursor: curso...
465,793
def set_attr(db): cursor = db.cursor() cursor.execute("SELECT authenticated FROM session WHERE " "sid = %s", (sid,)) for authenticated, in cursor: cursor.execute(""" SELECT name, value FROM session_attribute WHERE sid = %s AND authenticated = %s AND name = %s """, (sid, authenticated, attr)) for row in cursor: cursor.e...
def set_attr(db): cursor = db.cursor() cursor.execute("SELECT authenticated FROM session WHERE " "sid = %s", (sid,)) for authenticated, in cursor: cursor.execute(""" SELECT name, value FROM session_attribute WHERE sid = %s AND authenticated = %s AND name = %s """, (sid, authenticated, attr)) for row in cursor: cursor.e...
465,794
def delete_session(db): cursor = db.cursor() if sid.lower() == 'anonymous': cursor.execute("DELETE FROM session_attribute " "WHERE authenticated = 0") cursor.execute("DELETE FROM session " "WHERE authenticated = 0") elif sid == '*': cursor.execute("DELETE FROM session_attribute " "WHERE name <> 'password'") cursor.exec...
def delete_session(db): cursor = db.cursor() if sid.lower() == 'anonymous': cursor.execute(""" DELETE FROM session_attribute WHERE authenticated = 0 """) cursor.execute(""" DELETE FROM session WHERE authenticated = 0 """) elif sid == '*': cursor.execute("DELETE FROM session_attribute " "WHERE name <> 'password'") curso...
465,795
def delete_session(db): cursor = db.cursor() if sid.lower() == 'anonymous': cursor.execute("DELETE FROM session_attribute " "WHERE authenticated = 0") cursor.execute("DELETE FROM session " "WHERE authenticated = 0") elif sid == '*': cursor.execute("DELETE FROM session_attribute " "WHERE name <> 'password'") cursor.exec...
def delete_session(db): cursor = db.cursor() if sid.lower() == 'anonymous': cursor.execute("DELETE FROM session_attribute " "WHERE authenticated = 0") cursor.execute("DELETE FROM session " "WHERE authenticated = 0") elif sid == '*': cursor.execute(""" DELETE FROM session_attribute WHERE name <> 'password' """) cursor.e...
465,796
def delete_session(db): cursor = db.cursor() if sid.lower() == 'anonymous': cursor.execute("DELETE FROM session_attribute " "WHERE authenticated = 0") cursor.execute("DELETE FROM session " "WHERE authenticated = 0") elif sid == '*': cursor.execute("DELETE FROM session_attribute " "WHERE name <> 'password'") cursor.exec...
def delete_session(db): cursor = db.cursor() if sid.lower() == 'anonymous': cursor.execute("DELETE FROM session_attribute " "WHERE authenticated = 0") cursor.execute("DELETE FROM session " "WHERE authenticated = 0") elif sid == '*': cursor.execute("DELETE FROM session_attribute " "WHERE name <> 'password'") cursor.exec...
465,797
def purge_session(db): cursor = db.cursor() if age: cursor.execute(""" DELETE FROM session_attribute WHERE authenticated=0 AND sid IN (SELECT sid FROM session WHERE authenticated=0 AND last_visit < %s) """, (ts,)) cursor.execute(""" DELETE FROM session WHERE authenticated=0 AND last_visit < %s """, (ts,)) else: cursor....
def purge_session(db): cursor = db.cursor() if age: cursor.execute(""" DELETE FROM session_attribute WHERE authenticated=0 AND sid IN (SELECT sid FROM session WHERE authenticated=0 AND last_visit < %s) """, (ts,)) cursor.execute(""" DELETE FROM session WHERE authenticated=0 AND last_visit < %s """, (ts,)) else: cursor....
465,798
def get_status(ticket): status = ticket['status'] if status == 'new' or status == 'reopened' and not ticket['owner']: return 'NEEDS-ACTION' elif status == 'assigned' or status == 'reopened': return 'IN-PROCESS' elif status == 'closed': if ticket['resolution'] == 'fixed': return 'COMPLETED' else: return 'CANCELLED' else...
def get_status(ticket): status = ticket['status'] if status == 'new' or status == 'reopened' and not ticket['owner']: return 'NEEDS-ACTION' elif status == 'assigned' or status == 'reopened': return 'IN-PROCESS' elif status == 'closed': if ticket['resolution'] == 'fixed': return 'COMPLETED' else: return 'CANCELLED' else...
465,799