Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/request_now'
Browse files Browse the repository at this point in the history
  • Loading branch information
vmaksymiv committed Oct 5, 2017
2 parents ba5d742 + 8b3ad51 commit eb4a2db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/openprocurement/api/includeme.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pyramid.interfaces import IRequest
from openprocurement.api.interfaces import IContentConfigurator, IOPContent
from openprocurement.api.adapters import ContentConfigurator
from openprocurement.api.utils import get_content_configurator
from openprocurement.api.utils import get_content_configurator, request_get_now


def includeme(config):
Expand All @@ -11,3 +11,4 @@ def includeme(config):
config.registry.registerAdapter(ContentConfigurator, (IOPContent, IRequest),
IContentConfigurator)
config.add_request_method(get_content_configurator, 'content_configurator', reify=True)
config.add_request_method(request_get_now, 'now', reify=True)
4 changes: 4 additions & 0 deletions src/openprocurement/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def get_now():
return datetime.now(TZ)


def request_get_now(request):
return get_now()


def set_parent(item, parent):
if hasattr(item, '__parent__') and item.__parent__ is None:
item.__parent__ = parent
Expand Down

0 comments on commit eb4a2db

Please sign in to comment.