also begin to prefix type with cdist

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-02-12 01:10:57 +01:00
parent 4be37f6e93
commit 1314567012
4 changed files with 12 additions and 12 deletions

View File

@ -19,11 +19,11 @@
# #
# #
from cdist.core.type import Type from cdist.core.cdist_type import CdistType
from cdist.core.type import NoSuchTypeError from cdist.core.cdist_type import NoSuchTypeError
from cdist.core.object import Object from cdist.core.cdist_object import CdistObject
from cdist.core.object import IllegalObjectIdError from cdist.core.cdist_object import IllegalObjectIdError
from cdist.core.object import OBJECT_MARKER from cdist.core.cdist_object import OBJECT_MARKER
from cdist.core.explorer import Explorer from cdist.core.explorer import Explorer
from cdist.core.manifest import Manifest from cdist.core.manifest import Manifest
from cdist.core.code import Code from cdist.core.code import Code

View File

@ -34,7 +34,7 @@ class NoSuchTypeError(cdist.Error):
return "Type '%s' does not exist at %s" % (self.type_path, self.type_absolute_path) return "Type '%s' does not exist at %s" % (self.type_path, self.type_absolute_path)
class Type(object): class CdistType(object):
"""Represents a cdist type. """Represents a cdist type.
All interaction with types in cdist should be done through this class. All interaction with types in cdist should be done through this class.
@ -61,7 +61,7 @@ class Type(object):
# name is second argument # name is second argument
name = args[1] name = args[1]
if not name in cls._instances: if not name in cls._instances:
instance = super(Type, cls).__new__(cls) instance = super(CdistType, cls).__new__(cls)
cls._instances[name] = instance cls._instances[name] = instance
# return instance so __init__ is called # return instance so __init__ is called
return cls._instances[name] return cls._instances[name]
@ -84,7 +84,7 @@ class Type(object):
self.__optional_parameters = None self.__optional_parameters = None
def __repr__(self): def __repr__(self):
return '<Type %s>' % self.name return '<CdistType %s>' % self.name
def __eq__(self, other): def __eq__(self, other):
return isinstance(other, self.__class__) and self.name == other.name return isinstance(other, self.__class__) and self.name == other.name

View File

@ -38,7 +38,7 @@ class ObjectClassTestCase(test.CdistTestCase):
self.assertEqual(object_names, ['__first/man', '__second/on-the', '__third/moon']) self.assertEqual(object_names, ['__first/man', '__second/on-the', '__third/moon'])
def test_list_type_names(self): def test_list_type_names(self):
type_names = list(core.CdistObject.list_type_names(object_base_path)) type_names = list(cdist.core.CdistObject.list_type_names(object_base_path))
self.assertEqual(type_names, ['__first', '__second', '__third']) self.assertEqual(type_names, ['__first', '__second', '__third'])
def test_list_objects(self): def test_list_objects(self):