summaryrefslogtreecommitdiff
path: root/export.py
diff options
context:
space:
mode:
Diffstat (limited to 'export.py')
-rwxr-xr-xexport.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/export.py b/export.py
index 97ad669..8ddff42 100755
--- a/export.py
+++ b/export.py
@@ -11,7 +11,7 @@ import sys
11dryrun=False 11dryrun=False
12 12
13parser = ArgumentParser(description="C3 rating helper") 13parser = ArgumentParser(description="C3 rating helper")
14parser.add_argument("-d", action="store_true", dest="dryrun", default=False, help="Don't actually execute anything on frab or rt, just show what would have been done") 14parser.add_argument("-d", action="store_true", dest="dryrun", default=False, help="Don't actually execute anything on pretalx or rt, just show what would have been done")
15args = parser.parse_args() 15args = parser.parse_args()
16 16
17if args.dryrun: 17if args.dryrun:
@@ -21,7 +21,7 @@ with open(args.config, mode="r", encoding="utf-8") as json_file:
21 cfg = json.load(json_file) 21 cfg = json.load(json_file)
22 22
23app = Flask(__name__) 23app = Flask(__name__)
24app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + cfg['frab-conference'] + '-' + cfg['track'] + '.db' 24app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + cfg['pretalx-conference'] + '-' + cfg['track'] + '.db'
25app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False 25app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
26app.config['SECRET_KEY'] = 'Silence is golden. Gerd Eist.' 26app.config['SECRET_KEY'] = 'Silence is golden. Gerd Eist.'
27app.jinja_env.trim_blocks = True 27app.jinja_env.trim_blocks = True
@@ -30,13 +30,12 @@ app.jinja_env.lstrip_blocks = True
30db = SQLAlchemy(app) 30db = SQLAlchemy(app)
31 31
32config['rt-rest-url'] = cfg['rt-url'] + 'REST/1.0/' 32config['rt-rest-url'] = cfg['rt-url'] + 'REST/1.0/'
33config['frab-conf-url'] = config['frab-url'] + config['frab-conference'] 33config['pretalx-conf-url'] = config['pretalx-url'] + config['pretalx-conference']
34 34
35class Event(db.Model): 35class Event(db.Model):
36 """An event as dumped from frab""" 36 """An event as dumped from pretalx"""
37 frab_id = db.Column(db.Integer, primary_key=True) 37 pretalx_id = db.Column(db.String(16), primary_key=True)
38 title = db.Column(db.String(1024)) 38 title = db.Column(db.String(1024))
39 subtitle = db.Column(db.String(1024))
40 abstract = db.Column(db.Text()) 39 abstract = db.Column(db.Text())
41 description = db.Column(db.Text()) 40 description = db.Column(db.Text())
42 state = db.Column(db.String(64)) 41 state = db.Column(db.String(64))
@@ -49,13 +48,13 @@ class EventRating(db.Model):
49 """A rating as given by a logged in user""" 48 """A rating as given by a logged in user"""
50 id = db.Column(db.Integer, primary_key=True) 49 id = db.Column(db.Integer, primary_key=True)
51 submitter = db.Column(db.String(1024)) 50 submitter = db.Column(db.String(1024))
52 event_id = db.Column(db.Integer, db.ForeignKey('event.frab_id')) 51 event_id = db.Column(db.Integer, db.ForeignKey('event.pretalx_id'))
53 event = db.relationship('Event', backref=db.backref('ratings', lazy='dynamic')) 52 event = db.relationship('Event', backref=db.backref('ratings', lazy='dynamic'))
54 comment = db.Column(db.Text()) 53 comment = db.Column(db.Text())
55 rating_dict = db.Column(db.String(1024), server_default="{}") 54 rating_dict = db.Column(db.String(1024), server_default="{}")
56 55
57def add_coordinator(sess, person, event): 56def add_coordinator(sess, person, event):
58 edit_person_page = sess.get(config['frab-conf-url'] + '/events/' + event + '/edit_people') 57 edit_person_page = sess.get(config['pretalx-conf-url'] + '/events/' + event + '/edit_people')
59 tree = etree.HTML(edit_person_page.text) 58 tree = etree.HTML(edit_person_page.text)
60 for option in tree.xpath('//option[@selected]'): 59 for option in tree.xpath('//option[@selected]'):
61 if option.text.lower() == 'coordinator': 60 if option.text.lower() == 'coordinator':