Hi Belén and Alex,

I have a working solution for 7437, in that clicking the add new layer sources 
no longer crashes.

    dreyna/add_layersource_7437

It appears to me that given the backtrace, the Django admin is attempting to 
touch the new layer source object before the Toaster code can initialize it. 
This patch simple initializes the empty members to a sane (but empty) object 
values, allowing the bootstrap to finish. When the "Add layer source" page does 
appear to the user, all of the fields are indeed empty as you would expect.

You may not like this particular solution, but it works, and may indicate an 
obvious alternative fix if you see one. 

diff --git a/bitbake/lib/toaster/orm/models.py 
b/bitbake/lib/toaster/orm/models.py
index 625eb1e..abe9c3a 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -651,6 +651,14 @@ class LayerSource(models.Model):
         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:

- David

> -----Original Message-----
> From: [email protected] [mailto:toaster-
> [email protected]] On Behalf Of Reyna, David
> Sent: Monday, March 30, 2015 6:37 PM
> To: BARROS PENA, BELEN; WOOD, MICHAEL; DAMIAN, ALEXANDRU
> Cc: [email protected]
> Subject: [Toaster] [review-request] dreyna/projects_pagecount_7483
> 
> Hi Belén and Michael,
> 
> I went ahead and grabbed (and solved) 7483 "Searching in the all projects
> table resets the 'show rows' menu to '10'" since it was still in the new
> state.
> 
>     dreyna/projects_pagecount_7483
> 
> The "count" value for the all projects page was not fully saved in the
> cookies because the view class did not end with a
> '_save_parameters_cookies'.
> 
> The intermediate cookie "_count" was there (from basetable_bottom.html)
> which is why it kind of worked, but that is not used when a search is
> issued.
> 
> - David
> 
> --
> _______________________________________________
> toaster mailing list
> [email protected]
> https://lists.yoctoproject.org/listinfo/toaster
-- 
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Reply via email to