[Checkins] SVN: grokui.quickstart/trunk/src/grokui/quickstart/quickstart test for grokui.admin availability
Michael Haubenwallner
michael at d2m.at
Thu May 28 09:20:51 EDT 2009
Log message for revision 100511:
test for grokui.admin availability
Changed:
U grokui.quickstart/trunk/src/grokui/quickstart/quickstart.py
U grokui.quickstart/trunk/src/grokui/quickstart/quickstart_templates/quickstart.pt
-=-
Modified: grokui.quickstart/trunk/src/grokui/quickstart/quickstart.py
===================================================================
--- grokui.quickstart/trunk/src/grokui/quickstart/quickstart.py 2009-05-28 12:47:44 UTC (rev 100510)
+++ grokui.quickstart/trunk/src/grokui/quickstart/quickstart.py 2009-05-28 13:20:50 UTC (rev 100511)
@@ -18,8 +18,15 @@
def logged_in(self):
return not IUnauthenticatedPrincipal.providedBy(self.request.principal)
- def available_apps(self):
+ def apps_available(self):
apps=[]
for item in list(self.context.values()):
apps.append({'name':item.__name__,'url':self.url(item)})
return apps
+
+ def admin_available(self):
+ try:
+ admin=bool(pkg_resources.require('grokui.admin')[0])
+ except pkg_resources.DistributionNotFound:
+ admin=False
+ return admin
Modified: grokui.quickstart/trunk/src/grokui/quickstart/quickstart_templates/quickstart.pt
===================================================================
--- grokui.quickstart/trunk/src/grokui/quickstart/quickstart_templates/quickstart.pt 2009-05-28 12:47:44 UTC (rev 100510)
+++ grokui.quickstart/trunk/src/grokui/quickstart/quickstart_templates/quickstart.pt 2009-05-28 13:20:50 UTC (rev 100511)
@@ -28,16 +28,16 @@
<div id="content">
<div tal:condition="view/logged_in">
<div><b>Available applications</b></div>
- <ul tal:condition="view/available_apps">
- <li tal:repeat="app view/available_apps">
+ <ul tal:condition="view/apps_available">
+ <li tal:repeat="app view/apps_available">
<a tal:attributes="href app/url"
tal:content="app/name" />
</li>
</ul>
- <div tal:condition="not:view/available_apps">No apps available<br><br></div>
+ <div tal:condition="not:view/apps_available">No apps available<br><br></div>
</div>
- <div id="login" tal:condition="not:view/logged_in">» <a href="/@@login.html?nextURL=/applications">Login & manage applications</a></div>
- <div id="manage" tal:condition="view/logged_in">» <a href="/applications">Manage applications</a></div>
+ <div id="login" tal:condition="not:view/logged_in">» <a href="/@@login.html?nextURL=/">Login</a></div>
+ <div id="manage" tal:condition="python:view.logged_in() and view.admin_available()">» <a href="/applications">Manage applications</a></div>
<div id="logout" tal:condition="view/logged_in">» <a href="/@@logout.html?nextURL=/">Logout</a></div>
</div>
<div id="footer">
More information about the Checkins
mailing list