[Setup] ImageField

Vitaliyi imgrey at gmail.com
Sat May 5 10:53:18 UTC 2007


Good Day

I'm trying to resize picture. My schema contains :

ImageField('poster',
               required = 0,
               languageIndependent=1,
               original_size = (600,600),
                sizes={ 'mini' : (80,80),
                'normal' : (200,200),
                'big' : (300,300),
                'maxi' : (500,500)},
               widget = ImageWidget(label= "Poster",
                                    label_msgid = "label_poster",
                                    description = "Upload a poster. It will be a
                                    description_msgid = "desc_poster",
                                    i18n_domain = "ATVideo")
               ),

In fact i'd take ATAudio product and modified it slightly.
In my portlet :
<img tal:replace="structure python:
context.getField('poster').tag(context, scale='mini')" />

And this results "Insufficient Privileges". The log:

Traceback (innermost last):
  Module ZPublisher.Publish, line 115, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 41, in call_object
  Module Shared.DC.Scripts.Bindings, line 311, in __call__
  Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
  Module Products.CMFCore.FSPageTemplate, line 195, in _exec
  Module Products.CMFCore.FSPageTemplate, line 134, in pt_render
  Module Products.PageTemplates.PageTemplate, line 104, in pt_render
   - <FSPageTemplate at /xdf/video_view used for /xdf/eva.flv>
  Module TAL.TALInterpreter, line 238, in __call__
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 749, in do_useMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 780, in do_defineSlot
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 728, in do_defineMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 772, in do_defineSlot
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 728, in do_defineMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 647, in do_insertStructure_tal
  Module Products.PageTemplates.TALES, line 221, in evaluate
   - URL: file:ATAudio/skins/ataudio/video_view.pt
   - Line 69, Column 0
   - Expression: <PythonExpr context.getField('poster').tag(context,
scale='mini')>
   - Names:
      {'container': <PloneSite at /xdf>,
       'context': <ATVideo at /xdf/eva.flv>,
       'default': <Products.PageTemplates.TALES.Default instance at 0xb6f9876c>,
       'here': <ATVideo at /xdf/eva.flv>,
       'loop': <Products.PageTemplates.TALES.SafeMapping object at 0xc0df54c>,
       'modules':
<Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at
0xb6fc334c>,
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.TALES.SafeMapping object at 0xc0df54c>,
       'request': <HTTPRequest, URL=http://xdf.chakujiu/eva.flv/video_view>,
       'root': <Application at >,
       'template': <FSPageTemplate at /xdf/video_view used for /xdf/eva.flv>,
       'traverse_subpath': [],
       'user': <PloneUser 'admin'>}
  Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
   - __traceback_info__: context.getField('poster').tag(context, scale='mini')
  Module Python expression "context.getField('poster').tag(context,
scale='mini')", line 1, in <expression>
  Module AccessControl.ImplPython, line 729, in guarded_getattr
  Module AccessControl.ImplPython, line 671, in aq_validate
  Module AccessControl.ImplPython, line 565, in validate
  Module AccessControl.ImplPython, line 463, in validate
  Module AccessControl.ImplPython, line 810, in raiseVerbose
Unauthorized: Your user account does not have the required permission.
 Access to 'tag' of (Field poster(image:rw)) denied. Your user
account, admin, exists at /xdf/acl_users. Access requires one of the
following roles: ['Manager']. Your roles in this context are
['Authenticated'].

P.S. I've tried to amke it work a week before posting. Examples from
comments from Archetypes/Field.py is not working too.

Modified ATAudio : http://213.3.11.8:8000/ATAudio.tar.bz2
(it requires ExternalStorage and ATMediaFile products)



More information about the Setup mailing list