xml = None
type = None
version = None
- namespaces = None
+ namespaces = None
+ user_options = {}
- def __init__(self, rspec="", namespaces={}):
+ def __init__(self, rspec="", namespaces={}, type=None, user_options={}:
+ self.type = type
+ self.user_options = user_options
if rspec:
self.parse_rspec(rspec, namespaces)
else:
self.create()
- def create(self, type="advertisement"):
+ def __get_template(self):
+ return self.template
+
+ def create(self):
"""
Create root element
"""
now = datetime.utcnow()
generated_ts = now.strftime(date_format)
expires_ts = (now + timedelta(hours=1)).strftime(date_format)
- self.parse_rspec(self.template, self.namespaces)
+ self.parse_rspec(self.__get_template, self.namespaces)
self.xml.set('valid_until', expires_ts)
self.xml.set('generated', generated_ts)