Add get, set and has methods to Underscore

This commit is contained in:
ines 2017-10-10 04:14:35 +02:00
parent 51d18937af
commit 59c4f27499
1 changed files with 9 additions and 0 deletions

View File

@ -37,5 +37,14 @@ class Underscore(object):
else:
self._doc.user_data[self._get_key(name)] = value
def set(self, name, value):
return self.__setattr__(name, value)
def get(self, name):
return self.__getattr__(name)
def has(self, name):
return name in self._extensions
def _get_key(self, name):
return ('._.', name, self._start, self._end)