[Erp5-report] r33552 rafael - in /erp5/trunk/bt5/erp5_development_wizard: ExtensionTemplate...

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 10 06:43:48 CET 2010


Author: rafael
Date: Wed Mar 10 06:43:46 2010
New Revision: 33552

URL: http://svn.erp5.org?rev=33552&view=rev
Log:
lxml.html.tostring seems not work well when it has tal:block, so context substitution was moved to first.

Modified:
    erp5/trunk/bt5/erp5_development_wizard/ExtensionTemplateItem/Development.py
    erp5/trunk/bt5/erp5_development_wizard/SkinTemplateItem/portal_skins/erp5_development/Base_createNewWebSiteMainTemplateTheme.xml
    erp5/trunk/bt5/erp5_development_wizard/bt/revision

Modified: erp5/trunk/bt5/erp5_development_wizard/ExtensionTemplateItem/Development.py
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_development_wizard/ExtensionTemplateItem/Development.py?rev=33552&r1=33551&r2=33552&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_development_wizard/ExtensionTemplateItem/Development.py [utf8] (original)
+++ erp5/trunk/bt5/erp5_development_wizard/ExtensionTemplateItem/Development.py [utf8] Wed Mar 10 06:43:46 2010
@@ -57,10 +57,12 @@
 def updateCodeWithMainContent(self, html_code, div_class):
    main_content = """
        <div class="%s">
-        <tal:block metal:define-slot="main"/>
+        __REPLACE_MAIN_CONTENT__
       </div>      
    """ % (div_class)
    document = lxml.html.fromstring(html_code)
    element = document.find_class(div_class)[0]
    element.getparent().replace(element, lxml.html.fromstring(main_content))
-   return lxml.html.tostring(document, pretty_print=True)
+   new_html_code = lxml.html.tostring(document, pretty_print=True)
+   return new_html_code.replace("__REPLACE_MAIN_CONTENT__", 
+                                '<tal:block metal:define-slot="main"/>') 

Modified: erp5/trunk/bt5/erp5_development_wizard/SkinTemplateItem/portal_skins/erp5_development/Base_createNewWebSiteMainTemplateTheme.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_development_wizard/SkinTemplateItem/portal_skins/erp5_development/Base_createNewWebSiteMainTemplateTheme.xml?rev=33552&r1=33551&r2=33552&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_development_wizard/SkinTemplateItem/portal_skins/erp5_development/Base_createNewWebSiteMainTemplateTheme.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_development_wizard/SkinTemplateItem/portal_skins/erp5_development/Base_createNewWebSiteMainTemplateTheme.xml [utf8] Wed Mar 10 06:43:46 2010
@@ -61,11 +61,12 @@
 template = context.portal_skins.erp5_development.template_theme_web_main\n
 template_source = template.document_src()\n
 template_body_top, template_body_bottom = template_source.split("<!-- SPLIT -->")\n
-new_code_0 = html_text.replace("<body>", template_body_top)\n
+new_code = context.ERP5Site_updateCodeWithMainContent(html_text, main_div_class_name)\n
+new_code_0 = new_code.replace("<body>", template_body_top)\n
 new_code_1 = new_code_0.replace("</body>", template_body_bottom)\n
 new_code_2 = new_code_1.replace("\'__REPLACE_CSS__\'", css_tales)\n
-new_code_3 = new_code_2.replace("\'__REPLACE_JS__\'", js_tales)\n
-final_code = context.ERP5Site_updateCodeWithMainContent(new_code_3, main_div_class_name)\n
+final_code = new_code_2.replace("\'__REPLACE_JS__\'", js_tales)\n
+\n
 \n
 skin_folder.manage_addProduct[\'PageTemplates\'].manage_addPageTemplate(main_template_id, "Default Template")\n
 getattr(skin_folder, main_template_id).write(final_code)\n
@@ -124,10 +125,10 @@
                             <string>_getiter_</string>
                             <string>template_body_top</string>
                             <string>template_body_bottom</string>
+                            <string>new_code</string>
                             <string>new_code_0</string>
                             <string>new_code_1</string>
                             <string>new_code_2</string>
-                            <string>new_code_3</string>
                             <string>final_code</string>
                             <string>_getitem_</string>
                           </tuple>

Modified: erp5/trunk/bt5/erp5_development_wizard/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_development_wizard/bt/revision?rev=33552&r1=33551&r2=33552&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_development_wizard/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_development_wizard/bt/revision [utf8] Wed Mar 10 06:43:46 2010
@@ -1,1 +1,1 @@
-58
+59




More information about the Erp5-report mailing list