diff options
author | erdgeist <erdgeist@erdgeist.org> | 2024-10-12 21:29:51 +0200 |
---|---|---|
committer | erdgeist <erdgeist@erdgeist.org> | 2024-10-12 21:29:51 +0200 |
commit | 27db823c46c83b13b4cf36c865471633da74816e (patch) | |
tree | 0d1ded7ffef4905e7652440011b3216515856c19 /export.py | |
parent | cd9e07341c2eebba1ed6980acdd07acc6ab9c9f4 (diff) |
Use pretalx instead of frab
Diffstat (limited to 'export.py')
-rwxr-xr-x | export.py | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -11,7 +11,7 @@ import sys | |||
11 | dryrun=False | 11 | dryrun=False |
12 | 12 | ||
13 | parser = ArgumentParser(description="C3 rating helper") | 13 | parser = ArgumentParser(description="C3 rating helper") |
14 | parser.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") | 14 | parser.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") |
15 | args = parser.parse_args() | 15 | args = parser.parse_args() |
16 | 16 | ||
17 | if args.dryrun: | 17 | if 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 | ||
23 | app = Flask(__name__) | 23 | app = Flask(__name__) |
24 | app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + cfg['frab-conference'] + '-' + cfg['track'] + '.db' | 24 | app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + cfg['pretalx-conference'] + '-' + cfg['track'] + '.db' |
25 | app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False | 25 | app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False |
26 | app.config['SECRET_KEY'] = 'Silence is golden. Gerd Eist.' | 26 | app.config['SECRET_KEY'] = 'Silence is golden. Gerd Eist.' |
27 | app.jinja_env.trim_blocks = True | 27 | app.jinja_env.trim_blocks = True |
@@ -30,13 +30,12 @@ app.jinja_env.lstrip_blocks = True | |||
30 | db = SQLAlchemy(app) | 30 | db = SQLAlchemy(app) |
31 | 31 | ||
32 | config['rt-rest-url'] = cfg['rt-url'] + 'REST/1.0/' | 32 | config['rt-rest-url'] = cfg['rt-url'] + 'REST/1.0/' |
33 | config['frab-conf-url'] = config['frab-url'] + config['frab-conference'] | 33 | config['pretalx-conf-url'] = config['pretalx-url'] + config['pretalx-conference'] |
34 | 34 | ||
35 | class Event(db.Model): | 35 | class 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 | ||
57 | def add_coordinator(sess, person, event): | 56 | def 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': |