summaryrefslogtreecommitdiff
path: root/admin.py
diff options
context:
space:
mode:
authorrichard <devnull@localhost>2003-02-20 05:11:18 +0000
committerrichard <devnull@localhost>2003-02-20 05:11:18 +0000
commit568267bb0a080932ff8fe41d1c7203cafe5c06af (patch)
treec6b9893afac524dd2208dcc7f4d6f7f4283ba599 /admin.py
parent5431bab9fddbf385b96395a682d3bbc75f224346 (diff)
downloaddecorator-568267bb0a080932ff8fe41d1c7203cafe5c06af.tar.gz
ugh
Diffstat (limited to 'admin.py')
-rw-r--r--admin.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/admin.py b/admin.py
index 4dbe1ca..5319a58 100644
--- a/admin.py
+++ b/admin.py
@@ -1,5 +1,6 @@
import sys, os, urllib, StringIO, traceback, cgi, binascii, getopt
+sys.path.append('/usr/local/pypi/lib')
import store, config
@@ -12,12 +13,30 @@ def set_password(store, name, pw):
store.store_user(user['name'], pw.strip(), user['email'])
print 'done'
+
+def remove_package(store, name):
+ ''' Remove a package from the database
+ '''
+ cursor = store.cursor
+ cursor.execute('delete from packages where name=%s', name)
+ cursor.execute('delete from releases where name=%s', name)
+ cursor.execute('delete from journals where name=%s', name)
+ cursor.execute('delete from roles where package_name=%s', name)
+ print 'done'
+
if __name__ == '__main__':
config = config.Config('/usr/local/pypi/config.ini', 'webui')
store = store.Store(config)
store.open()
+ command = sys.argv[1]
+ args = (store, ) + tuple(sys.argv[2:])
try:
- set_password(store, sys.argv[1], sys.argv[2])
+ if command == 'password':
+ set_password(*args)
+ elif command == 'rmpackage':
+ remove_package(*args)
+ else:
+ print "unknown command '%s'!"%command
store.commit()
finally:
store.close()