rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
'author': row['author']}
'author': escape(row['author'])}
def perform_query (self, query, changeset, tickets, wiki, page=0): keywords = query.split(' ')
117d80f197a861587863b346ce4b11b5754a4845 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/117d80f197a861587863b346ce4b11b5754a4845/Search.py
req.send_header('Content-Disposition', 'filename=Changeset%s.diff' % req.args.get('rev'))
req.send_header('Content-Disposition', 'inline;' 'filename=Changeset%s.diff' % chgset.rev)
def _render_diff(self, req, repos, chgset, diff_options): """Raw Unified Diff version""" req.send_response(200) req.send_header('Content-Type', 'text/plain;charset=utf-8') req.send_header('Content-Disposition', 'filename=Changeset%s.diff' % req.args.get('rev')) req.end_headers()
0fd1909f0f4d6521f7e57078644ee4814b182ef5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0fd1909f0f4d6521f7e57078644ee4814b182ef5/changeset.py
req.send_header('Content-Disposition',
req.send_header('Content-Disposition', 'attachment;'
def _render_zip(self, req, repos, chgset): """ZIP archive with all the added and/or modified files.""" req.send_response(200) req.send_header('Content-Type', 'application/zip') req.send_header('Content-Disposition', 'filename=Changeset%s.zip' % chgset.rev) req.end_headers()
0fd1909f0f4d6521f7e57078644ee4814b182ef5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0fd1909f0f4d6521f7e57078644ee4814b182ef5/changeset.py
add_link(req, 'start', env.href.wiki()) add_link(req, 'search', env.href.search()) add_link(req, 'help', env.href.wiki('TracGuide')) icon = env.get_config('project', 'icon') if icon: if not icon[0] == '/' and icon.find('://') < 0: icon = htdocs_location + icon mimetype = env.mimeview.get_mimetype(icon) add_link(req, 'icon', icon, type=mimetype) add_link(req, 'shortcut icon', icon, type=mimetype)
def populate_hdf(hdf, env, req=None): from trac import __version__ from time import gmtime, localtime, strftime hdf['trac'] = { 'version': __version__, 'time': strftime('%c', localtime()), 'time.gmt': strftime('%a, %d %b %Y %H:%M:%S GMT', gmtime()) } hdf['trac.href'] = { 'wiki': env.href.wiki(), 'browser': env.href.browser('/'), 'timeline': env.href.timeline(), 'roadmap': env.href.roadmap(), 'milestone': env.href.milestone(None), 'report': env.href.report(), 'query': env.href.query(), 'newticket': env.href.newticket(), 'search': env.href.search(), 'about': env.href.about(), 'about_config': env.href.about('config'), 'login': env.href.login(), 'logout': env.href.logout(), 'settings': env.href.settings(), 'homepage': 'http://trac.edgewall.com/' } hdf['project'] = { 'name': env.get_config('project', 'name'), 'name.encoded': escape(env.get_config('project', 'name')), 'descr': env.get_config('project', 'descr'), 'footer': env.get_config('project', 'footer', 'Visit the Trac open source project at<br />' '<a href="http://trac.edgewall.com/">' 'http://trac.edgewall.com/</a>'), 'url': env.get_config('project', 'url') } htdocs_location = env.get_config('trac', 'htdocs_location') if htdocs_location[-1] != '/': htdocs_location += '/' hdf['htdocs_location'] = htdocs_location src = env.get_config('header_logo', 'src') src_abs = re.match(r'https?://', src) != None if not src[0] == '/' and not src_abs: src = htdocs_location + src hdf['header_logo'] = { 'link': env.get_config('header_logo', 'link'), 'alt': escape(env.get_config('header_logo', 'alt')), 'src': src, 'src_abs': src_abs, 'width': env.get_config('header_logo', 'width'), 'height': env.get_config('header_logo', 'height') } add_link(req, 'start', env.href.wiki()) add_link(req, 'search', env.href.search()) add_link(req, 'help', env.href.wiki('TracGuide')) icon = env.get_config('project', 'icon') if icon: if not icon[0] == '/' and icon.find('://') < 0: icon = htdocs_location + icon mimetype = env.mimeview.get_mimetype(icon) add_link(req, 'icon', icon, type=mimetype) add_link(req, 'shortcut icon', icon, type=mimetype) if req: hdf['base_url'] = req.base_url hdf['base_host'] = req.base_url[:req.base_url.rfind(req.cgi_location)] hdf['cgi_location'] = req.cgi_location hdf['trac.authname'] = escape(req.authname)
309bb56137df2c543dbfc5dd8569b42fb1831326 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/309bb56137df2c543dbfc5dd8569b42fb1831326/main.py
r"(?P<bolditalic>%s)" % BOLDITALIC_TOKEN, r"(?P<bold>%s)" % BOLD_TOKEN, r"(?P<italic>%s)" % ITALIC_TOKEN,
r"(?P<bolditalic>!?%s)" % BOLDITALIC_TOKEN, r"(?P<bold>!?%s)" % BOLD_TOKEN, r"(?P<italic>!?%s)" % ITALIC_TOKEN,
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 = text.tagname.lower() if tagname == 'div': class_ = text.attr.get('class_', '') if class_ and 'code' in class_: content_for_span = text.children else: interrupt_paragraph = True elif tagname == 'table': interrupt_paragraph = True else: match = re.match(self._code_block_re, text) if match: if match.group(1) and 'code' in match.group(1): content_for_span = match.group(2) else: interrupt_paragraph = True elif text.startswith('<table'): interrupt_paragraph = True if content_for_span: text = html.SPAN(class_='code-block')[content_for_span] elif interrupt_paragraph: text = "</p>%s<p>" % to_unicode(text) return to_unicode(text)
235f297c0e903036e7076837182dd1d5f0cf6e58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/235f297c0e903036e7076837182dd1d5f0cf6e58/formatter.py
_anchor_re = re.compile('[^\w\d\.-:]+', re.UNICODE)
_anchor_re = re.compile('[^\w\.-:]+', re.UNICODE)
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 = text.tagname.lower() if tagname == 'div': class_ = text.attr.get('class_', '') if class_ and 'code' in class_: content_for_span = text.children else: interrupt_paragraph = True elif tagname == 'table': interrupt_paragraph = True else: match = re.match(self._code_block_re, text) if match: if match.group(1) and 'code' in match.group(1): content_for_span = match.group(2) else: interrupt_paragraph = True elif text.startswith('<table'): interrupt_paragraph = True if content_for_span: text = html.SPAN(class_='code-block')[content_for_span] elif interrupt_paragraph: text = "</p>%s<p>" % to_unicode(text) return to_unicode(text)
235f297c0e903036e7076837182dd1d5f0cf6e58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/235f297c0e903036e7076837182dd1d5f0cf6e58/formatter.py
def simple_tag_handler(self, open_tag, close_tag):
def simple_tag_handler(self, match, open_tag, close_tag):
def simple_tag_handler(self, open_tag, close_tag): """Generic handler for simple binary style tags""" if self.tag_open_p((open_tag, close_tag)): return self.close_tag(close_tag) else: self.open_tag(open_tag, close_tag) return open_tag
235f297c0e903036e7076837182dd1d5f0cf6e58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/235f297c0e903036e7076837182dd1d5f0cf6e58/formatter.py
return self.simple_tag_handler('<strong>', '</strong>')
return self.simple_tag_handler(match, '<strong>', '</strong>')
def _bold_formatter(self, match, fullmatch): return self.simple_tag_handler('<strong>', '</strong>')
235f297c0e903036e7076837182dd1d5f0cf6e58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/235f297c0e903036e7076837182dd1d5f0cf6e58/formatter.py
return self.simple_tag_handler('<i>', '</i>')
return self.simple_tag_handler(match, '<i>', '</i>')
def _italic_formatter(self, match, fullmatch): return self.simple_tag_handler('<i>', '</i>')
235f297c0e903036e7076837182dd1d5f0cf6e58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/235f297c0e903036e7076837182dd1d5f0cf6e58/formatter.py
if match[0] == '!': return match[1:] else: return self.simple_tag_handler('<span class="underline">', '</span>')
return self.simple_tag_handler(match, '<span class="underline">', '</span>')
def _underline_formatter(self, match, fullmatch): if match[0] == '!': return match[1:] else: return self.simple_tag_handler('<span class="underline">', '</span>')
235f297c0e903036e7076837182dd1d5f0cf6e58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/235f297c0e903036e7076837182dd1d5f0cf6e58/formatter.py
if match[0] == '!': return match[1:] else: return self.simple_tag_handler('<del>', '</del>')
return self.simple_tag_handler(match, '<del>', '</del>')
def _strike_formatter(self, match, fullmatch): if match[0] == '!': return match[1:] else: return self.simple_tag_handler('<del>', '</del>')
235f297c0e903036e7076837182dd1d5f0cf6e58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/235f297c0e903036e7076837182dd1d5f0cf6e58/formatter.py
if match[0] == '!': return match[1:] else: return self.simple_tag_handler('<sub>', '</sub>')
return self.simple_tag_handler(match, '<sub>', '</sub>')
def _subscript_formatter(self, match, fullmatch): if match[0] == '!': return match[1:] else: return self.simple_tag_handler('<sub>', '</sub>')
235f297c0e903036e7076837182dd1d5f0cf6e58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/235f297c0e903036e7076837182dd1d5f0cf6e58/formatter.py
if match[0] == '!': return match[1:] else: return self.simple_tag_handler('<sup>', '</sup>')
return self.simple_tag_handler(match, '<sup>', '</sup>')
def _superscript_formatter(self, match, fullmatch): if match[0] == '!': return match[1:] else: return self.simple_tag_handler('<sup>', '</sup>')
235f297c0e903036e7076837182dd1d5f0cf6e58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/235f297c0e903036e7076837182dd1d5f0cf6e58/formatter.py
if key in self[section].overriden:
if key in self[section].overridden:
def save(self): """Write the configuration options to the primary file.""" if not self.filename: return
99f16af4b1bb12ffadcccab2470adf39c5851d5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/99f16af4b1bb12ffadcccab2470adf39c5851d5a/config.py
__slots__ = ['config', 'name', 'overriden']
__slots__ = ['config', 'name', 'overridden']
def has_site_option(self, section, name): return self.site_parser.has_option(section, name)
99f16af4b1bb12ffadcccab2470adf39c5851d5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/99f16af4b1bb12ffadcccab2470adf39c5851d5a/config.py
self.overriden = {}
self.overridden = {}
def __init__(self, config, name): self.config = config self.name = name self.overriden = {}
99f16af4b1bb12ffadcccab2470adf39c5851d5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/99f16af4b1bb12ffadcccab2470adf39c5851d5a/config.py
self.overriden[name] = True
self.overridden[name] = True
def set(self, name, value): """Change a configuration value. These changes are not persistent unless saved with `save()`. """ if not self.config.parser.has_section(self.name): self.config.parser.add_section(self.name) if value is None: self.overriden[name] = True value = '' else: value = to_unicode(value).encode('utf-8') return self.config.parser.set(self.name, name, value)
99f16af4b1bb12ffadcccab2470adf39c5851d5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/99f16af4b1bb12ffadcccab2470adf39c5851d5a/config.py
message = wiki_to_oneliner(util.shorten_line(message), env, db)
message = wiki_to_oneliner(shortlog, env, db)
def _get_changes(env, repos, revs, full=None, req=None, format=None): db = env.get_db_cnx() changes = {} for rev in revs: changeset = repos.get_changeset(rev) message = changeset.message files = None if format == 'changelog': files = [change[0] for change in changeset.get_changes()] elif message: if not full: message = wiki_to_oneliner(util.shorten_line(message), env, db) else: message = wiki_to_html(message, env, req, db, absurls=(format == 'rss'), escape_newlines=True) if not message: message = '--' changes[rev] = { 'date_seconds': changeset.date, 'date': time.strftime('%x %X', time.localtime(changeset.date)), 'age': util.pretty_timedelta(changeset.date), 'author': changeset.author or 'anonymous', 'message': message, 'files': files } return changes
998dac2369938253a93cb9438203ef2020aaaf5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/998dac2369938253a93cb9438203ef2020aaaf5f/Browser.py
'filename': attachment.filename}
'filename': attachment.filename, 'attachment': attachment}
def _render_confirm(self, req, attachment): perm_map = {'ticket': 'TICKET_ADMIN', 'wiki': 'WIKI_DELETE'} req.perm.assert_permission(perm_map[attachment.parent_type])
fb0445c7f1adfec845e2cfe18ed136b6bbed327b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/fb0445c7f1adfec845e2cfe18ed136b6bbed327b/attachment.py
cnx = MySQLdb.connect(db=path, user=user, passwd=password, host=host, port=port, use_unicode=True, charset='utf8')
if (self._mysqldb_gt_or_eq((1, 2, 1))): cnx = MySQLdb.connect(db=path, user=user, passwd=password, host=host, port=port, charset='utf8') else: cnx = MySQLdb.connect(db=path, user=user, passwd=password, host=host, port=port, use_unicode=True) self._set_character_set(cnx, 'utf8')
def __init__(self, path, user=None, password=None, host=None, port=None, params={}): import MySQLdb
259db393f7f049464973f9fa473e47c3b7c04d8d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/259db393f7f049464973f9fa473e47c3b7c04d8d/mysql_backend.py
cursor = self.db.cursor()
self.env.log.debug('Promoting anonymous session %s to authenticated ' 'session for user %s' % (sid, req.authname)) cursor = self.db.cursor()
def promote_session(self, sid): """ Promotes an anonymous session to an authenticated session, if there is no preexisting session data for that user name. """ assert self.req.authname != 'anonymous', \ 'Cannot promote session of anonymous user'
3edc417e45889ccb20ddf4acb5f9ff2789b2af95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/3edc417e45889ccb20ddf4acb5f9ff2789b2af95/session.py
self.perm.assert_permission(perm.TICKET_CREATE)
def render (self): if self.args.has_key('create'): self.perm.assert_permission(perm.TICKET_CREATE) self.create_ticket()
70e323f083ac4d08b83403dfa54286430b2561d9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/70e323f083ac4d08b83403dfa54286430b2561d9/Ticket.py
pfx = '%s.changes.%d' % (self.prefix, self.changeno)
self.changeno += 1 pfx = '%s.changes.%d.line' % (self.prefix, self.changeno)
def writeline(self, text): match = header_re.search(text) if match: self.hdf.setValue('%s.name.old' % self.prefix, match.group(1)) self.hdf.setValue('%s.name.new' % self.prefix, match.group(2)) return self.count = self.count + 1 if self.count < 3: return match = line_re.search(text) if match: pfx = '%s.changes.%d' % (self.prefix, self.changeno) self.print_block() self.hdf.setValue('%s.old' % pfx, match.group(1)) self.hdf.setValue('%s.new' % pfx, match.group(3)) self.changeno += 1 return ttype = text[0] text = text[1:] text = space_re.sub('&nbsp; ', text.expandtabs(8)) if ttype == self.ttype: self.block.append(text) else: if ttype == '+' and self.ttype == '-': self.p_block = self.block self.p_type = self.ttype else: self.print_block() self.block = [text] self.ttype = ttype
812ce6a416cd586498edc1c16e16b38d98564ca0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/812ce6a416cd586498edc1c16e16b38d98564ca0/Changeset.py
self.changeno += 1
def writeline(self, text): match = header_re.search(text) if match: self.hdf.setValue('%s.name.old' % self.prefix, match.group(1)) self.hdf.setValue('%s.name.new' % self.prefix, match.group(2)) return self.count = self.count + 1 if self.count < 3: return match = line_re.search(text) if match: pfx = '%s.changes.%d' % (self.prefix, self.changeno) self.print_block() self.hdf.setValue('%s.old' % pfx, match.group(1)) self.hdf.setValue('%s.new' % pfx, match.group(3)) self.changeno += 1 return ttype = text[0] text = text[1:] text = space_re.sub('&nbsp; ', text.expandtabs(8)) if ttype == self.ttype: self.block.append(text) else: if ttype == '+' and self.ttype == '-': self.p_block = self.block self.p_type = self.ttype else: self.print_block() self.block = [text] self.ttype = ttype
812ce6a416cd586498edc1c16e16b38d98564ca0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/812ce6a416cd586498edc1c16e16b38d98564ca0/Changeset.py
clause.append('%s = \'%s\'' % (constraints[i], vals[j].value))
vals[j] = vals[j].value clause.append('%s = \'%s\'' % (constraints[i], vals[j]))
def render(self): self.perm.assert_permission(perm.TICKET_VIEW)
c8221cee7eac3dcd8ba12503e281f7a01b6175b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/c8221cee7eac3dcd8ba12503e281f7a01b6175b0/Ticket.py
clause.append('%s = \'%s\'' % (constraints[i], vals.value))
vals = vals.value clause.append('%s = \'%s\'' % (constraints[i], vals))
def render(self): self.perm.assert_permission(perm.TICKET_VIEW)
c8221cee7eac3dcd8ba12503e281f7a01b6175b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/c8221cee7eac3dcd8ba12503e281f7a01b6175b0/Ticket.py
r"(?P<list>^(?P<ldepth>\s+)(?:\*|\d+\.|[a-zA-Z]+\.) )",
r"(?P<list>^(?P<ldepth>\s+)(?:\*|\d+\.|[a-zA-Z]\.|[ivxIVX]{1,5}\.) )",
def process(self, req, text, in_paragraph=False): if self.error: return system_message(Markup('Error: Failed to load processor ' '<code>%s</code>', self.name), self.error) text = self.processor(req, text) if in_paragraph: content_for_span = None interrupt_paragraph = False if isinstance(text, Element): tagname = text.tagname.lower() if tagname == 'div': class_ = text.attr.get('class_', '') if class_ and 'code' in class_: content_for_span = text.children else: interrupt_paragraph = True elif tagname == 'table': interrupt_paragraph = True else: match = re.match(self._code_block_re, text) if match: if match.group(1) and 'code' in match.group(1): content_for_span = match.group(2) else: interrupt_paragraph = True elif text.startswith('<table'): interrupt_paragraph = True if content_for_span: text = html.SPAN(class_='code-block')[content_for_span] elif interrupt_paragraph: text = "</p>%s<p>" % text return to_unicode(text)
6a4ca7278685b1828c8489159e6ff7cd2d1648be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/6a4ca7278685b1828c8489159e6ff7cd2d1648be/formatter.py
[wiki:TracTickets
[TracTickets
def validate_ticket(req, ticket): """Validate a ticket after it's been populated from user input. Must return a list of `(field, message)` tuples, one for each problem detected. `field` can be `None` to indicate an overall problem with the ticket. Therefore, a return value of `[]` means everything is OK."""
16243369591574d257dfe8e66b7b5c3fa90ee3e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/16243369591574d257dfe8e66b7b5c3fa90ee3e3/api.py
while True: data = fd.read(4096) if not data: break self.write(data)
while True: data = fd.read(4096) if not data: break self.write(data)
def send_file(self, path, mimetype=None): """ Send a local file to the browser. This method includes the "Last-Modified", "Content-Type" and "Content-Length" headers in the response, corresponding to the file attributes. It also checks the last modification time of the local file against the "If-Modified-Since" provided by the user agent, and sends a "304 Not Modified" response if it matches. """ if not os.path.isfile(path): raise TracError, "File %s not found" % path
b9175caf553fbfb8bdf1031f4e3db418f9dcc2f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/b9175caf553fbfb8bdf1031f4e3db418f9dcc2f6/main.py
page_name = 'WikiStart' else: page_name = self._set_title(req, page, '')
def _render_view(self, req, db, page): req.perm.assert_permission('WIKI_VIEW')
34c0352d84b6be7755971fd797384250dba987d4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/34c0352d84b6be7755971fd797384250dba987d4/web_ui.py
_anchor_re = re.compile('[^\w\d]+')
_anchor_re = re.compile('[^\w\d\.-_:]+', re.UNICODE)
def format(self, text, out): if not text: return self.out = out self._open_tags = []
2b8e0d5b28de51371fbcc0cf3b83f3d569be72d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/2b8e0d5b28de51371fbcc0cf3b83f3d569be72d7/WikiFormatter.py
if anchor[0].isdigit(): anchor = '_' + anchor
if not anchor or not anchor[0].isalpha(): anchor = 'a' + anchor
def _heading_formatter(self, match, fullmatch): match = match.strip() self.close_table() self.close_paragraph() self.close_indentation() self.close_list()
2b8e0d5b28de51371fbcc0cf3b83f3d569be72d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/2b8e0d5b28de51371fbcc0cf3b83f3d569be72d7/WikiFormatter.py
req.redirect(self.env.href.wiki(pagename, version, action='diff'))
req.redirect(self.env.href.wiki(pagename, version=version, action='diff'))
def _render_diff(self, req, pagename, version): # Stores the diff-style in the session if it has been changed, and adds # diff-style related item to the HDF self.perm.assert_permission(perm.WIKI_VIEW)
2c43b1eb4088f0b5b5cec87b9f2d2204d407d1a9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/2c43b1eb4088f0b5b5cec87b9f2d2204d407d1a9/Wiki.py
env_cache_lock.acquire() if not env_path in env_cache: env_cache[env_path] = open_environment(env_path, mpr) env = env_cache[env_path] env_cache_lock.release()
try: env = None env_cache_lock.acquire() if not env_path in env_cache: env_cache[env_path] = open_environment(env_path, mpr) env = env_cache[env_path] finally: env_cache_lock.release()
def get_environment(req, mpr): global env_cache, env_cache_lock options = req.get_options() if not options.has_key('TracEnv') and not options.has_key('TracEnvParentDir'): raise EnvironmentError, \ 'Missing PythonOption "TracEnv" or "TracEnvParentDir". Trac '\ 'requires one of these options to locate the Trac environment(s).' if options.has_key('TracEnv'): env_path = options['TracEnv'] elif options.has_key('TracEnvParentDir'): env_parent_dir = options['TracEnvParentDir'] env_name = mpr.cgi_location.split('/')[-1] env_path = os.path.join(env_parent_dir, env_name) if len(env_name) == 0 or not os.path.exists(env_path): send_project_index(req, mpr, env_parent_dir) return None env_cache_lock.acquire() if not env_path in env_cache: env_cache[env_path] = open_environment(env_path, mpr) env = env_cache[env_path] env_cache_lock.release() return env
08eedab11ecafad7ce25c1f9c3b2a97dbd2ebec1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/08eedab11ecafad7ce25c1f9c3b2a97dbd2ebec1/ModPythonHandler.py
data = {}
def display_html(self, req, query): req.hdf['title'] = 'Custom Query' add_stylesheet(req, 'css/report.css')
f33a5e0e936d7631bf404f0eeadab610be18c66c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f33a5e0e936d7631bf404f0eeadab610be18c66c/query.py
data['id'] = ticket.id data['time'] = ticket.time_created data['changetime'] = ticket.time_changed data['removed'] = True
def display_html(self, req, query): req.hdf['title'] = 'Custom Query' add_stylesheet(req, 'css/report.css')
f33a5e0e936d7631bf404f0eeadab610be18c66c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f33a5e0e936d7631bf404f0eeadab610be18c66c/query.py
deletions[key_path] = idx
deletions[base_path] = idx
def get_changes(self): pool = Pool(self.pool) tmp = Pool(pool) root = fs.revision_root(self.fs_ptr, self.rev, pool()) editor = repos.RevisionChangeCollector(self.fs_ptr, self.rev, pool()) e_ptr, e_baton = delta.make_editor(editor, pool()) repos.svn_repos_replay(root, e_ptr, e_baton, pool())
a174468ff51e2d8b245402a13761feb330c091ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/a174468ff51e2d8b245402a13761feb330c091ea/svn_fs.py
k = k.lstrip('/')
def get_changes(self): pool = Pool(self.pool) tmp = Pool(pool) root = fs.revision_root(self.fs_ptr, self.rev, pool()) editor = repos.RevisionChangeCollector(self.fs_ptr, self.rev, pool()) e_ptr, e_baton = delta.make_editor(editor, pool()) repos.svn_repos_replay(root, e_ptr, e_baton, pool())
a174468ff51e2d8b245402a13761feb330c091ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/a174468ff51e2d8b245402a13761feb330c091ea/svn_fs.py
not mime_type.startswith('text/plain'):
mime_type and not mime_type.startswith('text/plain'):
def _render_view(self, req, attachment): perm_map = {'ticket': 'TICKET_VIEW', 'wiki': 'WIKI_VIEW'} req.perm.assert_permission(perm_map[attachment.parent_type])
d297e4a1c8285594996719f1e8a2bceb6c9b705e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/d297e4a1c8285594996719f1e8a2bceb6c9b705e/attachment.py
u, h = line.strip().split(':')
line = line.strip() if not line: continue try: u, h = line.split(':') except ValueError: print >>sys.stderr, 'Warning: invalid password line in %s: %s' \ % (filename, line) continue
def load(self, filename): fd = open(filename, 'r') for line in fd: u, h = line.strip().split(':') if '$' in h or self.crypt: self.hash[u] = h else: print >>sys.stderr, 'Warning: cannot parse password for ' \ 'user "%s" without the "crypt" module' % u
7a76b9cd0b737c6c9d2e02588973aca865c44162 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/7a76b9cd0b737c6c9d2e02588973aca865c44162/auth.py
u, r, a1 = line.strip().split(':')
line = line.strip() if not line: continue try: u, r, a1 = line.split(':') except ValueError: print >>sys.stderr, 'Warning: invalid digest line in %s: %s' \ % (filename, line) continue
def load_htdigest(self, filename, realm): """Load account information from apache style htdigest files, only users from the specified realm are used """ fd = open(filename, 'r') for line in fd.readlines(): u, r, a1 = line.strip().split(':') if r == realm: self.hash[u] = a1 if self.hash == {}: print >> sys.stderr, "Warning: found no users in realm:", realm
7a76b9cd0b737c6c9d2e02588973aca865c44162 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/7a76b9cd0b737c6c9d2e02588973aca865c44162/auth.py
logo_width = IntOption('header_logo', 'width', 236,
logo_width = IntOption('header_logo', 'width', -1,
def get_templates_dirs(): """Return a list of directories containing the provided ClearSilver templates. """
83d832e55124e84ac351ee9e326cc862aae4d910 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/83d832e55124e84ac351ee9e326cc862aae4d910/chrome.py
logo_height = IntOption('header_logo', 'height', 73,
logo_height = IntOption('header_logo', 'height', -1,
def get_templates_dirs(): """Return a list of directories containing the provided ClearSilver templates. """
83d832e55124e84ac351ee9e326cc862aae4d910 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/83d832e55124e84ac351ee9e326cc862aae4d910/chrome.py
'width': self.logo_width, 'height': self.logo_height
'width': width, 'height': height
def populate_hdf(self, req, handler): """Add chrome-related data to the HDF."""
83d832e55124e84ac351ee9e326cc862aae4d910 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/83d832e55124e84ac351ee9e326cc862aae4d910/chrome.py
r"(?P<lhref>!?\[(?P<lns>\w+):(?P<ltgt>[^ ]+) (?P<label>.*?)\])",
r"(?P<lhref>!?\[(?P<lns>\w+):(?P<ltgt>[^\] ]+)(?: (?P<label>.*?))?\])",
def process(self, req, text, inline=False): if self.error: return system_message('Error: Failed to load processor <code>%s</code>' % self.name, self.error) text = self.processor(req, text, self.env) if inline: code_block_start = re.compile('^<div class="code-block">') code_block_end = re.compile('</div>$') text, nr = code_block_start.subn('<span class="code-block">', text, 1 ) if nr: text, nr = code_block_end.subn('</span>', text, 1 ) return text else: return text
db09b7ea6dc40dcf0b61793b93d948635eb7b221 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/db09b7ea6dc40dcf0b61793b93d948635eb7b221/formatter.py
label = fullmatch.group('label')
label = fullmatch.group('label') or target
def _lhref_formatter(self, match, fullmatch): ns = fullmatch.group('lns') target = fullmatch.group('ltgt') label = fullmatch.group('label') if ns in self.link_resolvers: return self._link_resolvers[ns](self, ns, target, label) elif target[:2] == '//': return self._make_ext_link(ns+':'+target, label) else: return match
db09b7ea6dc40dcf0b61793b93d948635eb7b221 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/db09b7ea6dc40dcf0b61793b93d948635eb7b221/formatter.py
for field in constraints:
for field in constraints.keys():
def query(self, constraints, order=None, desc=0): href = href_join(self.base, 'query') params = [] for field in constraints: values = constraints[field] if type(values) != list: values = [values] for value in values: params.append(field + '=' + urllib.quote(value)) if order: params.append('order=' + urllib.quote(order)) if desc: params.append('desc=1') if params: href += '?' + ('&').join(params) return href
e6c6969246d395cfae8f817229ae59846f46773c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e6c6969246d395cfae8f817229ae59846f46773c/Href.py
field['options'] = items.get(name + '.options', '').split('|')
field['options'] = map(lambda x: x.strip(), items.get(name + '.options', '').split('|'))
def get_custom_fields(env): cfg = env.config.options('ticket-custom') if not cfg: return [] names = [] items = {} for k, v in cfg: items[k] = v if '.' not in k: names.append(k) fields = [] for name in names: field = { 'name': name, 'type': items[name], 'order': items.get(name + '.order', '0'), 'label': items.get(name + '.label', ''), 'value': items.get(name + '.value', '') } if field['type'] == 'select' or field['type'] == 'radio': field['options'] = items.get(name + '.options', '').split('|') elif field['type'] == 'textarea': field['width'] = items.get(name + '.cols', '') field['height'] = items.get(name + '.rows', '') fields.append(field) def cmp_by_order(a, b): try: return int(a['order']) - int(b['order']) except: if a['order'] < b['order']: return -1 elif a['order'] > b['order']: return 1 else: return 0 fields.sort(cmp_by_order) return fields
0355d416c7b9f78b27419dadf330bb965e15b07c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0355d416c7b9f78b27419dadf330bb965e15b07c/Ticket.py
pfx = 'ticket.custom.%i' % i
pfx = 'ticket.custom.%d' % i
def insert_custom_fields(env, hdf, vals = {}): fields = get_custom_fields(env) i = 0 for f in fields: name = f['name'] val = vals.get('custom_' + name, f['value']) pfx = 'ticket.custom.%i' % i hdf['%s.name' % pfx] = f['name'] hdf['%s.type' % pfx] = f['type'] hdf['%s.label' % pfx] = f['label'] or f['name'] hdf['%s.value' % pfx] = val if f['type'] == 'select' or f['type'] == 'radio': j = 0 for option in f['options']: hdf['%s.option.%d' % (pfx, j)] = option if val and (option == val or str(j) == val): hdf['%s.option.%i.selected' % (pfx, j)] = 1 j += 1 elif f['type'] == 'checkbox': if val in util.TRUE: hdf['%s.selected' % pfx] = 1 elif f['type'] == 'textarea': hdf['%s.width' % pfx] = f['width'] hdf['%s.height' % pfx] = f['height'] i += 1
0355d416c7b9f78b27419dadf330bb965e15b07c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0355d416c7b9f78b27419dadf330bb965e15b07c/Ticket.py
hdf['%s.option.%i.selected' % (pfx, j)] = 1
hdf['%s.option.%d.selected' % (pfx, j)] = 1
def insert_custom_fields(env, hdf, vals = {}): fields = get_custom_fields(env) i = 0 for f in fields: name = f['name'] val = vals.get('custom_' + name, f['value']) pfx = 'ticket.custom.%i' % i hdf['%s.name' % pfx] = f['name'] hdf['%s.type' % pfx] = f['type'] hdf['%s.label' % pfx] = f['label'] or f['name'] hdf['%s.value' % pfx] = val if f['type'] == 'select' or f['type'] == 'radio': j = 0 for option in f['options']: hdf['%s.option.%d' % (pfx, j)] = option if val and (option == val or str(j) == val): hdf['%s.option.%i.selected' % (pfx, j)] = 1 j += 1 elif f['type'] == 'checkbox': if val in util.TRUE: hdf['%s.selected' % pfx] = 1 elif f['type'] == 'textarea': hdf['%s.width' % pfx] = f['width'] hdf['%s.height' % pfx] = f['height'] i += 1
0355d416c7b9f78b27419dadf330bb965e15b07c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0355d416c7b9f78b27419dadf330bb965e15b07c/Ticket.py
if cursor.fetchone():
if cursor.fetchone()[0] == 0:
def delete(self, version=None, db=None): assert self.exists, 'Cannot delete non-existent page' if not db: db = self.env.get_db_cnx() handle_ta = True else: handle_ta = False
d5fc0f83d81c5bcc7da4feee7124db81f33680d3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/d5fc0f83d81c5bcc7da4feee7124db81f33680d3/model.py
args[x] = argv.value
args[x] = argv.value.replace('\r','')
def real_main(): import sync import Href import perm import auth from util import redirect path_info = os.getenv('PATH_INFO') remote_addr = os.getenv('REMOTE_ADDR') remote_user = os.getenv('REMOTE_USER') http_cookie = os.getenv('HTTP_COOKIE') http_referer = os.getenv('HTTP_REFERER') cgi_location = os.getenv('SCRIPT_NAME') database = open_database() config = database.load_config() Href.initialize(cgi_location) # Authenticate the user cookie = Cookie.SimpleCookie(http_cookie) if cookie.has_key('trac_auth'): auth_cookie = cookie['trac_auth'].value else: auth_cookie = None authenticator = auth.Authenticator(database, auth_cookie, remote_addr) if path_info == '/logout': authenticator.logout() redirect (http_referer or Href.href.wiki()) elif remote_user and authenticator.authname == 'anonymous': auth_cookie = authenticator.login(remote_user, remote_addr) # send the cookie to the browser as a http header cookie = Cookie.SimpleCookie() cookie['trac_auth'] = auth_cookie cookie['trac_auth']['path'] = cgi_location print cookie.output() if path_info == '/login': redirect (http_referer or Href.href.wiki()) # Parse arguments args = parse_args(path_info) _args = cgi.FieldStorage() for x in _args.keys(): argv = _args[x] if type(argv) == list: argv = argv[0] args[x] = argv.value # Load the selected module mode = args.get('mode', 'wiki') module_name, constructor_name, need_svn = modules[mode] module = __import__(module_name, globals(), locals(), []) constructor = getattr(module, constructor_name) module = constructor(config, args) module._name = mode module.db = database module.authname = authenticator.authname module.remote_addr = remote_addr module.cgi_location = cgi_location module.perm = perm.PermissionCache(database, authenticator.authname) module.perm.add_to_hdf(module.cgi.hdf) # Only open the subversion repository for the modules that really # need it. This saves us some precious time. if need_svn: from svn import util, repos, core core.apr_initialize() pool = core.svn_pool_create(None) repos_dir = config['general']['repository_dir'] # Remove any trailing slash or else subversion might abort if not os.path.split(repos_dir)[1]: repos_dir = os.path.split(repos_dir)[0] rep = repos.svn_repos_open(repos_dir, pool) fs_ptr = repos.svn_repos_fs(rep) module.repos = rep module.fs_ptr = fs_ptr sync.sync(database, rep, fs_ptr, pool) else: pool = None # Let the wiki module build a dictionary of all page names import Wiki Wiki.populate_page_dict(database) module.pool = pool module.run() if pool: core.svn_pool_destroy(pool) core.apr_terminate()
3674c6fe0864f042053131baedff259e022ceb14 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/3674c6fe0864f042053131baedff259e022ceb14/trac.py
self.assertEqual((3, 0), diff2._get_change_extent('xxx', 'xxx')) self.assertEqual((0, 0), diff2._get_change_extent('', 'xxx')) self.assertEqual((0, 0), diff2._get_change_extent('xxx', '')) self.assertEqual((0, 0), diff2._get_change_extent('xxx', 'yyy')) self.assertEqual((1, -1), diff2._get_change_extent('xxx', 'xyx')) self.assertEqual((1, -1), diff2._get_change_extent('xxx', 'xyyyx')) self.assertEqual((1, 0), diff2._get_change_extent('xy', 'xzz')) self.assertEqual((1, -1), diff2._get_change_extent('xyx', 'xzzx')) self.assertEqual((1, -1), diff2._get_change_extent('xzzx', 'xyx'))
self.assertEqual((3, 0), Diff._get_change_extent('xxx', 'xxx')) self.assertEqual((0, 0), Diff._get_change_extent('', 'xxx')) self.assertEqual((0, 0), Diff._get_change_extent('xxx', '')) self.assertEqual((0, 0), Diff._get_change_extent('xxx', 'yyy')) self.assertEqual((1, -1), Diff._get_change_extent('xxx', 'xyx')) self.assertEqual((1, -1), Diff._get_change_extent('xxx', 'xyyyx')) self.assertEqual((1, 0), Diff._get_change_extent('xy', 'xzz')) self.assertEqual((1, -1), Diff._get_change_extent('xyx', 'xzzx')) self.assertEqual((1, -1), Diff._get_change_extent('xzzx', 'xyx'))
def test_get_change_extent(self): self.assertEqual((3, 0), diff2._get_change_extent('xxx', 'xxx')) self.assertEqual((0, 0), diff2._get_change_extent('', 'xxx')) self.assertEqual((0, 0), diff2._get_change_extent('xxx', '')) self.assertEqual((0, 0), diff2._get_change_extent('xxx', 'yyy')) self.assertEqual((1, -1), diff2._get_change_extent('xxx', 'xyx')) self.assertEqual((1, -1), diff2._get_change_extent('xxx', 'xyyyx')) self.assertEqual((1, 0), diff2._get_change_extent('xy', 'xzz')) self.assertEqual((1, -1), diff2._get_change_extent('xyx', 'xzzx')) self.assertEqual((1, -1), diff2._get_change_extent('xzzx', 'xyx'))
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
opcodes = diff2._get_opcodes(['A', 'B'], ['A', 'B', ''],
opcodes = Diff._get_opcodes(['A', 'B'], ['A', 'B', ''],
def test_insert_blank_line(self): opcodes = diff2._get_opcodes(['A', 'B'], ['A', 'B', ''], ignore_blank_lines=0) self.assertEqual(('equal', 0, 2, 0, 2), opcodes.next()) self.assertEqual(('insert', 2, 2, 2, 3), opcodes.next())
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
opcodes = diff2._get_opcodes(['A', 'B'], ['A', 'B', ''],
opcodes = Diff._get_opcodes(['A', 'B'], ['A', 'B', ''],
def test_insert_blank_line(self): opcodes = diff2._get_opcodes(['A', 'B'], ['A', 'B', ''], ignore_blank_lines=0) self.assertEqual(('equal', 0, 2, 0, 2), opcodes.next()) self.assertEqual(('insert', 2, 2, 2, 3), opcodes.next())
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
opcodes = diff2._get_opcodes(['A'], ['A', 'B', ''],
opcodes = Diff._get_opcodes(['A'], ['A', 'B', ''],
def test_insert_blank_line(self): opcodes = diff2._get_opcodes(['A', 'B'], ['A', 'B', ''], ignore_blank_lines=0) self.assertEqual(('equal', 0, 2, 0, 2), opcodes.next()) self.assertEqual(('insert', 2, 2, 2, 3), opcodes.next())
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
opcodes = diff2._get_opcodes(['A', 'B', ''], ['A', 'B'],
opcodes = Diff._get_opcodes(['A', 'B', ''], ['A', 'B'],
def test_delete_blank_line(self): opcodes = diff2._get_opcodes(['A', 'B', ''], ['A', 'B'], ignore_blank_lines=0) self.assertEqual(('equal', 0, 2, 0, 2), opcodes.next()) self.assertEqual(('delete', 2, 3, 2, 2), opcodes.next())
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
opcodes = diff2._get_opcodes(['A', 'B', ''], ['A', 'B'],
opcodes = Diff._get_opcodes(['A', 'B', ''], ['A', 'B'],
def test_delete_blank_line(self): opcodes = diff2._get_opcodes(['A', 'B', ''], ['A', 'B'], ignore_blank_lines=0) self.assertEqual(('equal', 0, 2, 0, 2), opcodes.next()) self.assertEqual(('delete', 2, 3, 2, 2), opcodes.next())
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
opcodes = diff2._get_opcodes(['A', 'B', ''], ['A'],
opcodes = Diff._get_opcodes(['A', 'B', ''], ['A'],
def test_delete_blank_line(self): opcodes = diff2._get_opcodes(['A', 'B', ''], ['A', 'B'], ignore_blank_lines=0) self.assertEqual(('equal', 0, 2, 0, 2), opcodes.next()) self.assertEqual(('delete', 2, 3, 2, 2), opcodes.next())
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
opcodes = diff2._get_opcodes(['A', 'B b'], ['A', 'B b'],
opcodes = Diff._get_opcodes(['A', 'B b'], ['A', 'B b'],
def test_space_changes(self): opcodes = diff2._get_opcodes(['A', 'B b'], ['A', 'B b'], ignore_space_changes=0) self.assertEqual(('equal', 0, 1, 0, 1), opcodes.next()) self.assertEqual(('replace', 1, 2, 1, 2), opcodes.next())
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
opcodes = diff2._get_opcodes(['A', 'B b'], ['A', 'B b'],
opcodes = Diff._get_opcodes(['A', 'B b'], ['A', 'B b'],
def test_space_changes(self): opcodes = diff2._get_opcodes(['A', 'B b'], ['A', 'B b'], ignore_space_changes=0) self.assertEqual(('equal', 0, 1, 0, 1), opcodes.next()) self.assertEqual(('replace', 1, 2, 1, 2), opcodes.next())
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
opcodes = diff2._get_opcodes(['A', 'B b'], ['A', 'B B'],
opcodes = Diff._get_opcodes(['A', 'B b'], ['A', 'B B'],
def test_case_changes(self): opcodes = diff2._get_opcodes(['A', 'B b'], ['A', 'B B'], ignore_case=0) self.assertEqual(('equal', 0, 1, 0, 1), opcodes.next()) self.assertEqual(('replace', 1, 2, 1, 2), opcodes.next())
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
opcodes = diff2._get_opcodes(['A', 'B b'], ['A', 'B B'],
opcodes = Diff._get_opcodes(['A', 'B b'], ['A', 'B B'],
def test_case_changes(self): opcodes = diff2._get_opcodes(['A', 'B b'], ['A', 'B B'], ignore_case=0) self.assertEqual(('equal', 0, 1, 0, 1), opcodes.next()) self.assertEqual(('replace', 1, 2, 1, 2), opcodes.next())
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
opcodes = diff2._get_opcodes(['A', 'B b'], ['A', 'B B'],
opcodes = Diff._get_opcodes(['A', 'B b'], ['A', 'B B'],
def test_space_and_case_changes(self): opcodes = diff2._get_opcodes(['A', 'B b'], ['A', 'B B'], ignore_case=0, ignore_space_changes=0) self.assertEqual(('equal', 0, 1, 0, 1), opcodes.next()) self.assertEqual(('replace', 1, 2, 1, 2), opcodes.next())
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
opcodes = diff2._get_opcodes(['A', 'B b'], ['A', 'B B'],
opcodes = Diff._get_opcodes(['A', 'B b'], ['A', 'B B'],
def test_space_and_case_changes(self): opcodes = diff2._get_opcodes(['A', 'B b'], ['A', 'B B'], ignore_case=0, ignore_space_changes=0) self.assertEqual(('equal', 0, 1, 0, 1), opcodes.next()) self.assertEqual(('replace', 1, 2, 1, 2), opcodes.next())
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
opcodes = diff2._get_opcodes(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'],
opcodes = Diff._get_opcodes(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'],
def test_grouped_opcodes_context1(self): opcodes = diff2._get_opcodes(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'], ['A', 'B', 'C', 'd', 'e', 'f', 'G', 'H']) groups = diff2._group_opcodes(opcodes, n=1) group = groups.next() self.assertEqual(('equal', 2, 3, 2, 3), group[0]) self.assertEqual(('replace', 3, 6, 3, 6), group[1]) self.assertEqual(('equal', 6, 8, 6, 8), group[2])
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
groups = diff2._group_opcodes(opcodes, n=1)
groups = Diff._group_opcodes(opcodes, n=1)
def test_grouped_opcodes_context1(self): opcodes = diff2._get_opcodes(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'], ['A', 'B', 'C', 'd', 'e', 'f', 'G', 'H']) groups = diff2._group_opcodes(opcodes, n=1) group = groups.next() self.assertEqual(('equal', 2, 3, 2, 3), group[0]) self.assertEqual(('replace', 3, 6, 3, 6), group[1]) self.assertEqual(('equal', 6, 8, 6, 8), group[2])
f0e6a3afeb9f648f246fa50a5aac86386a0128b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f0e6a3afeb9f648f246fa50a5aac86386a0128b9/diff.py
import textwrap return '\n'.join(textwrap.wrap(t, replace_whitespace=0, width=cols, break_long_words=0,
import textwrap t = t.replace('\r\n', '\n').replace('\r', '\n') wrapper = textwrap.TextWrapper(cols, replace_whitespace=0, break_long_words=0,
def wrap(t, cols=75, initial_indent='', subsequent_indent=''): try: import textwrap return '\n'.join(textwrap.wrap(t, replace_whitespace=0, width=cols, break_long_words=0, initial_indent=initial_indent, subsequent_indent=subsequent_indent)) except ImportError: return t
fdbf7afefbe36b1cdaf1e43e2261a635f45aa26b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/fdbf7afefbe36b1cdaf1e43e2261a635f45aa26b/Notify.py
subsequent_indent=subsequent_indent))
subsequent_indent=subsequent_indent) wrappedLines = [] for line in t.split('\n'): wrappedLines += wrapper.wrap(line.rstrip()) return '\n'.join(wrappedLines)
def wrap(t, cols=75, initial_indent='', subsequent_indent=''): try: import textwrap return '\n'.join(textwrap.wrap(t, replace_whitespace=0, width=cols, break_long_words=0, initial_indent=initial_indent, subsequent_indent=subsequent_indent)) except ImportError: return t
fdbf7afefbe36b1cdaf1e43e2261a635f45aa26b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/fdbf7afefbe36b1cdaf1e43e2261a635f45aa26b/Notify.py
self.COLS)
self.COLS, initial_indent=' ', subsequent_indent=' ')
def notify(self, tktid, newticket=1, modtime=0):
fdbf7afefbe36b1cdaf1e43e2261a635f45aa26b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/fdbf7afefbe36b1cdaf1e43e2261a635f45aa26b/Notify.py
subsequent_indent=' ').strip()
subsequent_indent=' ')
def notify(self, tktid, newticket=1, modtime=0):
fdbf7afefbe36b1cdaf1e43e2261a635f45aa26b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/fdbf7afefbe36b1cdaf1e43e2261a635f45aa26b/Notify.py
""" Called whenever a new Wiki page is added. """
"""Called whenever a new Wiki page is added."""
def wiki_page_added(page): """ Called whenever a new Wiki page is added. """
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
""" Called when a page has been modified. """
"""Called when a page has been modified."""
def wiki_page_changed(page, version, t, comment, author, ipnr): """ Called when a page has been modified. """
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
""" Called when a page has been deleted. """
"""Called when a page has been deleted."""
def wiki_page_deleted(page): """ Called when a page has been deleted. """
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
""" Extension point interface for components that provide Wiki macros. """
"""Extension point interface for components that provide Wiki macros."""
def wiki_page_deleted(page): """ Called when a page has been deleted. """
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
""" Return an iterable that provides the names of the provided macros. """
"""Return an iterable that provides the names of the provided macros."""
def get_macros(): """ Return an iterable that provides the names of the provided macros. """
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
""" Return a plain text description of the macro with the specified name.
"""Return a plain text description of the macro with the specified name.
def get_macro_description(name): """ Return a plain text description of the macro with the specified name. """
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
""" Return the HTML output of the macro. """
"""Return the HTML output of the macro."""
def render_macro(req, name, content): """ Return the HTML output of the macro. """
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
""" Return an iterable that provides additional wiki syntax. """
"""Return an iterable that provides additional wiki syntax."""
def get_wiki_syntax(): """ Return an iterable that provides additional wiki syntax. """
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
""" Return an iterable over (namespace, formatter) tuples. """
"""Return an iterable over (namespace, formatter) tuples."""
def get_link_resolvers(): """ Return an iterable over (namespace, formatter) tuples. """
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
""" Represents the wiki system. """
"""Represents the wiki system."""
def get_link_resolvers(): """ Return an iterable over (namespace, formatter) tuples. """
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
self._pages = None
self._index = None self._last_index_update = 0
def __init__(self): self._pages = None
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
def _load_pages(self): self._pages = {} db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT DISTINCT name FROM wiki") for (name,) in cursor: self._pages[name] = True
def _update_index(self): now = time.time() if now > self._last_index_update + WikiSystem.INDEX_UPDATE_INTERVAL: self.log.debug('Updating wiki page index') db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT DISTINCT name FROM wiki") self._index = {} for (name,) in cursor: self._index[name] = True self._last_index_update = now
def _load_pages(self): self._pages = {} db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT DISTINCT name FROM wiki") for (name,) in cursor: self._pages[name] = True
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
if self._pages is None: self._load_pages() for page in self._pages.keys():
"""Iterate over the names of existing Wiki pages. If the `prefix` parameter is given, only names that start with that prefix are included. """ self._update_index() for page in self._index.keys():
def get_pages(self, prefix=None): if self._pages is None: self._load_pages() for page in self._pages.keys(): if not prefix or page.startswith(prefix): yield page
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
if self._pages is None: self._load_pages() return pagename in self._pages.keys()
"""Whether a page with the specified name exists.""" self._update_index() return pagename in self._index.keys()
def has_page(self, pagename): if self._pages is None: self._load_pages() return pagename in self._pages.keys()
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
def wiki_page_deleted(self, page): if self.has_page(page.name): self.log.debug('Removing page %s from index' % page.name) del self._pages[page.name]
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
yield (r"!?(^|(?<=[^A-Za-z]))[A-Z][a-z]+(?:[A-Z][a-z]*[a-z/])+(?:
yield (r"!?(^|(?<=[^A-Za-z]))[A-Z][a-z]+(?:[A-Z][a-z]*[a-z/])+(?: 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))
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
def _format_link(self, formatter, ns, page, label): anchor = '' if page.find('#') != -1: anchor = page[page.find('#'):] page = page[:page.find('#')] page = urllib.unquote(page) label = urllib.unquote(label)
20038e9ad23fd6bf15d7cff6c788c825d8278ea5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/20038e9ad23fd6bf15d7cff6c788c825d8278ea5/api.py
hdf.setValue(p + '.descr', wiki_to_oneliner(file['description'], hdf, self,self.get_db_cnx))
hdf.setValue(p + '.descr', wiki_to_oneliner(file['description'], hdf, self,self.get_db_cnx() ))
def get_attachments_hdf(self, cnx, type, id, hdf, prefix): from Wiki import wiki_to_oneliner files = self.get_attachments(cnx, type, id) idx = 0 for file in files: p = '%s.%d' % (prefix, idx) hdf.setValue(p + '.name', file['filename']) hdf.setValue(p + '.descr', wiki_to_oneliner(file['description'], hdf, self,self.get_db_cnx)) hdf.setValue(p + '.author', util.escape(file['author'])) hdf.setValue(p + '.ipnr', file['ipnr']) hdf.setValue(p + '.size', util.pretty_size(file['size'])) hdf.setValue(p + '.time', time.strftime('%c', time.localtime(file['time']))) hdf.setValue(p + '.href', self.href.attachment(type, id, file['filename'])) idx += 1
c2e03863246e0eae1fe5325b53421c1ba8d31538 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/c2e03863246e0eae1fe5325b53421c1ba8d31538/Environment.py
self.req.hdf.setValue('title', self.path)
def display(self): self.env.log.debug("Displaying file: %s mime-type: %s" % (self.filename, self.mime_type)) # We don't have to guess if the charset is specified in the # svn:mime-type property ctpos = self.mime_type.find('charset=') if ctpos >= 0: charset = self.mime_type[ctpos + 8:] self.env.log.debug("Charset %s selected" % charset) else: charset = self.env.get_config('trac', 'default_charset', 'iso-8859-15') data = util.to_utf8(self.read_func(self.DISP_MAX_FILE_SIZE), charset)
e3cf5f972ad4f61e3b9d89d8bf6904da384ebe04 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e3cf5f972ad4f61e3b9d89d8bf6904da384ebe04/File.py
def _history(self, path, start, end, limit=None):
def _history(self, path, start, end, limit=None, pool=None):
def _history(self, path, start, end, limit=None): scoped_path = posixpath.join(self.scope[1:], path) return _get_history(scoped_path, self.authz, self.fs_ptr, self.pool, start, end, limit)
9c6ff2a43ba48c444878407af99f14bb4de378fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/9c6ff2a43ba48c444878407af99f14bb4de378fd/svn_fs.py
return _get_history(scoped_path, self.authz, self.fs_ptr, self.pool, start, end, limit)
return _get_history(scoped_path, self.authz, self.fs_ptr, pool or self.pool, start, end, limit) def _previous_rev(self, rev, path='', pool=None): if rev > 1: try: for _, prev in self._history(path, 0, rev-1, limit=1, pool=pool): return prev except (SystemError, core.SubversionException): pass return None
def _history(self, path, start, end, limit=None): scoped_path = posixpath.join(self.scope[1:], path) return _get_history(scoped_path, self.authz, self.fs_ptr, self.pool, start, end, limit)
9c6ff2a43ba48c444878407af99f14bb4de378fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/9c6ff2a43ba48c444878407af99f14bb4de378fd/svn_fs.py
if rev > 1: try: for _, prev in self._history(path, 0, rev-1, limit=1): return prev except (SystemError, core.SubversionException): pass return None
return self._previous_rev(rev, path)
def previous_rev(self, rev, path=''): rev = self.normalize_rev(rev) if rev > 1: # don't use oldest here, as it's too expensive try: for _, prev in self._history(path, 0, rev-1, limit=1): return prev except (SystemError, # "null arg to internal routine" in 1.2.x core.SubversionException): # in 1.3.x pass return None
9c6ff2a43ba48c444878407af99f14bb4de378fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/9c6ff2a43ba48c444878407af99f14bb4de378fd/svn_fs.py
rev = self.previous_rev(r)
rev = self._previous_rev(r, pool=subpool)
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() if self.has_node(path, rev, subpool): if expect_deletion: # it was missing, now it's there again: # rev+1 must be a delete yield path, rev+1, Changeset.DELETE newer = None # 'newer' is the previously seen history tuple older = None # 'older' is the currently examined history tuple for p, r in _get_history(self.scope + path, self.authz, self.fs_ptr, subpool, 0, rev, limit): older = (_path_within_scope(self.scope, p), r, Changeset.ADD) rev = self.previous_rev(r) if newer: if older[0] == path: # still on the path: 'newer' was an edit yield newer[0], newer[1], Changeset.EDIT else: # the path changed: 'newer' was a copy rev = self.previous_rev(newer[1]) # restart before the copy op yield newer[0], newer[1], Changeset.COPY older = (older[0], older[1], 'unknown') break newer = older if older: # either a real ADD or the source of a COPY yield older else: expect_deletion = True rev = self.previous_rev(rev)
9c6ff2a43ba48c444878407af99f14bb4de378fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/9c6ff2a43ba48c444878407af99f14bb4de378fd/svn_fs.py
rev = self.previous_rev(newer[1])
rev = self._previous_rev(newer[1], pool=subpool)
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() if self.has_node(path, rev, subpool): if expect_deletion: # it was missing, now it's there again: # rev+1 must be a delete yield path, rev+1, Changeset.DELETE newer = None # 'newer' is the previously seen history tuple older = None # 'older' is the currently examined history tuple for p, r in _get_history(self.scope + path, self.authz, self.fs_ptr, subpool, 0, rev, limit): older = (_path_within_scope(self.scope, p), r, Changeset.ADD) rev = self.previous_rev(r) if newer: if older[0] == path: # still on the path: 'newer' was an edit yield newer[0], newer[1], Changeset.EDIT else: # the path changed: 'newer' was a copy rev = self.previous_rev(newer[1]) # restart before the copy op yield newer[0], newer[1], Changeset.COPY older = (older[0], older[1], 'unknown') break newer = older if older: # either a real ADD or the source of a COPY yield older else: expect_deletion = True rev = self.previous_rev(rev)
9c6ff2a43ba48c444878407af99f14bb4de378fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/9c6ff2a43ba48c444878407af99f14bb4de378fd/svn_fs.py
rev = self.previous_rev(rev)
rev = self._previous_rev(rev, pool=subpool)
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() if self.has_node(path, rev, subpool): if expect_deletion: # it was missing, now it's there again: # rev+1 must be a delete yield path, rev+1, Changeset.DELETE newer = None # 'newer' is the previously seen history tuple older = None # 'older' is the currently examined history tuple for p, r in _get_history(self.scope + path, self.authz, self.fs_ptr, subpool, 0, rev, limit): older = (_path_within_scope(self.scope, p), r, Changeset.ADD) rev = self.previous_rev(r) if newer: if older[0] == path: # still on the path: 'newer' was an edit yield newer[0], newer[1], Changeset.EDIT else: # the path changed: 'newer' was a copy rev = self.previous_rev(newer[1]) # restart before the copy op yield newer[0], newer[1], Changeset.COPY older = (older[0], older[1], 'unknown') break newer = older if older: # either a real ADD or the source of a COPY yield older else: expect_deletion = True rev = self.previous_rev(rev)
9c6ff2a43ba48c444878407af99f14bb4de378fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/9c6ff2a43ba48c444878407af99f14bb4de378fd/svn_fs.py
options = field['options']
options = field['options'][:]
def process_request(self, req): req.perm.assert_permission('TICKET_CREATE')
3eafa2568fd1c4ddb482bb8a27111f99700e1751 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/3eafa2568fd1c4ddb482bb8a27111f99700e1751/web_ui.py
pobj.close() if sys.platform[:3] != "win" and sys.platform != "os2emx": os.waitpid(-1, 0)
def print_diff (self, old_path, new_path, pool): options = ['-u'] options.append('-L') options.append("%s\t(revision %d)" % (old_path, self.rev-1)) options.append('-L') options.append("%s\t(revision %d)" % (new_path, self.rev))
37ff1e1e3869bde78c01f026ca98ce2b0863e54d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/37ff1e1e3869bde78c01f026ca98ce2b0863e54d/Changeset.py
txt += '\n'
txt += CRLF
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') > -1: continue idx = 2 * (i % 2) if len(f) > width[idx]: width[idx] = len(f) if len(fval) > width[idx + 1]: width[idx + 1] = len(fval) format = ('%%%is: %%-%is | ' % (width[0], width[1]), ' %%%is: %%-%is%s' % (width[2], width[3], CRLF)) i = 1 l = (width[0] + width[1] + 5) sep = l*'-' + '+' + (self.COLS-l)*'-' txt = sep + CRLF big = [] for i, f in enum([f['name'] for f in fields]): if not tkt.values.has_key(f): continue fval = tkt[f] if '\n' in str(fval): big.append((f.capitalize(), fval)) else: txt += format[i % 2] % (f.capitalize(), fval) if not i % 2: txt += '\n' if big: txt += sep for k,v in big: txt += '\n%s:\n%s\n\n' % (k,v) txt += sep return txt
3bc49497d48201bbe4a10ba9e41cfd0d23185077 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/3bc49497d48201bbe4a10ba9e41cfd0d23185077/Notify.py
for k,v in big: txt += '\n%s:\n%s\n\n' % (k,v)
for name, value in big: txt += CRLF.join(['', name + ':', value, '', '')]
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') > -1: continue idx = 2 * (i % 2) if len(f) > width[idx]: width[idx] = len(f) if len(fval) > width[idx + 1]: width[idx + 1] = len(fval) format = ('%%%is: %%-%is | ' % (width[0], width[1]), ' %%%is: %%-%is%s' % (width[2], width[3], CRLF)) i = 1 l = (width[0] + width[1] + 5) sep = l*'-' + '+' + (self.COLS-l)*'-' txt = sep + CRLF big = [] for i, f in enum([f['name'] for f in fields]): if not tkt.values.has_key(f): continue fval = tkt[f] if '\n' in str(fval): big.append((f.capitalize(), fval)) else: txt += format[i % 2] % (f.capitalize(), fval) if not i % 2: txt += '\n' if big: txt += sep for k,v in big: txt += '\n%s:\n%s\n\n' % (k,v) txt += sep return txt
3bc49497d48201bbe4a10ba9e41cfd0d23185077 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/3bc49497d48201bbe4a10ba9e41cfd0d23185077/Notify.py