mirror of
https://git.yoctoproject.org/poky
synced 2026-04-19 15:32:13 +02:00
bitbake: toaster: add layer source in admin throws an error
Preset uninitialized object members to bootstrap new layer source creation. [YOCTO #7437] (Bitbake rev: 4de721aa75a4aaad186312443726e6daa764934b) Signed-off-by: David Reyna <David.Reyna@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
86f982c3df
commit
ac69236d1d
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user