| |
@@ -11,11 +11,15 @@
|
| |
template = templating.environment.get_template('templates/bugzilla.html')
|
| |
position = 'right'
|
| |
|
| |
+
|
| |
@argument(name="username",
|
| |
default=None,
|
| |
validator=validators.username,
|
| |
help="A FAS username.")
|
| |
def data(session, widget, username):
|
| |
+ ''' Returns data for Bugzilla Widget. Queries pkgdb api for package
|
| |
+ list of the user and bugzilla for correspoding issues '''
|
| |
+
|
| |
pkgdb_url = "https://admin.fedoraproject.org/pkgdb/api/packager/package"
|
| |
url = "/".join([pkgdb_url, username])
|
| |
response = requests.get(url)
|
| |
@@ -23,48 +27,51 @@
|
| |
|
| |
issues = []
|
| |
|
| |
+ # get the packages of which the user is
|
| |
+ # point of contact
|
| |
for package in data["point of contact"]:
|
| |
if len(issues) == 3:
|
| |
break
|
| |
- else:
|
| |
- pkg_details=pkgwat.api.bugs(package['name'])
|
| |
- for row in pkg_details['rows']:
|
| |
- if len(issues) == 3:
|
| |
- break
|
| |
- else:
|
| |
- issues.append(
|
| |
- dict(
|
| |
- id=row['id'],
|
| |
- title=row['description'],
|
| |
- pkg_name=package['name'],
|
| |
- )
|
| |
- )
|
| |
+ pkg_details = pkgwat.api.bugs(package['name'])
|
| |
+ for row in pkg_details['rows']:
|
| |
+ if len(issues) == 3:
|
| |
+ break
|
| |
+ issues.append(
|
| |
+ dict(
|
| |
+ id=row['id'],
|
| |
+ title=row['description'],
|
| |
+ pkg_name=package['name'],
|
| |
+ )
|
| |
+ )
|
| |
|
| |
+ # get the packages of which the user is
|
| |
+ # co maintainer
|
| |
for package in data["co-maintained"]:
|
| |
if len(issues) == 3:
|
| |
break
|
| |
- else:
|
| |
- pkg_details=pkgwat.api.bugs(package['name'])
|
| |
- for row in pkg_details['rows']:
|
| |
- if len(issues) == 3:
|
| |
- break
|
| |
- else:
|
| |
- issues.append(
|
| |
- dict(
|
| |
- id=row['id'],
|
| |
- title=row['description'],
|
| |
- pkg_name=package['name'],
|
| |
- )
|
| |
- )
|
| |
+ pkg_details = pkgwat.api.bugs(package['name'])
|
| |
+ for row in pkg_details['rows']:
|
| |
+ if len(issues) == 3:
|
| |
+ break
|
| |
+ issues.append(
|
| |
+ dict(
|
| |
+ id=row['id'],
|
| |
+ title=row['description'],
|
| |
+ pkg_name=package['name'],
|
| |
+ )
|
| |
+ )
|
| |
|
| |
return dict(
|
| |
- username=username,
|
| |
- issues=issues,
|
| |
+ username=username,
|
| |
+ issues=issues,
|
| |
)
|
| |
|
| |
|
| |
@hint(categories=['bugzilla'])
|
| |
def should_invalidate(message, session, widget):
|
| |
+ ''' Validate if the bugzilla widget cache needs an update
|
| |
+ This is called by a backend daemon listening to fedmsg '''
|
| |
+
|
| |
# TODO -- wrap this pkgdb pull in another invalidatible cache.
|
| |
username = widget.config['username']
|
| |
pkgdb_url = "https://admin.fedoraproject.org/pkgdb/api/packager/package"
|
| |