[kernel] r9200 - people/waldi/dkt/lib/dkt/image

Bastian Blank waldi at alioth.debian.org
Wed Jul 25 12:22:44 UTC 2007


Author: waldi
Date: Wed Jul 25 12:22:44 2007
New Revision: 9200

Log:
lib/dkt/image/base.py
- Register adapter.
- Check if the config is an image config.


Modified:
   people/waldi/dkt/lib/dkt/image/base.py

Modified: people/waldi/dkt/lib/dkt/image/base.py
==============================================================================
--- people/waldi/dkt/lib/dkt/image/base.py	(original)
+++ people/waldi/dkt/lib/dkt/image/base.py	Wed Jul 25 12:22:44 2007
@@ -6,7 +6,21 @@
 class BaseConfig(object):
     implements(interfaces.IImageBaseConfig)
 
+    @classmethod
+    def _factory(cls, context):
+        if 'image' not in context:
+            return None
+        return cls(context)
+
     def __init__(self, context):
         self.context = context
 
-registry.register([config_interfaces.IConfig], interfaces.IImageBaseConfig, '', BaseConfig)
+    @property
+    def type(self):
+        return self.context.get('image', 'type')
+
+    @property
+    def architecture(self):
+        return self.context.get('image', 'architecture')
+
+registry.register([config_interfaces.IConfig], interfaces.IImageBaseConfig, '', BaseConfig._factory)



More information about the Kernel-svn-changes mailing list