[Pypi-checkins] r865 - trunk/pypi
martin.von.loewis
python-checkins at python.org
Wed Sep 15 16:23:50 CEST 2010
Author: martin.von.loewis
Date: Wed Sep 15 16:23:44 2010
New Revision: 865
Modified:
trunk/pypi/store.py
trunk/pypi/webui.py
Log:
Speedup simple index, by not decoding and encoding.
Modified: trunk/pypi/store.py
==============================================================================
--- trunk/pypi/store.py (original)
+++ trunk/pypi/store.py Wed Sep 15 16:23:44 2010
@@ -586,6 +586,13 @@
safe_execute(cursor, 'select name,stable_version from packages order by name')
return Result(None, cursor.fetchall(), self._Packages)
+ def get_packages_utf8(self):
+ '''Fetch the complete list of package names, UTF-8 encoded
+ '''
+ cursor = self.get_cursor()
+ cursor.execute('select name from packages order by name')
+ return [p[0] for p in cursor.fetchall()]
+
_Journal = FastResultRow('action submitted_date! submitted_by submitted_from')
def get_journal(self, name, version):
''' Retrieve info about the package from the database.
Modified: trunk/pypi/webui.py
==============================================================================
--- trunk/pypi/webui.py (original)
+++ trunk/pypi/webui.py Wed Sep 15 16:23:44 2010
@@ -610,12 +610,12 @@
html = []
html.append("<html><head><title>Simple Index</title></head>")
html.append("<body>\n")
- for name,stable_version in self.store.get_packages():
- qname = urllib.quote(name.encode("utf-8"))
+ for name in self.store.get_packages_utf8():
+ qname = urllib.quote(name)
ename = cgi.escape(name)
html.append("<a href='%s/'>%s</a><br/>\n" % (qname,ename))
html.append("</body></html>")
- html = ''.join(html).encode('utf-8')
+ html = ''.join(html)
self.handler.send_response(200, 'OK')
self.handler.set_content_type('text/html; charset=utf-8')
self.handler.end_headers()
More information about the Pypi-checkins
mailing list