mirror of
https://github.com/lucaspalomodevelop/indico-plugins.git
synced 2026-03-13 07:29:39 +00:00
Add create_backend helper method to agent model
This commit is contained in:
parent
a18593ec84
commit
c2984bdd7d
@ -83,7 +83,7 @@ def initial_export(agent_id, force=False):
|
||||
transaction.abort()
|
||||
|
||||
with DBMgr.getInstance().global_connection():
|
||||
agent.backend(agent).run_initial_export(_iter_events())
|
||||
agent.create_backend().run_initial_export(_iter_events())
|
||||
|
||||
agent.initial_data_exported = True
|
||||
db.session.commit()
|
||||
@ -128,6 +128,6 @@ def run(agent_id=None):
|
||||
print cformat('Running agent: %{white!}{}%{reset}').format(agent.name)
|
||||
with DBMgr.getInstance().global_connection():
|
||||
try:
|
||||
agent.backend(agent).run()
|
||||
agent.create_backend().run()
|
||||
finally:
|
||||
transaction.abort()
|
||||
|
||||
@ -64,6 +64,10 @@ class LiveSyncAgent(db.Model):
|
||||
from indico_livesync.plugin import LiveSyncPlugin
|
||||
return LiveSyncPlugin.instance.agent_classes.get(self.backend_name)
|
||||
|
||||
def create_backend(self):
|
||||
"""Creates a new backend instance"""
|
||||
return self.backend(self)
|
||||
|
||||
@return_ascii
|
||||
def __repr__(self):
|
||||
return '<LiveSyncAgent({}, {}, {})>'.format(self.id, self.backend_name, self.name)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user