Products.CMFPlone/plip-1486-redirection: Fomat template

Stephan Klinger <jenkins-z4DKO/[email protected]>
Newsgroups gmane.comp.web.zope.plone.cvs
Message-ID <[email protected]>
Repository: Products.CMFPlone
Branch: refs/heads/plip-1486-redirection
Date: 2017-07-10T09:31:40+03:00
Author: Stephan Klinger (staeff) <[email protected]>
Commit: https://github.com/plone/Products.CMFPlone/commit/91628bf8ab4a671cddba5a37388035a6371be932

Fomat template

Files changed:
M Products/CMFPlone/controlpanel/browser/redirects-manage.pt
M Products/CMFPlone/controlpanel/browser/redirects.py

diff --git a/Products/CMFPlone/controlpanel/browser/redirects-manage.pt b/Products/CMFPlone/controlpanel/browser/redirects-manage.pt
index 19f58b9a2..558e9c44e 100644
--- a/Products/CMFPlone/controlpanel/browser/redirects-manage.pt
+++ b/Products/CMFPlone/controlpanel/browser/redirects-manage.pt
@@ -7,92 +7,120 @@
       i18n:domain="plone">
 
   <body>
-    <div metal:fill-slot="main"
-         tal:define="context_state context/@@plone_context_state">
-      <h1 class="documentFirstHeading" i18n:translate="heading_add_aliases">Manage aliases</h1>
+    <div
+        metal:fill-slot="main"
+        tal:define="context_state context/@@plone_context_state">
+      <h1
+          class="documentFirstHeading"
+          i18n:translate="heading_add_aliases">
+        Manage aliases
+      </h1>
 
-      <dl class="portalMessage info" tal:condition="context_state/is_default_page">
-          <dt i18n:translate="">
-              Info
-          </dt>
-          <dd i18n:translate="help_sharing_page_default_page">
-              You are managing the aliases of a default view in a container.
-              To manage them for the entire container,
-              <a i18n:name="go_here"
-                 i18n:translate="help_aliases_go_here"
-                 tal:define="folder context_state/folder"
-                 tal:attributes="href string:${folder/absolute_url}/@@manage-aliases">go here</a>.
-          </dd>
+      <dl
+          class="portalMessage info"
+          tal:condition="context_state/is_default_page">
+        <dt i18n:translate="">
+          Info
+        </dt>
+        <dd i18n:translate="help_sharing_page_default_page">
+          You are managing the aliases of a default view in a container.
+          To manage them for the entire container,
+          <a
+              i18n:name="go_here"
+              i18n:translate="help_aliases_go_here"
+              tal:define="folder context_state/folder"
+              tal:attributes="href string:${folder/absolute_url}/@@manage-aliases">
+            go here
+          </a>.
+        </dd>
       </dl>
 
       <p i18n:translate="description_adding_aliases">
-      Using this form, you can manage aliases for an item. This
-      is an easy way to make an item available under two different URLs.
+        Using this form, you can manage aliases for an item. This
+        is an easy way to make an item available under two different URLs.
       </p>
 
-      <form tal:attributes="action view/view_url" method="post">
+      <form
+          action="${view/view_url}"
+          method="post">
         <fieldset>
-          <legend i18n:translate="legend_existing_aliases">Existing aliases for this item</legend>
+          <legend i18n:translate="legend_existing_aliases">
+            Existing aliases for this item
+          </legend>
 
           <div class="field"
                tal:define="error options/errors/redirection|nothing;
                            redirection request/title | nothing;"
                tal:attributes="class python:error and 'field error' or 'field'">
-              <label for="title" i18n:translate="label_alias">Alias</label>
+            <label
+                for="title"
+                i18n:translate="label_alias">
+              Alias
+            </label>
 
-              <span class="fieldRequired" title="Required"
-                    i18n:attributes="title"
-                    i18n:translate="label_required">(Required)</span>
+            <span
+                class="fieldRequired"
+                title="Required"
+                i18n:attributes="title"
+                i18n:translate="label_required">
+              (Required)
+            </span>
 
