def get_cpb_ids_by_activity(): """ Get first active: True and first active: False cpb from standards To test rule that only CPB that have "active": true in standards can create electronicCatalogue framework https://prozorroukr.github.io/standards/organizations/authorized_cpb.json :return: active cpb id, non active cpb id """ active_cpb = [] non_active_cpb = [] authorized_cpb = standards.load("organizations/authorized_cpb.json") for cpb in authorized_cpb: if not active_cpb or not non_active_cpb: id_ = cpb["identifier"]["id"] active_cpb.append(id_) if cpb["active"] else non_active_cpb.append(id_) return active_cpb[0], non_active_cpb[0]
SCHEMA_VERSION = 24 SCHEMA_DOC = "openprocurement_schema" TZ = timezone(os.environ["TZ"] if "TZ" in os.environ else "Europe/Kiev") SANDBOX_MODE = os.environ.get("SANDBOX_MODE", False) DOCUMENT_BLACKLISTED_FIELDS = ("title", "format", "url", "dateModified", "hash") DOCUMENT_WHITELISTED_FIELDS = ("id", "datePublished", "author", "__parent__") # Tenders in which could be used criteria connected with guarantee GUARANTEE_ALLOWED_TENDER_TYPES = ("belowThreshold", "aboveThresholdUA", "aboveThresholdEU", "esco") WORKING_DAYS = {} HOLIDAYS = standards.load("calendars/workdays_off.json") for date_str in HOLIDAYS: WORKING_DAYS[date_str] = True def read_json(name): import os.path from json import loads curr_dir = os.path.dirname(os.path.realpath(__file__)) file_path = os.path.join(curr_dir, name) with open(file_path) as lang_file: data = lang_file.read() return loads(data)
UA_ROAD_SCHEME, UA_ROAD, GMDN_SCHEME, GMDN, COUNTRIES, UA_REGIONS, VALIDATE_ADDRESS_FROM, TZ, VALIDATE_TELEPHONE_FROM, CURRENCIES, VALIDATE_CURRENCY_FROM, UNIT_PRICE_REQUIRED_FROM, ) schematics_default_role = SchematicsDocument.Options.roles["default"] + blacklist("__parent__") schematics_embedded_role = SchematicsDocument.Options.roles["embedded"] + blacklist("__parent__") UNIT_CODES = standards.load("unit_codes/recommended.json") plain_role = blacklist("_attachments", "revisions", "dateModified") + schematics_embedded_role listing_role = whitelist("dateModified", "doc_id") draft_role = whitelist("status") from couchdb_schematics.document import DocumentMeta from zope.component import queryAdapter, getAdapters class AdaptiveDict(dict): def __init__(self, context, interface, data, prefix=""): self.context = context self.interface = interface self.prefix = prefix self.prefix_len = len(prefix) self.adaptive_items = {}
import standards from cornice.resource import resource from dateorro import calc_normalized_datetime, calc_working_datetime, calc_datetime from openprocurement.api.constants import WORKING_DAYS from openprocurement.api.utils import get_now, context_unpack, error_handler from openprocurement.framework.core.design import ( submissions_by_framework_id_total_view, ) from openprocurement.framework.core.utils import ( ENQUIRY_PERIOD_DURATION, SUBMISSION_STAND_STILL_DURATION, acceleratable, LOGGER) from openprocurement.framework.electroniccatalogue.traversal import contract_factory DAYS_TO_UNSUCCESSFUL_STATUS = 20 CONTRACT_BAN_DURATION = 90 AUTHORIZED_CPB = standards.load("organizations/authorized_cpb.json") MILESTONE_CONTRACT_STATUSES = { "ban": "suspended", "disqualification": "terminated", "terminated": "terminated" } contractresource = partial(resource, factory=contract_factory, error_handler=error_handler) @acceleratable def calculate_framework_date(date_obj, timedelta_obj, framework=None,
# -*- coding: utf-8 -*- from datetime import timedelta, datetime from openprocurement.api.constants import TZ import standards WORKING_DAYS = {} HOLIDAYS = standards.load("calendars/workdays_off.json") WORKING_WEEKENDS = standards.load("calendars/weekends_on.json") for date_str in HOLIDAYS: WORKING_DAYS[date_str] = True for date_str in WORKING_WEEKENDS: WORKING_DAYS[date_str] = False TENDERING_DAYS = 6 TENDERING_DURATION = timedelta(days=TENDERING_DAYS) STAND_STILL_TIME = timedelta(days=4) ENQUIRY_STAND_STILL_TIME = timedelta(days=2) CLAIM_SUBMIT_TIME = timedelta(days=3) COMPLAINT_SUBMIT_TIME = timedelta(days=2) COMPLAINT_OLD_SUBMIT_TIME = timedelta(days=3) COMPLAINT_OLD_SUBMIT_TIME_BEFORE = datetime(2016, 7, 5, tzinfo=TZ) ENQUIRY_PERIOD_TIME = timedelta(days=3) TENDERING_EXTRA_PERIOD = timedelta(days=2)
ROUTE_PREFIX = "/api/{}".format(VERSION) SESSION = Session() SCHEMA_VERSION = 24 SCHEMA_DOC = "openprocurement_schema" TZ = timezone(os.environ["TZ"] if "TZ" in os.environ else "Europe/Kiev") SANDBOX_MODE = os.environ.get("SANDBOX_MODE", False) DOCUMENT_BLACKLISTED_FIELDS = ("title", "format", "url", "dateModified", "hash") DOCUMENT_WHITELISTED_FIELDS = ("id", "datePublished", "author", "__parent__") # Tenders in which could be used criteria connected with guarantee GUARANTEE_ALLOWED_TENDER_TYPES = ("belowThreshold", "aboveThresholdUA", "aboveThresholdEU", "esco") WORKING_DAYS = {} HOLIDAYS = standards.load("calendars/workdays_off.json") for date_str in HOLIDAYS: WORKING_DAYS[date_str] = True def read_json(name): import os.path from json import loads curr_dir = os.path.dirname(os.path.realpath(__file__)) file_path = os.path.join(curr_dir, name) with open(file_path) as lang_file: data = lang_file.read() return loads(data) CPV_CODES = read_json("data/cpv.json")