[Grok-dev] FW: grok 1.0 and forbidden attribute error

Lacko Roman rlacko at gratex.com
Mon Jan 11 11:35:54 EST 2010


Hi,

Sorri, this is more complete template:
>>>
  <tal:block tal:repeat="file view/Files" tal:condition="view/Files">
    <div class="container doc_desc_container">
      <div class="doc_desc">
        <a tal:content="file/getFileBaseName"
          tal:attributes="href string:${view/application_url}/files/${file/__name__}/display/@@file/File/${file/getFileBaseName}">
          Title
        </a>
        -- <p tal:define="sizekb python:file.File.getSize()/1024" tal:replace="sizekb">100</p> KB
      </div>
    </div>
  </tal:block>
<<<

The @@file view is from collective.namedfile package and returns the DocumentFile instance.

The ${view/application_url}/files returns grok.Container which contains instances of DocumentFile class

It's just strange that this worked for in grok 0.14 but not in 1.0

I just want to create url to file like object, so users can download file, that is stored in zodb.
But i'm shore there is better way to do it ? 

Thanks for your help
- Roman

> -----Original Message-----
> From: Souheil CHELFOUH [mailto:trollfot at gmail.com]
> Sent: Monday, January 11, 2010 5:05 PM
> To: Lacko Roman
> Cc: Martijn Faassen; grok-dev at zope.org
> Subject: Re: [Grok-dev] FW: grok 1.0 and forbidden attribute error
> 
> Views are not traversable to attributes non present in IBrowserView.
> I don't understand your code here, though. If the view is "display",
> why is there a @@file ?
> Please, paste your whole code, this looks a bit weird to me.
> 
> 2010/1/11 Lacko Roman <rlacko at gratex.com>:
> > Hi Martijn,
> >
> >> -----Original Message-----
> >> From: grok-dev-bounces at zope.org [mailto:grok-dev-bounces at zope.org]
> On
> >> Behalf Of Martijn Faassen
> >>
> >> could you show the implementation of the Display object?
> >>
> >> Regards,
> >>
> >> Martijn
> >
> > Here is the class declaration of 'display' view:
> >>>>
> > # Define Display Form for DocumentFile
> >
> > class Display(grok.DisplayForm):
> >    grok.context(DocumentFile)
> > <<<
> >
> > The DocumentFile class just implements IDocumentFile interface
> >
> > And here is how i render the DocumentFile in zpt:
> >>>>
> >        <a tal:content="file/getFileBaseName"
> >          tal:attributes="href
> string:${view/application_url}/files/${file/__name__}/display/@@file/Fi
> le/${file/getFileBaseName}">
> > <<<
> >
> > Thanks
> > - Roman
> >
> > _______________________________________________
> > Grok-dev mailing list
> > Grok-dev at zope.org
> > https://mail.zope.org/mailman/listinfo/grok-dev
> >


More information about the Grok-dev mailing list