|
|
|
|
monks
()
|
|
||||||||||||
|
hello
i'm having an image field in my custom content type : ImageField('eventlogo', required = True, storage = AttributeStorage(), languageIndependent = True, #max_size = zconf.ATNewsItem.max_image_dimension, sizes= {'large' : (768, 768), 'preview' : (400, 400), 'mini' : (200, 200), 'thumb' : (128, 128), 'tile' : (64, 64), 'icon' : (32, 32), 'listing' : (16, 16), }, # validators = (('isNonEmptyFile', V_REQUIRED),('checkNewsImageMaxSize', V_REQUIRED)), widget = ImageWidget( description = "Upload Event Image", label= "Upload Event Image", #visible={'edit':'hidden', 'view':'invisible'}, #i18n_domain = "plone", #show_content_type = False ) ), now i want to fetch+display this image into my custom Home Page Portlet (which is a Pg. Template). Code is like : <div class="newsImageContainer"> <a href="#" tal:attributes="href string:$here_url/eventlogo/eventlogo_view_fullscreen" id="parent-fieldname-eventlogo"> <img tal:replace="structure python: here.tag(scale='mini', css_class='newsImage')" src="" alt="" /> </a> </div> but its giving some tag() error. Traceback is : URL: /egovrepository/portal_skins/custom/hmpg_eventsrighttmp_dynamicevents - Line 54, Column 15 - Expression: <PythonExpr here.tag(scale='mini', css_class='newsImage')> - Names: {'container': <PloneSite at /egovrepository>, 'context': <PloneSite at /egovrepository>, 'default': <object object at 0xb7f6d528>, 'here': <PloneSite at /egovrepository>, 'loop': {u'obj': <Products.PageTemplates.Expressions.PathIterator object at 0xfec086c>}, 'nothing': None, 'options': {'args': ()}, 'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xfdeb58c>, 'request': <HTTPRequest, URL=http://192.168.1.53:8082/egovrepository/HomePage_maintemplate>, 'root': <Application at >, 'template': <ImplicitAcquirerWrapper object at 0xfdeb2cc>, 'traverse_subpath': [], 'user': <PropertiedUser 'admin'>, 'view': <plone.app.portlets.portlets.classic.Renderer object at 0xfed1c2c>, 'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0xfdeb7ec>} Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__ - __traceback_info__: here.tag(scale='mini', css_class='newsImage') Module PythonExpr, line 1, in <expression> AttributeError: tag To me, it seems that, there is some problem reading tag() module. FYI, i already have tag() + __bobo_traverse__() modules defined in my Python script . How can i make it working ? Thanks for any pointers ------ Regards, Mayank Mathur ------------------------------------------------------------------------------ _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users Regards, Mayank |
||||||||||||||
|
|
luis silva-3
()
|
|
||||||||||||
|
This is because your content type don't have tag method
If you do something like this, it should work <div class="newsImageContainer"> <a href="#" tal:attributes="href string:$here_url/eventlogo/eventlogo_view_fullscreen" id="parent-fieldname-eventlogo"> <img src="" alt="" tal:attributes="src python: here.getEventlogo().absolute_url() + '_mini' /> </a> </div> I hope this help you Luís Silva 2009/7/3 Mayank Mathur <[hidden email]>
------------------------------------------------------------------------------ _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
|
|
monks
()
|
|
||||||||||||
|
hi luis.
Thanks for pointer. I've changed code to sth like this : <div class="newsImageContainer"> <a href="#" tal:attributes="href string:$here_url/eventlogo/eventlogo_view_fullscreen" id="parent-fieldname-eventlogo"> <img src="" alt="" tal:attributes="src python: obj.getObject().getEventlogo().absolute_url() + '_mini' " /> </a> </div> and it's working. luis silva wrote: This is because your content type don't have tag method -- ------ Regards, Mayank Mathur ------------------------------------------------------------------------------ _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users Regards, Mayank |
||||||||||||||
|
|
luis silva-3
()
|
|
||||||||||||
|
Can you show me the error log? and what is the obj variable?
On Fri, Jul 3, 2009 at 11:16 AM, Mayank Mathur <[hidden email]> wrote:
------------------------------------------------------------------------------ _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
|
|
monks
()
|
|
||||||||||||
|
I've already posted error traceback below.
Regd. 'obj' varb., its: <tal:newsitems tal:repeat="obj results">, where results fetches results from portal_catalog.searchResults() method luis silva wrote: Can you show me the error log? and what is the obj variable? -- ------ Regards, Mayank Mathur ------------------------------------------------------------------------------ _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users Regards, Mayank |
||||||||||||||
|
|
luis silva-3
()
|
|
||||||||||||
|
I don't see the new traceback, the old one was because the tag method,
but if you have a new error you have a new traceback. Maybe the error is because the Eventlogo has no image in some object, to prevent this you should do something like this <div class="newsImageContainer"> <img src="" alt="" tal:attributes="src python: event_logo.absolute_url() + '_mini' " /><a href="#" tal:attributes="href string:$here_url/eventlogo/eventlogo_view_fullscreen" id="parent-fieldname-eventlogo"> <tal:def define="event_obj obj/getObject; event_logo event_obj/getEventlogo|nothing"> <tal:img condition="event_logo"> </tal:img> </tal:def> </a> </div> On Fri, Jul 3, 2009 at 11:36 AM, Mayank Mathur <[hidden email]> wrote:
------------------------------------------------------------------------------ _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
|
|
monks
()
|
|
||||||||||||
|
hi.
FYI, i already have tag() + __bobobase_traverse__() method defined in my Python script. new traceback was sth like : URL: /egovrepository/portal_skins/custom/hmpg_eventsrighttmp_dynamicevents - Line 53, Column 15 - Expression: <PythonExpr results.getEventlogo().absolute_url() + '_mini'> - Names: {'container': <PloneSite at /egovrepository>, 'context': <PloneSite at /egovrepository>, 'default': <object object at 0xb7f6d528>, 'here': <PloneSite at /egovrepository>, 'loop': {u'obj': <Products.PageTemplates.Expressions.PathIterator object at 0x100ea8cc>}, 'nothing': None, 'options': {'args': ()}, 'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x100922ac>, 'request': <HTTPRequest, URL=http://192.168.1.53:8082/egovrepository/HomePage_maintemplate>, 'root': <Application at >, 'template': <ImplicitAcquirerWrapper object at 0x10092b0c>, 'traverse_subpath': [], 'user': <PropertiedUser 'admin'>, 'view': <plone.app.portlets.portlets.classic.Renderer object at 0x1004f50c>, 'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0x10092e8c>} Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__ - __traceback_info__: results.getEventlogo().absolute_url() + '_mini' Module PythonExpr, line 1, in <expression> AttributeError: LazyMap instance has no attribute 'getEventlogo' secondly, i've rechecked and all objects have image in EventLogo. thanks luis silva wrote: I don't see the new traceback, the old one was because the tag method,
-- ------ Regards, Mayank Mathur ------------------------------------------------------------------------------ _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users Regards, Mayank |
||||||||||||||
|
|
luis silva-3
()
|
|
||||||||||||
|
this error is because the results variable don't have the method getEventlogo, and I think this is normal
because you tell me the results variable are the result of portal_catalog.searchResults() method To make sure the method getEventlogo exists you should put the accessor defination in your content type ImageField('eventlogo', required = True, accessor = 'getEventlogo', storage = AttributeStorage(), (...) On Fri, Jul 3, 2009 at 12:16 PM, Mayank Mathur <[hidden email]> wrote:
------------------------------------------------------------------------------ _______________________________________________ Plone-Users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/plone-users |
||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |