Skip to content

Commit

Permalink
Merge pull request #55 from peter-/staticID
Browse files Browse the repository at this point in the history
Change EntitiesDescriptor/@id generation behaviour
  • Loading branch information
leifj committed Mar 4, 2015
2 parents a300c0b + 81cba27 commit ac02b44
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pyff/builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,9 +971,15 @@ def finalize(req, *opts):

now = datetime.utcnow()

idprefix = req.args.get('ID', '_')
mdid = req.args.get('ID', 'prefix _')
if re.match('(\s)*prefix(\s)*', mdid):
prefix = re.sub('^(\s)*prefix(\s)*', '', mdid)
ID = now.strftime(prefix + "%Y%m%dT%H%M%SZ")
else:
ID = mdid

if not e.get('ID'):
e.set('ID', now.strftime(idprefix + "%Y%m%dT%H%M%SZ"))
e.set('ID', ID)

valid_until = str(req.args.get('validUntil', e.get('validUntil', None)))
if valid_until is not None and len(valid_until) > 0:
Expand Down

0 comments on commit ac02b44

Please sign in to comment.