Permalink
Browse files

Bug page being served as a "frame".

  • Loading branch information...
1 parent 66f9f12 commit 17b591d00fbb208158bed61e88b4383683d46c96 @FedericoCeratto committed May 4, 2010
@@ -81,9 +81,21 @@ def bugtable():
return dict(bugs=buglid)
-@route('/bug')
+@route('/bug/:bug_number')
+@validate(bug_number=int)
+@view('bug')
def bug(bug_number):
"""Renders a bug page."""
+ bug = getbug(bug_number)
+ print repr(bug)
+ bug['bug_number'] = bug_number
+ bug['message'] = 'u'
+
+
+ return bug
+
+ #TODO: all the stuff below this comment needs to be reviewed
+
from btsqueries import SoapQueries
import re
# info = process_bug_post(request, bug_number)
@@ -64,7 +64,7 @@ def bugfilter(bugs, kname, kval):
bs = filter(lambda n: kval in bugs[n][kname], bugs)
return dict((n, bugs[n]) for n in bs)
-@Timed
+#@Timed
@beaker.cache(expire=conf.bug_caching_time, type='file', data_dir='cache')
def getbugsbypackage(package):
"""Return a list of dictionaries, one dict for each bug:
@@ -77,7 +77,6 @@ def getbugsbypackage(package):
u = urlopen(conf.dde_url + "q/bts/bypackage/%s?t=json" % package)
j = json.load(u)
u.close()
-# return j['r']
bugs = j['r'] # workaround for a bug in DDE
for n in bugs:
try:
@@ -114,11 +113,11 @@ def getbugs(package):
bugs = map(int, j['r'])
return bugs
-@beaker.cache(expire=conf.bug_caching_time, type='file')
+@beaker.cache(expire=conf.bug_caching_time, type='file', data_dir='cache')
def getbug(bug_id):
assert(int(bug_id) > 0)
try:
- u = urlopen(dde_url + "q/bts/bynumber/%d?t=json" % bug_id)
+ u = urlopen(conf.dde_url + "q/bts/bynumber/%d?t=json" % bug_id)
j = json.load(u)
bug = j['r']
u.close()
@@ -36,6 +36,8 @@ def dummy_urlopen(url):
return open('tests/nmapbugs.json', 'r')
elif 'hedgehog' in url:
return open('tests/hhbugs.json', 'r')
+ elif '411369' in url:
+ return open('tests/bug_411369', 'r')
utils.urlopen = dummy_urlopen
@@ -58,6 +60,10 @@ def test_bugcounter3():
kw = {'originator': '', 'status': '', 'pkgname': 'nmap', 'maintainer': '', 'tags': '', 'tagblock': '', 'form_options': '1', 'submit': 'Show', 'owner': '', '_fo_combine_key_fo_searchkey_value_fo_searchvalue': '1', 'minseverity': 'normal', 'archive': '0', 'subject': ''}
assert utils.bugcounter(kw) == 19
+def test_getbug1():
+ bug = {'fixed_versions': [], 'blockedby': '', 'done': False, 'unarchived': False, 'owner': '', 'subject': 'nmap: hangs if sigint during startup', 'archived': False, 'forwarded': '', 'bug_num': 411369, 'msgid': '<20070218135218.GA23313@libra>', 'source': 'nmap', 'location': 'db-h', 'pending': 'pending', 'found_date': [], 'originator': 'Justin Pryzby <pryzbyj@justinpryzby.com>', 'blocks': '', 'tags': [], 'date': 1171806841, 'mergedwith': '', 'severity': 'normal', 'package': 'nmap', 'summary': '', 'log_modified': 1171806845, 'fixed_date': [], 'found_versions': ['nmap/4.11-1'], 'affects': '', 'found': None, 'fixed': None}
+ assert bug == utils.getbug(411369)
+
# ---------- bottle webapp functions tests ----------
@@ -0,0 +1 @@
+{"r": {"fixed_versions": [], "blockedby": "", "done": false, "unarchived": false, "owner": "", "subject": "nmap: hangs if sigint during startup", "archived": false, "forwarded": "", "bug_num": 411369, "msgid": "<20070218135218.GA23313@libra>", "source": "nmap", "location": "db-h", "pending": "pending", "found_date": [], "originator": "Justin Pryzby <pryzbyj@justinpryzby.com>", "blocks": "", "tags": [], "date": 1171806841, "mergedwith": "", "severity": "normal", "package": "nmap", "summary": "", "log_modified": 1171806845, "fixed_date": [], "found_versions": ["nmap/4.11-1"], "affects": "", "found": null, "fixed": null}}
@@ -1,40 +1,37 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude">
- <xi:include href="master.html" />
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
<title>Debian Bug Tracker</title>
</head>
<body>
- ${sidebar_top()}
<div id="getting_started">
<h2>Bug search</h2>
- ${info_to_user}
+ {{}}
<div class="bug">
<div class="bug_information">
<span class="bug_number">
- <a href="javascript:toggle_star('${bug_number}')" class="favorite_icon">
- <img
- py:attrs="{'src': '../images/star_on.png'} if bug_is_fav else {'src': '../images/star_off.png'}"
- id="${bug_number}_star" />
+ <a href="javascript:toggle_star('{{bug_number}}')" class="favorite_icon">
+ <img
+ py:attrs="{'src': '../images/star_on.png'} if bug_is_fav else {'src': '../images/star_off.png'}"
+ id="{{bug_number}}_star" />
</a>
- <a href="/bug/${bug_number}">bug ${bug_number}</a>
+ <a href="/bug/{{bug_number}}">bug {{bug_number}}</a>
</span>
- <span class="bug_modified">Last modified <span class="modified">${bug_status.log_modified}</span> ago ${bug_status.log_modified}</span>
+ <span class="bug_modified">Last modified <span class="modified">{{log_modified}}</span> ago {{log_modified}}</span>
</div>
- <div class="bug_title">${bug_status.subject}<span class="bug_severity">${bug_status.severity}</span></div>
+ <div class="bug_title">{{subject}}<span class="bug_severity">{{severity}}</span></div>
<div class="bug_extra_information">
- (Package: <a href="/package/${bug_status.package}">${bug_status.package}</a>)<br/>
+ (Package: <a href="/package/{{package}}">{{package}}</a>)<br/>
xx
</div>
<div id="subscribe">
xx
- <a href="#http://bugs.debian.org/cgi-bin/bugspam.cgi?bug=${bug_number}" class="action" id="report_spam">
+ <a href="#http://bugs.debian.org/cgi-bin/bugspam.cgi?bug={{bug_number}}" class="action" id="report_spam">
<img id="spam_img" src="../images/mail-mark-junk.png" /> <span id="spam_text">This report contains spam</span>
</a>
<script type="text/javascript" language="javascript" charset="utf-8">
@@ -43,36 +40,39 @@
});
</script>
- <a href="javascript:toggle_subscribe(${bug_number})" class="action">
- <img id="subscribe_img"
+ <a href="javascript:toggle_subscribe({{bug_number})" class="action">
+ <img id="subscribe_img"
py:attrs="{'src': '../images/list-remove.png'} if user_subscribed else {'src': '../images/list-add.png'}" />
<span id="subscribe_text" >
- ${'Unsubscribe from this report'} if user_subscribed else {'Subscribe to this report'}
+ {{'Unsubscribe from this report'} if user_subscribed else {'Subscribe to this report'}
</span>
</a>
xx Log in to be able to subscribe to reports.
xx </div>
<div class="bug_log_item bug_log_item_reporter" py:for="message in bug_messages">
<div class="bug_log_header">
- <span class="bug_log_from">By <a href="mailto:{{ message.from.1 }}">{ message.from}</a></span>
- <span class="bug_log_date">${message.date}</span>
+ <span class="bug_log_from">
+ By <a href="mailto:
+ ">
+ {{ message}}</a></span>
+ <span class="bug_log_date">{message.date}</span>
</div>
<div class="bug_log_header">
- <span class="bug_log_subject">${message.subject}</span>
+ <span class="bug_log_subject">{message.subject}</span>
</div>
<div class="bug_log_body">
- <pre>${message.body}</pre>
+ <pre>{message.body}</pre>
</div>
</div>
<br/>
</div>
-
-
-
-
-
-
+
+
+
+
+
+
</div>
<div class="clearingdiv" />
</body>
@@ -19,9 +19,9 @@
<script>
$("table.bugs tr").click(function() {
bug_num = $(this).attr('id');
- if (bug_num) {
- window.location.replace("/bug/" +bug_num);
- }
+
+ $("form#bugsearch").slideUp();
+ $("table.bugs").load('/bug/' + bug_num);
});
</script>
</html>
@@ -19,7 +19,7 @@
<div id="getting_started">
<h2>Bug search</h2>
- <form method="get" action="">
+ <form id="bugsearch" method="get" action="">
<table class="forms" summary="">
<tr>
<td><h3>Package name</h3></td>

0 comments on commit 17b591d

Please sign in to comment.