def __init__(self, expire = 86400 * 7):
self.id = hexencode(gennonce(16))
self.dict = {}
- self.lock = threading.Lock()
+ self.lock = threading.RLock()
self.ctime = self.atime = self.mtime = int(time.time())
self.expire = expire
self.dctl = set()
def __todom__(self, doc):
return doc.createTextNode(self)
+class raw(node, str):
+ def __todom__(self, doc):
+ raise Exception("Cannot convert raw code to DOM objects")
+
class element(node):
def __init__(self, ns, name, ctx):
self.ns = ns
def text(self, el):
self.quotewrite(el)
+ def rawcode(self, el):
+ self.write(el)
+
def attrval(self, buf):
qc, qt = ("'", "'") if '"' in buf else ('"', """)
self.write(qc)
self.element(el)
elif isinstance(el, cons.text):
self.text(el)
+ elif isinstance(el, cons.raw):
+ self.rawcode(el)
else:
raise Exception("Unknown object in element tree: " + el)
except KeyError:
if not create:
return None
- ret = cls(req)
+ ret = cls(req, sess)
sess[cls] = ret
return ret