[Zope3-Users] How do I get the value of security proxied attributes from a view template

2007-08-24 Thread Yuan HOng
Hi, list, I am just trying to migrate a existing application from Zope2 to Zope3, and had to feel around for my ways to do things correctly. I have following view.pt snippet: Item Name specification: Price: The template is registered like this: What I get is output looking this: 卡朗妮专供

[Zope3-Users] Database authentication service

2007-08-24 Thread Yuan HOng
Hi, everyone, This must be novice question: Is there a package providing relational database based authentication service for zope 3 already lying around somewhere or do I have write one? And how does one connect a login form with the authentication service? In Zope 2 one can have lots products

Re: [Zope3-Users] How do I get the value of security proxied attributes from a view template

2007-08-25 Thread Yuan HOng
On 8/24/07, Andreas Reuleaux <[EMAIL PROTECTED]> wrote: > from zope.security.proxy import removeSecurityProxy > > price=removeSecurityProxy(proxiedPrice) > > Yes, it works fine. Thanks. However it would mean that I have to add a view class to all my objects which contains a decimal attribute, a

[Zope3-Users] How

2007-08-25 Thread Yuan HOng
Hi, everyone: In my page template, I would like to show one message if the request is authenticated, and other if the user has not logged in. Is there a simple test I can use in the template file like? Please Log In Hello Mr. XXX Similiar thing used to work with Zope2. But with Zope3, request o

[Zope3-Users] How is ++debug++tal supposed to work?

2007-08-26 Thread Yuan HOng
Hi, everyone In the book "Web Component Development with Zope 3", it is mentioned that one can use the URL adapter ++debug++tal to show the tal tags besides the rendered page, provided the devmod is turned on. But how is this working exactly? For I can not see the URL adapter taking any effects.

[Zope3-Users] How to assign a role or permission to users programatically?

2007-09-03 Thread Yuan HOng
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

[Zope3-Users] Problem with z3c.form security when rendering error

2007-09-20 Thread Yuan HOng
HI, list: I am new to z3c.form. In my first AddForm, I encountered the following problem: When the form is submitted which contains some input error, like missing required fields, the rendering of the error message causes an system error. The traceback: ... File "/usr/lib/python2.5/site-packa

[Zope3-Users] zopeproject Exception debugging

2007-09-20 Thread Yuan HOng
Hello, In the 'Debugging' section of zopeproject's project page, the following is mentioned for the ajax based exception debugging: When you now repeat the steps that led to the exception, you will see the relevant traceback in your browser, along with the ability to view the corresponding source

[Zope3-Users] Several points about z3c.form internationalization

2007-09-21 Thread Yuan HOng
Hi, list I stumbled upon several problems with i18n of z3c.form and z3c.formui and would like to have advice from the more experienced. 1. I have a schema field: gender = Choice( title=_(u'Gender'), values=(_(u'male'), _(u'female')), required=False) When rendered, th

[Zope3-Users] Does zope cache authentication?

2007-09-22 Thread Yuan HOng
Hi, I have written a custom authenticator in my application to authenticate a login against a PostgreSQL database. In the site I have configured a PAU with a session credentials plugin and my custom authenticator plugin. I found out that with configuration, EVERY browser request is triggering my

Re: [Zope3-Users] Re: Does zope cache authentication?

2007-09-23 Thread Yuan HOng
Thanks for clarifying this. -- Hong Yuan 大管家网上建材超市 装修装潢建材一站式购物 http://www.homemaster.cn ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users

[Zope3-Users] How to register multiple view for the same content class

2007-09-28 Thread Yuan HOng
Hi, I thought this would be a simple case for Zope3, but after one whole day I am not able to find a clean solution. Must be missing something. Suppose I have a BookShelf which contains lots of Books. The view for BookShelf will show a list of Books contained in the shelf, and when the user clic

Re: [Zope3-Users] How to register multiple view for the same content class

