Add getSingleton() method to return the Site settings entity.
authorTodd Larsen <tlarsen@google.com>
Tue, 20 Jan 2009 21:48:28 +0000
changeset 851 506752de2e19
parent 850 05e376c84e08
child 852 c94bf642be8d
Add getSingleton() method to return the Site settings entity. There is always only one Site entity, referred to by DEF_SITE_LINK_ID. Patch by: Todd Larsen Review by: to-be-reviewed
app/soc/logic/models/site.py
--- a/app/soc/logic/models/site.py	Tue Jan 20 21:37:30 2009 +0000
+++ b/app/soc/logic/models/site.py	Tue Jan 20 21:48:28 2009 +0000
@@ -74,5 +74,10 @@
 
     return ['link_id']
 
+  def getSingleton(self):
+    """Return singleton Site settings entity, since there is always only one.
+    """
+    return self.getFromFields(link_id=self.DEF_SITE_LINK_ID)
+
 
 logic = Logic()