[Pypi-checkins] r956 - in trunk/pypi: . templates tools
richard
python-checkins at python.org
Tue Aug 23 08:03:30 CEST 2011
Author: richard
Date: Tue Aug 23 08:03:30 2011
New Revision: 956
Added:
trunk/pypi/tools/sql-migrate-20110823.sql
Modified:
trunk/pypi/pkgbase_schema.sql
trunk/pypi/store.py
trunk/pypi/templates/display.pt
trunk/pypi/webui.py
Log:
add ability for packages to list a bug tracker stored against the package (not release); thanks Kaleb Ufton
Modified: trunk/pypi/pkgbase_schema.sql
==============================================================================
--- trunk/pypi/pkgbase_schema.sql (original)
+++ trunk/pypi/pkgbase_schema.sql Tue Aug 23 08:03:30 2011
@@ -85,6 +85,7 @@
name TEXT PRIMARY KEY,
stable_version TEXT,
normalized_name TEXT,
+ bugtrack_url TEXT,
autohide BOOLEAN DEFAULT TRUE,
comments BOOLEAN DEFAULT TRUE
);
Modified: trunk/pypi/store.py
==============================================================================
--- trunk/pypi/store.py (original)
+++ trunk/pypi/store.py Tue Aug 23 08:03:30 2011
@@ -250,8 +250,18 @@
# see if we're inserting or updating a package
if not self.has_package(name):
# insert the new package entry
- sql = 'insert into packages (name, normalized_name) values (%s, %s)'
- safe_execute(cursor, sql, (name, normalize_package_name(name)))
+ cols = 'name, normalized_name'
+ vals = '%s, %s'
+ args = (name, normalize_package_name(name))
+
+ # if a bugtracker url is provided then insert it too
+ if 'bugtrack_url' in info:
+ cols += ', bugtrack_url'
+ vals += ', %s'
+ args += (info['bugtrack_url'], )
+
+ sql = 'insert into packages (%s) values (%s)' % (cols, vals)
+ safe_execute(cursor, sql, args)
# journal entry
safe_execute(cursor, '''insert into journals (name, version, action,
@@ -285,7 +295,7 @@
# handle the special vars that most likely won't have been
# submitted
- for k in ('_pypi_ordering', '_pypi_hidden'):
+ for k in ('_pypi_ordering', '_pypi_hidden', 'bugtrack_url'):
if not info.has_key(k):
info[k] = existing[k]
@@ -307,6 +317,14 @@
vals.append(info[k])
vals.extend([name, version])
+ # pull out the bugtrack_url and put it in the packages table
+ # instead
+ if 'bugtrack_url' in cols:
+ sql = 'update packages set bugtrack_url=%s where name=%s'
+ safe_execute(cursor, sql, (info['bugtrack_url'], name))
+ del vals[cols.index('bugtrack_url')]
+ cols.remove('bugtrack_url')
+
# get old classifiers list
old_cifiers = self.get_release_classifiers(name, version)
old_cifiers.sort()
@@ -507,9 +525,9 @@
_Package = FastResultRow('''name stable_version version author author_email
maintainer maintainer_email home_page license summary description
- description_html keywords platform requires_python download_url
- _pypi_ordering! _pypi_hidden! cheesecake_installability_id!
- cheesecake_documentation_id! cheesecake_code_kwalitee_id!''')
+ description_html keywords platform requires_python download_url
+ _pypi_ordering! _pypi_hidden! cheesecake_installability_id!
+ cheesecake_documentation_id! cheesecake_code_kwalitee_id! bugtrack_url!''')
def get_package(self, name, version):
''' Retrieve info about the package from the database.
@@ -520,10 +538,10 @@
author_email, maintainer, maintainer_email, home_page,
license, summary, description, description_html, keywords,
platform, requires_python, download_url, _pypi_ordering,
- _pypi_hidden,
+ _pypi_hidden,
cheesecake_installability_id,
cheesecake_documentation_id,
- cheesecake_code_kwalitee_id
+ cheesecake_code_kwalitee_id, bugtrack_url
from packages, releases
where packages.name=%s and version=%s
and packages.name = releases.name'''
Modified: trunk/pypi/templates/display.pt
==============================================================================
--- trunk/pypi/templates/display.pt (original)
+++ trunk/pypi/templates/display.pt Tue Aug 23 08:03:30 2011
@@ -117,6 +117,14 @@
tal:content="data/release/home_page" />
</li>
+
+ <li tal:condition="data/bugtrack_url | nothing">
+ <strong>Bug Tracker:</strong>
+ <a tal:attributes="href python:data['bugtrack_url']"
+ tal:content="structure
+ python:data['bugtrack_url'].replace('\n', ', ')"/>
+ </li>
+
<li tal:condition="data/release/download_url | nothing">
<strong>Download URL:</strong>
<!-- <th>Download URL -->
Added: trunk/pypi/tools/sql-migrate-20110823.sql
==============================================================================
--- (empty file)
+++ trunk/pypi/tools/sql-migrate-20110823.sql Tue Aug 23 08:03:30 2011
@@ -0,0 +1 @@
+alter table packages add bugtrack_url text;
Modified: trunk/pypi/webui.py
==============================================================================
--- trunk/pypi/webui.py (original)
+++ trunk/pypi/webui.py Tue Aug 23 08:03:30 2011
@@ -1301,9 +1301,10 @@
columns = ('name version author author_email maintainer '
'maintainer_email home_page requires_python download_url '
'summary license description description_html keywords '
- 'platform').split()
+ 'platform bugtrack_url').split()
release = {'description_html': ''}
+ bugtrack_url =''
for column in columns:
value = info[column]
if not info[column]: continue
@@ -1326,6 +1327,9 @@
elif column.startswith('cheesecake_'):
column = column[:-3]
value = self.store.get_cheesecake_index(int(value))
+ elif column == 'bugtrack_url':
+ bugtrack_url = value
+ value = info[column]
release[column] = value
roles = {}
@@ -1392,6 +1396,7 @@
obsoletes_dist=obsoletes_dist,
requires_external=requires_external,
project_url=project_url,
+ bugtrack_url = bugtrack_url,
requires_python=release.get('requires_python', ''))
def index(self, nav_current='index', releases=None):
@@ -1536,7 +1541,7 @@
w = content.write
# display all the properties
- for property in 'name version author author_email maintainer maintainer_email home_page license summary description keywords platform download_url _pypi_hidden'.split():
+ for property in 'name version author author_email maintainer maintainer_email home_page license summary description keywords platform download_url _pypi_hidden bugtrack_url'.split():
# get the existing entry
if self.form.has_key(property):
value = self.form[property]
More information about the Pypi-checkins
mailing list