From python-checkins at python.org Mon Feb 14 05:00:09 2011 From: python-checkins at python.org (richard) Date: Mon, 14 Feb 2011 05:00:09 +0100 (CET) Subject: [Pypi-checkins] r883 - trunk/pypi Message-ID: <20110214040009.6D70DEE98B@mail.python.org> Author: richard Date: Mon Feb 14 05:00:09 2011 New Revision: 883 Modified: trunk/pypi/admin.py Log: add function to remove nested lists examples Modified: trunk/pypi/admin.py ============================================================================== --- trunk/pypi/admin.py (original) +++ trunk/pypi/admin.py Mon Feb 14 05:00:09 2011 @@ -1,5 +1,6 @@ import sys, os, urllib, StringIO, traceback, cgi, binascii, getopt, shutil +import zipfile, gzip, tarfile #sys.path.append('/usr/local/pypi/lib') import store, config @@ -125,6 +126,33 @@ c.execute('update comments_journal set submitted_by=%s where submitted_by=%s', (new, old)) c.execute('delete from users where name=%s', (old,)) +def nuke_nested_lists(store): + c = store.get_cursor() + c.execute("""select name, version, summary from releases + where summary like '%nested lists%'""") + hits = {} + for name, version, summary in c.fetchall(): + for f in store.list_files(name, version): + path = store.gen_file_path(f['python_version'], name, f['filename']) + if path.endswith('.zip'): + z = zipfile.ZipFile(path) + for i in z.infolist(): + if not i.filename.endswith('.py'): continue + if 'def print_lol' in z.read(i.filename): + hits[name] = summary + elif path.endswith('.tar.gz'): + z = gzip.GzipFile(path) + t = tarfile.TarFile(fileobj=z) + for i in t.getmembers(): + if not i.name.endswith('.py'): continue + f = t.extractfile(i.name) + if 'def print_lol' in f.read(): + hits[name] = summary + for name in hits: + store.remove_package(name) + print '%s: %s' % (name, hits[name]) + print 'removed %d packages' % len(hits) + if __name__ == '__main__': config = config.Config('/data/pypi/config.ini') st = store.Store(config) @@ -155,6 +183,8 @@ send_comments(*args) elif command == 'mergeuser': merge_user(*args) + elif command == 'nuke_nested_lists': + nuke_nested_lists(*args) else: print "unknown command '%s'!"%command st.changed() From python-checkins at python.org Sun Feb 20 23:33:49 2011 From: python-checkins at python.org (martin.von.loewis) Date: Sun, 20 Feb 2011 23:33:49 +0100 (CET) Subject: [Pypi-checkins] r884 - in trunk/pypi: . tools Message-ID: <20110220223349.6AE5DEE989@mail.python.org> Author: martin.von.loewis Date: Sun Feb 20 23:33:49 2011 New Revision: 884 Added: trunk/pypi/tools/sql-migrate-20110220.sql (contents, props changed) Modified: trunk/pypi/pkgbase_schema.sql Log: Cascade renamed into comments_journal. Modified: trunk/pypi/pkgbase_schema.sql ============================================================================== --- trunk/pypi/pkgbase_schema.sql (original) +++ trunk/pypi/pkgbase_schema.sql Sun Feb 20 23:33:49 2011 @@ -274,7 +274,7 @@ submitted_by TEXT REFERENCES users ON DELETE CASCADE, date TIMESTAMP, action TEXT, - FOREIGN KEY (name, version) REFERENCES releases (name, version) ON DELETE CASCADE + FOREIGN KEY (name, version) REFERENCES releases ON UPDATE CASCADE ON DELETE CASCADE ); commit; Added: trunk/pypi/tools/sql-migrate-20110220.sql ============================================================================== --- (empty file) +++ trunk/pypi/tools/sql-migrate-20110220.sql Sun Feb 20 23:33:49 2011 @@ -0,0 +1,6 @@ +begin; +alter table comments_journal drop constraint comments_journal_name_fkey; +alter table comments_journal + add foreign key (name, version) references releases + on update cascade on delete cascade; +end; From python-checkins at python.org Mon Feb 21 22:34:41 2011 From: python-checkins at python.org (martin.von.loewis) Date: Mon, 21 Feb 2011 22:34:41 +0100 (CET) Subject: [Pypi-checkins] r885 - trunk/pypi Message-ID: <20110221213441.C0B7CEE986@mail.python.org> Author: martin.von.loewis Date: Mon Feb 21 22:34:41 2011 New Revision: 885 Modified: trunk/pypi/webui.py Log: Complain if there are multiple :action parameters. Modified: trunk/pypi/webui.py ============================================================================== --- trunk/pypi/webui.py (original) +++ trunk/pypi/webui.py Mon Feb 21 22:34:41 2011 @@ -525,6 +525,8 @@ path = self.env.get('PATH_INFO', '') if self.form.has_key(':action'): action = self.form[':action'] + if isinstance(action, list): + raise RuntimeError("Multiple actions: %r" % action) elif path: # Split into path items, drop leading slash try: From python-checkins at python.org Mon Feb 21 22:37:35 2011 From: python-checkins at python.org (martin.von.loewis) Date: Mon, 21 Feb 2011 22:37:35 +0100 (CET) Subject: [Pypi-checkins] r886 - trunk/pypi/templates Message-ID: <20110221213735.63107EE986@mail.python.org> Author: martin.von.loewis Date: Mon Feb 21 22:37:35 2011 New Revision: 886 Modified: trunk/pypi/templates/password_reset.pt Log: Restore password reset support by dropping bogus action. Modified: trunk/pypi/templates/password_reset.pt ============================================================================== --- trunk/pypi/templates/password_reset.pt (original) +++ trunk/pypi/templates/password_reset.pt Mon Feb 21 22:37:35 2011 @@ -10,7 +10,7 @@

