Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed broken jbot style export of zopeview

fixed broken export of some filesystem types

svn path=/plone.app.themeeditor/trunk/; revision=49382
  • Loading branch information...
commit 5bfcadac341d372c77302399bf6ac73728f87d1f 1 parent d765eba
@pigeonflight pigeonflight authored
View
1  docs/HISTORY.txt
@@ -3,6 +3,7 @@ Changelog
1.0a3
-------------------
- Add french translation [toutpt]
+- Fixed broken export for resources that were identified as 'zopeview' [pigeonflight]
1.0a2
-------------------
View
26 plone/app/themeeditor/browser/export.py
@@ -20,13 +20,19 @@
from paste.script import pluginlib
import tempfile
import logging
-JBOTCOMPATIBLE = ('portlet','view','viewlet')
+JBOTCOMPATIBLE = ('zopeview','portlet','view','viewlet')
_templates_dir = os.path.join(os.path.dirname(__file__))
_templates_dir = os.path.join(_templates_dir,'..','templates')
LOGGER="plone.app.themeeditor"
+class JBOTResourceException(Exception):
+ def __init__(self, value):
+ self.parameter = value
+ def __str__(self):
+ return repr(self.parameter)
+
def info(msg):
logging.getLogger(LOGGER).info(msg)
@@ -94,7 +100,10 @@ def theme_populate(self,output_dir,namespace_package,name,make_jbot_zcml=0,
self.resource_to_jbot(resource,output_dir,namespace_package,name)
else:
dump_cmfskins = 1
- base_theme = resource.base_skin
+ try:
+ base_theme = resource.base_skin
+ except AttributeError:
+ base_theme = ""
if dump_cmfskins == 1:
self.dump_cmfskins(output_dir,namespace_package,
name,base_theme,version)
@@ -240,7 +249,13 @@ def resource_to_jbot(self,resource,output_dir,namespace_package,name):
convert resource to just a bunch of templates (jbot)
we assume that this is an already customized resource
"""
- jbotname,tmpl_text = self.jbot_resource_info(resource)
+ try:
+ resource_info = self.jbot_resource_info(resource)
+ except JBOTResourceException:
+ # XXX Fixme - should use a more robust test
+ # skip this resource
+ return
+ jbotname,tmpl_text = resource_info
package_name = "%s.%s" % (namespace_package,name)
jbot_dir = os.path.join(output_dir,package_name,namespace_package,name,"jbot")
@@ -272,11 +287,10 @@ def jbot_resource_info(self,resource):
rm = getUtility(IResourceRetriever)
resources = rm.iter_resources(name=resource.name,
exact=True).next()
- if resources[-1].info == u'On the filesystem':
+ if resources[-1].info.startswith(u'On the filesystem'):
path = resources[-1].path
else:
- # XXX change this to an exception
- return "this is not a customized resource"
+ raise JBOTResourceException("%s is not a working properly with jbot this may be a bug in plone.app.themeeditor " % resource.name)
context_prefix = resources[-1].context[-1].split('.interfaces')[0]
jbotname = '.'.join([context_prefix,basename(path)])
tmpl_text = resource.text
View
16 plone/app/themeeditor/utils.py
@@ -63,12 +63,16 @@ def get_id(obj):
def getData(obj, meta_type):
""" Return object's data."""
- #return meta_type in ['Image', 'File'] and obj.manage_FTPget() or obj.document_src()
- return meta_type in ['Image', 'File'] and obj.data or obj.document_src()
- if meta_type == 'Image':
- return obj.data
- if meta_type == 'File':
- return obj.document_src() or obj.data
+ if meta_type in ['Image', 'File']:
+ output = obj.data
+ else:
+ try:
+ output = obj.document_src()
+ except AttributeError:
+ # XXX Fixme now fails silently (though it should never fail, add a test for this silent fail)
+ return
+ return output
+
def dumpPortalViewCustomization(context):
result = []
Please sign in to comment.
Something went wrong with that request. Please try again.