def __acl__(self): auction = get_auction(self) for bid in auction.bids: if bid.id == self.bid_id: bid_owner = bid.owner bid_owner_token = bid.owner_token return [(Allow, '{}_{}'.format(bid_owner, bid_owner_token), 'edit_auction_award')]
def __local_roles__(self): auction = get_auction(self) for bid in auction.bids: if bid.id == self.bid_id: bid_owner = bid.owner bid_owner_token = bid.owner_token return dict([('{}_{}'.format(bid_owner, bid_owner_token), 'bid_owner')])
def award_signingPeriod(self): period = self.signingPeriod if not period: return if not period.endDate: auction = get_auction(self) calculate_enddate(auction, period, CONTRACT_SIGNING_TIME) return period.to_primitive()
def award_paymentPeriod(self): period = self.paymentPeriod if not period: return if not period.endDate: auction = get_auction(self) calculate_enddate(auction, period, AWARD_PAYMENT_TIME) return period.to_primitive()
def award_verificationPeriod(self): period = self.verificationPeriod if not period: return if not period.endDate: auction = get_auction(self) calculate_enddate(auction, period, VERIFY_AUCTION_PROTOCOL_TIME) return period.to_primitive()
def validate_id(self, data, code): auction = get_auction(data['__parent__']) if data.get('scheme') == u'CPV' and code not in CPV_CODES: raise ValidationError(BaseType.MESSAGES['choices'].format(unicode(CPV_CODES))) elif data.get('scheme') == u'CAV-PS' and code not in CAVPS_CODES: raise ValidationError(BaseType.MESSAGES['choices'].format(unicode(CAVPS_CODES))) if code.find("00000-") > 0 and (auction.get('revisions')[0].date if auction.get('revisions') else get_now()) > CLASSIFICATION_PRECISELY_FROM: raise ValidationError('At least {} classification class (XXXX0000-Y) should be specified more precisely'.format(data.get('scheme')))
def validate_id(self, data, code): auction = get_auction(data['__parent__']) if data.get('scheme') == u'CPV' and code not in CPV_CODES: raise ValidationError(BaseType.MESSAGES['choices'].format(unicode(CPV_CODES))) elif data.get('scheme') == u'CAV-PS' and code not in CAVPS_CODES: raise ValidationError(BaseType.MESSAGES['choices'].format(unicode(CAVPS_CODES))) if code.find("00000-") > 0 and get_auction_creation_date(data) > CLASSIFICATION_PRECISELY_FROM: raise ValidationError('At least {} classification class (XXXX0000-Y) should be specified more precisely'.format(data.get('scheme')))
def award_signingPeriod(self): period = self.signingPeriod if not period: return if not period.endDate: auction = get_auction(self) period.endDate = calculate_business_date(period.startDate, CONTRACT_SIGNING_TIME, auction, True) round_to_18_hour_delta = period.endDate.replace( hour=18, minute=0, second=0) - period.endDate period.endDate = calculate_business_date(period.endDate, round_to_18_hour_delta, auction, False) return period.to_primitive()
def award_paymentPeriod(self): period = self.paymentPeriod if not period: return if not period.endDate: auction = get_auction(self) period.endDate = calculate_business_date(period.startDate, AWARD_PAYMENT_TIME, auction, True) round_to_18_hour_delta = period.endDate.replace( hour=18, minute=0, second=0) - period.endDate period.endDate = calculate_business_date(period.endDate, round_to_18_hour_delta, auction, False) return period.to_primitive()
def award_verificationPeriod(self): period = self.verificationPeriod if not period: return if not period.endDate: auction = get_auction(self) period.endDate = calculate_business_date( period.startDate, VERIFY_AUCTION_PROTOCOL_TIME, auction, True) round_to_18_hour_delta = period.endDate.replace( hour=18, minute=0, second=0) - period.endDate period.endDate = calculate_business_date(period.endDate, round_to_18_hour_delta, auction, False) return period.to_primitive()
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, startDate): auction = get_auction(data['__parent__']) if not auction.revisions and not startDate: raise ValidationError(u'This field is required.')
def validate_participationUrl(self, data, url): if url and isinstance(data['__parent__'], Model) and get_auction( data['__parent__']).lots: raise ValidationError(u"url should be posted for each lot of bid")