libxl: Add get/set_default_namespace in libxltypes.py.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
Anthony PERARD committed 2011-09-29 16:28:21 +01:00
1 parent 49338ad5c5
commit 6cde0b9c4e
2 files changed
+18 -2

No files matched your search

+2
View File
@@ -3,6 +3,8 @@
# Builtin libxl types
#
namespace("libxl_")
libxl_domid = Builtin("domid")
libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE)
libxl_mac = Builtin("mac", passby=PASS_BY_REFERENCE)
+16 -2
View File
@@ -8,10 +8,23 @@ DIR_IN = 1
DIR_OUT = 2
DIR_BOTH = 3
_default_namespace = ""
def namespace(s):
if type(s) != str:
raise TypeError, "Require a string for the default namespace."
global _default_namespace
_default_namespace = s
def _get_default_namespace():
global _default_namespace
return _default_namespace
class Type(object):
def __init__(self, typename, **kwargs):
self.comment = kwargs.setdefault('comment', None)
self.namespace = kwargs.setdefault('namespace', "libxl_")
self.namespace = kwargs.setdefault('namespace',
_get_default_namespace())
self.dir = kwargs.setdefault('dir', DIR_BOTH)
if self.dir not in [DIR_NONE, DIR_IN, DIR_OUT, DIR_BOTH]:
raise ValueError
@@ -256,7 +269,8 @@ def parse(f):
elif isinstance(t,type(object)) and issubclass(t, Type):
globs[n] = t
elif n in ['PASS_BY_REFERENCE', 'PASS_BY_VALUE',
'DIR_NONE', 'DIR_IN', 'DIR_OUT', 'DIR_BOTH']:
'DIR_NONE', 'DIR_IN', 'DIR_OUT', 'DIR_BOTH',
'namespace']:
globs[n] = t
try:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.