-              <div tal:content="error">Validation error output</div>
+            <div tal:content="error">
+              Validation error output
+            </div>
 
-              <div class="formHelp" i18n:translate="help_alias">
-                  Enter the alternative Short Name or an absolute path where an alias should exist.
-              </div>
+            <div class="formHelp" i18n:translate="help_alias">
+              Enter the absolute path where the alias should exist. The path must start with '/'.
+            </div>
 
-              <input type="text"
-                     name="redirection"
-                     value="#"
-                     size="40"
-                     tal:attributes="value request/redirection | nothing;"
-                     />
+            <input
+                type="text"
+                name="redirection"
+                value="#"
+                size="40"
+                tal:attributes="value request/redirection | nothing;"/>
           </div>
           <div class="formControls">
-            <input class="context"
-                   type="submit"
-                   value="Add"
-                   name="form.button.Add"
-                   i18n:attributes="value"
-                   />
+            <input
+                class="context"
+                type="submit"
+                value="Add"
+                name="form.button.Add"
+                i18n:attributes="value" />
           </div>
 
         </fieldset>
       </form>
 
-      <form tal:attributes="action view/view_url" method="post">
+      <form
+          action="${view/view_url}"
+          method="post">
         <fieldset>
-          <legend i18n:translate="legend_existing_aliases">Existing aliases for this item</legend>
+          <legend i18n:translate="legend_existing_aliases">
+            Existing aliases for this item
+          </legend>
 
           <tal:redirects repeat="redirect view/redirects">
             <div>
               <label>
-              <input type="checkbox"
-                     class="noborder"
-                     name="redirects:tuple"
-                     tal:attributes="value redirect/redirect" />
-
-                <span tal:replace="redirect/path" />
+              <input
+                  type="checkbox"
+                  class="noborder"
+                  name="redirects:tuple"
+                  value="${redirect/redirect}" />
+                ${redirect/path}
               </label>
             </div>
           </tal:redirects>
 
           <div class="formControls">
-            <input class="context"
-                   type="submit"
-                   value="Remove"
-                   name="form.button.Remove"
-                   i18n:attributes="value"
-                   />
+            <input
+                class="context"
+                type="submit"
+                value="Remove"
+                name="form.button.Remove"
+                i18n:attributes="value" />
           </div>
 
         </fieldset>
diff --git a/Products/CMFPlone/controlpanel/browser/redirects.py b/Products/CMFPlone/controlpanel/browser/redirects.py
index e44b9dc90..0fe0f907b 100644
--- a/Products/CMFPlone/controlpanel/browser/redirects.py
+++ b/Products/CMFPlone/controlpanel/browser/redirects.py
@@ -32,9 +32,6 @@ def absolutize_path(path, context=None, is_alias=True):
     if path is None or path == '':
         err = (is_alias and _(u"You have to enter an alias.")
                or _(u"You have to enter a target."))
-    elif '://' in path:
-        err = (is_alias and _(u"An alias is a path from the portal root and doesn't include http:// or alike.")  # noqa
-               or _(u"Target path must be relative to the portal root and not include http:// or the like."))  # noqa
     else:
         if path.startswith('/'):
             context_path = "/".join(portal.getPhysicalPath())
@@ -46,19 +43,13 @@ def absolutize_path(path, context=None, is_alias=True):
             else:
                 context_path = "/".join(context.getPhysicalPath()[:-1])
                 path = "%s/%s" % (context_path, path)
-        # Check whether obj exists and
-        # noqa XXX should we require Modify Alias permission on the target as well?
+        # Check whether obj exists at source path
         if not err and is_alias:
             source = path.split('/')
             while len(source):
                 obj = portal.unrestrictedTraverse(source, None)
                 if obj is None:
                     source = source[:-1]
-                else:
-                    # if not getSecurityManager().checkPermission(ModifyAliases, obj):
-                    if not getSecurityManager().checkPermission(ManagePortal, obj):
-                        obj = None
-                    break
             if obj is None:
                 err = _(u"You don't have the permission to set an alias from the location you provided.")  # noqa
             else:



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.