sureshvv / plonegomobile

Automatically exported from code.google.com/p/plonegomobile
0 stars 0 forks source link

TraversalError to image_preview #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
While rendering the view of an ATDocument derived type I receive the following:

2010-10-28 08:59:20 INFO Zope Ready to handle requests
2010-10-28 09:00:22 ERROR Zope.SiteErrorLog 1288252822.290.543343452261 
http://localhost.mobi:8080/20101028-055330/onkopedia/leitlinien/aml/index_html/d
ocument_view
Traceback (innermost last):
  Module ZPublisher.Publish, line 127, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 47, in call_object
  Module Shared.DC.Scripts.Bindings, line 324, in __call__
  Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec
  Module Products.CMFCore.FSPageTemplate, line 240, in _exec
  Module Products.CMFCore.FSPageTemplate, line 180, in pt_render
  Module Products.PageTemplates.PageTemplate, line 80, in pt_render
  Module zope.pagetemplate.pagetemplate, line 115, in pt_render
  Module zope.tal.talinterpreter, line 271, in __call__
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 888, in do_useMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 954, in do_defineSlot
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 858, in do_defineMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 954, in do_defineSlot
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 946, in do_defineSlot
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 858, in do_defineMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 583, in do_setLocal_tal
  Module zope.tales.tales, line 696, in evaluate
   - URL: file:/Users/ajung/.buildout/eggs/gomobiletheme.basic-0.9.1-py2.6.egg/gomobiletheme/basic/skins/gomobiletheme_basic/document_view.pt
   - Line 21, Column 16
   - Expression: <PythonExpr helper.processHTML(text)>
   - Names:
      {'container': <PloneSite at /20101028-055330>,
       'context': <Leitlinie at /20101028-055330/onkopedia/leitlinien/aml/index_html>,
       'default': <object object at 0x1002bbb20>,
       'here': <Leitlinie at /20101028-055330/onkopedia/leitlinien/aml/index_html>,
       'loop': {},
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x10a030368>,
       'request': <HTTPRequest, URL=http://localhost.mobi:8080/20101028-055330/onkopedia/leitlinien/aml/index_html/document_view>,
       'root': <Application at >,
       'template': <FSPageTemplate at /20101028-055330/document_view used for /20101028-055330/onkopedia/leitlinien/aml/index_html>,
       'traverse_subpath': [],
       'user': <SpecialUser 'Anonymous User'>}
  Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__
   - __traceback_info__: helper.processHTML(text)
  Module PythonExpr, line 1, in <expression>
  Module gomobile.mobile.browser.imageprocessor, line 703, in processHTML
  Module gomobile.mobile.browser.imageprocessor, line 364, in processHTML
  Module mobile.htmlprocessing.transformers.basic, line 77, in process
  Module mobile.htmlprocessing.transformers.basic, line 59, in clean_mobile
  Module mobile.htmlprocessing.transformers.basic, line 54, in process_imgs
  Module mobile.htmlprocessing.transformers.imageresizer, line 87, in process_img
  Module gomobile.mobile.browser.imageprocessor, line 171, in rewrite
  Module gomobile.mobile.browser.imageprocessor, line 319, in getImageDownloadURL
  Module gomobile.mobile.browser.imageprocessor, line 281, in mapURL
  Module OFS.Traversable, line 293, in unrestrictedTraverse
   - __traceback_info__: (['image_preview'], '9bf030a5a7161ea7c3f52f2ce2ceab62')
NotFound: 9bf030a5a7161ea7c3f52f2ce2ceab62
Active template id:document_view
Performing mobile folder listing

Original issue reported on code.google.com by zopyxfilter on 28 Oct 2010 at 8:01

GoogleCodeExporter commented 9 years ago
Looks as if the image processor code can't deal properly with references to 
images through UID.

I suggest to add something like:

uid_reg = re.compile('([\dA-Fa-f]{32})')$

338             if img_obj is None and 'resolveuid' in src:$
339                 mo = uid_reg.search(src)$
340                 if mo:$
341                     uid = mo.group(0)$
342                     img_obj = 
params['context'].reference_catalog.lookupObject(uid)$

taken from zopyx.smartprintng.plone

Original comment by zopyxfilter on 28 Oct 2010 at 9:19

GoogleCodeExporter commented 9 years ago
From a debug session:

(Pdb) print url
resolveuid/9bf030a5a7161ea7c3f52f2ce2ceab62/image_preview

(Pdb) context.restrictedTraverse(url)
*** NotFound: 9bf030a5a7161ea7c3f52f2ce2ceab62

(Pdb) context.reference_catalog.lookupObject('9bf030a5a7161ea7c3f52f2ce2ceab62')
<ATImage at 
/20101028-055330/onkopedia/redaktion/autorenumgebung/contents/onkopedia/aml/aml-
1>

(Pdb) context.reference_catalog.lookupObject('9bf030a5a7161ea7c3f52f2ce2ceab62')

Original comment by zopyxfilter on 28 Oct 2010 at 9:41

GoogleCodeExporter commented 9 years ago
Thanks.

We will fix this for the next release.

Original comment by mioht...@gmail.com on 4 Nov 2010 at 1:22