rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
encoding = locale.getlocale(locale.LC_TIME)[1] or \ locale.getpreferredencoding()
lc_time_encoding = sys.platform != 'win32' and getlocale(locale.LC_TIME)[1] encoding = lc_time_encoding or locale.getpreferredencoding()
def format_datetime(t=None, format='%x %X', gmt=False): if t is None: t = time.time() if not isinstance(t, (list, tuple, time.struct_time)): if gmt: t = time.gmtime(int(t)) else: t = time.localtime(int(t)) text = time.strftime(format, t) encoding = locale.getlocale(locale.LC_TIME)[1] or \ locale.getpreferredencoding() return unicode(text, encoding, 'replace')
84f89827b0114115d884b0c55287b16d670f29e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/84f89827b0114115d884b0c55287b16d670f29e8/__init__.py
html = PhpDeuglifier().format(odata.splitlines()[1])
fst_nl = odata.find('\n') snd_nl = odata.find('\n', fst_nl + 1) odata = odata[snd_nl + 1:] html = PhpDeuglifier().format(odata)
def render(self, req, mimetype, content, filename=None, rev=None): cmdline = self.config.get('mimeviewer', 'php_path') cmdline += ' -s' self.env.log.debug("PHP command line: %s" % cmdline)
0032c42fd5ab8c79d45587a3f1b9ff721d124701 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0032c42fd5ab8c79d45587a3f1b9ff721d124701/php.py
Markup('<a href="%s" accesskey="2">Timeline</a>', self.env.href.timeline()))
Markup('<a href="%s">About Trac</a>', self.env.href.about()))
def get_navigation_items(self, req): yield ('metanav', 'about', Markup('<a href="%s" accesskey="2">Timeline</a>', self.env.href.timeline()))
8056f40f45b01baa36e1a53a5deae39410b80b04 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/8056f40f45b01baa36e1a53a5deae39410b80b04/About.py
return '<a class="ext-link" href="%s"%s>%s</a>' \ % (url, title_attr, text)
return '<a class="ext-link" href="%s"%s><span class="icon">' \ '</span>%s</a>' % (url, title_attr, text)
def _make_ext_link(self, url, text, title=''): title_attr = title and ' title="%s"' % title or '' if Formatter.img_re.search(url) and self.flavor != 'oneliner': return '<img src="%s" alt="%s" />' % (url, title or text) if not url.startswith(self._local): return '<a class="ext-link" href="%s"%s>%s</a>' \ % (url, title_attr, text) else: return '<a href="%s"%s>%s</a>' % (url, title_attr, text)
d0b3f8b945384c41f7b20f04fd4326c8470664da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/d0b3f8b945384c41f7b20f04fd4326c8470664da/formatter.py
if i % 2:
if not i % 2:
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 f in tkt.values.keys(): 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 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
2e03fac2c19f1957610801eb12d443f1703e87f3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/2e03fac2c19f1957610801eb12d443f1703e87f3/Notify.py
def readline(self): return self.req.readline()
def readline(self, size=-1): return self.req.readline(size)
def readline(self): return self.req.readline()
6b3a73c1e1dab648293794a66b4b434022aef71e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/6b3a73c1e1dab648293794a66b4b434022aef71e/modpython_frontend.py
if port == 80: self.base_url = 'http://%s%s' % (host, self.cgi_location) elif port == 443: self.base_url = 'https://%s%s' % (host, self.cgi_location)
proto_port = '' if port == 443: proto = 'https'
def init_request(self): core.Request.init_request(self) options = self.req.get_options()
2f85f179210e9a836e0e1f31436066a4aba6bc01 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/2f85f179210e9a836e0e1f31436066a4aba6bc01/ModPythonHandler.py
self.base_url = 'http://%s:%d%s' % (host, port, self.cgi_location)
proto = 'http' if port != 80: proto_port = ':%d' % port self.base_url = '%s://%s%s%s' % (proto, host, proto_port, self.cgi_location)
def init_request(self): core.Request.init_request(self) options = self.req.get_options()
2f85f179210e9a836e0e1f31436066a4aba6bc01 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/2f85f179210e9a836e0e1f31436066a4aba6bc01/ModPythonHandler.py
req.hdf['wiki.action'] = 'preview'
action = 'preview'
def process_request(self, req): action = req.args.get('action', 'view') pagename = req.args.get('page', 'WikiStart')
f3bfeca9a15d3cbbce26559a70c307f9b71adaf3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f3bfeca9a15d3cbbce26559a70c307f9b71adaf3/Wiki.py
if os.path.samefile(os.path.dirname(egg_path), plugins_dir): for module in modules: env.config.setdefault('components', module + '.*', 'enabled')
try: if os.path.samefile(os.path.dirname(egg_path), plugins_dir): for module in modules: env.config.setdefault('components', module + '.*', 'enabled') except OSError: pass
def enable_modules(egg_path, modules): """Automatically enable any components provided by plugins loaded from the environment plugins directory.""" if os.path.samefile(os.path.dirname(egg_path), plugins_dir): for module in modules: env.config.setdefault('components', module + '.*', 'enabled')
bbba1d166b8dc4b946602594856fb71a5e56484a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/bbba1d166b8dc4b946602594856fb71a5e56484a/loader.py
from trac.Browser import BrowserModule
from trac.versioncontrol.web_ui import BrowserModule
def render_macro(self, req, name, content): # args will be null if the macro is called without parenthesis. if not content: return '' # parse arguments # we expect the 1st argument to be a filename (filespec) args = content.split(',') if len(args) == 0: raise Exception("No argument.") filespec = args[0] size_re = re.compile('^[0-9]+%?$') align_re = re.compile('^(?:left|right|top|bottom)$') keyval_re = re.compile('^([-a-z0-9]+)([=:])(.*)') quoted_re = re.compile("^(?:&#34;|')(.*)(?:&#34;|')$") attr = {} style = {} for arg in args[1:]: arg = arg.strip() if size_re.search(arg): # 'width' keyword attr['width'] = arg continue if align_re.search(arg): # 'align' keyword attr['align'] = arg continue match = keyval_re.search(arg) if match: key = match.group(1) sep = match.group(2) val = match.group(3) m = quoted_re.search(val) # unquote &#34; character " if m: val = m.group(1) if sep == '=': attr[key] = val; elif sep == ':': style[key] = val
036f8356557b45a69ceb2ac5d9bf8910b5b561ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/036f8356557b45a69ceb2ac5d9bf8910b5b561ab/macros.py
else:
else:
def render_macro(self, req, name, content): # args will be null if the macro is called without parenthesis. if not content: return '' # parse arguments # we expect the 1st argument to be a filename (filespec) args = content.split(',') if len(args) == 0: raise Exception("No argument.") filespec = args[0] size_re = re.compile('^[0-9]+%?$') align_re = re.compile('^(?:left|right|top|bottom)$') keyval_re = re.compile('^([-a-z0-9]+)([=:])(.*)') quoted_re = re.compile("^(?:&#34;|')(.*)(?:&#34;|')$") attr = {} style = {} for arg in args[1:]: arg = arg.strip() if size_re.search(arg): # 'width' keyword attr['width'] = arg continue if align_re.search(arg): # 'align' keyword attr['align'] = arg continue match = keyval_re.search(arg) if match: key = match.group(1) sep = match.group(2) val = match.group(3) m = quoted_re.search(val) # unquote &#34; character " if m: val = m.group(1) if sep == '=': attr[key] = val; elif sep == ':': style[key] = val
036f8356557b45a69ceb2ac5d9bf8910b5b561ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/036f8356557b45a69ceb2ac5d9bf8910b5b561ab/macros.py
return '<a href="%s" style="%s"><img src="%s" %s style="%s" /></a>' \ % (url, a_style, raw_url, img_attr, img_style)
result = '<img src="%s" %s style="%s" />' \ % (raw_url, img_attr, img_style) if not nolink: result = '<a href="%s" style="%s">%s</a>' % (url, a_style, result) return result
def render_macro(self, req, name, content): # args will be null if the macro is called without parenthesis. if not content: return '' # parse arguments # we expect the 1st argument to be a filename (filespec) args = content.split(',') if len(args) == 0: raise Exception("No argument.") filespec = args[0] size_re = re.compile('^[0-9]+%?$') align_re = re.compile('^(?:left|right|top|bottom)$') keyval_re = re.compile('^([-a-z0-9]+)([=:])(.*)') quoted_re = re.compile("^(?:&#34;|')(.*)(?:&#34;|')$") attr = {} style = {} for arg in args[1:]: arg = arg.strip() if size_re.search(arg): # 'width' keyword attr['width'] = arg continue if align_re.search(arg): # 'align' keyword attr['align'] = arg continue match = keyval_re.search(arg) if match: key = match.group(1) sep = match.group(2) val = match.group(3) m = quoted_re.search(val) # unquote &#34; character " if m: val = m.group(1) if sep == '=': attr[key] = val; elif sep == ':': style[key] = val
036f8356557b45a69ceb2ac5d9bf8910b5b561ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/036f8356557b45a69ceb2ac5d9bf8910b5b561ab/macros.py
q['all_tickets'] = env.href.query(milestone=milestone, grouped_by=group) q['active_tickets'] = env.href.query(milestone=milestone, grouped_by=group,
q['all_tickets'] = env.href.query({grouped_by: group}, milestone=milestone) q['active_tickets'] = env.href.query({grouped_by: group}, milestone=milestone,
def get_query_links(env, milestone, grouped_by='component', group=None): q = {} if not group: q['all_tickets'] = env.href.query(milestone=milestone) q['active_tickets'] = env.href.query(milestone=milestone, status=('new', 'assigned', 'reopened')) q['closed_tickets'] = env.href.query(milestone=milestone, status='closed') else: q['all_tickets'] = env.href.query(milestone=milestone, grouped_by=group) q['active_tickets'] = env.href.query(milestone=milestone, grouped_by=group, status=('new', 'assigned', 'reopened')) q['closed_tickets'] = env.href.query(milestone=milestone, grouped_by=group, status='closed') return q
010814f00fd2766b20a4252804a8a8acf3670ee8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/010814f00fd2766b20a4252804a8a8acf3670ee8/Milestone.py
q['closed_tickets'] = env.href.query(milestone=milestone, grouped_by=group,
q['closed_tickets'] = env.href.query({grouped_by: group}, milestone=milestone,
def get_query_links(env, milestone, grouped_by='component', group=None): q = {} if not group: q['all_tickets'] = env.href.query(milestone=milestone) q['active_tickets'] = env.href.query(milestone=milestone, status=('new', 'assigned', 'reopened')) q['closed_tickets'] = env.href.query(milestone=milestone, status='closed') else: q['all_tickets'] = env.href.query(milestone=milestone, grouped_by=group) q['active_tickets'] = env.href.query(milestone=milestone, grouped_by=group, status=('new', 'assigned', 'reopened')) q['closed_tickets'] = env.href.query(milestone=milestone, grouped_by=group, status='closed') return q
010814f00fd2766b20a4252804a8a8acf3670ee8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/010814f00fd2766b20a4252804a8a8acf3670ee8/Milestone.py
_rules = [r"(?P<bold>''')",
_rules = [r"(?P<bolditalic>''''')", r"(?P<bold>''')",
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
92c4897f3386550e19f7beebdb2369c29518b3ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/92c4897f3386550e19f7beebdb2369c29518b3ce/formatter.py
for i in range(len(self._open_tags)-1, -1, -1): if self._open_tags[i] == tag: tmp += self._open_tags[i]
for i in xrange(len(self._open_tags)-1, -1, -1): tmp += self._open_tags[i][1] if self._open_tags[i][1] == tag:
def close_tag(self, tag): tmp = '' for i in range(len(self._open_tags)-1, -1, -1): if self._open_tags[i] == tag: tmp += self._open_tags[i] del self._open_tags[i] break return tmp
92c4897f3386550e19f7beebdb2369c29518b3ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/92c4897f3386550e19f7beebdb2369c29518b3ce/formatter.py
def open_tag(self, tag): self._open_tags.append(tag)
def open_tag(self, open, close): self._open_tags.append((open, close))
def open_tag(self, tag): self._open_tags.append(tag)
92c4897f3386550e19f7beebdb2369c29518b3ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/92c4897f3386550e19f7beebdb2369c29518b3ce/formatter.py
if self.tag_open_p(close_tag):
if self.tag_open_p((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(close_tag): return self.close_tag(close_tag) else: self.open_tag(close_tag) return open_tag
92c4897f3386550e19f7beebdb2369c29518b3ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/92c4897f3386550e19f7beebdb2369c29518b3ce/formatter.py
self.open_tag(close_tag)
self.open_tag(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(close_tag): return self.close_tag(close_tag) else: self.open_tag(close_tag) return open_tag
92c4897f3386550e19f7beebdb2369c29518b3ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/92c4897f3386550e19f7beebdb2369c29518b3ce/formatter.py
self.out.write(self._open_tags.pop())
self.out.write(self._open_tags.pop()[1])
def close_paragraph(self): if self.paragraph_open: while self._open_tags != []: self.out.write(self._open_tags.pop()) self.out.write('</p>' + os.linesep) self.paragraph_open = 0
92c4897f3386550e19f7beebdb2369c29518b3ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/92c4897f3386550e19f7beebdb2369c29518b3ce/formatter.py
result += self.close_tag(None)
def format(self, text, out, escape_newlines=False): self.out = out self._open_tags = [] self._list_stack = []
92c4897f3386550e19f7beebdb2369c29518b3ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/92c4897f3386550e19f7beebdb2369c29518b3ce/formatter.py
from docutils.core import publish_string
from docutils.core import publish_parts
def render(self, req, mimetype, content, filename=None, rev=None): try: from docutils import nodes from docutils.core import publish_string from docutils.parsers import rst from docutils import __version__ except ImportError: raise TracError, 'Docutils not found' if StrictVersion(__version__) < StrictVersion('0.3.9'): raise TracError, 'Docutils version >= %s required, %s found' \ % ('0.3.9', __version__)
aaa94e438c3ec6ca0b01c661241e5fcbd49a2f79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/aaa94e438c3ec6ca0b01c661241e5fcbd49a2f79/rst.py
content = content.encode('utf-8') html = publish_string(content, writer_name='html', parser=_parser,
parts = publish_parts(content, writer_name='html', parser=_parser,
def code_block(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """ Create a code-block directive for docutils.
aaa94e438c3ec6ca0b01c661241e5fcbd49a2f79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/aaa94e438c3ec6ca0b01c661241e5fcbd49a2f79/rst.py
'raw_enabled': 0}) html = html.decode('utf-8') return html[html.find('<body>') + 6:html.find('</body>')].strip()
'raw_enabled': 0}) return parts['html_body']
def code_block(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """ Create a code-block directive for docutils.
aaa94e438c3ec6ca0b01c661241e5fcbd49a2f79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/aaa94e438c3ec6ca0b01c661241e5fcbd49a2f79/rst.py
if lspace_re.match(text): text = '&nbsp;' + text[1:] text = space_re.sub('&nbsp; ', text.expandtabs(self.tabwidth))
text = space_re.sub(lambda m: len(m.group(0)) / 2 * '&nbsp; ' + len(m.group(0)) % 2 * '&nbsp;', text.expandtabs(self.tabwidth))
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 if text[0:2] in ['++', '--']: return match = line_re.search(text) if match: self.print_block() self.changeno += 1 self.blockno = 0 pfx = '%s.changes.%d.line' % (self.prefix, self.changeno) self.hdf.setValue('%s.old' % pfx, match.group(1)) self.hdf.setValue('%s.new' % pfx, match.group(3)) return ttype = text[0] text = text[1:] if lspace_re.match(text): text = '&nbsp;' + text[1:] text = space_re.sub('&nbsp; ', text.expandtabs(self.tabwidth)) 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
91f00115b3309f4c289a0af8cb4e1bd17403bc35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/91f00115b3309f4c289a0af8cb4e1bd17403bc35/Changeset.py
rows.append((action, user))
rows.append((user, action))
def _do_permission_list(self, user=None): if not self._permsys: self._permsys = PermissionSystem(self.env_open()) if user: rows = [] perms = self._permsys.get_user_permissions(user) for action in perms: if perms[action]: rows.append((action, user)) else: rows = self._permsys.get_all_permissions() rows.sort() self.print_listing(['User', 'Action'], rows) print print 'Available actions:' actions = self._permsys.get_actions() actions.sort() text = ', '.join(actions) print wrap(text, initial_indent=' ', subsequent_indent=' ', linesep='\n') print
5cccf16a90ff2c4fae2326473abb94ade2eb9b31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/5cccf16a90ff2c4fae2326473abb94ade2eb9b31/admin.py
sqlite = None
using_pysqlite2 = False
def executemany(self, sql, args=None): if args: sql = sql % tuple(['?'] * len(args[0])) sqlite.Cursor.executemany(self, sql, args or [])
8ff18972a8c4235c0bfa5d1aee44a9c9d25d2984 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/8ff18972a8c4235c0bfa5d1aee44a9c9d25d2984/db.py
global sqlite
global using_pysqlite2
def __init__(self, path, params={}): global sqlite self.cnx = None if path != ':memory:': if not os.access(path, os.F_OK): raise TracError, 'Database "%s" not found.' % path
8ff18972a8c4235c0bfa5d1aee44a9c9d25d2984 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/8ff18972a8c4235c0bfa5d1aee44a9c9d25d2984/db.py
if sqlite is not None:
if using_pysqlite2: global sqlite
def __init__(self, path, params={}): global sqlite self.cnx = None if path != ':memory:': if not os.access(path, os.F_OK): raise TracError, 'Database "%s" not found.' % path
8ff18972a8c4235c0bfa5d1aee44a9c9d25d2984 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/8ff18972a8c4235c0bfa5d1aee44a9c9d25d2984/db.py
global sqlite if sqlite is not None:
global using_pysqlite2 if using_pysqlite2:
def cursor(self): global sqlite if sqlite is not None: # Using PySQLite 2.x return self.cnx.cursor(PyFormatCursor) else: return self.cnx.cursor()
8ff18972a8c4235c0bfa5d1aee44a9c9d25d2984 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/8ff18972a8c4235c0bfa5d1aee44a9c9d25d2984/db.py
file = StringIO(pair[1]) self.list.append(util.Field(pair[0], file, "text/plain", {}, None, {}))
qsargs.append(util.Field(pair[0], StringIO(pair[1]), "text/plain", {}, None, {})) self.list += qsargs
def __getattr__(self, name): return getattr(self.req, name)
7753eac6213cabbf8fc06faff4b3cb6f26194f58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/7753eac6213cabbf8fc06faff4b3cb6f26194f58/modpython_frontend.py
def _execute(self, cmd):
def _execute(self, cmd, strip_trailing_space=True):
def _execute(self, cmd): try: _err = sys.stderr _out = sys.stdout sys.stderr = sys.stdout = out = StringIO() try: self._admin.docmd(cmd) except SystemExit, e: pass return STRIP_TRAILING_SPACE.sub('', out.getvalue()) finally: sys.stderr = _err sys.stdout = _out
7ba65fef3c78c51a750f40d9e8e5607c5f3f9be4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/7ba65fef3c78c51a750f40d9e8e5607c5f3f9be4/admin.py
return STRIP_TRAILING_SPACE.sub('', out.getvalue())
if strip_trailing_space: return STRIP_TRAILING_SPACE.sub('', out.getvalue()) else: return out.getvalue()
def _execute(self, cmd): try: _err = sys.stderr _out = sys.stdout sys.stderr = sys.stdout = out = StringIO() try: self._admin.docmd(cmd) except SystemExit, e: pass return STRIP_TRAILING_SPACE.sub('', out.getvalue()) finally: sys.stderr = _err sys.stdout = _out
7ba65fef3c78c51a750f40d9e8e5607c5f3f9be4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/7ba65fef3c78c51a750f40d9e8e5607c5f3f9be4/admin.py
test_results = self._execute('about')
test_results = self._execute('about', strip_trailing_space=False)
def test_about(self): """ Tests the 'about' command in trac-admin. Since the 'about' command has no command arguments, it is hard to call it incorrectly. As a result, there is only this one test. """
7ba65fef3c78c51a750f40d9e8e5607c5f3f9be4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/7ba65fef3c78c51a750f40d9e8e5607c5f3f9be4/admin.py
if id == -1:
if not id:
def save_milestone(self, id): self.perm.assert_permission(perm.MILESTONE_MODIFY) if self.args.has_key('save'): name = self.args.get('name', '') if not name: raise TracError('You must provide a name for the milestone.', 'Required Field Missing') datemode = self.args.get('datemode', 'manual') if datemode == 'now': date = int(time.time()) else: datestr = self.args.get('date', '') date = 0 if datestr: date = self.parse_date(datestr) descr = self.args.get('descr', '') if id == -1: self.create_milestone(name, date, descr) else: self.update_milestone(id, name, date, descr) elif id != -1: self.req.redirect(self.env.href.milestone(id)) else: self.req.redirect(self.env.href.roadmap())
f3a151aafecef938ddc857db0d77fdbc95978a0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f3a151aafecef938ddc857db0d77fdbc95978a0b/Milestone.py
elif id != -1:
elif id:
def save_milestone(self, id): self.perm.assert_permission(perm.MILESTONE_MODIFY) if self.args.has_key('save'): name = self.args.get('name', '') if not name: raise TracError('You must provide a name for the milestone.', 'Required Field Missing') datemode = self.args.get('datemode', 'manual') if datemode == 'now': date = int(time.time()) else: datestr = self.args.get('date', '') date = 0 if datestr: date = self.parse_date(datestr) descr = self.args.get('descr', '') if id == -1: self.create_milestone(name, date, descr) else: self.update_milestone(id, name, date, descr) elif id != -1: self.req.redirect(self.env.href.milestone(id)) else: self.req.redirect(self.env.href.roadmap())
f3a151aafecef938ddc857db0d77fdbc95978a0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f3a151aafecef938ddc857db0d77fdbc95978a0b/Milestone.py
id = self.args.get('id', -1)
id = self.args.get('id')
def render(self): self.perm.assert_permission(perm.MILESTONE_VIEW)
f3a151aafecef938ddc857db0d77fdbc95978a0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f3a151aafecef938ddc857db0d77fdbc95978a0b/Milestone.py
self.render_editor(-1)
self.render_editor()
def render(self): self.perm.assert_permission(perm.MILESTONE_VIEW)
f3a151aafecef938ddc857db0d77fdbc95978a0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f3a151aafecef938ddc857db0d77fdbc95978a0b/Milestone.py
def render_editor(self, id): if id == -1:
def render_editor(self, id=None): if not id:
def render_editor(self, id): if id == -1: milestone = { 'name': '', 'date': '', 'descr': '' } self.req.hdf.setValue('title', 'New Milestone') self.req.hdf.setValue('milestone.mode', 'new') else: milestone = self.get_milestone(id) self.req.hdf.setValue('title', 'Milestone %s' % milestone['name']) self.req.hdf.setValue('milestone.mode', 'edit') add_to_hdf(milestone, self.req.hdf, 'milestone')
f3a151aafecef938ddc857db0d77fdbc95978a0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f3a151aafecef938ddc857db0d77fdbc95978a0b/Milestone.py
"""Detect different unicode charsets by looking for BOM's (Byte Order Marks)"""
"""Detect different unicode charsets by looking for BOMs (Byte Order Marks)."""
def detect_unicode(data): """Detect different unicode charsets by looking for BOM's (Byte Order Marks)""" if data[:2] == '\xff\xfe': return 'utf-16-le' elif data[:2] == '\xfe\xff': return 'utf-16-be' elif data[:3] == '\xef\xbb\xbf': return 'utf-8' else: return None
5791c265f25f0d2102cbfbec252345cb86087713 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/5791c265f25f0d2102cbfbec252345cb86087713/api.py
space_re = re.compile(' ( +)|^ ')
space_re = re.compile('(?P<spaces> (?: +))|' '^(?P<tag><\w+.*?>)?( )')
def _annotate(self, lines, annotations): buf = StringIO() buf.write('<table class="code-block listing"><thead><tr>') annotators = [] for annotator in self.annotators: atype, alabel, adesc = annotator.get_annotation_type() if atype in annotations: buf.write('<th class="%s">%s</th>' % (atype, alabel)) annotators.append(annotator) buf.write('<th class="content">&nbsp;</th>') buf.write('</tr></thead><tbody>')
5791c265f25f0d2102cbfbec252345cb86087713 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/5791c265f25f0d2102cbfbec252345cb86087713/api.py
div, mod = divmod(len(match.group(0)), 2) return div * '&nbsp; ' + mod * '&nbsp;'
m = match.group('spaces') if m: div, mod = divmod(len(m), 2) return div * '&nbsp; ' + mod * '&nbsp;' return (match.group('tag') or '') + '&nbsp;'
def htmlify(match): div, mod = divmod(len(match.group(0)), 2) return div * '&nbsp; ' + mod * '&nbsp;'
5791c265f25f0d2102cbfbec252345cb86087713 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/5791c265f25f0d2102cbfbec252345cb86087713/api.py
return '<th id="l%s">%s</th>' % (number, number)
return '<th id="l%s"><a href=" number)
def annotate_line(self, number, content): return '<th id="l%s">%s</th>' % (number, number)
5791c265f25f0d2102cbfbec252345cb86087713 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/5791c265f25f0d2102cbfbec252345cb86087713/api.py
self.systeminfo = [('Python': sys.version)]
self.systeminfo = [('Python', sys.version)]
def __init__(self, default_data=False, enable=None): ComponentManager.__init__(self) Component.__init__(self) self.enabled_components = enable self.db = InMemoryDatabase() self.systeminfo = [('Python': sys.version)]
bba014c5566745127db0aad63fa100e84a7693d3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/bba014c5566745127db0aad63fa100e84a7693d3/test.py
item['message'] = item['message']
item['message'] = wiki_to_oneliner(item['message'])
def get_info (self, start, stop, tickets, changeset, wiki): cnx = db.get_connection() cursor = cnx.cursor ()
30b2a787d9f0a4a76b0beb6e68ed1fe959bbbe2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/30b2a787d9f0a4a76b0beb6e68ed1fe959bbbe2a/Timeline.py
item['message'] = item['message']
item['message'] = wiki_to_oneliner(item['message'])
def get_info (self, start, stop, tickets, changeset, wiki): cnx = db.get_connection() cursor = cnx.cursor ()
30b2a787d9f0a4a76b0beb6e68ed1fe959bbbe2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/30b2a787d9f0a4a76b0beb6e68ed1fe959bbbe2a/Timeline.py
if remove_contraints.has_key(field):
if remove_constraints.has_key(field):
def _get_constraints(self, req): constraints = {} ticket_fields = [f['name'] for f in TicketSystem(self.env).get_ticket_fields()]
bb72c868c1c1f74af2c146af51e92c4319c19cec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/bb72c868c1c1f74af2c146af51e92c4319c19cec/query.py
self.ticket['description'] = wrap(self.ticket.get('description',''),
self.ticket['description'] = wrap(self.ticket.values.get('description', ''),
def notify(self, ticket, newticket=1, modtime=0): self.ticket = ticket self.modtime = modtime self.newticket = newticket self.ticket['description'] = wrap(self.ticket.get('description',''), self.COLS, initial_indent=' ', subsequent_indent=' ', linesep=CRLF) self.ticket['link'] = self.env.abs_href.ticket(ticket['id']) self.hdf['email.ticket_props'] = self.format_props() self.hdf['email.ticket_body_hdr'] = self.format_hdr() self.hdf['ticket'] = self.ticket self.hdf['ticket.new'] = self.newticket and '1' or '0' subject = self.format_subj() if not self.newticket: subject = 'Re: ' + subject self.hdf['email.subject'] = subject changes = '' if not self.newticket and modtime: # Ticket change changelog = ticket.get_changelog(self.db, modtime) for date, author, field, old, new in changelog: self.hdf['ticket.change.author'] = author pfx = 'ticket.change.%s' % field newv = '' if field == 'comment': newv = wrap(new, self.COLS, ' ', ' ', CRLF) elif field == 'description': new_descr = wrap(new, self.COLS, ' ', ' ', CRLF) old_descr = wrap(old, self.COLS, '> ', '> ', CRLF) old_descr = old_descr.replace(2*CRLF, CRLF + '>' + CRLF) cdescr = CRLF cdescr += 'Old description:' + 2*CRLF + old_descr + 2*CRLF cdescr += 'New description:' + 2*CRLF + new_descr + CRLF self.hdf['email.changes_descr'] = cdescr else: newv = new l = 7 + len(field) chg = wrap('%s => %s' % (old, new), self.COLS-l,'', l*' ', CRLF) changes += ' * %s: %s%s' % (field, chg, CRLF) if newv: self.hdf['%s.oldvalue' % pfx] = old self.hdf['%s.newvalue' % pfx] = newv if field == 'cc': self.prev_cc += old and self.parse_cc(old) or [] self.hdf['%s.author' % pfx] = author if changes: self.hdf['email.changes_body'] = changes NotifyEmail.notify(self, ticket['id'], subject)
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
self.ticket['link'] = self.env.abs_href.ticket(ticket['id'])
self.ticket['link'] = self.env.abs_href.ticket(ticket.id)
def notify(self, ticket, newticket=1, modtime=0): self.ticket = ticket self.modtime = modtime self.newticket = newticket self.ticket['description'] = wrap(self.ticket.get('description',''), self.COLS, initial_indent=' ', subsequent_indent=' ', linesep=CRLF) self.ticket['link'] = self.env.abs_href.ticket(ticket['id']) self.hdf['email.ticket_props'] = self.format_props() self.hdf['email.ticket_body_hdr'] = self.format_hdr() self.hdf['ticket'] = self.ticket self.hdf['ticket.new'] = self.newticket and '1' or '0' subject = self.format_subj() if not self.newticket: subject = 'Re: ' + subject self.hdf['email.subject'] = subject changes = '' if not self.newticket and modtime: # Ticket change changelog = ticket.get_changelog(self.db, modtime) for date, author, field, old, new in changelog: self.hdf['ticket.change.author'] = author pfx = 'ticket.change.%s' % field newv = '' if field == 'comment': newv = wrap(new, self.COLS, ' ', ' ', CRLF) elif field == 'description': new_descr = wrap(new, self.COLS, ' ', ' ', CRLF) old_descr = wrap(old, self.COLS, '> ', '> ', CRLF) old_descr = old_descr.replace(2*CRLF, CRLF + '>' + CRLF) cdescr = CRLF cdescr += 'Old description:' + 2*CRLF + old_descr + 2*CRLF cdescr += 'New description:' + 2*CRLF + new_descr + CRLF self.hdf['email.changes_descr'] = cdescr else: newv = new l = 7 + len(field) chg = wrap('%s => %s' % (old, new), self.COLS-l,'', l*' ', CRLF) changes += ' * %s: %s%s' % (field, chg, CRLF) if newv: self.hdf['%s.oldvalue' % pfx] = old self.hdf['%s.newvalue' % pfx] = newv if field == 'cc': self.prev_cc += old and self.parse_cc(old) or [] self.hdf['%s.author' % pfx] = author if changes: self.hdf['email.changes_body'] = changes NotifyEmail.notify(self, ticket['id'], subject)
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
changelog = ticket.get_changelog(self.db, modtime)
changelog = ticket.get_changelog(modtime)
def notify(self, ticket, newticket=1, modtime=0): self.ticket = ticket self.modtime = modtime self.newticket = newticket self.ticket['description'] = wrap(self.ticket.get('description',''), self.COLS, initial_indent=' ', subsequent_indent=' ', linesep=CRLF) self.ticket['link'] = self.env.abs_href.ticket(ticket['id']) self.hdf['email.ticket_props'] = self.format_props() self.hdf['email.ticket_body_hdr'] = self.format_hdr() self.hdf['ticket'] = self.ticket self.hdf['ticket.new'] = self.newticket and '1' or '0' subject = self.format_subj() if not self.newticket: subject = 'Re: ' + subject self.hdf['email.subject'] = subject changes = '' if not self.newticket and modtime: # Ticket change changelog = ticket.get_changelog(self.db, modtime) for date, author, field, old, new in changelog: self.hdf['ticket.change.author'] = author pfx = 'ticket.change.%s' % field newv = '' if field == 'comment': newv = wrap(new, self.COLS, ' ', ' ', CRLF) elif field == 'description': new_descr = wrap(new, self.COLS, ' ', ' ', CRLF) old_descr = wrap(old, self.COLS, '> ', '> ', CRLF) old_descr = old_descr.replace(2*CRLF, CRLF + '>' + CRLF) cdescr = CRLF cdescr += 'Old description:' + 2*CRLF + old_descr + 2*CRLF cdescr += 'New description:' + 2*CRLF + new_descr + CRLF self.hdf['email.changes_descr'] = cdescr else: newv = new l = 7 + len(field) chg = wrap('%s => %s' % (old, new), self.COLS-l,'', l*' ', CRLF) changes += ' * %s: %s%s' % (field, chg, CRLF) if newv: self.hdf['%s.oldvalue' % pfx] = old self.hdf['%s.newvalue' % pfx] = newv if field == 'cc': self.prev_cc += old and self.parse_cc(old) or [] self.hdf['%s.author' % pfx] = author if changes: self.hdf['email.changes_body'] = changes NotifyEmail.notify(self, ticket['id'], subject)
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
NotifyEmail.notify(self, ticket['id'], subject)
NotifyEmail.notify(self, ticket.id, subject)
def notify(self, ticket, newticket=1, modtime=0): self.ticket = ticket self.modtime = modtime self.newticket = newticket self.ticket['description'] = wrap(self.ticket.get('description',''), self.COLS, initial_indent=' ', subsequent_indent=' ', linesep=CRLF) self.ticket['link'] = self.env.abs_href.ticket(ticket['id']) self.hdf['email.ticket_props'] = self.format_props() self.hdf['email.ticket_body_hdr'] = self.format_hdr() self.hdf['ticket'] = self.ticket self.hdf['ticket.new'] = self.newticket and '1' or '0' subject = self.format_subj() if not self.newticket: subject = 'Re: ' + subject self.hdf['email.subject'] = subject changes = '' if not self.newticket and modtime: # Ticket change changelog = ticket.get_changelog(self.db, modtime) for date, author, field, old, new in changelog: self.hdf['ticket.change.author'] = author pfx = 'ticket.change.%s' % field newv = '' if field == 'comment': newv = wrap(new, self.COLS, ' ', ' ', CRLF) elif field == 'description': new_descr = wrap(new, self.COLS, ' ', ' ', CRLF) old_descr = wrap(old, self.COLS, '> ', '> ', CRLF) old_descr = old_descr.replace(2*CRLF, CRLF + '>' + CRLF) cdescr = CRLF cdescr += 'Old description:' + 2*CRLF + old_descr + 2*CRLF cdescr += 'New description:' + 2*CRLF + new_descr + CRLF self.hdf['email.changes_descr'] = cdescr else: newv = new l = 7 + len(field) chg = wrap('%s => %s' % (old, new), self.COLS-l,'', l*' ', CRLF) changes += ' * %s: %s%s' % (field, chg, CRLF) if newv: self.hdf['%s.oldvalue' % pfx] = old self.hdf['%s.newvalue' % pfx] = newv if field == 'cc': self.prev_cc += old and self.parse_cc(old) or [] self.hdf['%s.author' % pfx] = author if changes: self.hdf['email.changes_body'] = changes NotifyEmail.notify(self, ticket['id'], subject)
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
tkt['id'] = '%s' % tkt['id'] t = self.modtime or tkt['time'] tkt['modified'] = time.strftime('%c', time.localtime(t)) fields = ['id', 'status', 'component', 'modified', 'severity', 'milestone', 'priority', 'version', 'owner', 'reporter'] fields.extend(filter(lambda f: f.startswith('custom_'), self.ticket.keys())) i = 1
fields = [f for f in tkt.fields if f['type'] != 'textarea'] t = self.modtime or tkt.time_changed
def format_props(self): tkt = self.ticket tkt['id'] = '%s' % tkt['id'] t = self.modtime or tkt['time'] tkt['modified'] = time.strftime('%c', time.localtime(t)) fields = ['id', 'status', 'component', 'modified', 'severity', 'milestone', 'priority', 'version', 'owner', 'reporter'] fields.extend(filter(lambda f: f.startswith('custom_'), self.ticket.keys())) i = 1 width = [0,0,0,0] for f in fields: if not tkt.has_key(f): continue fval = str(tkt[f]) if fval.find('\n') > -1: continue fname = f.startswith('custom_') and f[7:] or f idx = 2*(i % 2) if len(fname) > width[idx]: width[idx] = len(fname) if len(fval) > width[idx+1]: width[idx+1] = len(fval) i += 1 format = (' %%%is: %%-%is%s' % (width[0], width[1], CRLF), '%%%is: %%-%is | ' % (width[2], width[3])) i = 1 l = (width[2] + width[3] + 5) sep = l*'-' + '+' + (self.COLS-l)*'-' txt = sep + CRLF big=[] for f in fields: if not tkt.has_key(f): continue fval = tkt[f] fname = f.startswith('custom_') and f[7:] or f if '\n' in str(fval): big.append((fname.capitalize(), fval)) else: txt += format[i%2] % (fname.capitalize(), fval) i += 1 if i % 2 == 0: txt += '\n' if big: txt += sep for k,v in big: txt += '\n%s:\n%s\n\n' % (k,v) txt += sep return txt
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
for f in fields: if not tkt.has_key(f):
for i, f in enum([f['name'] for f in fields]): if not f in tkt.values.keys():
def format_props(self): tkt = self.ticket tkt['id'] = '%s' % tkt['id'] t = self.modtime or tkt['time'] tkt['modified'] = time.strftime('%c', time.localtime(t)) fields = ['id', 'status', 'component', 'modified', 'severity', 'milestone', 'priority', 'version', 'owner', 'reporter'] fields.extend(filter(lambda f: f.startswith('custom_'), self.ticket.keys())) i = 1 width = [0,0,0,0] for f in fields: if not tkt.has_key(f): continue fval = str(tkt[f]) if fval.find('\n') > -1: continue fname = f.startswith('custom_') and f[7:] or f idx = 2*(i % 2) if len(fname) > width[idx]: width[idx] = len(fname) if len(fval) > width[idx+1]: width[idx+1] = len(fval) i += 1 format = (' %%%is: %%-%is%s' % (width[0], width[1], CRLF), '%%%is: %%-%is | ' % (width[2], width[3])) i = 1 l = (width[2] + width[3] + 5) sep = l*'-' + '+' + (self.COLS-l)*'-' txt = sep + CRLF big=[] for f in fields: if not tkt.has_key(f): continue fval = tkt[f] fname = f.startswith('custom_') and f[7:] or f if '\n' in str(fval): big.append((fname.capitalize(), fval)) else: txt += format[i%2] % (fname.capitalize(), fval) i += 1 if i % 2 == 0: txt += '\n' if big: txt += sep for k,v in big: txt += '\n%s:\n%s\n\n' % (k,v) txt += sep return txt
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
fval = str(tkt[f])
fval = tkt[f]
def format_props(self): tkt = self.ticket tkt['id'] = '%s' % tkt['id'] t = self.modtime or tkt['time'] tkt['modified'] = time.strftime('%c', time.localtime(t)) fields = ['id', 'status', 'component', 'modified', 'severity', 'milestone', 'priority', 'version', 'owner', 'reporter'] fields.extend(filter(lambda f: f.startswith('custom_'), self.ticket.keys())) i = 1 width = [0,0,0,0] for f in fields: if not tkt.has_key(f): continue fval = str(tkt[f]) if fval.find('\n') > -1: continue fname = f.startswith('custom_') and f[7:] or f idx = 2*(i % 2) if len(fname) > width[idx]: width[idx] = len(fname) if len(fval) > width[idx+1]: width[idx+1] = len(fval) i += 1 format = (' %%%is: %%-%is%s' % (width[0], width[1], CRLF), '%%%is: %%-%is | ' % (width[2], width[3])) i = 1 l = (width[2] + width[3] + 5) sep = l*'-' + '+' + (self.COLS-l)*'-' txt = sep + CRLF big=[] for f in fields: if not tkt.has_key(f): continue fval = tkt[f] fname = f.startswith('custom_') and f[7:] or f if '\n' in str(fval): big.append((fname.capitalize(), fval)) else: txt += format[i%2] % (fname.capitalize(), fval) i += 1 if i % 2 == 0: txt += '\n' if big: txt += sep for k,v in big: txt += '\n%s:\n%s\n\n' % (k,v) txt += sep return txt
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
fname = f.startswith('custom_') and f[7:] or f idx = 2*(i % 2) if len(fname) > width[idx]: width[idx] = len(fname) if len(fval) > width[idx+1]: width[idx+1] = len(fval) i += 1 format = (' %%%is: %%-%is%s' % (width[0], width[1], CRLF), '%%%is: %%-%is | ' % (width[2], width[3]))
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[2], width[3]), ' %%%is: %%-%is%s' % (width[0], width[1], CRLF))
def format_props(self): tkt = self.ticket tkt['id'] = '%s' % tkt['id'] t = self.modtime or tkt['time'] tkt['modified'] = time.strftime('%c', time.localtime(t)) fields = ['id', 'status', 'component', 'modified', 'severity', 'milestone', 'priority', 'version', 'owner', 'reporter'] fields.extend(filter(lambda f: f.startswith('custom_'), self.ticket.keys())) i = 1 width = [0,0,0,0] for f in fields: if not tkt.has_key(f): continue fval = str(tkt[f]) if fval.find('\n') > -1: continue fname = f.startswith('custom_') and f[7:] or f idx = 2*(i % 2) if len(fname) > width[idx]: width[idx] = len(fname) if len(fval) > width[idx+1]: width[idx+1] = len(fval) i += 1 format = (' %%%is: %%-%is%s' % (width[0], width[1], CRLF), '%%%is: %%-%is | ' % (width[2], width[3])) i = 1 l = (width[2] + width[3] + 5) sep = l*'-' + '+' + (self.COLS-l)*'-' txt = sep + CRLF big=[] for f in fields: if not tkt.has_key(f): continue fval = tkt[f] fname = f.startswith('custom_') and f[7:] or f if '\n' in str(fval): big.append((fname.capitalize(), fval)) else: txt += format[i%2] % (fname.capitalize(), fval) i += 1 if i % 2 == 0: txt += '\n' if big: txt += sep for k,v in big: txt += '\n%s:\n%s\n\n' % (k,v) txt += sep return txt
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
big=[] for f in fields: if not tkt.has_key(f): continue
big = [] for i, f in enum([f['name'] for f in fields]): if not tkt.values.has_key(f): continue
def format_props(self): tkt = self.ticket tkt['id'] = '%s' % tkt['id'] t = self.modtime or tkt['time'] tkt['modified'] = time.strftime('%c', time.localtime(t)) fields = ['id', 'status', 'component', 'modified', 'severity', 'milestone', 'priority', 'version', 'owner', 'reporter'] fields.extend(filter(lambda f: f.startswith('custom_'), self.ticket.keys())) i = 1 width = [0,0,0,0] for f in fields: if not tkt.has_key(f): continue fval = str(tkt[f]) if fval.find('\n') > -1: continue fname = f.startswith('custom_') and f[7:] or f idx = 2*(i % 2) if len(fname) > width[idx]: width[idx] = len(fname) if len(fval) > width[idx+1]: width[idx+1] = len(fval) i += 1 format = (' %%%is: %%-%is%s' % (width[0], width[1], CRLF), '%%%is: %%-%is | ' % (width[2], width[3])) i = 1 l = (width[2] + width[3] + 5) sep = l*'-' + '+' + (self.COLS-l)*'-' txt = sep + CRLF big=[] for f in fields: if not tkt.has_key(f): continue fval = tkt[f] fname = f.startswith('custom_') and f[7:] or f if '\n' in str(fval): big.append((fname.capitalize(), fval)) else: txt += format[i%2] % (fname.capitalize(), fval) i += 1 if i % 2 == 0: txt += '\n' if big: txt += sep for k,v in big: txt += '\n%s:\n%s\n\n' % (k,v) txt += sep return txt
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
fname = f.startswith('custom_') and f[7:] or f
def format_props(self): tkt = self.ticket tkt['id'] = '%s' % tkt['id'] t = self.modtime or tkt['time'] tkt['modified'] = time.strftime('%c', time.localtime(t)) fields = ['id', 'status', 'component', 'modified', 'severity', 'milestone', 'priority', 'version', 'owner', 'reporter'] fields.extend(filter(lambda f: f.startswith('custom_'), self.ticket.keys())) i = 1 width = [0,0,0,0] for f in fields: if not tkt.has_key(f): continue fval = str(tkt[f]) if fval.find('\n') > -1: continue fname = f.startswith('custom_') and f[7:] or f idx = 2*(i % 2) if len(fname) > width[idx]: width[idx] = len(fname) if len(fval) > width[idx+1]: width[idx+1] = len(fval) i += 1 format = (' %%%is: %%-%is%s' % (width[0], width[1], CRLF), '%%%is: %%-%is | ' % (width[2], width[3])) i = 1 l = (width[2] + width[3] + 5) sep = l*'-' + '+' + (self.COLS-l)*'-' txt = sep + CRLF big=[] for f in fields: if not tkt.has_key(f): continue fval = tkt[f] fname = f.startswith('custom_') and f[7:] or f if '\n' in str(fval): big.append((fname.capitalize(), fval)) else: txt += format[i%2] % (fname.capitalize(), fval) i += 1 if i % 2 == 0: txt += '\n' if big: txt += sep for k,v in big: txt += '\n%s:\n%s\n\n' % (k,v) txt += sep return txt
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
big.append((fname.capitalize(), fval))
big.append((f.capitalize(), fval))
def format_props(self): tkt = self.ticket tkt['id'] = '%s' % tkt['id'] t = self.modtime or tkt['time'] tkt['modified'] = time.strftime('%c', time.localtime(t)) fields = ['id', 'status', 'component', 'modified', 'severity', 'milestone', 'priority', 'version', 'owner', 'reporter'] fields.extend(filter(lambda f: f.startswith('custom_'), self.ticket.keys())) i = 1 width = [0,0,0,0] for f in fields: if not tkt.has_key(f): continue fval = str(tkt[f]) if fval.find('\n') > -1: continue fname = f.startswith('custom_') and f[7:] or f idx = 2*(i % 2) if len(fname) > width[idx]: width[idx] = len(fname) if len(fval) > width[idx+1]: width[idx+1] = len(fval) i += 1 format = (' %%%is: %%-%is%s' % (width[0], width[1], CRLF), '%%%is: %%-%is | ' % (width[2], width[3])) i = 1 l = (width[2] + width[3] + 5) sep = l*'-' + '+' + (self.COLS-l)*'-' txt = sep + CRLF big=[] for f in fields: if not tkt.has_key(f): continue fval = tkt[f] fname = f.startswith('custom_') and f[7:] or f if '\n' in str(fval): big.append((fname.capitalize(), fval)) else: txt += format[i%2] % (fname.capitalize(), fval) i += 1 if i % 2 == 0: txt += '\n' if big: txt += sep for k,v in big: txt += '\n%s:\n%s\n\n' % (k,v) txt += sep return txt
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
txt += format[i%2] % (fname.capitalize(), fval) i += 1 if i % 2 == 0:
txt += format[i % 2] % (f.capitalize(), fval) if i % 2:
def format_props(self): tkt = self.ticket tkt['id'] = '%s' % tkt['id'] t = self.modtime or tkt['time'] tkt['modified'] = time.strftime('%c', time.localtime(t)) fields = ['id', 'status', 'component', 'modified', 'severity', 'milestone', 'priority', 'version', 'owner', 'reporter'] fields.extend(filter(lambda f: f.startswith('custom_'), self.ticket.keys())) i = 1 width = [0,0,0,0] for f in fields: if not tkt.has_key(f): continue fval = str(tkt[f]) if fval.find('\n') > -1: continue fname = f.startswith('custom_') and f[7:] or f idx = 2*(i % 2) if len(fname) > width[idx]: width[idx] = len(fname) if len(fval) > width[idx+1]: width[idx+1] = len(fval) i += 1 format = (' %%%is: %%-%is%s' % (width[0], width[1], CRLF), '%%%is: %%-%is | ' % (width[2], width[3])) i = 1 l = (width[2] + width[3] + 5) sep = l*'-' + '+' + (self.COLS-l)*'-' txt = sep + CRLF big=[] for f in fields: if not tkt.has_key(f): continue fval = tkt[f] fname = f.startswith('custom_') and f[7:] or f if '\n' in str(fval): big.append((fname.capitalize(), fval)) else: txt += format[i%2] % (fname.capitalize(), fval) i += 1 if i % 2 == 0: txt += '\n' if big: txt += sep for k,v in big: txt += '\n%s:\n%s\n\n' % (k,v) txt += sep return txt
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
return ' self.COLS, linesep=CRLF))
return ' self.COLS, linesep=CRLF))
def format_hdr(self): return '#%s: %s' % (self.ticket['id'], wrap(self.ticket['summary'], self.COLS, linesep=CRLF))
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
return '[%s] self.ticket['summary'])
return '[%s] self.ticket['summary'])
def format_subj(self): projname = self.config.get('project', 'name') return '[%s] #%s: %s' % (projname, self.ticket['id'], self.ticket['summary'])
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
def get_recipients(self, tktid): val = self.config.get('notification', 'always_notify_reporter') notify_reporter = val.lower() in TRUE val = self.config.get('notification', 'always_notify_owner') notify_owner = val.lower() in TRUE recipients = self.prev_cc cursor = self.db.cursor()
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
int(self.ticket['id']), modtime, rcpt)
int(self.ticket.id), modtime, rcpt)
def get_message_id(self, rcpt, modtime=0): """Generate a predictable, but sufficiently unique message ID.""" s = '%s.%08d.%d.%s' % (self.config.get('project', 'url'), int(self.ticket['id']), modtime, rcpt) dig = md5.new(s).hexdigest() host = self.from_email[self.from_email.find('@') + 1:] msgid = '<%03d.%s@%s>' % (len(s), dig, host) return msgid
e955cc298b14d4c8585186dd50d2db31c6327444 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/e955cc298b14d4c8585186dd50d2db31c6327444/Notify.py
print `info`
def _render_diff(self, req, db, page): req.perm.assert_permission('WIKI_VIEW')
08151f5358d279402c74a740b5d2327d338534df /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/08151f5358d279402c74a740b5d2327d338534df/web_ui.py
num_changes += 1
def _render_diff(self, req, db, page): req.perm.assert_permission('WIKI_VIEW')
08151f5358d279402c74a740b5d2327d338534df /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/08151f5358d279402c74a740b5d2327d338534df/web_ui.py
match = re.match(r'/(browser|file)(?:(/.*))?', req.path_info)
match = re.match(r'/(export|browser|file)(?:(/.*))?', req.path_info)
def match_request(self, req): import re match = re.match(r'/(browser|file)(?:(/.*))?', req.path_info) if match: req.args['path'] = match.group(2) or '/' if match.group(1) == 'file': req.redirect(req.href.browser(req.args.get('path'), rev=req.args.get('rev'), format=req.args.get('format')), permanent=True) return True
6aeb5cf917295ed2f9f9d8f5a6f3e94a94837184 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/6aeb5cf917295ed2f9f9d8f5a6f3e94a94837184/browser.py
req.args['path'] = match.group(2) or '/' if match.group(1) == 'file': req.redirect(req.href.browser(req.args.get('path'), rev=req.args.get('rev'),
mode, path = match.groups() if mode == 'export': if path and '/' in path: _, rev, path = path.split('/', 2) req.args['rev'] = rev req.args['format'] = 'raw' elif mode == 'file': req.redirect(req.href.browser(path, rev=req.args.get('rev'),
def match_request(self, req): import re match = re.match(r'/(browser|file)(?:(/.*))?', req.path_info) if match: req.args['path'] = match.group(2) or '/' if match.group(1) == 'file': req.redirect(req.href.browser(req.args.get('path'), rev=req.args.get('rev'), format=req.args.get('format')), permanent=True) return True
6aeb5cf917295ed2f9f9d8f5a6f3e94a94837184 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/6aeb5cf917295ed2f9f9d8f5a6f3e94a94837184/browser.py
raw_href = req.href.browser(node.path, rev=rev, format='raw')
raw_href = req.href.export(rev or repos.youngest_rev, node.path)
def _render_file(self, req, repos, node, rev=None): req.perm.require('FILE_VIEW')
6aeb5cf917295ed2f9f9d8f5a6f3e94a94837184 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/6aeb5cf917295ed2f9f9d8f5a6f3e94a94837184/browser.py
return [('repos', self._format_link), ('source', self._format_link), ('browser', self._format_link)] def _format_link(self, formatter, ns, path, label):
return [('repos', self._format_browser_link), ('export', self._format_export_link), ('source', self._format_browser_link), ('browser', self._format_browser_link)] def _format_export_link(self, formatter, ns, export, label): if ':' in export: rev, path = export.split(':', 1) else: rev, path = self.env.get_repository().youngest_rev, export return html.A(label, class_='source', href=formatter.href.export(rev, path)) def _format_browser_link(self, formatter, ns, path, label):
def get_link_resolvers(self): """TracBrowser link resolvers. - `source:` and `browser:` * simple paths (/dir/file) * paths at a given revision (/dir/file@234) * paths with line number marks (/dir/file@234:10,20-30) * paths with line number anchor (/dir/file@234#L100) Marks and anchor can be combined. The revision must be present when specifying line numbers. In the few cases where it would be redundant (e.g. for tags), the revision number itself can be omitted: /tags/v10/file@100-110#L99 """ return [('repos', self._format_link), ('source', self._format_link), ('browser', self._format_link)]
6aeb5cf917295ed2f9f9d8f5a6f3e94a94837184 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/6aeb5cf917295ed2f9f9d8f5a6f3e94a94837184/browser.py
milestone = urllib.quote_plus(milestone) href = href_join(self.base, 'milestone', str(milestone))
if milestone.find('/') >= 0: href = href_join(self.base, 'milestone') params.append(('id', milestone)) else: href = href_join(self.base, 'milestone', urllib.quote_plus(milestone))
def milestone(self, milestone, action=None): if milestone: milestone = urllib.quote_plus(milestone) href = href_join(self.base, 'milestone', str(milestone)) else: href = href_join(self.base, 'milestone') if action: href = href + '?action=' + action return href
ae329e1d529e93ba296f22c983067a3547d7b6ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/ae329e1d529e93ba296f22c983067a3547d7b6ba/Href.py
href = href + '?action=' + action
params.append(('action', action)) if params: href += '?' + urllib.urlencode(params)
def milestone(self, milestone, action=None): if milestone: milestone = urllib.quote_plus(milestone) href = href_join(self.base, 'milestone', str(milestone)) else: href = href_join(self.base, 'milestone') if action: href = href + '?action=' + action return href
ae329e1d529e93ba296f22c983067a3547d7b6ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/ae329e1d529e93ba296f22c983067a3547d7b6ba/Href.py
elif name in ['changetime', 'time']: val = int(val)
elif name in ('changetime', 'time'): val = datetime.fromtimestamp(int(val), utc)
def execute(self, req, db=None): if not self.cols: self.get_columns()
87f2b587949e267f7ef8012e23eb81ac3d067ed9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/87f2b587949e267f7ef8012e23eb81ac3d067ed9/query.py
time_col = name == 'milestone' and 'milestone.due' or 'version.time'
time_col = name == 'milestone' and 'milestone.due' or \ 'version.time'
def get_constraint_sql(name, value, mode, neg): if name not in custom_fields: name = 't.' + name else: name = name + '.value' value = value[len(mode) + neg:]
87f2b587949e267f7ef8012e23eb81ac3d067ed9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/87f2b587949e267f7ef8012e23eb81ac3d067ed9/query.py
if int(ticket['time']) > orig_time:
if ticket['time'] > orig_time:
def template_data(self, req, db, tickets, orig_list=None, orig_time=None): constraints = {} for k, v in self.constraints.items(): constraint = {'values': [], 'mode': ''} for val in v: neg = val.startswith('!') if neg: val = val[1:] mode = '' if val[:1] in ('~', '^', '$'): mode, val = val[:1], val[1:] constraint['mode'] = (neg and '!' or '') + mode constraint['values'].append(val) constraints[k] = constraint
87f2b587949e267f7ef8012e23eb81ac3d067ed9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/87f2b587949e267f7ef8012e23eb81ac3d067ed9/query.py
elif int(ticket['changetime']) > orig_time:
elif ticket['changetime'] > orig_time:
def template_data(self, req, db, tickets, orig_list=None, orig_time=None): constraints = {} for k, v in self.constraints.items(): constraint = {'values': [], 'mode': ''} for val in v: neg = val.startswith('!') if neg: val = val[1:] mode = '' if val[:1] in ('~', '^', '$'): mode, val = val[:1], val[1:] constraint['mode'] = (neg and '!' or '') + mode constraint['values'].append(val) constraints[k] = constraint
87f2b587949e267f7ef8012e23eb81ac3d067ed9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/87f2b587949e267f7ef8012e23eb81ac3d067ed9/query.py
for field, value in ticket.items(): if field == self.group: groups.setdefault(value, []).append(ticket) if not groupsequence or groupsequence[-1] != value: groupsequence.append(value) if field == 'time': ticket[field] = value elif field == 'description': ticket[field] = \ wiki_to_html(value or '', self.env, req, db) else: ticket[field] = value
if self.group: group_key = ticket[self.group] groups.setdefault(group_key, []).append(ticket) if not groupsequence or groupsequence[-1] != group_key: groupsequence.append(group_key) description = ticket.get('description') if description: ticket['description'] = wiki_to_html(description, self.env, req, db)
def template_data(self, req, db, tickets, orig_list=None, orig_time=None): constraints = {} for k, v in self.constraints.items(): constraint = {'values': [], 'mode': ''} for val in v: neg = val.startswith('!') if neg: val = val[1:] mode = '' if val[:1] in ('~', '^', '$'): mode, val = val[:1], val[1:] constraint['mode'] = (neg and '!' or '') + mode constraint['values'].append(val) constraints[k] = constraint
87f2b587949e267f7ef8012e23eb81ac3d067ed9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/87f2b587949e267f7ef8012e23eb81ac3d067ed9/query.py
orig_time = int(time.time())
orig_time = datetime.now(utc) query_time = int(req.session.get('query_time', 0)) query_time = datetime.fromtimestamp(query_time, utc)
def display_html(self, req, query): db = self.env.get_db_cnx() tickets = query.execute(req, db)
87f2b587949e267f7ef8012e23eb81ac3d067ed9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/87f2b587949e267f7ef8012e23eb81ac3d067ed9/query.py
or int(req.session.get('query_time', 0)) < orig_time - 3600:
or query_time < orig_time - timedelta(hours=1):
def display_html(self, req, query): db = self.env.get_db_cnx() tickets = query.execute(req, db)
87f2b587949e267f7ef8012e23eb81ac3d067ed9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/87f2b587949e267f7ef8012e23eb81ac3d067ed9/query.py
orig_time = int(req.session.get('query_time', 0))
orig_time = query_time
def display_html(self, req, query): db = self.env.get_db_cnx() tickets = query.execute(req, db)
87f2b587949e267f7ef8012e23eb81ac3d067ed9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/87f2b587949e267f7ef8012e23eb81ac3d067ed9/query.py
req.session['query_time'] = orig_time
req.session['query_time'] = to_timestamp(orig_time)
def display_html(self, req, query): db = self.env.get_db_cnx() tickets = query.execute(req, db)
87f2b587949e267f7ef8012e23eb81ac3d067ed9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/87f2b587949e267f7ef8012e23eb81ac3d067ed9/query.py
% (class_map.get(change, 'mod'), name))
% (class_map.get(change, 'mod'), path))
def _render_changeset(self, req, item): absurls = req.args.get('format') == 'rss' href = self.env.href if absurls: href = self.env.abs_href
0d7c75148954f712021ba89ea710c128d6f52b90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0d7c75148954f712021ba89ea710c128d6f52b90/Timeline.py
r"""(?P<wikilink>(^|(?<=[^A-Za-z]))[!]?[A-Z][a-z/]+(?:[A-Z][a-z/]+)+(?=\Z|\s|,|\.|:))""",
r"""(?P<wikilink>(^|(?<=[^A-Za-z]))[!]?[A-Z][a-z0-9/]+(?:[A-Z][a-z0-9/]+)+(?=\Z|\s|,|\.|:))""",
def populate_page_dict(db, env): """Extract wiki page names. This is used to detect broken wiki-links""" page_dict = {'TitleIndex': 1, 'RecentChanges': 1} cursor = db.cursor() cursor.execute('SELECT DISTINCT name FROM wiki') while 1: row = cursor.fetchone() if not row: break page_dict[row[0]] = 1 env._wiki_pages = page_dict
5b35fc575751640076113c96cb4fad1186df4b20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/5b35fc575751640076113c96cb4fad1186df4b20/Wiki.py
conf_dir = os.path.join(self.prefix, 'share', 'trac', 'conf') templates_dir = os.path.join(self.prefix, 'share', 'trac', 'templates') htdocs_dir = os.path.join(self.prefix, 'share', 'trac', 'htdocs') wiki_dir = os.path.join(self.prefix, 'share', 'trac', 'wiki-default') macros_dir = os.path.join(self.prefix, 'share', 'trac', 'wiki-macros') plugins_dir = os.path.join(self.prefix, 'share', 'trac', 'plugins')
path = self.prefix or self.home path = os.path.expanduser(path) conf_dir = os.path.join(path, 'share', 'trac', 'conf') templates_dir = os.path.join(path, 'share', 'trac', 'templates') htdocs_dir = os.path.join(path, 'share', 'trac', 'htdocs') wiki_dir = os.path.join(path, 'share', 'trac', 'wiki-default') macros_dir = os.path.join(path, 'share', 'trac', 'wiki-macros') plugins_dir = os.path.join(path, 'share', 'trac', 'plugins')
def siteconfig(self): conf_dir = os.path.join(self.prefix, 'share', 'trac', 'conf') templates_dir = os.path.join(self.prefix, 'share', 'trac', 'templates') htdocs_dir = os.path.join(self.prefix, 'share', 'trac', 'htdocs') wiki_dir = os.path.join(self.prefix, 'share', 'trac', 'wiki-default') macros_dir = os.path.join(self.prefix, 'share', 'trac', 'wiki-macros') plugins_dir = os.path.join(self.prefix, 'share', 'trac', 'plugins') f = open(_p('trac/siteconfig.py'), 'w') f.write("""
a32d902698f98ba52d1b457abe3bb0d430f946a0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/a32d902698f98ba52d1b457abe3bb0d430f946a0/setup.py
if 'description' in req.args or 'reporter' in req.args:
if 'description' in req.args.keys() or 'reporter' in req.args.keys():
def save_changes(self, req, id): if self.perm.has_permission(perm.TICKET_CHGPROP): # TICKET_CHGPROP gives permission to edit the ticket if not req.args.get('summary'): raise util.TracError('Tickets must contain summary.')
597a7234970c2b1061e2e8fa39d2efa8422efa7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/597a7234970c2b1061e2e8fa39d2efa8422efa7d/Ticket.py
added = [x for x in newcc if x not in oldcc] removed = [x for x in oldcc if x not in newcc]
added = [x for x in newcc if x and x not in oldcc] removed = [x for x in oldcc if x and x not in newcc]
def diff_cc(self, old, new): oldcc = NotifyEmail.addrsep_re.split(old) newcc = NotifyEmail.addrsep_re.split(new) added = [x for x in newcc if x not in oldcc] removed = [x for x in oldcc if x not in newcc] return (added, removed)
d31b131d68353072e819c975b65a904b7cdfa5de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/d31b131d68353072e819c975b65a904b7cdfa5de/notification.py
import SilverCity
def render(self, req, mimetype, content, filename=None, rev=None): import SilverCity try: mimetype = mimetype.split(';', 1)[0] typelang = self._types[mimetype] lang = typelang[0] module = getattr(SilverCity, lang) generator = getattr(module, lang + "HTMLGenerator") try: allprops = typelang[2] propset = SilverCity.PropertySet() for p in allprops.keys(): propset[p] = allprops[p] except IndexError: pass except (KeyError, AttributeError): err = "No SilverCity lexer found for mime-type '%s'." % mimetype raise Exception, err
b000279247f58d42609d6a42c2dfca88b97d535f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/b000279247f58d42609d6a42c2dfca88b97d535f/silvercity.py
attachments_dir = os.path.join(self.env.path, 'attachments')
attachments_dir = os.path.join(os.path.normpath(self.env.path), 'attachments')
def insert(self, filename, fileobj, size, t=None, db=None): if not db: db = self.env.get_db_cnx() handle_ta = True else: handle_ta = False
0f7cbb65665d11bafb5df004c4ac1a8e8b1e4772 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0f7cbb65665d11bafb5df004c4ac1a8e8b1e4772/attachment.py
description="Trac - Wiki-based issue tracker and project environment",
description="Integrated scm, wiki, issue tracker and project environment", long_description=\ """ Trac is a minimalistic web-based software project management and bug/issue tracking system. It provides an interface to the Subversion revision control systems, an integrated wiki, flexible issue tracking and convenient report facilities. """,
def run (self): if not self.skip_build: self.run_command('build_scripts')
a07a240baa38d13da7dbe17a0d8b32a87d564d70 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/a07a240baa38d13da7dbe17a0d8b32a87d564d70/setup.py
safe_name = milestone.name.replace('/', '%2F')
safe_name = None if milestone.exists: safe_name = milestone.name.replace('/', '%2F')
def milestone_to_hdf(env, db, req, milestone): safe_name = milestone.name.replace('/', '%2F') hdf = {'name': escape(milestone.name), 'href': escape(env.href.milestone(safe_name))} if milestone.description: hdf['description_source'] = escape(milestone.description) hdf['description'] = wiki_to_html(milestone.description, env, req, db) if milestone.due: hdf['due'] = milestone.due hdf['due_date'] = format_date(milestone.due) hdf['due_delta'] = pretty_timedelta(milestone.due) hdf['late'] = milestone.is_late if milestone.completed: hdf['completed'] = milestone.completed hdf['completed_date'] = format_datetime(milestone.completed) hdf['completed_delta'] = pretty_timedelta(milestone.completed) return hdf
63d71841f60a739a125dc38fdc67fbd6b3ffeab4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/63d71841f60a739a125dc38fdc67fbd6b3ffeab4/roadmap.py
return True
return True
def all(S): for x in S: if not x: return False return True
d07cf66d33a27fb4978bd5d2bdb090fae271d24e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/d07cf66d33a27fb4978bd5d2bdb090fae271d24e/compat.py
milestone.name = req.args.get('name')
def _do_save(self, req, db, milestone): if milestone.exists: req.perm.assert_permission('MILESTONE_MODIFY') else: req.perm.assert_permission('MILESTONE_CREATE')
84800751480d44807332e76456381650d53603d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/84800751480d44807332e76456381650d53603d8/roadmap.py
perm_map = {'ticket': perm.TICKET_ADMIN, 'wiki': perm.WIKI_DELETE}
perm_map = {'ticket': 'TICKET_ADMIN', 'wiki': 'WIKI_DELETE'}
def _do_save(self, req, attachment): perm_map = {'ticket': 'TICKET_APPEND', 'wiki': 'WIKI_MODIFY'} req.perm.assert_permission(perm_map[attachment.parent_type])
26c1ed314048b86aca0a1480eb65005e51319ed9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/26c1ed314048b86aca0a1480eb65005e51319ed9/attachment.py
fromlines[i] = fr[:start] + '\0' + fr[start:end+len(fr)] + \ '\1' + fr[end:] tolines[i] = to[:start] + '\0' + to[start:end+len(to)] + \ '\1' + to[end:]
last = end+len(fr) fromlines[i] = fr[:start] + '\0' + fr[start:last] + \ '\1' + fr[last:] last = end+len(to) tolines[i] = to[:start] + '\0' + to[start:last] + \ '\1' + to[last:]
def _markup_intraline_change(fromlines, tolines): from trac.versioncontrol.diff import _get_change_extent for i in xrange(len(fromlines)): fr, to = fromlines[i], tolines[i] (start, end) = _get_change_extent(fr, to) if start != 0 or end != 0: fromlines[i] = fr[:start] + '\0' + fr[start:end+len(fr)] + \ '\1' + fr[end:] tolines[i] = to[:start] + '\0' + to[start:end+len(to)] + \ '\1' + to[end:]
dc797fd5b404bc0ecb9fa2a99aa0555931ad4e6b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/dc797fd5b404bc0ecb9fa2a99aa0555931ad4e6b/patch.py
for event_provider in self.event_providers:
for provider in self.event_providers:
def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW') data = {}
91b55e4836e3a7540d774c04761878ac8296019f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/91b55e4836e3a7540d774c04761878ac8296019f/web_ui.py
for event in event_provider.get_timeline_events(req, start, stop, filters):
for event in provider.get_timeline_events(req, start, stop, filters):
def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW') data = {}
91b55e4836e3a7540d774c04761878ac8296019f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/91b55e4836e3a7540d774c04761878ac8296019f/web_ui.py
self._provider_failure(e, req, event_provider, filters,
self._provider_failure(e, req, provider, filters,
def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW') data = {}
91b55e4836e3a7540d774c04761878ac8296019f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/91b55e4836e3a7540d774c04761878ac8296019f/web_ui.py
day = format_date(event.date, tzinfo=req.tz), data_events.append((day, event))
data_events.append(event)
def process_request(self, req): req.perm.assert_permission('TIMELINE_VIEW') data = {}
91b55e4836e3a7540d774c04761878ac8296019f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/91b55e4836e3a7540d774c04761878ac8296019f/web_ui.py
self.req.headers_out.add(name, str(value))
if content_type_re.match(name): self.req.content_type = value else: self.req.headers_out.add(name, str(value))
def send_header(self, name, value): self.req.headers_out.add(name, str(value))
9dde52e0051945fbfb27cca0967687918c82a2b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/9dde52e0051945fbfb27cca0967687918c82a2b7/ModPythonHandler.py
'title': row['title'],
'title': escape(row['title'] or ''),
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