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!
-