No title Revision 623164383039 (Wed Aug 01 2012 at 12:45) - Diff Link to this snippet: https://friendpaste.com/2mG5P3PKomMTPV5stPAlLo Embed: manni perldoc borland colorful default murphy trac fruity autumn bw emacs pastie friendly Show line numbers Wrap lines 1234567891011121314151617 def clean(self): if self.operation_id and self.operation.slug_libelle == 'location': if not self.periode: raise ValidationError("Pour une location, le champ 'periode' est obligatoire") if self.p_image and self.p_image.size() > IMAGE_SIZE: raise ValidationError("La taille maximale est de %s"%filesizeformat(IMAGE_SIZE)) if self.open_date and self.close_date: if self.open_date > self.close_date: raise ValidationError("Mauvaise configuration des dates") if ANNONCES_LIFETIMES: date_ecart = self.close_date - self.open_date if date_ecart.days > ANNONCES_LIFETIMES: raise ValidationError(u"La durée d'une annonce ne peut pas dépasser %s jour(s)"%ANNONCES_LIFETIMES)