|
@@ -0,0 +1,37 @@
|
|
|
+#!/usr/bin/env python3
|
|
|
+
|
|
|
+import sys
|
|
|
+
|
|
|
+from flask import Flask
|
|
|
+from flask.ext.sqlalchemy import SQLAlchemy
|
|
|
+
|
|
|
+from peerfinder import Participant
|
|
|
+
|
|
|
+
|
|
|
+app = Flask(__name__)
|
|
|
+app.config.from_pyfile('config.py')
|
|
|
+db = SQLAlchemy(app)
|
|
|
+
|
|
|
+
|
|
|
+def show_participants():
|
|
|
+ for p in Participant.query.all():
|
|
|
+ print("[{}] {} ({}) is {} "
|
|
|
+ "and has UUID {}".format(p.id,
|
|
|
+ p.name,
|
|
|
+ p.contact,
|
|
|
+ "active" if p.active else "inactive",
|
|
|
+ p.uuid))
|
|
|
+
|
|
|
+def activate_participant(id):
|
|
|
+ p = Participant.query.get(id)
|
|
|
+ p.active = True
|
|
|
+ db.session.merge(p)
|
|
|
+ db.session.commit()
|
|
|
+ print("Activated participant {}".format(p))
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ if len(sys.argv) > 1:
|
|
|
+ activate_participant(int(sys.argv[1]))
|
|
|
+ else:
|
|
|
+ show_participants()
|