Closed jdeniau closed 4 years ago
@RomainMapado commented on 2018-02-21 08:19
Une version un peu plus élégante avec le package re
# ces 2 lignes au niveau module pour pas compiler la regexp à chaque appel
rrule_keywords = ['BYHOUR', 'BYMINUTE', 'BYDAY']
regexp_keywords_equal_null = re.compile('|'.join(['%s=(;|$)' % keyword for keyword in rrule_keywords ]))
# puis dans la méthode
rrule_str = re.sub(regexp_keywords_equal_null, '', rrule_str).strip(';')
@jnieuviarts commented on 2018-02-21 11:24
Remplacé. Thx
@RomainMapado approved :heavy_check_mark: the pull request on 2018-02-21 11:37
Le rrule du type : 'FREQ=DAILY;UNTIL=20220228T235959;BYMINUTE=;BYHOUR=' ne passent pas (il faut forcément une valeur après le BYHOUR Objectif de la PR, supprimer ce type de cas
Le code est un peu "sale" mais je vois pas bien comment faire mieux quand on regarde comment est structuré un rrule avec le code officiel http://dateutil.readthedocs.io/en/stable/_modules/dateutil/rrule.html