scripts para aƱadir y borrar usuarios
authordanigm <dani@danigm.net>
Sat, 7 Nov 2009 18:24:45 +0000 (19:24 +0100)
committerdanigm <dani@danigm.net>
Sat, 7 Nov 2009 18:24:45 +0000 (19:24 +0100)
adduser.py [new file with mode: 0755]
deluser.py [new file with mode: 0755]

diff --git a/adduser.py b/adduser.py
new file mode 100755 (executable)
index 0000000..4592ac1
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/bin/python
+
+import db
+User = db.User
+import getpass
+
+
+orm = db.connect()
+
+name = raw_input("username: ")
+pwd = getpass.getpass("password: ")
+u = User(name, pwd)
+orm.add(u)
+
+orm.commit()
diff --git a/deluser.py b/deluser.py
new file mode 100755 (executable)
index 0000000..8a5bb43
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/python
+
+import db
+User = db.User
+import getpass
+
+
+orm = db.connect()
+
+name = raw_input("username: ")
+user = orm.query(User).filter(name == name).one()
+orm.delete(user)
+
+orm.commit()