mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-05 23:38:25 -04:00
remove history-meta for templates, replace with hand-made history table
history-meta's dynamic magic is insufficient for templates, where we need to be able to refer to the specific history table to take advantage of sqlalchemy's relationship management (2/3rds of an ORM). So replace it with a custom made version table. Had to change the version decorator slightly for this
This commit is contained in:
@@ -171,17 +171,13 @@ class Versioned(object):
|
||||
return history_mapper.class_
|
||||
|
||||
|
||||
def versioned_objects(iter):
|
||||
for obj in iter:
|
||||
if hasattr(obj, '__history_mapper__'):
|
||||
yield obj
|
||||
def create_history(obj, history_cls=None):
|
||||
if not history_cls:
|
||||
history_mapper = obj.__history_mapper__
|
||||
history_cls = history_mapper.class_
|
||||
|
||||
|
||||
def create_history(obj):
|
||||
obj_mapper = object_mapper(obj)
|
||||
history_mapper = obj.__history_mapper__
|
||||
history_cls = history_mapper.class_
|
||||
history = history_cls()
|
||||
obj_mapper = object_mapper(obj)
|
||||
|
||||
obj_state = attributes.instance_state(obj)
|
||||
data = {}
|
||||
|
||||
Reference in New Issue
Block a user