You must supply a username or password!

-
+ @@ -25,7 +25,7 @@

Or, if you know your username, then enter it below.

- +
From python-checkins at python.org Mon Feb 21 22:42:32 2011 From: python-checkins at python.org (martin.von.loewis) Date: Mon, 21 Feb 2011 22:42:32 +0100 (CET) Subject: [Pypi-checkins] r887 - trunk/pypi/templates Message-ID: <20110221214232.9772CEE98C@mail.python.org> Author: martin.von.loewis Date: Mon Feb 21 22:42:32 2011 New Revision: 887 Modified: trunk/pypi/templates/role_form.pt Log: Drop extraneous :action on role_form. Modified: trunk/pypi/templates/role_form.pt ============================================================================== --- trunk/pypi/templates/role_form.pt (original) +++ trunk/pypi/templates/role_form.pt Mon Feb 21 22:42:32 2011 @@ -19,7 +19,7 @@

- +
From python-checkins at python.org Mon Feb 21 23:17:55 2011 From: python-checkins at python.org (martin.von.loewis) Date: Mon, 21 Feb 2011 23:17:55 +0100 (CET) Subject: [Pypi-checkins] r888 - trunk/pypi Message-ID: <20110221221755.B222DEE9D6@mail.python.org> Author: martin.von.loewis Date: Mon Feb 21 23:17:55 2011 New Revision: 888 Modified: trunk/pypi/webui.py Log: Prevent crashes when OAuth is sent. Modified: trunk/pypi/webui.py ============================================================================== --- trunk/pypi/webui.py (original) +++ trunk/pypi/webui.py Mon Feb 21 23:17:55 2011 @@ -468,7 +468,7 @@ # see if the user has provided a username/password auth = self.env.get('HTTP_CGI_AUTHORIZATION', '').strip() if auth: - authtype, auth = auth.split() + authtype, auth = auth.split(None, 1) # OAuth has many more parameters if authtype.lower() == 'basic': try: un, pw = base64.decodestring(auth).split(':') From python-checkins at python.org Wed Feb 23 16:22:44 2011 From: python-checkins at python.org (martin.von.loewis) Date: Wed, 23 Feb 2011 16:22:44 +0100 (CET) Subject: [Pypi-checkins] r889 - trunk/pypi/templates Message-ID: <20110223152244.B254AEEA1A@mail.python.org> Author: martin.von.loewis Date: Wed Feb 23 16:22:44 2011 New Revision: 889 Modified: trunk/pypi/templates/standard_template.pt Log: Issue #3189400: Add id attribute to Python 3 logo. Modified: trunk/pypi/templates/standard_template.pt ============================================================================== --- trunk/pypi/templates/standard_template.pt (original) +++ trunk/pypi/templates/standard_template.pt Wed Feb 23 16:22:44 2011 @@ -30,7 +30,7 @@

