[bitbake-devel] [PATCH 4/8] toaster: add layer source in admin throws an error
Damian, Alexandru
alexandru.damian at intel.com
Mon Apr 27 14:23:03 UTC 2015
Hello,
I am going to revert this patch because it messes up the class
instantiation for layer sources saved through the admin. We need a better
solution for 7437.
Alex
On Thu, Apr 16, 2015 at 3:47 PM, Alex DAMIAN <alexandru.damian at intel.com>
wrote:
> From: David Reyna <David.Reyna at windriver.com>
>
> Preset uninitialized object members to bootstrap new layer source creation.
>
> [YOCTO #7437]
>
> Signed-off-by: David Reyna <David.Reyna at windriver.com>
> ---
> lib/toaster/orm/models.py | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
> index 625eb1e..4a6ca8f 100644
> --- a/lib/toaster/orm/models.py
> +++ b/lib/toaster/orm/models.py
> @@ -640,17 +640,25 @@ 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 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
> + 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
> 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
>
>
--
Alex Damian
Yocto Project
SSG / OTC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20150427/fab13c46/attachment-0002.html>
More information about the bitbake-devel
mailing list