[Mpuls-commits] r5844 - in base/trunk/mpulsweb: lib templates

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Fri Mar 2 14:38:54 CET 2012


Author: ludwig
Date: 2012-03-02 14:38:54 +0100 (Fri, 02 Mar 2012)
New Revision: 5844

Modified:
   base/trunk/mpulsweb/lib/helpers.py
   base/trunk/mpulsweb/templates/main.mako
Log:
Issue 2738 Replace url_for with url calls in main.mako


Modified: base/trunk/mpulsweb/lib/helpers.py
===================================================================
--- base/trunk/mpulsweb/lib/helpers.py	2012-03-02 13:10:36 UTC (rev 5843)
+++ base/trunk/mpulsweb/lib/helpers.py	2012-03-02 13:38:54 UTC (rev 5844)
@@ -36,11 +36,11 @@
 import datetime
 
 from libmpuls.service.tags import TagSetterConfig, TagSetter
-from pylons import config, app_globals as g, request, url
+from pylons import config, app_globals as g, request, url as url2
 from mpulsweb.lib.translation import _
 
 # Use url_for from prior versions
-from routes import url_for
+from routes import url_for as url_for2
 
 from webhelpers.html import escape, literal, url_escape
 from webhelpers.html.tags import *
@@ -59,7 +59,19 @@
 
 log = logging.getLogger(__name__)
 
+# XXX Test propose
+def url_for(*args, **kargs):
+    tmp_url = url_for2(*args, **kargs)
+    print "XXX url_for", tmp_url
+    return tmp_url
 
