Commit 58f528bb authored by Jérome Perrin's avatar Jérome Perrin

*: use getPortalObject directly

Products.CMFCore's version 2.7.0 of portal_url.getPortalObject
returns the portal in an incomplete acquisition context, which
causes issues when the site is registered as ISiteRoot utility
(the typical error being AttributeError REQUEST)

ERP5Site.getPortalObject works just fine and is used in many
places, this commit replaces all occurences of
portal_url.getPortalObject by getPortalObject.
parent 5b61fec0
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
""" """
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery from Products.ZSQLCatalog.SQLCatalog import SimpleQuery
from Products.ERP5Form.Report import ReportSection from Products.ERP5Form.Report import ReportSection
portal = context.portal_url.getPortalObject() portal = context.getPortalObject()
request = portal.REQUEST request = portal.REQUEST
cat_tool = portal.portal_categories cat_tool = portal.portal_categories
......
"""Client & vendors accounts. """Client & vendors accounts.
""" """
portal = context.portal_url.getPortalObject() portal = context.getPortalObject()
from Products.ERP5Form.Report import ReportSection from Products.ERP5Form.Report import ReportSection
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
from Products.ERP5Form.Report import ReportSection from Products.ERP5Form.Report import ReportSection
request = context.REQUEST request = context.REQUEST
portal = context.portal_url.getPortalObject() portal = context.getPortalObject()
at_date = request['at_date'] at_date = request['at_date']
from_date = request.get('from_date', None) from_date = request.get('from_date', None)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
from Products.ERP5Form.Report import ReportSection from Products.ERP5Form.Report import ReportSection
request = context.REQUEST request = context.REQUEST
portal = context.portal_url.getPortalObject() portal = context.getPortalObject()
at_date = request['at_date'] at_date = request['at_date']
section_category = request['transaction_section_category'] section_category = request['transaction_section_category']
......
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<template bottommargin='2cm' showboundary='0' topmargin='2cm' <template bottommargin='2cm' showboundary='0' topmargin='2cm'
rightmargin='2cm' tal:define='portal python:here.portal_url.getPortalObject()' rightmargin='2cm' tal:define='portal python:here.getPortalObject()'
filename='journal.pdf' pagesize='A4' allowsplitting='1' landscape='0' leftmargin='2cm'> filename='journal.pdf' pagesize='A4' allowsplitting='1' landscape='0' leftmargin='2cm'>
<pagetemplate startframe='content' id='FirstPage'> <pagetemplate startframe='content' id='FirstPage'>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# XXX This script could be deleted after the full transition to PAS (don't forget to update assignment workflow too) # XXX This script could be deleted after the full transition to PAS (don't forget to update assignment workflow too)
# user_folder: NuxUserGroups or PluggableAuthService at the root of the ERP5Site. # user_folder: NuxUserGroups or PluggableAuthService at the root of the ERP5Site.
user_folder = context.portal_url.getPortalObject()['acl_users'] user_folder = context.getPortalObject()['acl_users']
# This script can be bypassed in the context of PAS use because user groups are # This script can be bypassed in the context of PAS use because user groups are
# automaticcaly managed and set by ERP5Security/ERP5GroupManage.py # automaticcaly managed and set by ERP5Security/ERP5GroupManage.py
......
...@@ -78,5 +78,5 @@ class SkinConfiguratorItemMixin(ConfiguratorItemMixin): ...@@ -78,5 +78,5 @@ class SkinConfiguratorItemMixin(ConfiguratorItemMixin):
.manage_addPythonScript(id = script_id) .manage_addPythonScript(id = script_id)
script = container._getOb(script_id) script = container._getOb(script_id)
script.ZPythonScript_edit(script_params, script_content) script.ZPythonScript_edit(script_params, script_content)
container.portal_url.getPortalObject().changeSkin(None) container.getPortalObject().changeSkin(None)
return script return script
<tal:block tal:define="dummy python:request.RESPONSE.setHeader('Content-Type', 'text/html;; charset=utf-8'); <tal:block tal:define="dummy python:request.RESPONSE.setHeader('Content-Type', 'text/html;; charset=utf-8');
global portal here/portal_url/getPortalObject; global portal here/getPortalObject;
global portal_path portal/portal_url/getPortalPath; global portal_path portal/portal_url/getPortalPath;
portal_preferences python: here.getPortalObject().portal_preferences; portal_preferences python: portal.portal_preferences;
global preferred_html_style_developper_mode portal_preferences/getPreferredHtmlStyleDevelopperMode; global preferred_html_style_developper_mode portal_preferences/getPreferredHtmlStyleDevelopperMode;
global preferred_html_style_translator_mode portal_preferences/getPreferredHtmlStyleTranslatorMode; global preferred_html_style_translator_mode portal_preferences/getPreferredHtmlStyleTranslatorMode;
global preferred_html_style_contextual_help portal_preferences/getPreferredHtmlStyleContextualHelp; global preferred_html_style_contextual_help portal_preferences/getPreferredHtmlStyleContextualHelp;
......
...@@ -29,7 +29,7 @@ Note: ...@@ -29,7 +29,7 @@ Note:
</thead> </thead>
<tbody> <tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block tal:define="portal here/portal_url/getPortalObject; <tal:block tal:define="portal here/getPortalObject;
caller python: getattr(context, 'Zuite_setSkipSave', None); caller python: getattr(context, 'Zuite_setSkipSave', None);
no_file_update python: caller() if caller is not None else True;"> no_file_update python: caller() if caller is not None else True;">
<tr> <tr>
......
...@@ -29,7 +29,7 @@ Note: ...@@ -29,7 +29,7 @@ Note:
</thead> </thead>
<tbody> <tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block tal:define="portal here/portal_url/getPortalObject; <tal:block tal:define="portal here/getPortalObject;
caller python: getattr(context, 'Zuite_setSkipSave', None); caller python: getattr(context, 'Zuite_setSkipSave', None);
no_file_update python: caller() if caller is not None else True;"> no_file_update python: caller() if caller is not None else True;">
<tr> <tr>
......
...@@ -29,7 +29,7 @@ Note: ...@@ -29,7 +29,7 @@ Note:
</thead> </thead>
<tbody> <tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block tal:define="portal here/portal_url/getPortalObject; <tal:block tal:define="portal here/getPortalObject;
caller python: getattr(context, 'Zuite_setSkipSave', None); caller python: getattr(context, 'Zuite_setSkipSave', None);
no_file_update python: caller() if caller is not None else True;"> no_file_update python: caller() if caller is not None else True;">
<tr> <tr>
......
...@@ -29,7 +29,7 @@ Note: ...@@ -29,7 +29,7 @@ Note:
</thead> </thead>
<tbody> <tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block tal:define="portal here/portal_url/getPortalObject; <tal:block tal:define="portal here/getPortalObject;
caller python: getattr(context, 'Zuite_setSkipSave', None); caller python: getattr(context, 'Zuite_setSkipSave', None);
no_file_update python: caller() if caller is not None else True;"> no_file_update python: caller() if caller is not None else True;">
<tr> <tr>
......
...@@ -29,7 +29,7 @@ Note: ...@@ -29,7 +29,7 @@ Note:
</thead> </thead>
<tbody> <tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block tal:define="portal here/portal_url/getPortalObject; <tal:block tal:define="portal here/getPortalObject;
caller python: getattr(context, 'Zuite_setSkipSave', None); caller python: getattr(context, 'Zuite_setSkipSave', None);
no_file_update python: caller() if caller is not None else True;"> no_file_update python: caller() if caller is not None else True;">
<tr> <tr>
......
...@@ -25,7 +25,7 @@ Note: ...@@ -25,7 +25,7 @@ Note:
</thead> </thead>
<tbody> <tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block tal:define="portal here/portal_url/getPortalObject; <tal:block tal:define="portal here/getPortalObject;
caller python: getattr(context, 'Zuite_setSkipSave', None); caller python: getattr(context, 'Zuite_setSkipSave', None);
no_file_update python: caller() if caller is not None else True;"> no_file_update python: caller() if caller is not None else True;">
<tr> <tr>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
result = '' result = ''
request = context.REQUEST request = context.REQUEST
translate = context.portal_url.getPortalObject().Localizer.erp5_ui.gettext translate = context.getPortalObject().Localizer.erp5_ui.gettext
listboxline_list = context.get_value('default', render_format='list', REQUEST=request) listboxline_list = context.get_value('default', render_format='list', REQUEST=request)
......
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<template bottommargin='0.665cm' showboundary='0' topmargin='0.635cm' rightmargin='0.665cm' tal:define='portal python:here.portal_url.getPortalObject()' filename='accounting_details.pdf' pagesize='A4' allowsplitting='1' landscape='0' leftmargin='0.635cm'> <template bottommargin='0.665cm' showboundary='0' topmargin='0.635cm' rightmargin='0.665cm' tal:define='portal python:here.getPortalObject()' filename='accounting_details.pdf' pagesize='A4' allowsplitting='1' landscape='0' leftmargin='0.635cm'>
<pagetemplate startframe='content' id='FirstPage'> <pagetemplate startframe='content' id='FirstPage'>
<static> <static>
<rectangle z='' height='1.452cm' width='19.701cm' stroke='(0.0,0.0,0.0)' y='27.613cm' x='0.635cm' linewidth='1' fill='(0.4,0.4,0.4)'/> <rectangle z='' height='1.452cm' width='19.701cm' stroke='(0.0,0.0,0.0)' y='27.613cm' x='0.635cm' linewidth='1' fill='(0.4,0.4,0.4)'/>
......
...@@ -487,7 +487,7 @@ fieldset { ...@@ -487,7 +487,7 @@ fieldset {
/* listbox */ /* listbox */
.ListSummary { .ListSummary {
background: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/tab_left.png') top left no-repeat; background: url('<dtml-var expr="getPortalObject().absolute_url()">/images/tab_left.png') top left no-repeat;
color: #000; color: #000;
background-color: <dtml-var document_background_color>; background-color: <dtml-var document_background_color>;
padding-left: 10px; padding-left: 10px;
...@@ -585,28 +585,28 @@ fieldset { ...@@ -585,28 +585,28 @@ fieldset {
} }
#favourites button .image { #favourites button .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/favourite.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/favourite.png');
} }
#modules button .image { #modules button .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/appearance.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/appearance.png');
} }
#language button .image { #language button .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/language.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/language.png');
} }
#search button .image { #search button .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/search.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/search.png');
} }
#actions button .image{ #actions button .image{
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/exec16.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/exec16.png');
position: relative; position: relative;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
#jump button .image { #jump button .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/jump.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/jump.png');
position: relative; position: relative;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
...@@ -630,76 +630,76 @@ fieldset { ...@@ -630,76 +630,76 @@ fieldset {
} }
#context_bar .separator { #context_bar .separator {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/sepacla.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/sepacla.png');
height: 16px; height: 16px;
} }
#context_bar .tool_buttons .jump_first .image { #context_bar .tool_buttons .jump_first .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/2leftarrowb.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/2leftarrowb.png');
} }
#context_bar .tool_buttons .jump_previous .image { #context_bar .tool_buttons .jump_previous .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/1leftarrowb.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/1leftarrowb.png');
} }
#context_bar .tool_buttons .jump_next .image { #context_bar .tool_buttons .jump_next .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/1rightarrowb.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/1rightarrowb.png');
} }
#context_bar .tool_buttons .jump_last .image { #context_bar .tool_buttons .jump_last .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/2rightarrowb.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/2rightarrowb.png');
} }
#context_bar .tool_buttons .list_mode .image { #context_bar .tool_buttons .list_mode .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/text_block.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/text_block.png');
} }
#context_bar .tool_buttons .new .image { #context_bar .tool_buttons .new .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/filenew.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/filenew.png');
} }
#context_bar .tool_buttons .clone .image { #context_bar .tool_buttons .clone .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/fileclone.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/fileclone.png');
} }
#context_bar .tool_buttons .cut .image { #context_bar .tool_buttons .cut .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/editcut.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/editcut.png');
} }
#context_bar .tool_buttons .copy .image { #context_bar .tool_buttons .copy .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/editcopy.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/editcopy.png');
} }
#context_bar .tool_buttons .paste .image { #context_bar .tool_buttons .paste .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/editpaste.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/editpaste.png');
} }
#context_bar .tool_buttons .delete .image { #context_bar .tool_buttons .delete .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/editdelete.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/editdelete.png');
} }
#context_bar .tool_buttons .find .image { #context_bar .tool_buttons .find .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/find.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/find.png');
} }
#context_bar .tool_buttons .show_all .image { #context_bar .tool_buttons .show_all .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/showall.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/showall.png');
} }
#context_bar .tool_buttons .filter .image { #context_bar .tool_buttons .filter .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/filter.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/filter.png');
} }
#context_bar .tool_buttons .filter_on .image { #context_bar .tool_buttons .filter_on .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/filter_on.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/filter_on.png');
} }
#context_bar .tool_buttons .sort .image { #context_bar .tool_buttons .sort .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/sort.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/sort.png');
} }
#context_bar .tool_buttons .configure .image { #context_bar .tool_buttons .configure .image {
background-image: url('<dtml-var expr="portal_url.getPortalObject().absolute_url()">/images/configure.png'); background-image: url('<dtml-var expr="getPortalObject().absolute_url()">/images/configure.png');
} }
#navigation_buttons { #navigation_buttons {
......
...@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--> -->
</tal:block> </tal:block>
<tal:block tal:define="form_action string:logged_in; <tal:block tal:define="form_action string:logged_in;
js_list python: ['%s/login_form.js' % (here.portal_url.getPortalObject().absolute_url(), )]"> js_list python: ['%s/login_form.js' % (here.getPortalObject().absolute_url(), )]">
<tal:block metal:use-macro="here/main_template/macros/master"> <tal:block metal:use-macro="here/main_template/macros/master">
<tal:block metal:fill-slot="main"> <tal:block metal:fill-slot="main">
<div class="content login"> <div class="content login">
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</tal:block> </tal:block>
</tal:block> </tal:block>
</tal:block> </tal:block>
<tal:block tal:define="portal_object here/portal_url/getPortalObject"> <tal:block tal:define="portal_object here/getPortalObject">
<tal:block tal:condition="not: sheet_per_report_section"> <tal:block tal:condition="not: sheet_per_report_section">
<table:table tal:attributes="table:name python:unicode(form.getProperty('title'), 'utf8')" i18n:attributes="table:name"> <table:table tal:attributes="table:name python:unicode(form.getProperty('title'), 'utf8')" i18n:attributes="table:name">
<!-- at least one table-column element is required for ODF to validate --> <!-- at least one table-column element is required for ODF to validate -->
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
</tal:block> </tal:block>
</tal:block> </tal:block>
</tal:block> </tal:block>
<tal:block tal:define="portal_object here/portal_url/getPortalObject; <tal:block tal:define="portal_object here/getPortalObject;
dummy python:report_item.popReport(portal_object, render_prefix=render_prefix)"/> dummy python:report_item.popReport(portal_object, render_prefix=render_prefix)"/>
</tal:block> </tal:block>
</tal:block> </tal:block>
......
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
</tal:block> </tal:block>
<tal:block tal:condition="not: rendered_report_item_list"> <tal:block tal:condition="not: rendered_report_item_list">
<tal:block tal:define="portal_object here/portal_url/getPortalObject"> <tal:block tal:define="portal_object here/getPortalObject">
<tal:block tal:repeat="report_item report_item_list"> <tal:block tal:repeat="report_item report_item_list">
<tal:block tal:define="here python:report_item.getObject(portal_object); <tal:block tal:define="here python:report_item.getObject(portal_object);
render_prefix python: 'x%s' % (repeat['report_item'].index, ); render_prefix python: 'x%s' % (repeat['report_item'].index, );
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<title>List Print</title>\n <title>List Print</title>\n
<author>Nexedi</author>\n <author>Nexedi</author>\n
<subject>Print Example</subject>\n <subject>Print Example</subject>\n
<content tal:define="localizer python: here.portal_url.getPortalObject().Localizer; ">\n <content tal:define="localizer python: here.getPortalObject().Localizer; ">\n
\n \n
<table splitbyrow="1" repeatrows="0" repeatcols="0" style="AttributesTable" >\n <table splitbyrow="1" repeatrows="0" repeatcols="0" style="AttributesTable" >\n
<tr>\n <tr>\n
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
meta_reference python: here.getProperty('reference') or ''; meta_reference python: here.getProperty('reference') or '';
meta_description python: here.getProperty('description') or ''; meta_description python: here.getProperty('description') or '';
meta_title python: here.getProperty('title') or here.getPortalObject().title_or_id(); meta_title python: here.getProperty('title') or here.getPortalObject().title_or_id();
global portal here/portal_url/getPortalObject; global portal here/getPortalObject;
global portal_path portal_path | portal/absolute_url; global portal_path portal_path | portal/absolute_url;
request python: context.REQUEST; request python: context.REQUEST;
dynamic_path_url python: request['PATH_INFO']; dynamic_path_url python: request['PATH_INFO'];
......
...@@ -185,7 +185,7 @@ class ReferCheckerBeforeTraverseHook: ...@@ -185,7 +185,7 @@ class ReferCheckerBeforeTraverseHook:
if user is not None and 'Manager' in user.getRoles(): if user is not None and 'Manager' in user.getRoles():
return return
portal_url = container.portal_url.getPortalObject().absolute_url() portal_url = container.getPortalObject().absolute_url()
if http_referer != '': if http_referer != '':
# if HTTP_REFERER is set, user can acces the object if referer is ok # if HTTP_REFERER is set, user can acces the object if referer is ok
if http_referer.startswith(portal_url): if http_referer.startswith(portal_url):
......
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
<metal:block define-macro="master"> <metal:block define-macro="master">
<tal:block tal:define="title here/Title; <tal:block tal:define="title here/Title;
enctype string:multipart/form-data; enctype string:multipart/form-data;
portal context/portal_url/getPortalObject; portal context/getPortalObject;
global css_list python:['%s/tabber_style.css' % (portal.absolute_url(),)]; global css_list python:['%s/tabber_style.css' % (portal.absolute_url(),)];
global js_list python:['%s/erp5_tabber.js' % (portal.absolute_url(),)]"> global js_list python:['%s/erp5_tabber.js' % (portal.absolute_url(),)]">
<tal:block metal:use-macro="here/main_template/macros/master"> <tal:block metal:use-macro="here/main_template/macros/master">
<tal:block metal:fill-slot="main"> <tal:block metal:fill-slot="main">
<tal:block tal:condition="here/portal_membership/isAnonymousUser"> <tal:block tal:condition="portal/portal_membership/isAnonymousUser">
<tal:block tal:define="dummy python:request.RESPONSE.redirect('%s/login_form' % portal.absolute_url())" /> <tal:block tal:define="dummy python:request.RESPONSE.redirect('%s/login_form' % portal.absolute_url())" />
</tal:block> </tal:block>
<tal:block tal:condition="python:not here.portal_membership.isAnonymousUser()"> <tal:block tal:condition="python:not portal.portal_membership.isAnonymousUser()">
<div class="index_html" style="margin:20px 40px 0 40px; padding:0; text-align:left;"> <div class="index_html" style="margin:20px 40px 0 40px; padding:0; text-align:left;">
<div class="document"> <div class="document">
<div class="actions"> <div class="actions">
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</div> </div>
<p class="clear" /> <p class="clear" />
</div> </div>
<tal:block tal:condition="python: here.getPortalObject().restrictedTraverse('portal_gadgets', None) is not None"> <tal:block tal:condition="python: portal.restrictedTraverse('portal_gadgets', None) is not None">
<tal:block tal:condition="exists:here/ERP5Site_viewHomeAreaRenderer" <tal:block tal:condition="exists:here/ERP5Site_viewHomeAreaRenderer"
tal:replace="structure python: here.ERP5Site_viewHomeAreaRenderer(create_default_pad=True, tal:replace="structure python: here.ERP5Site_viewHomeAreaRenderer(create_default_pad=True,
make_security_check=True)" /> make_security_check=True)" />
......
...@@ -16,7 +16,7 @@ ConfigUserFilesPath="" ...@@ -16,7 +16,7 @@ ConfigUserFilesPath=""
# SECURITY TIP: Uncomment the 3 following code lines to force the Plone Member Home Folder as fixed path # SECURITY TIP: Uncomment the 3 following code lines to force the Plone Member Home Folder as fixed path
# You can do it as well with wysiwyg_support templates customization # You can do it as well with wysiwyg_support templates customization
# it's just more secure # it's just more secure
# portal=context.portal_url.getPortalObject() # portal=context.getPortalObject()
# portal_url=portal.absolute_url() # portal_url=portal.absolute_url()
# ConfigUserFilesPath = portal.portal_membership.getHomeUrl().replace(portal_url, '') + '/' # ConfigUserFilesPath = portal.portal_membership.getHomeUrl().replace(portal_url, '') + '/'
...@@ -269,10 +269,10 @@ def GetFoldersAndFiles( resourceType, currentFolder ): ...@@ -269,10 +269,10 @@ def GetFoldersAndFiles( resourceType, currentFolder ):
obj = context.restrictedTraverse(currentFolder.lstrip('/')) obj = context.restrictedTraverse(currentFolder.lstrip('/'))
except Exception as e: except Exception as e:
obj = context.portal_url.getPortalObject() obj = context.getPortalObject()
else : else :
obj = context.portal_url.getPortalObject() obj = context.getPortalObject()
for object in obj.objectValues(): for object in obj.objectValues():
...@@ -304,10 +304,10 @@ def GetFolders( resourceType, currentFolder ): ...@@ -304,10 +304,10 @@ def GetFolders( resourceType, currentFolder ):
obj = context.restrictedTraverse(currentFolder.lstrip('/')) obj = context.restrictedTraverse(currentFolder.lstrip('/'))
#except Exception,e: #except Exception,e:
# obj = context.portal_url.getPortalObject() # obj = context.getPortalObject()
else : else :
#obj = context.portal_url.getPortalObject() #obj = context.getPortalObject()
return xmlString([],resourceType,1) return xmlString([],resourceType,1)
...@@ -346,7 +346,7 @@ def CreateFolder(currentFolder, folderName ): ...@@ -346,7 +346,7 @@ def CreateFolder(currentFolder, folderName ):
if currentFolder != "/" : if currentFolder != "/" :
obj = context.restrictedTraverse(currentFolder.lstrip('/')) obj = context.restrictedTraverse(currentFolder.lstrip('/'))
else : else :
obj = context.portal_url.getPortalObject() obj = context.getPortalObject()
sErrorNumber="" sErrorNumber=""
# error cases # error cases
...@@ -382,7 +382,7 @@ def UploadFile(resourceType, currentFolder, data, title) : ...@@ -382,7 +382,7 @@ def UploadFile(resourceType, currentFolder, data, title) :
if currentFolder != "/" : if currentFolder != "/" :
obj = context.restrictedTraverse(currentFolder.lstrip('/')) obj = context.restrictedTraverse(currentFolder.lstrip('/'))
else : else :
obj = context.portal_url.getPortalObject() obj = context.getPortalObject()
error="" error=""
idObj="" idObj=""
...@@ -457,7 +457,7 @@ RESPONSE = request.RESPONSE ...@@ -457,7 +457,7 @@ RESPONSE = request.RESPONSE
dicoRequest = request.form dicoRequest = request.form
message_error="" message_error=""
portal_url=context.portal_url.getPortalObject().absolute_url() portal_url=context.getPortalObject().absolute_url()
server_url = request.SERVER_URL server_url = request.SERVER_URL
portal_path = portal_url.replace(server_url,'') portal_path = portal_url.replace(server_url,'')
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
xmlns:i18n="http://xml.zope.org/namespaces/i18n"> xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<tal:block metal:define-macro="header_definitions"> <tal:block metal:define-macro="header_definitions">
<tal:block tal:define=" <tal:block tal:define="
global portal here/portal_url/getPortalObject; global portal here/getPortalObject;
global portal_path portal_path | portal/absolute_url; global portal_path portal_path | portal/absolute_url;
local_parameter_list local_parameter_list | python: {}; local_parameter_list local_parameter_list | python: {};
action_context python: portal.restrictedTraverse(request.get('object_path', '?'), here); action_context python: portal.restrictedTraverse(request.get('object_path', '?'), here);
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
title title | python:'ERP5'; title title | python:'ERP5';
header_title header_title | nothing; header_title header_title | nothing;
" "
tal:content="python: header_title or '%s | %s' % (title, here.getPortalObject().title_or_id())" tal:content="python: header_title or '%s | %s' % (title, portal.title_or_id())"
></title> ></title>
<link rel="icon" tal:attributes="href python: portal_path + '/favicon.ico'" type="image/x-icon" /> <link rel="icon" tal:attributes="href python: portal_path + '/favicon.ico'" type="image/x-icon" />
<link rel="shortcut icon" tal:attributes="href python: portal_path + '/favicon.ico'" type="image/x-icon" /> <link rel="shortcut icon" tal:attributes="href python: portal_path + '/favicon.ico'" type="image/x-icon" />
......
...@@ -871,8 +871,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate): ...@@ -871,8 +871,7 @@ class ERP5Form(Base, ZMIForm, ZopePageTemplate):
return append return append
def add_default_field_library(): def add_default_field_library():
portal_url = getToolByName(self, 'portal_url') portal = self.getPortalObject()
portal = portal_url.getPortalObject()
portal_skins = getToolByName(self, 'portal_skins') portal_skins = getToolByName(self, 'portal_skins')
default_field_library_path = portal.getProperty( default_field_library_path = portal.getProperty(
......
...@@ -1695,7 +1695,7 @@ def makeTreeList(here, form, root_dict, report_path, base_category, ...@@ -1695,7 +1695,7 @@ def makeTreeList(here, form, root_dict, report_path, base_category,
portal_categories = getattr(form, 'portal_categories', None) portal_categories = getattr(form, 'portal_categories', None)
portal_domains = getattr(form, 'portal_domains', None) portal_domains = getattr(form, 'portal_domains', None)
portal_object = form.portal_url.getPortalObject() portal_object = form.getPortalObject()
if len(report_path): if len(report_path):
base_category = report_path[0] base_category = report_path[0]
......
...@@ -286,7 +286,7 @@ def createZODBPythonScript(container, script_id, script_params, ...@@ -286,7 +286,7 @@ def createZODBPythonScript(container, script_id, script_params,
.manage_addPythonScript(id = script_id) .manage_addPythonScript(id = script_id)
script = container._getOb(script_id) script = container._getOb(script_id)
script.ZPythonScript_edit(script_params, script_content) script.ZPythonScript_edit(script_params, script_content)
container.portal_url.getPortalObject().changeSkin(None) container.getPortalObject().changeSkin(None)
return script return script
def removeZODBPythonScript(container, script_id): def removeZODBPythonScript(container, script_id):
...@@ -305,7 +305,7 @@ def createZODBFile(container, file_id, file_content_type, file_content): ...@@ -305,7 +305,7 @@ def createZODBFile(container, file_id, file_content_type, file_content):
content_type=file_content_type, content_type=file_content_type,
filedata=file_content) filedata=file_content)
container.portal_url.getPortalObject().changeSkin(None) container.getPortalObject().changeSkin(None)
return zodb_file return zodb_file
# memcache tool # memcache tool
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment