[bitbake-devel] [PATCH 1/1] Revert "toaster: add layer source in admin throws an error"
Alex DAMIAN
alexandru.damian at intel.com
Mon Apr 27 14:24:25 UTC 2015
From: Alexandru DAMIAN <alexandru.damian at intel.com>
This reverts commit 4de721aa75a4aaad186312443726e6daa764934b.
---
lib/toaster/orm/models.py | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index b9bb896..cccf7f3 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -646,25 +646,17 @@ class LayerSource(models.Model):
raise Exception("Abstract, update() must be implemented by all LayerSource-derived classes (object is %s)" % str(vars(self)))
def save(self, *args, **kwargs):
- if self.sourcetype == LayerSource.TYPE_LOCAL:
- self.__class__ = LocalLayerSource
- elif self.sourcetype == LayerSource.TYPE_LAYERINDEX:
- self.__class__ = LayerIndexLayerSource
- elif self.sourcetype == LayerSource.TYPE_IMPORTED:
- self.__class__ = ImportedLayerSource
+ if isinstance(self, LocalLayerSource):
+ self.sourcetype = LayerSource.TYPE_LOCAL
+ elif isinstance(self, LayerIndexLayerSource):
+ self.sourcetype = LayerSource.TYPE_LAYERINDEX
+ elif isinstance(self, ImportedLayerSource):
+ self.sourcetype = LayerSource.TYPE_IMPORTED
elif self.sourcetype == None:
raise Exception("Unknown LayerSource-derived class. If you added a new layer source type, fill out all code stubs.")
return super(LayerSource, self).save(*args, **kwargs)
def get_object(self):
- # preset an un-initilized object
- if None == self.name:
- self.name=""
- if None == self.apiurl:
- self.apiurl=""
- if None == self.sourcetype:
- self.sourcetype=LayerSource.TYPE_LOCAL
-
if self.sourcetype == LayerSource.TYPE_LOCAL:
self.__class__ = LocalLayerSource
elif self.sourcetype == LayerSource.TYPE_LAYERINDEX:
--
1.9.1
More information about the bitbake-devel
mailing list