+def url(*args, **kargs):
+    tmp_url = url2(*args, **kargs)
+    print "XXX url", tmp_url
+    return tmp_url
+
+# XXX End test code
+
 # unicode helper
 def ensure_unicode(s):
     """Convert s to a unicode object.

Modified: base/trunk/mpulsweb/templates/main.mako
===================================================================
--- base/trunk/mpulsweb/templates/main.mako	2012-03-02 13:10:36 UTC (rev 5843)
+++ base/trunk/mpulsweb/templates/main.mako	2012-03-02 13:38:54 UTC (rev 5844)
@@ -4,7 +4,7 @@
   <div id="statusbar">
     ${_('Login as')}:
     % if g.mpuls_config.is_enabled('module', 'administration'):
-        <a href="${h.url_for(controller='/usersettings', action='showSettings')}"
+        <a href="${h.url(controller='usersettings', action='showSettings')}"
            title="${_('My Account')}"
            id="userSettings"
            onclick="return checkModification();">
@@ -28,7 +28,7 @@
   <div id="startmenu">
     <ul>
       <li>
-        <a href="${h.url_for(controller='/')}"
+        <a href="${h.url('/')}"
            id="blackBoard"
            onclick="return checkModification();">
           ${_('Black board')}
@@ -36,7 +36,7 @@
       </li>
       % if g.mpuls_config.is_enabled('module', 'administration'):
       <li>
-        <a href="${h.url_for(controller='/usersettings', action='showSettings')}"
+        <a href="${h.url(controller='usersettings', action='showSettings')}"
            id="usetSettingsShowSettings"
            onclick="return checkModification();">
           ${_('My Account')}
@@ -44,13 +44,13 @@
       </li>
       % endif
       <li>
-          <a href="${h.url_for(controller='/help')}"
+          <a href="${h.url(controller='help', action='index')}"
              id="help"
            onclick="return checkModification();">
            ${_('Help')}</a>
       </li>
       <li>
-        <a href="${h.url_for(controller='/auth', action='logout')}"
+        <a href="${h.url(controller='auth', action='logout')}"
            id="logout"
            onclick="return checkModification();">
           ${_('Logout')}</a>
@@ -60,7 +60,7 @@
 </%def>
 
 <%def name="buildNavipath()">
-  <li><a href="${h.url_for(controller='/')}"
+  <li><a href="${h.url('/')}"
          id="breadCrumbRoot"
          onclick="return checkModification();">${_('%s Start') % h.get_app_title()}</a></li>
 </%def>
@@ -83,14 +83,14 @@
           <h1>${_('%s Start') % h.get_app_title()}</h1>
           <ul>
             <li>
-              <a href="${h.url_for(controller='/')}" id="blackBoardSideNavigation">
+              <a href="${h.url('/')}" id="blackBoardSideNavigation">
                 ${_('Black board')}
               </a>
             </li>
             ## APPOINTMENTS 
             % if g.mpuls_config.is_enabled('module', 'appointments'):
               <li>
-                <a href="${h.url_for(controller='/appointment',
+                <a href="${h.url(controller='appointment',
                                      action='overview')}"
                    id="appointmentOverview">
                   ${_('Events')}
@@ -100,7 +100,7 @@
             ## DOCUMENTS
             % if g.mpuls_config.is_enabled('module', 'documents'):
               <li>
-                <a href="${h.url_for(controller='/document', 
+                <a href="${h.url(controller='document', 
                                      action='globalOverview')}"
                    id="documentGlobalOverview">
                   ${_('Documents')}
@@ -117,7 +117,7 @@
           <h1>${_('Case Management')}</h1>
           <ul>
             <li>
-              <a href="${h.url_for(controller='/case_overview',
+              <a href="${h.url(controller='case_overview',
                                    action='overview')}"
                  id="caseoverviewOverview">
                 ${_('Case documents	')}
@@ -126,7 +126,7 @@
             % if h.hasRole(['cm']):
               % if g.mpuls_config.is_enabled('case-module', 'create'):
               <li>
-                <a href="${h.url_for(controller='/case', action='new')}"
+                <a href="${h.url(controller='case', action='new')}"
                    id="caseNew">
                   ${_('New case document')}
                 </a> 
@@ -134,7 +134,7 @@
               % endif
               % if g.mpuls_config.is_enabled('case-module', 'import'):
                 <li>
-                  <a href="${h.url_for(controller='/case', action='importCase')}"
+                  <a href="${h.url(controller='case', action='importCase')}"
                      id="caseImportCase">
                     ${_('Import case document')}
                   </a>
@@ -152,7 +152,7 @@
           <h1>${_('Overview')}</h1>
             <ul>
               <li>
-                <a href="${h.url_for(controller='/evaluation_overview', action='index')}"
+                <a href="${h.url(controller='evaluation_overview', action='index')}"
                    id="evaluationOverviewIndex">
                   ${_('Agency')}
                 </a>
@@ -180,21 +180,21 @@
         <h1>${_('Administration')}</h1>
         <ul>
           <li>
-            <a href="${h.url_for(controller='/administration',
+            <a href="${h.url(controller='administration',
                                  action='overviewUser')}"
                id="administrationOverviewUser"> 
               ${_('User')}
             </a>
           </li>
           <li>
-            <a href="${h.url_for(controller='/administration',
+            <a href="${h.url(controller='administration',
                                  action='overviewUserGroups')}"
                id="administrationOverviewUserGroups">
               ${_('Usergroup')}
             </a>
           </li>
           <li>
-            <a href="${h.url_for(controller='/settings')}"
+            <a href="${h.url(controller='settings', action='index')}"
                id="settings">
               ${_('Settings')}
             </a>
@@ -209,7 +209,7 @@
   <ul>
     % for eval in g.mpuls_config.get('evaluations', 'enabled'): 
       <li>
-        <a href="${h.url_for(controller='/evaluate', action='evaluate',
+        <a href="${h.url(controller='evaluate', action='evaluate',
                              id=eval.get('id'))}"
            id="evaluateEvaluate">${eval.get('name')}</a>
       </li>
@@ -234,7 +234,7 @@
 <%def name="buildFooter()">
   <div id="footer">
     <div id="version_str">
-    <a href="${h.url_for(controller='/info')}"
+    <a href="${h.url(controller='info', action='index')}"
            onclick="return checkModification();"
            id="info">
           ${_('Info')}</a>
@@ -275,9 +275,9 @@
 </span>
 <div id="header">
   <div class="left" id="logo">
-    <a href="${h.url_for(controller='/')}"
+    <a href="${h.url('/')}"
        onclick="return checkModification();">
-      <img src="${h.url_for('/images/logos/logo_ka_75.png')}" 
+      <img src="${h.url('/images/logos/logo_ka_75.png')}" 
            alt="${_('Logo agency')}" border="0">
     </a>
   </div>



More information about the Mpuls-commits mailing list