take tables out of global scope at import time

This commit is contained in:
David Raznick 2011-05-31 18:02:07 +01:00
parent 2b98080266
commit 264b606c48
1 changed files with 113 additions and 97 deletions

View File

@ -19,9 +19,18 @@ __all__ = [
] ]
harvest_source_table = None
harvest_job_table = None
harvest_object_table = None
harvest_gather_error_table = None
harvest_object_error_table = None
def setup(): def setup():
if harvest_source_table is None:
create_harvester_tables()
metadata.create_all() metadata.create_all()
class HarvestError(Exception): class HarvestError(Exception):
pass pass
@ -92,6 +101,13 @@ class HarvestObjectError(HarvestDomainObject):
''' '''
pass pass
def create_harvester_tables():
global harvest_source_table
global harvest_job_table
global harvest_object_table
global harvest_gather_error_table
global harvest_object_error_table
harvest_source_table = Table('harvest_source', metadata, harvest_source_table = Table('harvest_source', metadata,
Column('id', types.UnicodeText, primary_key=True, default=make_uuid), Column('id', types.UnicodeText, primary_key=True, default=make_uuid),