Exemple #1
0
 def __call__(self, cls, data, items):
     cpv_336_group = items[
         0].classification.id[:3] == '336' if items else False
     if not cpv_336_group and items and len(
             set([i.classification.id[:4] for i in items])) != 1:
         raise ValidationError(u"CPV class of items should be identical")
     else:
         validate_cpv_group(items)
 def validate_items(self, data, items):
     cpv_336_group = items[
         0].classification.id[:3] == "336" if items else False
     date = get_first_revision_date(data, default=get_now())
     if (not cpv_336_group and date > CPV_ITEMS_CLASS_FROM and items
             and len(set([i.classification.id[:4] for i in items])) != 1):
         raise ValidationError("CPV class of items should be identical")
     else:
         validate_cpv_group(items)
Exemple #3
0
 def validate_items(self, data, items):
     cpv_336_group = items[
         0].classification.id[:3] == "336" if items else False
     if (not cpv_336_group
             and (data.get("revisions")[0].date if data.get("revisions")
                  else get_now()) > CPV_ITEMS_CLASS_FROM and items
             and len(set([i.classification.id[:4] for i in items])) != 1):
         raise ValidationError(u"CPV class of items should be identical")
     else:
         validate_cpv_group(items)
Exemple #4
0
 def __call__(self, cls, data, items):
     cpv_336_group = items[
         0].classification.id[:3] == '336' if items else False
     if not cpv_336_group and (
             data.get('revisions')[0].date if data.get('revisions') else
             get_now()) > CPV_ITEMS_CLASS_FROM and items and len(
                 set([i.classification.id[:4] for i in items])) != 1:
         raise ValidationError(u"CPV class of items should be identical")
     else:
         validate_cpv_group(items)
Exemple #5
0
 def validate_items(self, data, items):
     if data["status"] in ("draft", "draft.publishing",
                           "draft.unsuccessful"):
         return
     if not all((i.classification for i in items)):
         return
     cpv_336_group = items[0].classification.id[:3] == "336"\
         if items else False
     if (not cpv_336_group and items
             and len(set([i.classification.id[:4] for i in items])) != 1):
         raise ValidationError(u"CPV class of items should be identical")
     else:
         validate_cpv_group(items)
     validate_classification_id(items)