Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Uses the latest onegov.core release to get rid of some code
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Krienbühl committed Jan 28, 2016
1 parent 01c6773 commit 2694d60
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 3 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
Unreleased
~~~~~~~~~~

- Uses the latest onegov.core release to get rid of some code.
[href]

0.8.3 (2015-11-26)
~~~~~~~~~~~~~~~~~~~

Expand Down
13 changes: 6 additions & 7 deletions onegov/form/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
FormSubmissionFile
)
from sedate import replace_timezone, utcnow
from sqlalchemy import inspect, func, not_, exc
from sqlalchemy import func, not_, exc
from uuid import uuid4


Expand Down Expand Up @@ -74,9 +74,7 @@ def add(self, title, definition,
""" Add the given form to the database. """

# look up the right class depending on the type
_mapper = inspect(FormDefinition).polymorphic_map.get(type)
form = (_mapper and _mapper.class_ or FormDefinition)()

form = FormDefinition.get_polymorphic_class(type, FormDefinition)()
form.name = name or normalize_for_url(title)
form.title = title
form.definition = definition
Expand Down Expand Up @@ -153,9 +151,10 @@ def add(self, name, form, state, id=None):
form.validate()

# look up the right class depending on the type
_mapper = inspect(FormSubmission).polymorphic_map.get(state)

submission = (_mapper and _mapper.class_ or FormSubmission)()
submission_class = FormSubmission.get_polymorphic_class(
state, FormSubmission
)
submission = submission_class()
submission.id = id or uuid4()
submission.name = name
submission.state = state
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_long_description():
'colour>=0.0.4',
'humanize',
'jsonpickle',
'onegov.core>=0.4.4',
'onegov.core>=0.16.0',
'onegov.search',
'pyparsing',
'pyyaml',
Expand Down

0 comments on commit 2694d60

Please sign in to comment.