-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from gorserg/init_bridge
add bridge
- Loading branch information
Showing
7 changed files
with
719 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
[run] | ||
omit = | ||
*tests* | ||
*databridge.py | ||
|
||
[report] | ||
exclude_lines = | ||
|
606 changes: 606 additions & 0 deletions
606
openprocurement/tender/competitivedialogue/databridge.py
Large diffs are not rendered by default.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
openprocurement/tender/competitivedialogue/journal_msg_ids.py
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
DATABRIDGE_RESTART = "cd_bridge_restart" | ||
DATABRIDGE_GET_CREDENTIALS = "cd_bridge_get_tender_credentials" | ||
DATABRIDGE_GOT_CREDENTIALS = "cd_bridge_got_tender_credentials" | ||
DATABRIDGE_FOUND_NOLOT = "cd_bridge_found_nolot" | ||
DATABRIDGE_COPY_TENDER_ITEMS = "cd_bridge_prepare_items" | ||
DATABRIDGE_GET_EXTRA_INFO = "cd_bridge_get_credentials" | ||
DATABRIDGE_MISSING_CREDENTIALS = "cd_bridge_missing_credentials" | ||
DATABRIDGE_GOT_EXTRA_INFO = "cd_bridge_got_credentials" | ||
DATABRIDGE_CREATE_NEW_TENDER = "cd_bridge_create_new_tender" | ||
DATABRIDGE_TENDER_CREATED = "cd_bridge_tender_created" | ||
DATABRIDGE_CD_PATCHED = "cd_bridge_cd_patched" | ||
DATABRIDGE_UNSUCCESSFUL_CREATE = "cd_bridge_unsuccessful_create" | ||
DATABRIDGE_RETRY_CREATE = "cd_bridge_create_retry" | ||
DATABRIDGE_CREATE_ERROR = "cd_bridge_create_error" | ||
DATABRIDGE_TENDER_PROCESS = "cd_bridge_tender_process" | ||
DATABRIDGE_SKIP_NOT_MODIFIED = "cd_bridge_not_modified" | ||
DATABRIDGE_SYNC_SLEEP = "cd_bridge_sleep" | ||
DATABRIDGE_SYNC_RESUME = "cd_bridge_resume" | ||
DATABRIDGE_PATCH_DIALOG = "cd_patch_dialog" | ||
DATABRIDGE_UNSUCCESSFUL_PATCH = "cd_bridge_unsuccessful_patch" | ||
DATABRIDGE_RETRY_PATCH = "cd_bridge_patch_retry" | ||
DATABRIDGE_CD_PATCH_STAGE2_ID = "cd_bridge_patch_dialog_stage2_id" | ||
DATABRIDGE_CD_UNSUCCESSFUL_PATCH_STAGE2_ID = "cd_bridge_unsuccessful_patch_dialog_stage2_id" | ||
DATABRIDGE_CD_RETRY_PATCH_STAGE2_ID = "cd_bridge_retry_patch_dialog_stage2_id" | ||
DATABRIDGE_CD_PATCHED_STAGE2_ID = "cd_bridge_retry_patched_dialog_stage2_id" | ||
DATABRIDGE_PATCH_NEW_TENDER_STATUS = "cd_bridge_patch_new_tender_status" | ||
DATABRIDGE_UNSUCCESSFUL_PATCH_NEW_TENDER_STATUS = "cd_bridge_unsuccessful_patch_new_tender_status" | ||
DATABRIDGE_SUCCESSFUL_PATCH_NEW_TENDER_STATUS = "cd_bridge_successful_patch_new_tender_status" | ||
DATABRIDGE_PATCH_DIALOG_STATUS = "cd_bridge_patch_dialog_status" | ||
DATABRIDGE_UNSUCCESSFUL_PATCH_DIALOG_STATUS = "cd_bridge_unsuccessful_patch_dialog_status" | ||
DATABRIDGE_SUCCESSFUL_PATCH_DIALOG_STATUS = "cd_bridge_successful_patch_dialog_status" | ||
DATABRIDGE_ONLY_PATCH = 'cd_bridge_need_patch' | ||
DATABRIDGE_TENDER_STAGE2_NOT_EXIST = 'cd_bridge_tender_stage2_not_exist' | ||
|
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from openprocurement.api.validation import validate_data, validate_json_data | ||
from openprocurement.api.utils import apply_data_patch | ||
from openprocurement.tender.competitivedialogue.models import STAGE2_STATUS | ||
|
||
|
||
def validate_patch_tender_stage2_data(request): | ||
data = validate_json_data(request) | ||
if request.context.status == 'draft': | ||
default_statuses = ['active.tendering', STAGE2_STATUS] | ||
if data.get('status') not in default_statuses: | ||
request.errors.add('body', 'data', 'Can\'t update tender in current ({0}) status'.format(data['status'])) | ||
request.errors.status = 403 | ||
return | ||
request.validated['data'] = {'status': data.get('status')} | ||
request.context.status = data.get('status') | ||
return | ||
if data: | ||
if 'items' in data: | ||
items = request.context.items | ||
cpv_group_lists = [i.classification.id[:3] for i in items] | ||
for item in data['items']: | ||
if 'classification' in item and 'id' in item['classification']: | ||
cpv_group_lists.append(item['classification']['id'][:3]) | ||
if len(set(cpv_group_lists)) != 1: | ||
request.errors.add('body', 'item', 'Can\'t change classification') | ||
request.errors.status = 403 | ||
return None | ||
if 'enquiryPeriod' in data: | ||
if apply_data_patch(request.context.enquiryPeriod.serialize(), data['enquiryPeriod']): | ||
request.errors.add('body', 'item', 'Can\'t change enquiryPeriod') | ||
request.errors.status = 403 | ||
return None | ||
|
||
return validate_data(request, type(request.tender), True, data) |
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