Add context-manager support to libhtml so it can be used in a "with" statement
svn: r12616
This commit is contained in:
parent
885ddddbc1
commit
32f0251b9e
@ -530,6 +530,12 @@ class Html(list):
|
|||||||
if len(self) > 2:
|
if len(self) > 2:
|
||||||
self[:] = self[:1] + self[-1:]
|
self[:] = self[:1] + self[-1:]
|
||||||
inside = property(__getinside, __setinside, __delinside)
|
inside = property(__getinside, __setinside, __delinside)
|
||||||
|
#
|
||||||
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
#
|
||||||
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
|
return exc_type is None
|
||||||
|
|
||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user