2007-09-28 Thread Yuan HOng
On 9/28/07, Frank Burkhardt <[EMAIL PROTECTED]> wrote: > > You just need another browser:page here. Name it 'in-shelf-view' and > use something like > > > > to embed it. > Thanks, that works. So all was missing is the '@@' notation to tell TALES to look up a view for Book. > Registering the vi

Re: [Zope3-Users] How to register multiple view for the same content class

2007-09-28 Thread Yuan HOng
On 9/28/07, Frank Burkhardt <[EMAIL PROTECTED]> wrote: > > You could use a view as dispatcher which then would be traversed like > object/@@view: > > class MyDispatcher(object): >def __call__(self): > > realview=zapi.getMultiAdapter((self.context,self.context.__parent__,self.request))

[Zope3-Users] ATDocument-like content component

2007-09-28 Thread Yuan HOng
Hi, Does there exists for Zope3 a content component for creating/editing HTML pages through the Web, preferably with the ability to upload images related to the HTML document? Something similiar to ATDocument for Plone/Zope2? -- Hong Yuan 大管家网上建材超市 装修装潢建材一站式购物 http://www.homemaster.cn _

Re: [Zope3-Users] Re: Remaking an 'instance' site with zopeproject

2007-10-08 Thread Yuan HOng
On 10/4/07, Philipp von Weitershausen <[EMAIL PROTECTED]> wrote: > > > __ > > ANOTHER PROBLEM: > > I don't get the access logs constantly running in Terminal that I was > > used to. > > How do I start these up? > > Ah, thanks for bringing this up. You can use a l

[Zope3-Users] dynamicall javascript and css generation

2007-10-08 Thread Yuan HOng
Hi, How do I dynamically generate javascript and css files and how to register them? ZPT doesn't seem to be a viable solution for generating these. DTML as far as I know is no longer available. So I think I should write a browser view to generate it in python with string formatting. Then how do

[Zope3-Users] How to get at the URL as entered in the browser?

2007-10-23 Thread Yuan HOng
Hi, list, Is it possible to retrieve the URL the user enters in the browser location box? The request's getURL method seems to return the traversed URL, including the default view name. In particular, I have a custom traverser for my object which extracts certain parameters from the URL path inst

Re: [Zope3-Users] How to get at the URL as entered in the browser?

2007-10-24 Thread Yuan HOng
On 10/24/07, Frank Burkhardt <[EMAIL PROTECTED]> wrote: > > The web server never gets the URL which as typed by the user. At least > the protocol (http vs. https), is lost. This is what you can do: > > url='http://' + request['HTTP_HOST'] + request['REQUEST_URI'] > Does this work for Zope3? I u

[Zope3-Users] Problem with interdependent utilities registration

2007-11-16 Thread Yuan HOng
Hi, If I have a utility component whose initializaiton depends on the availability of another utility, the initialization fails with a Component Lookup Error. It seems that in the ZCML file, the utility components are first created, and then at the end of the whole configuration, they are register

[Zope3-Users] How can I register a simple content provider (i.e. not viewlet)

2007-11-28 Thread Yuan HOng
With which ZCML directive can I register a simple content provider, say for the main menu. The browser namespaces only has viewlet and viewletManager directives, which must be used together to provide the ability to include multiple viewlets in an area represented by viewlet manager. In some simpl

[Zope3-Users] How to persist an attribute of list type

2007-11-30 Thread Yuan HOng
Hi, It seems that I can not get list attribute of an persistent object changed. I have the following class, which has a list as one of its attributes: class Cart(Persistent): items = [] amount = 0 In the debug console, I find that only with direct attribute assignment can I change the pe

Re: [Zope3-Users] How to persist an attribute of list type

2007-11-30 Thread Yuan HOng
On Dec 1, 2007 10:49 AM, Paul Winkler <[EMAIL PROTECTED]> wrote: > On Sat, Dec 01, 2007 at 02:34:49AM +0800, Yuan HOng wrote: > > Hi, > > > > It seems that I can not get list attribute of an persistent object > > changed. I have the following class, which has a

Re: [Zope3-Users] How can I register a simple content provider (i.e.not viewlet)

2007-11-30 Thread Yuan HOng
On Nov 29, 2007 1:07 PM, Roger Ineichen <[EMAIL PROTECTED]> wrote: > You can use the adapter directive for this. > > class IHeaderProvider(zope.contentprovider.interfaces.IContentProvider): > """Header provider.""" > > class HeaderProvider(object): > """Header content provider.""" > >

[Zope3-Users] z3c.json and datetime objects

2008-01-31 Thread Yuan HOng
The z3c.json write implementation uses str to convert any unrecognized data types json. But json only recogonizes basic data types, and strings must be enclosed in quotation marks, so the data representation given by z3c.json is often invalid. For example: >>> import zope.component >>> from z3

[Zope3-Users] Stability problem of zope3

2008-03-02 Thread Yuan HOng
Hi, I have jsut moved a production site from Zope2 to Zope3. I used zopeproject to download the necessary eggs and started my site using paste serve deploy.ini. Under moderate traffic however, the site stops responding soon. I have to regularily restart the server. When the site stops responding

Re: [Zope3-Users] Stability problem of zope3

2008-03-03 Thread Yuan HOng
On 3/3/08, Andreas Jung <[EMAIL PROTECTED]> wrote: > > The official Python version for Zope 3.3/3.4 is Python 2.4, not 2.5. > > Andreas > OK. I will try Python2.4 first, though in my development installation using also Python2.5 but will different versions of packages (because I ran zopeproject at

Re: [Zope3-Users] Stability problem of zope3

2008-03-03 Thread Yuan HOng
On Mon, Mar 3, 2008 at 10:08 PM, Jim Fulton <[EMAIL PROTECTED]> wrote: > > On Mar 3, 2008, at 4:00 AM, Jodok Batlogg wrote: > ... > > > paster opens a lot of threads. > > That's odd. That must depend on the server used. The zope.server > server factory uses 4 by default. The cherrypy server

Re: [Zope3-Users] Stability problem of zope3

2008-03-04 Thread Yuan HOng
I also noticed that on my production server, there are multiple process of zdaemon running, 3 exactly: root 23550 1 0 22:05 ?00:00:00 /usr/bin/python2.5 bin/homemaster-ctl -S /root/app/eggs/zdaemon-2.0.1-py2.5.egg/zdaemon/schema.xml -C zdaemon.conf bin/paster serve deploy.ini root

Re: [Zope3-Users] Stability problem of zope3

2008-03-11 Thread Yuan HOng
Hi, Thanks for the various advises previously. I have experimented with different wsgi servers: zope.server#main Paste#http PasteScript#cherrypy PasteScript#twisted and put them under some load: ab -c 20 The zope.server seems to give the best result. It causes the least failed requests due to t

[Zope3-Users] ZODB conflict for session data container

2008-03-19 Thread Yuan HOng
Hi, list I have newly migrated an Zope2 application to Zope3 and added session support to it. When I stress test the application with 'ab -c 20', I found lots of database conflict errors, like the following: 2008-03-20T13:44:24 WARNING ZopePublication Competing writes/reads at /prod/++vh++http:rh

Re: [Zope3-Users] ZODB conflict for session data container

2008-03-23 Thread Yuan HOng
Thanks Bernd for giving detailed answer and suggestions. > it is the case ... there are two workarounds imho > > 1. > don't write to the session if it does not change, so if you do an > apache bench without sending the client id cookie, a write is done on > each request > > additionally ever

[Zope3-Users] zope.app.wsgi doesn't register product configurations properly

2008-04-17 Thread Yuan HOng
Tyring out z3c.extfile, I added in zope.conf file the following product configuration section: storagedir var/filestorage This doesn't not work as expected when I am using Paste and wsgi. Looking into the code, I think the config function in zope.app.wsgi should be patched by adding: from zo

Re: [Zope3-Users] retrieving zope.conf parameters and paths of buildout dirs

2008-04-19 Thread Yuan HOng
One caveat, I you are using product-config directive to specify your application directory, please note that it can not be retrieved by zope.app.appsetup.getProductConfig if you are using zope.app.wsgi to start your zope3 application. In stead, a patch to zope.app.wsgi is needed. See my mail 2 day

[Zope3-Users] Using z3c.extfile with ZEO

2008-04-20 Thread Yuan HOng
Hello, I am trying to use z3c.extfile on clients running ZEO. My zope.conf has the following configuration: server localhost:8101 storage 1 blob-dir var/blob cache-size 20MB Then I get the following error: 2008-04-20T23:13:54 ERROR ZODB.Connection Couldn't load state for

Re: [Zope3-Users] zope.app.wsgi doesn't register product configurations properly

2008-04-21 Thread Yuan HOng
On Mon, Apr 21, 2008 at 11:47 PM, Marius Gedminas <[EMAIL PROTECTED]> wrote: > > I think it's a simple bug. Would you mind adding it to the bug tracker? > https://launchpad.net/zope3/+bugs > Done. -- Hong Yuan 大管家网上建材超市 装修装潢建材一站式购物 http://www.homemaster.cn ___

[Zope3-Users] z3c.extfile bug: unicode path name

2008-04-23 Thread Yuan HOng
Hello, With z3c.extfile, if the path name of the HashDir utility is a unicode string, as configured by the directive in zcml, a unicode digest will be returned. However, loading the file with this digest raises a ValueError, since the getPath function only recognizes StringType as digest: >>> fr

[Zope3-Users] Re: z3c.extfile bug: unicode path name

2008-04-23 Thread Yuan HOng
2008/4/23 Yuan HOng <[EMAIL PROTECTED]>: > > Below is the patch that fixes this. I am not sure if this is the best, > since it allows the file digest to be unicode. Can someone have a > look? > The alternative patch is simpler and doesn't allow digest to be u

[Zope3-Users] How do I find out references to objects in ZODB

2008-05-02 Thread Yuan HOng
Hi, Is it possible to find out what other objects are referencing a particular object in ZODB? In particular, I want to prevent some content objects, like images, from being removed from the folder if they are used in some other content object, like a news article. Do I have to keep track of obj

[Zope3-Users] How do I submit an update to zope translation?

2008-05-04 Thread Yuan HOng
Hi, If I find the current translation in zope.app.locales not satisfactory, how can I submit an update? In particular, I find a bug in the Chinese (zh_CN) translation which causes the sizes of content objects not displayed in the rotterdam skin. Following is the fix, hope someone can commit it.

[Zope3-Users] z3c.jsonrpc response content type bug

2008-10-28 Thread Yuan HOng
When I use z3c.jsonrpc (svn head) to publish an object, the response generated gets the content header: Content-Type: application/x-javascript According to the README.txt of the package: This project provides the proposed request type "application/json". The request type "application/json-rpc" i

Re: [Zope3-Users] z3c.jsonrpc response content type bug

2008-10-28 Thread Yuan HOng
On Tue, Oct 28, 2008 at 6:32 PM, Jim Washington <[EMAIL PROTECTED]> wrote: > > A bit of history on this. The content-type in this bit of code was > determined more than three years ago by testing with several old major > web browsers. At the time, 'application/x-javascript' was the > content-type

Re: [Zope3-Users] z3c.jsonrpc response content type bug

2008-10-29 Thread Yuan HOng
Hi, Roger, > > That's very interesting, which JS library are you using for JSON-RPC calls > from ExtJS? > Or does ExtJS provide JSON-RPC calls out of the box? > No, it is regretful that ExtJS (at least 2.0.1 which I am using) doesn't function well with z3c.jsonrpc out of the box, because z3c.json