Models: Unify 'now' import and comment across galaxy and toolshed.

This commit is contained in:
John Chilton
2013-12-05 00:20:54 -06:00
parent 9faa65a66e
commit 77a9bb5db2
3 changed files with 15 additions and 21 deletions
+1 -10
View File
@@ -3,7 +3,6 @@ Details of how the data model objects are mapped onto the relational database
are encapsulated here.
"""
import datetime
import logging
import pkg_resources
@@ -16,6 +15,7 @@ from sqlalchemy.orm.collections import attribute_mapped_collection
from galaxy import model
from galaxy.model.orm.engine_factory import build_engine
from galaxy.model.orm.now import now
from galaxy.model.custom_types import JSONType, MetadataType, TrimmedString, UUIDType
from galaxy.model.base import ModelMapping
from galaxy.security import GalaxyRBACAgent
@@ -24,15 +24,6 @@ log = logging.getLogger( __name__ )
metadata = MetaData()
# NOTE REGARDING TIMESTAMPS:
# It is currently difficult to have the timestamps calculated by the
# database in a portable way, so we're doing it in the client. This
# also saves us from needing to postfetch on postgres. HOWEVER: it
# relies on the client's clock being set correctly, so if clustering
# web servers, use a time server to ensure synchronization
# Return the current time in UTC without any timezone information
now = datetime.datetime.utcnow
model.User.table = Table( "galaxy_user", metadata,
Column( "id", Integer, primary_key=True),
+13
View File
@@ -0,0 +1,13 @@
from datetime import datetime
# NOTE REGARDING TIMESTAMPS:
# It is currently difficult to have the timestamps calculated by the
# database in a portable way, so we're doing it in the client. This
# also saves us from needing to postfetch on postgres. HOWEVER: it
# relies on the client's clock being set correctly, so if clustering
# web servers, use a time server to ensure synchronization
# Return the current time in UTC without any timezone information
now = datetime.utcnow
__all__ = [now]
+1 -11
View File
@@ -5,13 +5,12 @@ are encapsulated here.
import logging
log = logging.getLogger( __name__ )
import datetime
from galaxy.webapps.tool_shed.model import *
import galaxy.webapps.tool_shed.model
from galaxy.model.orm import *
from galaxy.model.custom_types import *
from galaxy.model.orm.engine_factory import build_engine
from galaxy.model.orm.now import now
from galaxy.model.base import ModelMapping
import galaxy.webapps.tool_shed.util.shed_statistics as shed_statistics
import galaxy.webapps.tool_shed.util.hgweb_config
@@ -19,15 +18,6 @@ from galaxy.webapps.tool_shed.security import CommunityRBACAgent
metadata = MetaData()
# NOTE REGARDING TIMESTAMPS:
# It is currently difficult to have the timestamps calculated by the
# database in a portable way, so we're doing it in the client. This
# also saves us from needing to postfetch on postgres. HOWEVER: it
# relies on the client's clock being set correctly, so if clustering
# web servers, use a time server to ensure synchronization
# Return the current time in UTC without any timezone information
now = datetime.datetime.utcnow
APIKeys.table = Table( "api_keys", metadata,
Column( "id", Integer, primary_key=True ),