def validate_id(self, data, id):
     if id not in DK_CODES:
         raise ValidationError(BaseType.MESSAGES["choices"].format(
             unicode(DK_CODES)))
Beispiel #2
0
 def validate_startDate(self, data, startDate):
     auction = get_auction(data['__parent__'])
     if not auction.revisions and not startDate:
         raise ValidationError(u'This field is required.')
 def validate_startDate(self, data, value):
     if value and data.get('endDate') and data.get('endDate') < value:
         raise ValidationError(u"period should begin before its end")
def validate_dkpp(items, *args):
    if items and not any(
        [i.scheme in ADDITIONAL_CLASSIFICATIONS_SCHEMES for i in items]):
        raise ValidationError(
            u"One of additional classifications should be one of [{0}].".
            format(", ".join(ADDITIONAL_CLASSIFICATIONS_SCHEMES)))
Beispiel #5
0
 def validate_template_path(self, data, value):
     if value and data["class_path"]:
         raise ValidationError(
             "class_path cannot be present when "
             "template_path is provided.")
     self.validate_stack_source(data)
 def validate_tenderPeriod(self, data, period):
     if period and period.startDate and data.get(
             'enquiryPeriod') and data.get(
                 'enquiryPeriod').endDate and period.startDate < data.get(
                     'enquiryPeriod').endDate:
         raise ValidationError(u"period should begin after enquiryPeriod")
def validate_items_uniq(items, *args):
    if items:
        ids = [i.id for i in items]
        if [i for i in set(ids) if ids.count(i) > 1]:
            raise ValidationError(u"Item id should be uniq for all items")
Beispiel #8
0
 def validate_id(self, data, code):
     if data.get('scheme') == u'CPVS' and code not in CPVS_CODES:
         raise ValidationError(BaseType.MESSAGES['choices'].format(
             unicode(CPVS_CODES)))
Beispiel #9
0
def is_between(value):
    if not 1000 <= value <= 4000:
        raise ValidationError(
            "The amount must to be between 1000.00 - 4000.00")
    return value
Beispiel #10
0
 def validate_dgfID(self, data, dgfID):
     if not dgfID:
         if (data.get('revisions')[0].date if data.get('revisions') else
                 get_now()) > DGF_ID_REQUIRED_FROM:
             raise ValidationError(u'This field is required.')
Beispiel #11
0
def validate_ua_fin(items, *args):
    if items and not any([i.scheme == u"UA-FIN" for i in items]):
        raise ValidationError(
            u"One of additional classifications should be UA-FIN.")
Beispiel #12
0
def validate_not_available(items, *args):
    if items:
        raise ValidationError(
            u"Option not available in this procurementMethodType")
Beispiel #13
0
 def validate_accessDetails(self, data, accessDetails):
     if data.get('documentType'
                 ) == 'x_dgfAssetFamiliarization' and not accessDetails:
         raise ValidationError(u'This field is required.')
Beispiel #14
0
 def validate_hash(self, data, hash_):
     if data.get('documentType') in [
             'virtualDataRoom', 'x_dgfAssetFamiliarization'
     ] and hash_:
         raise ValidationError(u'This field is not required.')
Beispiel #15
0
 def validate_criteria(self, data, value):
     if value:
         raise ValidationError("Rogue field")
Beispiel #16
0
def is_inside(value):
    if int(value) not in [6, 9, 12]:
        raise ValidationError("The terms not in [6, 9, 12]")
    return value
 def validate_auctionUrl(self, data, url):
     if url and data['lots']:
         raise ValidationError(u"url should be posted for each lot")
 def validate_days(self, data, days):
     if data["years"] == 15 and days > 0:
         raise ValidationError("max contract duration 15 years")
     if data["years"] == 0 and days < 1:
         raise ValidationError("min contract duration 1 day")
 def validate_lots(self, data, value):
     if len(set([lot.guarantee.currency
                 for lot in value if lot.guarantee])) > 1:
         raise ValidationError(
             u"lot guarantee currency should be identical to tender guarantee currency"
         )
 def validate_annualCostsReduction(self, data, value):
     if len(value) != 21:
         raise ValidationError(
             "annual costs reduction should be set for 21 period")
def validate_cpv_group(items, *args):
    if items and len(set([i.classification.id[:3] for i in items])) != 1:
        raise ValidationError(u"CPV group of items be identical")
def greater_than_zero(value):
    if value < 0:
        raise ValidationError("must be greater than zero")
    return value
Beispiel #23
0
def not_empty_list(value):
    if not value or len(value) < 1:
        raise ValidationError("Should have more than one element.")
    return value
Beispiel #24
0
 def validate_questions(self, data, value):
     """Validate question field."""
     if value and len(value) > len(set(value)):
         raise ValidationError('Election questions must be unique')
     return value
Beispiel #25
0
 def validate_email(self, data, value):
     if not value and not data.get('telephone'):
         raise ValidationError(u"telephone or email should be present")
Beispiel #26
0
def is_positive_float(value):
    if value <= 0:
        raise ValidationError(u"Float value should be greater than 0.")
Beispiel #27
0
 def validate_value(self, data, value):
     if value.currency != u'UAH':
         raise ValidationError(u"currency should be only UAH")
 def validate_lotID(self, data, lotID):
     if isinstance(data['__parent__'], Model):
         if not lotID and data['__parent__'].lots:
             raise ValidationError(u'This field is required.')
         if lotID and lotID not in [i.id for i in data['__parent__'].lots]:
             raise ValidationError(u"lotID should be one of lots")
 def validate_id(self, data, code):
     available_codes = ITEM_CLASSIFICATIONS.get(data.get('scheme'), [])
     if code not in available_codes:
         raise ValidationError(BaseType.MESSAGES['choices'].format(
             unicode(available_codes)))
Beispiel #30
0
 def validate_index(self, value):
     if any(not isinstance(v, str) for v in value.index):
         raise ValidationError("Invalid index. All indices must be strings")