I begin to see the light: with an update method in a class supporting the view I was getting a forbidden attribute error. I am not sure how to deal with that so I have left the update method in the content class but put all code to do with the edit form in the view class. Not quite right because form fields are processed in the content class.

Cliff

Cliff Ford wrote:
Thanks for the help. I 'discovered' the isinstance method in the ZAPI Reference of your book, which is just what I needed. I put the filter method in the custom content class rather than a separate view class. It all seems to work so I am progressing again.

Cliff

Philipp von Weitershausen wrote:



Cliff Ford wrote:

I have a custom object that uses a page template to make a list of other objects in its containing folder. This so far lists security proxied object instances:

<p tal:repeat="item view/__parent__/__parent__/values" tal:content="item">
Testing
</p>



Uh, you should use context/__parent__/values...

I want to filter the objects by metatype. That does not exist in Zope 3 and I don't know how to use queryType or queryContentType in a page template. Is there something simple that I am missing?



You can't do this in a Page Template because you're not supposed to. Filtering involves logic, Page Templates are there to only render data structures into XML/XHTML.


So, what you'll want to do is write a complementary view class for your ZPT that gets zapi.getParent(context).values() and filters the elements in that list according to their content type or whatever you'll need.

From your ZPT you can call that method through the 'view' variable (the one you used above not quite correctly).

Philipp

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to