From e6cacd10ddc6d1e393c454cba889d9d3cc9c8498 Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Wed, 26 Jun 2013 17:06:06 +0200 Subject: [PATCH] [px] Better error reporting when encountering a parsing error in a PX. --- gen/mixins/ToolMixin.py | 4 +- gen/ui/appy.js | 5 + gen/wrappers/__init__.py | 319 +++++++++++++++++++++++++++------------ px/__init__.py | 22 ++- 4 files changed, 248 insertions(+), 102 deletions(-) diff --git a/gen/mixins/ToolMixin.py b/gen/mixins/ToolMixin.py index 82ffdac..7973c58 100644 --- a/gen/mixins/ToolMixin.py +++ b/gen/mixins/ToolMixin.py @@ -269,9 +269,9 @@ class ToolMixin(BaseMixin): '''When must the portlet be shown?''' # Not on 'edit' pages. if layoutType == 'edit': return - if context.id == 'ui': context = context.getParentNode() + if context and (context.id == 'ui'): context = context.getParentNode() res = True - if hasattr(context.aq_base, 'appy'): + if context and hasattr(context.aq_base, 'appy'): appyObj = context.appy() try: res = appyObj.showPortlet() diff --git a/gen/ui/appy.js b/gen/ui/appy.js index 2974a17..f892ddd 100644 --- a/gen/ui/appy.js +++ b/gen/ui/appy.js @@ -41,6 +41,11 @@ function showLoginForm() { loginFields.style.display = "inline"; } +function switchLanguage(selectWidget) { + var language = selectWidget.options[selectWidget.selectedIndex].value; + window.location = "/config/changeLanguage?language=" + language; +} + var isIe = (navigator.appName == "Microsoft Internet Explorer"); function getElementsHavingName(tag, name) { diff --git a/gen/wrappers/__init__.py b/gen/wrappers/__init__.py index d9f68f5..1470af1 100644 --- a/gen/wrappers/__init__.py +++ b/gen/wrappers/__init__.py @@ -27,6 +27,131 @@ class AbstractWrapper(object): '''Any real Appy-managed Zope object has a companion object that is an instance of this class.''' + pxPhases = Px('''Phases + ''') + + pxPortlet = Px(''' + + + :self.pxPhases + + + + + + + + + + + ::_(rootClass + '_plural') + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + :text... + + + + + + + + + + + + + + + + + + ''') + + pxMessage = Px(''' + + + + + + ::messages + + + ''') + + pxFooter = Px(''' + + + Made with + Appy + + ''') + pxTemplate = Px(''' + value=":_('object_cancel')"/> @@ -127,10 +252,9 @@ class AbstractWrapper(object): - + class="pageLink" onchange="switchLanguage(this)"> :ztool.getLanguageName(lg) @@ -138,101 +262,98 @@ class AbstractWrapper(object): - - - :content + + + + :self.pxMessage + + + + + + + + + + + + + + + + + :_('app_login') + + :_('app_password') + + + + :_('forgot_password') + + + + + + + + + + + + + + + + + + + + :userInfo[0] + + + + + + + + + + + + + + + + + + + + + + + :self.pxPortlet + + :content + + + + + + :self.pxFooter +
Phases