forked from openprocurement/openprocurement.auctions.dgf
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jcdb2dev43_enquiryPeriod_editing' of https://github.com…
…/prozorro-sale/openprocurement.auctions.dgf * 'jcdb2dev43_enquiryPeriod_editing' of https://github.com/prozorro-sale/openprocurement.auctions.dgf: Autogenerated rectificationPeriod without timebased changes
- Loading branch information
Showing
6 changed files
with
61 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
# -*- coding: utf-8 -*- | ||
from openprocurement.api.utils import error_handler | ||
from openprocurement.api.models import get_now, TZ | ||
from openprocurement.auctions.dgf.utils import generate_rectificationPeriod | ||
|
||
|
||
def validate_rectification_period_editing(request): | ||
if request.context.status == 'active.tendering' and request.authenticated_role not in ['chronograph', 'Administrator']: | ||
auction = request.validated['auction'] | ||
if auction.rectificationPeriod.endDate.astimezone(TZ) < get_now(): | ||
request.errors.add('body', 'data', 'Auction can be edited only during the rectification period: from ({}) to ({}).'.format(auction.rectificationPeriod.startDate.isoformat(), auction.rectificationPeriod.endDate.isoformat())) | ||
rectificationPeriod = auction.rectificationPeriod or generate_rectificationPeriod(auction) | ||
if rectificationPeriod.endDate.astimezone(TZ) < get_now(): | ||
request.errors.add('body', 'data', 'Auction can be edited only during the rectification period: from ({}) to ({}).'.format(rectificationPeriod.startDate.isoformat(), rectificationPeriod.endDate.isoformat())) | ||
request.errors.status = 403 | ||
raise error_handler(request.errors) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters