Re: [Zope3-Users] Testbrowser returns escaped html
Hi, Sorry for the noise, i made a stupid typo. Thanks, Christian. Hello everybody, i run into a problem by testing a megrok.addon. I setup serveral tests in this package in try to test these with zope.testbrowser. Unfortunatly i don´t get *real* html back. This means i got always escaped html instead of unsecaped html in browser contents. This is a error from a test run: ## Failed example: print browser.contents Differences (ndiff with -expected +actual): + lt;div class=actionMenuWrappergt; + lt;ul class=actionMenugt; + lt;li class=inactive-menu-itemgt; + lt;a href=gt; + lt;divgt;printlt;/divgt; + lt;/agt; + lt;/ligt; + BLANKLINE + lt;/ulgt; + lt;/divgt; + lt;div class=clearActionMenu /gt; + BLANKLINE + BLANKLINE You can see the whole package in my svn.zope.org Sandbox here. [1] So maybe someone has an idea howto fix this. cheers Christian [1] http://svn.zope.org/Sandbox/cklinger/megrok.ootbviewlets/trunk/ ___ 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
[Zope3-Users] Testbrowser returns escaped html
Hello everybody, i run into a problem by testing a megrok.addon. I setup serveral tests in this package in try to test these with zope.testbrowser. Unfortunatly i don´t get *real* html back. This means i got always escaped html instead of unsecaped html in browser contents. This is a error from a test run: ## Failed example: print browser.contents Differences (ndiff with -expected +actual): + lt;div class=actionMenuWrappergt; + lt;ul class=actionMenugt; + lt;li class=inactive-menu-itemgt; + lt;a href=gt; + lt;divgt;printlt;/divgt; + lt;/agt; + lt;/ligt; + BLANKLINE + lt;/ulgt; + lt;/divgt; + lt;div class=clearActionMenu /gt; + BLANKLINE + BLANKLINE You can see the whole package in my svn.zope.org Sandbox here. [1] So maybe someone has an idea howto fix this. cheers Christian [1] http://svn.zope.org/Sandbox/cklinger/megrok.ootbviewlets/trunk/ ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Automatic schema field sanitation?
Hi Dennis, i think you can try to add a new Field and a corresponding Widget for your needs. I think this could be a good starting poing. http://wiki.zope.org/zope3/fieldsandwidgets.html If you have further questions - please ask. Hope this helps. - Christian Hi, I would like to define a custom type inheriting from zope.schema.TextLine, which in addition to having a built-in constraint method also sanitizes the input. For example suppose you need to store codes of the kind: 3 letters, space, 3 numbers. The constraint uses a regexp, and this works fine. However it would be nice if I could also automatically capitalize the letters, such that abc 123 is stored as ABC 123 which is the presentation that should be used everywhere. Being able to do this automatically, just like the validation, would completely remove the need to remember to sanitize on input/output throughout the rest of the system. What would be the best way to implement this, ideally without needing to modify any of the standard zope.interface/zope.schema code? Thanks for any suggestions, Cheers, Dennis ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: XML schema definitions,zope.schema and z3c.form
Martin Aspeli schrieb: Christian Klinger wrote: Hi Nylan, we are working during the grokkerdam sprint on the same topic. Interesting! Can you give us some more information? Martin Hi Martin, we are working on a automatic form generation out of sqlalchemy. We used userschema and ore.alchemist as an inspiration. You can see some very basic code on megrok.rdb. http://svn.zope.org/grokapps/rdbexample/trunk/megrok.rdb/src/megrok/rdb/schema.py?rev=86282view=auto As I said this is on a very early stage. Christian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: XML schema definitions,zope.schema and z3c.form
Hi Nylan, we are working during the grokkerdam sprint on the same topic. We used userschema, and ore.alchemist as exampels. I think userschema has some xml thing. Hope this helps, Christian http://agendaless.com/Members/tseaver/software/userschema http://pypi.python.org/simple/ore.alchemist/ Hello, I need some advice from experienced zope3 developers. ;-) Use case: 1. Receive xsd from a server(see example xsd) 2. use xsd with zope3(add,edit forms with z3c.form) I've found this solution(supports only simple elements at root level): http://blogs.nuxeo.com/sections/blogs/julien_anguenot/2005_08_19_xml-schema-support-on Are there other solutions, besides the link above, I haven't found/noticed? Something able to manage more complex types? Any help or advice appreciated! best regards Example XSD: ?xml version=1.0 encoding=UTF-8? schema xmlns=http://www.w3.org/2001/XMLSchema; targetNamespace=http://schemas.domain.com/SQLSource; xmlns:tns=http://schemas.domain.com/SQLSource; elementFormDefault=qualified element name=source type=tns:sourcetype / complexType name=sourcetype sequence element name=connection complexType attribute name=nameref type=string / /complexType /element element name=query type=string minOccurs=0 maxOccurs=1/ element name=alias_map complexType sequence element name=alias minOccurs=0 maxOccurs=unbounded complexType simpleContent extension base=int attribute name=name type=string / /extension /simpleContent /complexType /element /sequence /complexType /element /sequence attribute name=name type=string / attribute name=type type=string / /complexType /schema ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Five Formlib and validator
Hi, i try to make a formlib action with an validator. My environment is Zope 2.10.4 Five 1.4.4 plone.app.form branch 2.5 This is my method: def validate_change_passwd(self, action, data): errors = self.validate(action, data) # test password from zope.app.form.interfaces import WidgetInputError if not errors: if data['passwort'] != data['confirm']: errors = WidgetInputError(field_name='passwort', widget_title=_(u'Passwort'), errors=_(u'Foo')) return errors @form.action(_(u'Speichern'), validator=validate_change_passwd) def action_resutls(self, action, data): What do i have to return to display a error message on my form? I try everything but i don´t get it to work maybe someone has an tip for me Christian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: mysql connection
Hi Roman, it depends on what you are trying to do: When you want a zope database adapter for mysql: look here http://svn.zope.org/mysqldbda/ If you want ORM than try zalchemy. http://pypi.python.org/pypi/z3c.zalchemy/0.2.1 If you need a kind of SQL-Expression than take a look at z3c.sqlalchemy. http://pypi.python.org/pypi/z3c.sqlalchemy/1.0.11 HTH Christian I am trying to connect to mysql. What is the preferred package to do that ? I am using zopeproject. I tried to add dependency to mysqldbda, but it fails. The 2nd edition of the book mentions mysql utility, but it is not installed by default it seems. Thanks, Roman [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ___ 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
[Zope3-Users] Re: mysql connection
Roman Budzianowski schrieb: On Nov 14, 2007, at 12:01 AM, Christian Klinger wrote: Hi Roman, it depends on what you are trying to do: When you want a zope database adapter for mysql: look here http://svn.zope.org/mysqldbda/ Yes. Maybe it's a question about zopeproject. I added mysqldbda dependency to setup.py and ran buildout, but it fails to find it. What's the naming scheme for the libraries ? I have a copy downloaded from zope.org, but I am unsure where to install it manually in the zopeproject framework. The installation instructions in mysqldbda are obsolete (referring to cvs). So somehow this package doesn't fit neatly into the new easy way of doing things. I wondered if I should use it at all. I don´t know if there is an egg of mysqldbda. If there is not you can try to use the addtional buildout receipe infrae.subversion [1] which allows you to include a package from an svn tree. I don´t know zopeproject details, but i think this should be doable. HTH Christian [1] http://pypi.python.org/pypi?%3Aaction=searchterm=infrae.subversionsubmit=search If you want ORM than try zalchemy. http://pypi.python.org/pypi/z3c.zalchemy/0.2.1 If you need a kind of SQL-Expression than take a look at z3c.sqlalchemy. http://pypi.python.org/pypi/z3c.sqlalchemy/1.0.11 HTH Christian I am trying to connect to mysql. What is the preferred package to do that ? I am using zopeproject. I tried to add dependency to mysqldbda, but it fails. The 2nd edition of the book mentions mysql utility, but it is not installed by default it seems. Thanks, Roman [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ___ 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 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] i18n question
Hi, what is the recommended way in translating an already existing msgid. For example: there a some translations in zope/app/locales/de/LC_MESSAGES/zope.po. But i don´t like the german translations. Should i write my new translations in this file? Or is it possible to do this in my own i18n:domain? myapp/locals/de/LC_MESSAGES/extranetmembership.po Please give me some advice. Christian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Getting started with a zope 3 install as eggs
Jesper, do you know zopeproject http://cheeseshop.python.org/pypi/zopeproject/0.4.1 with the help of zopeproject you will get a buildout where you can specifiy further dependencies in your application. HTH Christian Good afternoon list, I currently have a Zope 3.3.1 installation (tarball) and have written some code that uses zc.catalog and hurry.query. These two were installed as eggs and work fine (I used zc.catalog 1.1 because later versions required a lot of zope eggs) I'd like to use more packages but I see that most of the new stuff today require eggs from the 'eggified' version of Zope.. So I figure I just might as well switch to all eggs and join the future. I want this to go as smooth as possible. Not sure how to get started though. 1. Which package to easy_install to get Zope 3? And when you've got it installed can you say that you actually run a certain version of Zope any longer? 2. If I install everything as eggs, how do I actually create, configure and run instances? Or do I actually keep my old 3.3.1 install alongside the new eggs? 3. Any other suggestions? Greatly appreciate any answers bringing some clarity to this Regards Jesper ___ 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
[Zope3-Users] Choice Field with MultiCheckBoxWidget?
Hi, i try to have a form with an ChoiceField rendered as a MultiCheckBoxWidget. interfaces.py - berechtigung = schema.Choice(title=_(u'Berechtigung'), description=_(u'Berechtiung'), missing_value=None, #value_type=schema.Choice(vocabulary=VocabularyBerechtigungen)) vocabulary=VocabularyBerechtigungen) browser.py: -- form_fields['berechtigung'].custom_widget = MultiCheckBox?? Where can i find a MulitCheckBoxWidget? Is this the right way to do this? Christian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: How to assign a role or permission to users programatically?
Hi Yuan, iirc you can subscribe to the zope.app.authentication.interfaces.IAuthenticatedPrincipalCreated event. In your event you can do something like this: def authenticated_principal_created(event): principal = event.principal principal.groups.append('zope.Manager') hth Christian Dear list, I have written a custom authenticator plugin to authenticate users against a Postgres database. The question is, once a user is authenticated, what role or permission does she/he get? If I would like to give the permission 'site.MemberPermission' to all users when they log in. I don't want to store the permission a a persistent folder like object, but just assign them on the fly when the log in. what shall I do? Thanks for helping. ___ 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
[Zope3-Users] Re: Confirming member generated objects?
Hi Maken, maybe the hurry.workflow fits in your usecase. See the documentation here http://codespeak.net/svn/z3/hurry.workflow/trunk/src/hurry/workflow/workflow.txt Christian Hi! In many applications members can add content but with the restriction that it needs to be confirmed by a manager before it becomes active and accessible to anybody else. I'm trying to accomplish this with an idea of mine, but I'm very open to other ideas of course :) Basically, lets say I have a site 'mysite' and an item container 'items'. And an Item is the content component of my app. When people add items in /mysite/items/+/ztest.Item ... my idea is that it is then actually only added e.g in an 'unconfirmed' folder in the site manager of mysite. This, I'm trying to achieve by subclassing AddForm and overriding the add method (since add is the only interesting here, the rest is dotted in the code below:)): # class ItemMemberAddForm(AddForm): form_fields = ... label = ... def create(self, data): ... def add(self, object): con = queryUtility(IItemContainer, u'unconfirmed') o = IAdding(con).add(object)# How to add it?? self._finished_add = True return o # The 'unconfirmed' folder is registered as a utility for easy access. Obviously the code above isn't working and i'm not even sure I know what I'm doing with the IAdding :O I think I'm in the difficult phase of the Z-learning curve... just learnt the basics and now anything beyond the basics seem really complicated :) When I do manage to pull this off, it shouldn't be too hard moving confirmed objects to /mysite/items (I looked at zope.copypastemove for this, but first I want to get the adding working..) Any thoughts on my idea/code or any other things related to confirming member generated content are very much appreciated! Regards Seteva ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Howto add roles to my principal
Hi, i try to fetch users from an rdbms to authenticate them in zope3. I have created a custom AuthenticatorPlugin which reads the user from an sqltable and return the PrincipalInfo when username password is valid. This works so far. Now the Problem: I have role information in my rdbms table and i want that my principals get these roles. But i don´t know how can i assign these roles to my principal. Maybe something like that: return PrincipalInfo(self.prefix+login, login, login, login, ['Manager','Viewer',]) In Zope2 PAS there is a IRolesPlugin which assign the role to the principal. Maybe someone had an idea or an example for me. Christian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Howto add roles to my principal
Christian Klinger schrieb: Hi, i try to fetch users from an rdbms to authenticate them in zope3. I have created a custom AuthenticatorPlugin which reads the user from an sqltable and return the PrincipalInfo when username password is valid. This works so far. Now the Problem: I have role information in my rdbms table and i want that my principals get these roles. But i don´t know how can i assign these roles to my principal. Maybe something like that: return PrincipalInfo(self.prefix+login, login, login, login, ['Manager','Viewer',]) In Zope2 PAS there is a IRolesPlugin which assign the role to the principal. Maybe someone had an idea or an example for me. Christian Hi, i have found it myself. I have to access the event subscriber for=zope.app.authentication.interfaces.IAuthenticatedPrincipalCreated handler=.plugins.event.authenticated_principal_created / and add my role to: def authenticated_principal_created(event): principal = event.principal principal.groups.append('zope.Manager') Thx Christian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Some SOAP-Zope questions!
Hi, i experiment with SOAP support for Zope. I ´ve found the package http://svn.zope.org/soap/trunk/. After testing and exploring this package a got some questions about it. General Questions: - I see no changes since 1 year. Does someone use this package? - Are there any other SOAP-Zope integrations available? Technical Questions: - Is it possible to let this package work like the xml-rpc stuff. (every method is accessable through http,xml-rpc,soap?) - How can i provide a wsdl file for my SOAPView? - Is it possible to let soap or zsi generate the wsdl file or should i write it by hand? - Does the package http://svn.zope.org/soap/trunk/ work with Five in a Zope2 environment, too? When not is it possible to integrate it in Five? Thx Christian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users