- + From python-checkins at python.org Wed Feb 23 16:37:51 2011 From: python-checkins at python.org (martin.von.loewis) Date: Wed, 23 Feb 2011 16:37:51 +0100 (CET) Subject: [Pypi-checkins] r890 - trunk/pypi Message-ID: <20110223153751.452C6EE9FF@mail.python.org> Author: martin.von.loewis Date: Wed Feb 23 16:37:50 2011 New Revision: 890 Modified: trunk/pypi/webui.py Log: Issue #3175857: Catch and report form decode errors. Modified: trunk/pypi/webui.py ============================================================================== --- trunk/pypi/webui.py (original) +++ trunk/pypi/webui.py Wed Feb 23 16:37:50 2011 @@ -258,11 +258,15 @@ self.authenticated = False # was a password or a valid cookie passed? self.loggedin = False # was a valid cookie sent? self.usercookie = None + self.failed = None # error message if initialization already produced a failure # XMLRPC request or not? if self.env.get('CONTENT_TYPE') != 'text/xml': fs = cgi.FieldStorage(fp=handler.rfile, environ=env) - self.form = decode_form(fs) + try: + self.form = decode_form(fs) + except UnicodeDecodeError: + self.failed = "Form data is not correctly encoded in UTF-8" else: self.form = None @@ -296,6 +300,10 @@ ''' Run the request, handling all uncaught errors and finishing off cleanly. ''' + if self.failed: + # failed during initialization + self.fail(self.failed) + return self.store = store.Store(self.config) try: try: From python-checkins at python.org Wed Feb 23 19:56:18 2011 From: python-checkins at python.org (martin.von.loewis) Date: Wed, 23 Feb 2011 19:56:18 +0100 (CET) Subject: [Pypi-checkins] r891 - trunk/pypi/templates Message-ID: <20110223185618.F157BEA28@mail.python.org> Author: martin.von.loewis Date: Wed Feb 23 19:56:18 2011 New Revision: 891 Modified: trunk/pypi/templates/register.pt Log: Add explicit form action to clear out :action parameter. Modified: trunk/pypi/templates/register.pt ============================================================================== --- trunk/pypi/templates/register.pt (original) +++ trunk/pypi/templates/register.pt Wed Feb 23 19:56:18 2011 @@ -64,13 +64,13 @@ - + From python-checkins at python.org Wed Feb 23 19:58:30 2011 From: python-checkins at python.org (martin.von.loewis) Date: Wed, 23 Feb 2011 19:58:30 +0100 (CET) Subject: [Pypi-checkins] r892 - trunk/pypi/templates Message-ID: <20110223185830.EB3D8EE9E9@mail.python.org> Author: martin.von.loewis Date: Wed Feb 23 19:58:30 2011 New Revision: 892 Modified: trunk/pypi/templates/register.pt Log: Repeat last change for dropid. Modified: trunk/pypi/templates/register.pt ============================================================================== --- trunk/pypi/templates/register.pt (original) +++ trunk/pypi/templates/register.pt Wed Feb 23 19:58:30 2011 @@ -81,7 +81,7 @@

Your OpenIDs:

  • - +

User Name: