src/reportlab/platypus/doctemplate.py
changeset 4551 d357e2acc856
parent 4530 3f6cc4ae6211
equal deleted inserted replaced
4550:80dd9e83dad9 4551:d357e2acc856
  1213         NS=self._nameSpace
  1213         NS=self._nameSpace
  1214         K0=list(NS.keys())
  1214         K0=list(NS.keys())
  1215         try:
  1215         try:
  1216             if lifetime not in self._allowedLifetimes:
  1216             if lifetime not in self._allowedLifetimes:
  1217                 raise ValueError('bad lifetime %r not in %r'%(lifetime,self._allowedLifetimes))
  1217                 raise ValueError('bad lifetime %r not in %r'%(lifetime,self._allowedLifetimes))
  1218             exec(stmt, {},NS)
  1218             exec(stmt, NS)
  1219         except:
  1219         except:
  1220             for k in NS.keys():
  1220             for k in NS.keys():
  1221                 if k not in K0:
  1221                 if k not in K0:
  1222                     del NS[k]
  1222                     del NS[k]
  1223             annotateException('\ndocExec %s lifetime=%r failed!\n' % (stmt,lifetime))
  1223             annotateException('\ndocExec %s lifetime=%r failed!\n' % (stmt,lifetime))