[oe-commits] [bitbake] 03/14: toaster: models Layer_Version get_detailspage_url optional project_id

git at git.openembedded.org git at git.openembedded.org
Mon Dec 12 20:45:57 UTC 2016


rpurdie pushed a commit to branch master
in repository bitbake.

commit 78dc7b9f1801e7f4c266ba1369e5706f177ddaa1
Author: Michael Wood <michael.g.wood at intel.com>
AuthorDate: Fri Dec 9 16:52:44 2016 +0000

    toaster: models Layer_Version get_detailspage_url optional project_id
    
    Allow passing none as the project id, this is convenient for layers
    which belong to projects already and therefore have their own project
    field.
    
    Add documentation string to function
    
    Signed-off-by: Michael Wood <michael.g.wood at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/toaster/orm/models.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index 4cd6683..98745d6 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -1493,7 +1493,13 @@ class Layer_Version(models.Model):
             return self.commit
         return 'N/A'
 
-    def get_detailspage_url(self, project_id):
+    def get_detailspage_url(self, project_id=None):
+        """ returns the url to the layer details page uses own project
+        field if project_id is not specified """
+
+        if project_id is None:
+            project_id = self.project.pk
+
         return reverse('layerdetails', args=(project_id, self.pk))
 
     def get_alldeps(self, project_id):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list