Re: [Zope] Apache mod_rewrite module...

2000-05-22 Thread Peter Sabaini


you might want to use apaches proxy module in conjunction with
mod_rewrite.

from the docs of mod_rewrite
(http://www.apache.org/docs/mod/mod_rewrite.html): 

"""
proxy|P' (force proxy)
This flag forces the substitution part to be internally
forced as a proxy request and immediately (i.e., rewriting rule
processing stops here) put through the proxy module. [...]
"""

i have something like:

   RewriteRule /(.*) http://stromapp.kleinezeitung.at:8080/$1 [p]


you should make sure you got mod_proxy as it is not compiled in by
default.

have a lot of fun in the voodoo world of mod_rewrite :)

peter.

On Mon, 22 May 2000, Pierre Rougier wrote:

:>
:> > My URL references to Apache
:> > example:
:> > http://margo.pla.fr/intra/machin.html
:> >
:> > and I want to use httpd.conf to transform it (only for html and htm
:> > files)
:> > in
:> >
:> > http://margo.pla.fr/intra/?machin.html (which is my ZServer)
:> >
:> > Does someone know the rewrite I sould use regular expression are a
:> > mistery for me
:>
:> does "intra" represent that it should be represented by zserver? if so,
:>
:> RewriteRule ^/intra/(.*)htm  /intra/?$1htm
:> RewriteRule ^/intra/(.*)html /intra/?$1html
:>
:>
:
:Well, thanks mindlace, it helps, in fact, now, I use the following line:
:RewriteRule^(^([^/]*/)*)([^/]*\.html)$  http://newhost:8080$1?$3
:(this line should be usefull for those who want to redirect any *.html URL
:to your ZServer)
:
:which change the URL like I want. The problem is that it makes a redirect,
:and all my relative addresses in the page are changed too (for instance, my
:.gif are served by zope too, and I don't want to!)
:
:To be clearer,  what my product do is:
:
:I address Apache, with for instance:
:http://margo.ina.fr/intra/index.html
:
:then, Apache change the URL to:
:http://margo.ina.fr:8080/intra/?index.html  (8080 is my ZServer port)
:
:my zope product construct a new page with informations from the "intra"
:folder, go and search the file ../intra/index.html on the disk, insert it
:to the builded page (by reading the file) and serve it.
:
:The problem is that by doing that, as in the HTML pages, paths are
:relatives, the redirection change all the relative address to the port 8080
:(because the final served URL is on this port), and I want my Images to be
:served by apache
:
:(I hope I am clear, but it is hard to explain in an email).
:A solution would be to write absolute URL for my images, but I am not
:allowed to do it.
:
:so, I try... to use Apache not to redirect, but to go and search the
:result of http://margo.ina.fr:8080/intra/?index.html, in a way which would
:be transparent to the browser(the printed URL would keep the Apache
:one), and I have to say that untill now, I don't manage to do it...
:
:Well. thanks for your attention
:
:Pierre
:
:
:___
:Zope maillist  -  [EMAIL PROTECTED]
:http://lists.zope.org/mailman/listinfo/zope
:**   No cross posts or HTML encoding!  **
:(Related lists - 
: http://lists.zope.org/mailman/listinfo/zope-announce
: http://lists.zope.org/mailman/listinfo/zope-dev )
:

-- 

_
peter sabaini, mailto: [EMAIL PROTECTED]
-


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] DTML newbie question on summation

2000-06-02 Thread Peter Sabaini


try 

  
:
:The days represent hours but are stored as integers in the database.
:
:- Bryan Patrick Coleman
:  Questcon Technologies
:  (336)273-2428
:  [EMAIL PROTECTED]
:
:
:___
:Zope maillist  -  [EMAIL PROTECTED]
:http://lists.zope.org/mailman/listinfo/zope
:**   No cross posts or HTML encoding!  **
:(Related lists - 
: http://lists.zope.org/mailman/listinfo/zope-announce
: http://lists.zope.org/mailman/listinfo/zope-dev )
:

-- 

_
peter sabaini, mailto: [EMAIL PROTECTED]
-


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] another zope site gone...

2000-06-05 Thread Peter Sabaini


...finally online!

http://druck.kleinezeitung.at/ now holds the 'as printed' version of
the 'Kleine Zeitung', one of the bigger austrian newspapers.

doing the zope part was the fun bit... thanks to DC for a great
product and to the list for real good ressources.

hope i get management to adopt zope as our primary platform!

ru,
peter sabaini.

-- 

_________
peter sabaini, mailto: [EMAIL PROTECTED]
-



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] ProxyPass Problems

2000-06-27 Thread Peter Sabaini


i dont know much about ssl but wouldn't you want to pass / -->
https:// instead of / --> http:// ?
but then again i dont know a thing about ssl...
peter


On Mon, 26 Jun 2000, Baker, Dennis [sjmr] wrote:

:I'm having a problem with getting ProxyPass and SSL to work.  I followed the
:How-to on Using Apache with ZServer,  and unfo's How-To on
:Apache+ZServer+SSL.  And my setup is nearly identical to the one listed on
:the howto.  I have my main site in the root of my Zope Setup,  and My SSL
:site is in a subdirectory of the root called SecureSite.  
:
:After setting up the ProxyPass Directives in Apache (I have the httpd.conf
:section attached below) and Adding the SiteRoot objects on Zope I can access
:the main Site at http://mysite.org,  but if I try to access
:https://mysite.org my web browser hangs until it times out.  Also,  it
:becomes impossible to browse the SecureSite Folder unless I delete the
:SiteRoot Object. 
:
:It appears to be some kind of Apache issue,  however I can't figure out why
:it won't connect,  the directives are almost identical to the ones on the
:Howto.  Any Suggestions ??
:
:  Snippet from httpd.conf  ---
:NameVirtualHost 206.171.167.101:80
:
:
:ServerAdmin [EMAIL PROTECTED]
:ServerName mysite.org
:ProxyPass / http://mysite.org:8080/
:ProxyPassReverse / http://mysite.org:8080/
:ProxyPass /misc_ http://mysite.org:8080/misc_
:ProxyPass /p_ http://mysite.org:8080/p_
:
:
:NameVirtualHost 206.171.167.101:443
:
:
:ServerAdmin [EMAIL PROTECTED]
:ServerName mysite.org
:ProxyPass / http://mysite.org:8080/SecureSite/
:ProxyPassReverse / http://mysite.org:8080/SecureSite/
:ProxyPass /misc_ http://mysite.org:8080/misc_
:ProxyPass /p_ http://mysite.org:8080/p_
:
:
:  End Snippet 
:
:Dennis Baker
:Information Systems Manager, St. Joseph's Medical Resources 
:
:
:___
:Zope maillist  -  [EMAIL PROTECTED]
:http://lists.zope.org/mailman/listinfo/zope
:**   No cross posts or HTML encoding!  **
:(Related lists - 
: http://lists.zope.org/mailman/listinfo/zope-announce
: http://lists.zope.org/mailman/listinfo/zope-dev )
:

-- 

_________
peter sabaini, mailto: [EMAIL PROTECTED]
-


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] NESTED IN STATEMENTS AND PASSING VARIABLES in DTML

2000-07-20 Thread Peter Sabaini



this should work too (untestet):

 
 
   id=&seq=&vid=
 
  

('id' var should be put on the namespace by 'active_category_method()'
and gets passed in to 'category_method()' (which, being a zsqlmethod,
wouldnt take a var from the namespace)

peter.

-- 

_____
peter sabaini, mailto: [EMAIL PROTECTED]
-


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Property problem - still the same...

2000-09-29 Thread Peter Sabaini


hi

afaik its not possible to nest properties.

what about dtml method mytitle in the root folder consisting of

   - 

or something like this? this will acquire title from the current
document and enterprisename from the rootfolder provided theres not
another enterprisename in the acquisition path.

hth peter.

On Fri, 29 Sep 2000, Lars Heber wrote:

:Hello again,
:
:I recently set a question about nested properties.
:
:Unfortunately, we didn't come to a proper solution.
:
:I was told to use ZClasses, and I read a lot of documentation about it.
:But I found out that this isn't the thing I was searching for.
:
:So, now I'll try it again, very concrete this time:
:
:In my root folder, I have a property enterpriseName (string) =
:"myEnterprise".
:
:Furthermore I have an arbitrary DTML document, and I want to include my
:global property enterpriseName in the title property of this document so
:that the title of the document is "myEnterprise" at the end.
:
:The sense of that is that when I change the value of enterpriseName
:automatically all titles are updated.
:
:It is not possible to include this enterpriseName into
:standard_html_header or similar, because there will be many documents,
:and only some of them need the enterpriseName in their titles, others
:want to add an own text to the enterpriseName resulting in e. g. "This
:is the Homepage of XYZ, who is working at myEnterprise".
:
:I generally just want to insert one property into another...
:
:Please, please help me, I'm despairing in the meantime...
:
:Lars
:
:
:___
:Zope maillist  -  [EMAIL PROTECTED]
:http://lists.zope.org/mailman/listinfo/zope
:**   No cross posts or HTML encoding!  **
:(Related lists - 
: http://lists.zope.org/mailman/listinfo/zope-announce
: http://lists.zope.org/mailman/listinfo/zope-dev )
:

-- 

_____
peter sabaini, mailto: [EMAIL PROTECTED]
-


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




RE: [Zope] overriding __str__ method?

2000-10-09 Thread Peter Sabaini


so if i'm not mistaken you want to be able to include an object
instance with say  and, depending on the user
being authenticated, have that object render with "edit this" button
or without?

overriding the __str__ method can afaik only be done inside a python
product (read the python product tutorial)

you could use lalo's "Renderable Base ZClass" product or call your
instance like so:

  

  

(or call it )

and in the "method_that_renders_myinstance" you'd render those "edit"
buttons only if theres the correct role in AUTHENTICATED_USER

hth peter sabaini.

On Mon, 9 Oct 2000, Seb Bacon wrote:

:Thanks for the reply,
:
:> Either I don't understand the problem or you're making it too
:> complicated. 
:
:I think both, but mostly the latter ;)
:
:Explanation MK II:
:
:I know how to create a form that does what I want (update properties,
:whatever).  What I don't know is how to include it as part of the rendered
:content programmatically.  At the moment users have to go to
:www.widgets.com/manage_content, log in, and see a set of forms loosely based
:on the Zope manage interface.  Instead, I'd like them to go to the same url,
:and see exactly the same website as someone who's not logged in, except they
:have these lovely little "edit this" buttons next to each editable content
:element (by which I mean image, text snippet, etc).
:
:Now I *could* do a
:
:  
:edit this
:  
:
:in each content element. But I'd much rather be able to subclass or mixin an
:'editable' class for each content element in question.  The question is,
:what methods should I be providing to manipulate how the content is
:rendered?  For example, I can provide a new 'view' method in the 'views' tab
:for a ZClass, but this does not get called when an object is rendered as
:part of another document.  The reason I was going on about __str__ is
:because that seems to be the only place that you can interfere with how the
:content is rendered inline?
:
:Hope that's clearer,
:
:seb.
:
:
:
:
:
:>
:> You have a form to edit the properties.
:> ...
:> 
:> ...
:>
:> The action method of this form sets the REQUEST variables to the
:> property names:
:> ...
:> 
:> ...
:> (I generally use the same names for form vars and property names
:> to avoid confusing myself)
:>
:> then:
:> 
:>
:> Does this help?
:> >
:>
:> Seb Bacon wrote:
:>
:> > My strategy:
:> > Each element that I want the user to be able to edit is a ZClass with a
:> > manage_content method.  This provides the custom management view (e.g.
:> > combines properties and title/data into a single form).
:> > Now I want a way to give the user access to this screen.  I
:> could do a new
:> > version of the folders tree view (manage_menu), but what I'd
:> really like to
:> > do is have a button next to each of these elements ("edit
:> this") which calls
:> > its manage_content method.  The button would only appear when
:> the user was
:> > authenticated / authorised.
:> >
:> > My problem:
:> > The only place I can think of doing this is in each object's
:> __str__ method.
:> > But AFAIK there's no convenient way of overriding its default behaviour.
:> > What I'd like to do is override it in the ZClass views interface.  I can
:> > override the 'View' method (from the ZClass 'views' tab), but
:> that doesn't
:> > get called in the course of rendering a component in a page.
:> The problem
:> > would seem to be that there's no equivalent of the __str__
:> method available
:> > to override...  Or is there?
:
:
:___
:Zope maillist  -  [EMAIL PROTECTED]
:http://lists.zope.org/mailman/listinfo/zope
:**   No cross posts or HTML encoding!  **
:(Related lists - 
: http://lists.zope.org/mailman/listinfo/zope-announce
: http://lists.zope.org/mailman/listinfo/zope-dev )
:

-- 

_
peter sabaini, mailto: [EMAIL PROTECTED]
-


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] DCOracle + LOB

2000-10-18 Thread Peter Sabaini


hi all,

i have this shiny brand new oracle 8i server and now read (on the
mailinglist) that there's no lob support for oracle 8i in dcoracle
1.3.2, and indeed it does not appear to work.

is that true? i need lob support! is there any workaround? through
stored procedures maybe?

thanks a lot!

peter. 

-- 

_
peter sabaini, mailto: [EMAIL PROTECTED]
-


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Inserting LONGs with DCOracle

2000-11-20 Thread Peter Sabaini



do something like:

from DCOracle import *
conn=Connect( "%s/%s@%s" % (user,pw,srv) )
h=conn.prepare("insert into table_x (x,y,z) values :p1, p2:, :p3")
long_str = 'a'*8000
h.execute(1,2,long_str)

assuming column z is declared as LONG

hth

peter.


On Fri, 17 Nov 2000, Dorothea Kuehn wrote:

:Hi,
:If I try to insert an ca.5000 char string with DCOracle(1.3.2) into a LONG
:column in Oracle (8i) I keep getting ORA-1704 'string literal too
:long'-Errors.
:
:Ok, I read here
:http://osi.oracle.com/~tkyte/Misc/LargeStrings.html
:that it will work (a) with bind variables or (b) that I have to use
:ODBC,OCI or alike.
:
:Questions: (a) Can I use bind variables with DCOracle? How?
:(b) I thought DCOracle is using OCI, so why the heck this isn't working?
:Any workarounds?
:
:thanks for help,
:dekay
:
:___
:Zope maillist  -  [EMAIL PROTECTED]
:http://lists.zope.org/mailman/listinfo/zope
:**   No cross posts or HTML encoding!  **
:(Related lists -
: http://lists.zope.org/mailman/listinfo/zope-announce
: http://lists.zope.org/mailman/listinfo/zope-dev )
:

-- 

_________
peter sabaini, mailto: [EMAIL PROTECTED]
-


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




RE: [Zope] Caching/http-acceleration and proxying Zope-served content

2001-01-09 Thread Peter Sabaini


not sure if thats what you want, but squid _can_ act as a frontend to
multiple backend-servers. check out the squid users guide
(http://squid-docs.sourceforge.net/latest/html/book1.htm)
specifically http://squid-docs.sourceforge.net/latest/html/x2544.htm
which deals with "accelerator" options

peter.

On Mon, 8 Jan 2001 [EMAIL PROTECTED] wrote:

:Hmm.  That's been my thought on squid as well, given its ground-up design
:for caching in the first place.  My worry, though, is that with squid I lose
:support for virtual hosts on seperate boxes, because I need to support Zope,
:static content, and some legacy stuff running ColdFusion on an NT box.  My
:impression is that Squid's http accelerator mode (inverse transparent proxy,
:or whatever you want to call it) is somewhat of an afterthought compared to
:the standard proxy use case.  If it supports the ability to direct traffic
:based upon the virtual host address, then squid works - if not, I think I
:have to go the Apache route... I also wonder just how good Apache's
:mod_proxy caching is?  Any thoughts?
:
:Sean
:
:-Original Message-
:From: Shane Hathaway [mailto:[EMAIL PROTECTED]]
:Sent: Monday, January 08, 2001 12:59 PM
:To: [EMAIL PROTECTED]
:Subject: Re: [Zope] Caching/http-acceleration and proxying Zope-served
:content
:
:
:[EMAIL PROTECTED] wrote:
:>
:> I have a question, for anyone experienced in working with Zope and caching
:> proxies:
:>
:> I'm setting up a load-balanced server farm that has nodes that will run
:> Apache and proxy (via mod_proxy) to ZEO clients running ZServer.  This
:farm
:> is routed (both ways) through a layer 4 load-balancing appliance, and all
:> these boxes (both nodes and the balancer) are sitting inside a DMZ with
:> private IP addresses.  The public world will access these servers via a
:> firewall box running transparent proxy (actually, I guess, similar to
:> squid's http_accel mode; the semantics here are a bit tricky, as it's more
:> of a inverse trans-proxy).  Between Apache and Zope, there would be
:several
:> virtual hosts, and I'd be using the SiteAccess product.  It gets a bit
:> tricky in that I need to access several different virtual hosts inside the
:> DMZ (one for the ZEO farm, and another for a dedicated CGI-based ad server
:> on another box) via the proxy.  A more detailed (ascii art) diagram of
:what
:> I am trying to do, is at http://209.132.8.98/server_ascii_art.txt
:>
:> My question is this: does anybody have any thoughts on the merits of Squid
:> (http accelerator mode) versus Apache/mod_proxy in terms of caching,
:virtual
:> hosts, and the like when working with Zope sites?  Any big pitfalls to
:this
:> kind of setup with Zope sites?
:
:I would prefer Squid since its only purpose in life is caching.  It
:follows the "do one thing and do it well" mantra.
:
:But whatever your choice, I hope you make use of the new CacheManagement
:feature in Zope 2.3.  It is designed to make things like this
:straightforward and easy.  There's a recent news announcement that links
:to everything you need--including complete help docs!
:
:Shane
:
:___
:Zope maillist  -  [EMAIL PROTECTED]
:http://lists.zope.org/mailman/listinfo/zope
:**   No cross posts or HTML encoding!  **
:(Related lists -
: http://lists.zope.org/mailman/listinfo/zope-announce
: http://lists.zope.org/mailman/listinfo/zope-dev )
:
:___
:Zope maillist  -  [EMAIL PROTECTED]
:http://lists.zope.org/mailman/listinfo/zope
:**   No cross posts or HTML encoding!  **
:(Related lists -
: http://lists.zope.org/mailman/listinfo/zope-announce
: http://lists.zope.org/mailman/listinfo/zope-dev )
:

-- 

_
peter sabaini, mailto: [EMAIL PROTECTED]
-


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Caching/http-acceleration and proxying Zope-served content

2001-01-09 Thread Peter Sabaini

On Tue, 9 Jan 2001, Toby Dickenson wrote:

:On Tue, 9 Jan 2001 09:31:35 +0100 (CET), Peter Sabaini
:<[EMAIL PROTECTED]> wrote:
:
:>actually i use a combination of squid / apache because i need some
:>re-writing, you could as well use squid for caching and apache for
:>(name-based) virtual hosting. this of course introduces additional
:>latency, but this shouldnt be a problem if your objects are fairly
:>cacheable, ie. most content would be served out of squid anyway.
:
:That's an interesting configuration. For a while Ive been considering
:a solution based on longer-than-usual chains of http proxies, and a
:"do one thing well" principal. In my case:
:
:Apache (for rewriting and SSL)
:  -> Squid accelerator
:   -> A custom load-balancing redirector
:-> Multiple Zopes
:
:Have you had any significant latency, or other problems?
:
:Toby Dickenson
:[EMAIL PROTECTED]

my configuration was:

  --> squid --> apache w/ rewriting and logging --> zserver / zope

there was of course some latency added but nothing significant -- <
0.5s afai can remember. and, since squid was the first stage, most
content would be served of squid (and thus with no added latency)
anyway. ssl was not an issue.

the problem i had with zserver-only was that the most-requested pages
(frontpage and index pages) were also the most expensive to render
(drawing in content from diverse categories etc.) with the proxy
setup, the most-requested pages would be in the cache, and
little-requested pages (article views) are a) simple to render and
therefore dont contribute much to load and latency and b) there's more
willingness for users to wait half a second longer for a detailed view
than for an index page, where they decide if they want to read
anything at all (imho).

i needed apache for logging and also served all static images via
apache -- all those small gifs can have quite an impact of subjective
load times. and since these dont change often you dont need
manageability via zope. you just have to write  instead of  (or
whatever)...

ru,
peter.



-- 

_
peter sabaini, mailto: [EMAIL PROTECTED]
-


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] MVC Approach

2005-08-04 Thread Peter Sabaini
On Wednesday 03 August 2005 22:06, Thomas Adams wrote:
> Hi all,
>
> I'm a newbie to Zope, using version 2.7.3 (okay it is not the newest one)
> and I want to know if there is something
> like a MVC approach available for Zope, i.e. Model-View-Controller
> approach, as it is for instance in Java with  the Struts framework from
> Apache.

Sure its possible to implement MVC in Zope2 (we did it for our product), 
especially if youre not afraid of Python Products, though theres no special 
support for this in Zope 2.7

You really should be looking at Zope3 or Zope2 + Five (which is part of 
Zope2.8) for this though. See the Zope3 Developers Book, eg. 
http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/Zope3Book/components.html
 

 - peter.


> To be more specific:
>
> - The Model consists of several python classes implementing business logic
> (the pendant to Enterprise Java Beans or simple Java Beans)
>
> - The Views producing  the visual appearance of the business objects
>   (in java or more specific in Struts these are the custom tag libraries)
>
> - The Controller, as a kind of glue between the two above, is
> controlling the work/process-flow
>   (in java with servlets and in struts with actions classes (as a minimum)
> )
>
> To transfer this appraoch to Zope, I'm not sure:
>
> Views:
> DTML-Document and/or DTML-Methods?
>
> Controller:
> PythonScripts?
>
> Models:
> I'm absolutely not sure, Pluggable brains? (the Zope book has a example
> but only as a handling of resultsets)
>
> So if has anybody a hint if there are some resources
> in the web, please post it.
>
> P.S: I don't know Zope 3 (Is that apossible answer of my questions?)
>
> Thasnks in advance
> Regards
> Thomas Adams
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] APE and Zope 2.9?

2005-12-20 Thread Peter Sabaini
It seems APE 1.0 doesnt run out of the box with Zope 2.9 -- has anyone tried 
hacking APE up so it can run inside Zope 2.9? 

Any thoughts as to what would be necessary / how hard this would be?


Thanks,
peter.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Permissions, files and folders

2006-04-21 Thread Peter Sabaini
On Friday 21 April 2006 10:15, Tino Wildenhain wrote:
> Erik Billing schrieb:
> > Ah! Thanx! DocFinder will shore come very useful in time =)
> >
> > Btw, what editor would you recommend for writing python outside Zope.
> > I've frequently used Eclipse with PyDev before, but it's a bit slow and
> > heavy. I've looked around a bit on the free editors without finding
> > anything I like so I'm thinking it might be worth trying a commercial
> > editor. What do you guys use?
>
> Linux/KDE: kate and/or eric3 (nice because of seamless sftp/webdav)
> Linux: vim, some will use (x)emacs, pida
>
> Windows: hm. I've used the ide that comes with the win32 extensions
>   from Marc Hammond. You bend some paths and get nice module
>   view and hinting for zope classes too.

I've used WingIDE a bit lately and am quite impressed by its feature set:

* Good editor: Syntax coloring, folding, autocompletion, ...
* Auto-lookup of documentation 
* Visual Debugger: watches, breakpoints, lots of goodies
* Code / Class browser
* Zope support

Last but not least: great support staff. 

It uses quite a bit of resources though.

Review of Python IDEs:
http://spyced.blogspot.com/2005/09/review-of-6-python-ides.html

peter.

> Regards
> Tino
>
> ___
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Five: Adapter registry not working?

2007-05-30 Thread Peter Sabaini
Hi list,

I am clearly doing something wrong here.

I try to use an Adapter from zope.app.session with an HTTPRequest object, but 
the Adapterregistry doesnt quite cooperate.

Specifically, I try to adapt a HTTPRequest object to 
zope.app.session.interfaces.IClientId via the Adapter 
zope.app.session.session.ClientId

A short demo:

% ./zopectl debug
 [ ... ]

Import stuff:

>>> from ZPublisher.HTTPRequest import *
>>> from StringIO import StringIO
>>> from zope.app.session.session import ClientId
>>> from zope.app.session.interfaces import IClientId
>>> from zope import component
>>> from zope.interface import *

Create ourselves a faux request object:

>>> env = {'SERVER_NAME': '', 'SERVER_PORT' : ''}
>>> request = HTTPRequest(StringIO(), env, None)

ClientId implements IClientId:

>>> list(implementedBy(ClientId))
[]

It seems ClientId is an Adapter for IRequest:

>>> component.adaptedBy(ClientId)
(,)

request implements IBrowserRequest, which is a subclass of IRequest:

>>> list(providedBy(request))
[]
>>> issubclass(list(providedBy(request))[0], component.adaptedBy(ClientId)
[0])
True

...so I'd expect to get ClientId as an Adapter for IClientId(request), but I 
dont:

>>> IClientId(request)
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: ('Could not adapt', , 
)


Shouldnt this work? Obviously I am missing something here.
This is on Zope 2.10.2 with the built-in Five, and Python 2.4.4

Any help greatly appreciated!

 - peter.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Five: Adapter registry not working?

2007-05-30 Thread Peter Sabaini
On Wed 2007-05-30 17:14:13 Tres Seaver wrote:
> Peter Sabaini wrote:
> > Hi list,
> >
> > I am clearly doing something wrong here.
> >
> > I try to use an Adapter from zope.app.session with an HTTPRequest object,
> > but the Adapterregistry doesnt quite cooperate.
> >
> > Specifically, I try to adapt a HTTPRequest object to
> > zope.app.session.interfaces.IClientId via the Adapter
> > zope.app.session.session.ClientId
> >
> > A short demo:
> >
> > % ./zopectl debug
> >  [ ... ]
> >
> > Import stuff:
> > >>> from ZPublisher.HTTPRequest import *
> > >>> from StringIO import StringIO
> > >>> from zope.app.session.session import ClientId
> > >>> from zope.app.session.interfaces import IClientId
> > >>> from zope import component
> > >>> from zope.interface import *
> >
> > Create ourselves a faux request object:
> > >>> env = {'SERVER_NAME': '', 'SERVER_PORT' : ''}
> > >>> request = HTTPRequest(StringIO(), env, None)
> >
> > ClientId implements IClientId:
> > >>> list(implementedBy(ClientId))
> >
> > []
> >
> > It seems ClientId is an Adapter for IRequest:
> > >>> component.adaptedBy(ClientId)
> >
> > (,)
> >
> > request implements IBrowserRequest, which is a subclass of IRequest:
> > >>> list(providedBy(request))
> >
> > []
> >
> > >>> issubclass(list(providedBy(request))[0],
> > >>> component.adaptedBy(ClientId)
> >
> > [0])
> > True
> >
> > ...so I'd expect to get ClientId as an Adapter for IClientId(request),
> > but I
> >
> > dont:
> > >>> IClientId(request)
> >
> > Traceback (most recent call last):
> >   File "", line 1, in ?
> > TypeError: ('Could not adapt', ,
> > )
> >
> >
> > Shouldnt this work? Obviously I am missing something here.
> > This is on Zope 2.10.2 with the built-in Five, and Python 2.4.4
> >
> > Any help greatly appreciated!
>
> You have verified that 'ClientID' is a suitable candidate for adapting
> 'IRequest' to 'IClientID', but not that it has been actually registered
> as the factory for that adaptaion.

Ah, I see. I thought component.adaptedBy() checked the actual registration... 

> Does adding the following help?
>
>   >>> from zope.component import provideAdapter
>   >>> provideAdapter(ClientID)

Nope, I still get the "Could not adapt ... " error.

Besides, zope/app/session/configure.zcml has the following:

  

and ClientId has:

class ClientId(str):
implements(IClientId)
adapts(IRequest)

Does that take care of registration?

I wonder if I need to do some special Five incantation to make the global 
registration work?

This, on the other hand, works quite well (lifted from some unit tests):

>>> from cStringIO import StringIO
>>> from zope.app.testing import ztapi, placelesssetup
>>> from zope.app.session.interfaces import IClientId, IClientIdManager
>>> from zope.app.session.session import ClientId
>>> from zope.app.session.http import CookieClientIdManager
>>> from zope.publisher.interfaces import IRequest
>>> from zope.publisher.http import HTTPRequest
>>>
>>> placelesssetup.setUp()
>>> ztapi.provideAdapter(IRequest, IClientId, ClientId)
>>> ztapi.provideUtility(IClientIdManager, CookieClientIdManager())
>>> request = HTTPRequest(StringIO(), {}, None)
>>> IClientId(request)
'WiKfis240zXEVZ0UWM6H6AsWc6kYwJyviHNXhGqd835xsnZhKlzfjc'

The difference: zope.publisher.http.HTTPRequest is a new-style class (is that 
required?), and placelesssetup.setUp() is executed (what does it do?)

> Also, at the point where the lookup fails, you can try:
>   >>> import pdb; pdb.pm()
>
> and be in a "postmortem" traceback of the failed component tookup.

I'm afraid I'm not sure what I should be looking for...

Thanks a lot,
peter.

>
> Tres.


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Five: Adapter registry not working?

2007-06-04 Thread Peter Sabaini
FTR: I tracked this down again some more -- the culprit is not the adapter 
registry but a failing getUtility() call.

I really wish component lookup / adapation would be easier to debug; IMHO this 
is pretty opaque -- but then again I'm a newb at this.

peter.



On Wednesday 30 May 2007 18:51:18 Peter Sabaini wrote:
> On Wed 2007-05-30 17:14:13 Tres Seaver wrote:
> > Peter Sabaini wrote:
> > > Hi list,
> > >
> > > I am clearly doing something wrong here.
> > >
> > > I try to use an Adapter from zope.app.session with an HTTPRequest
> > > object, but the Adapterregistry doesnt quite cooperate.
> > >
> > > Specifically, I try to adapt a HTTPRequest object to
> > > zope.app.session.interfaces.IClientId via the Adapter
> > > zope.app.session.session.ClientId
> > >
> > > A short demo:
> > >
> > > % ./zopectl debug
> > >  [ ... ]
> > >
> > > Import stuff:
> > > >>> from ZPublisher.HTTPRequest import *
> > > >>> from StringIO import StringIO
> > > >>> from zope.app.session.session import ClientId
> > > >>> from zope.app.session.interfaces import IClientId
> > > >>> from zope import component
> > > >>> from zope.interface import *
> > >
> > > Create ourselves a faux request object:
> > > >>> env = {'SERVER_NAME': '', 'SERVER_PORT' : ''}
> > > >>> request = HTTPRequest(StringIO(), env, None)
> > >
> > > ClientId implements IClientId:
> > > >>> list(implementedBy(ClientId))
> > >
> > > []
> > >
> > > It seems ClientId is an Adapter for IRequest:
> > > >>> component.adaptedBy(ClientId)
> > >
> > > (,)
> > >
> > > request implements IBrowserRequest, which is a subclass of IRequest:
> > > >>> list(providedBy(request))
> > >
> > > [ > > zope.publisher.interfaces.browser.IBrowserRequest>]
> > >
> > > >>> issubclass(list(providedBy(request))[0],
> > > >>> component.adaptedBy(ClientId)
> > >
> > > [0])
> > > True
> > >
> > > ...so I'd expect to get ClientId as an Adapter for IClientId(request),
> > > but I
> > >
> > > dont:
> > > >>> IClientId(request)
> > >
> > > Traceback (most recent call last):
> > >   File "", line 1, in ?
> > > TypeError: ('Could not adapt', ,
> > > )
> > >
> > >
> > > Shouldnt this work? Obviously I am missing something here.
> > > This is on Zope 2.10.2 with the built-in Five, and Python 2.4.4
> > >
> > > Any help greatly appreciated!
> >
> > You have verified that 'ClientID' is a suitable candidate for adapting
> > 'IRequest' to 'IClientID', but not that it has been actually registered
> > as the factory for that adaptaion.
>
> Ah, I see. I thought component.adaptedBy() checked the actual
> registration...
>
> > Does adding the following help?
> >
> >   >>> from zope.component import provideAdapter
> >   >>> provideAdapter(ClientID)
>
> Nope, I still get the "Could not adapt ... " error.
>
> Besides, zope/app/session/configure.zcml has the following:
>
>  factory=".session.ClientId"
>   permission="zope.Public"
>   />
>
> and ClientId has:
>
> class ClientId(str):
> implements(IClientId)
> adapts(IRequest)
>
> Does that take care of registration?
>
> I wonder if I need to do some special Five incantation to make the global
> registration work?
>
> This, on the other hand, works quite well (lifted from some unit tests):
> >>> from cStringIO import StringIO
> >>> from zope.app.testing import ztapi, placelesssetup
> >>> from zope.app.session.interfaces import IClientId, IClientIdManager
> >>> from zope.app.session.session import ClientId
> >>> from zope.app.session.http import CookieClientIdManager
> >>> from zope.publisher.interfaces import IRequest
> >>> from zope.publisher.http import HTTPRequest
> >>>
> >>> placelesssetup.setUp()
> >>> ztapi.provideAdapter(IRequest, IClientId, ClientId)
> >>> ztapi.provide

Re: [Zope] Acquisition / proxying object

2008-02-25 Thread Peter Sabaini
On Monday 25 February 2008 20:45:37 Joerg Baach wrote:
> Hi *,
>
> I am trying to have a folderish object that acquires from a user object
> (ldapuserfolder). It should have its own properties and contents, but
> fall back to the ones of the ldap user.
>
> I have created an object, extending Folder, and it behaves nicely in
> zopectl debug. When I try to access it through e.g. a python script  I
> get an:
>
> Error Type: Unauthorized
> Error Value: Unable to find __roles__ in the container and the container
> is not wrapped. Access to 'dn' of test, acquired through (LDAPProxy at
> /testfolder/ldapproxy), denied.
>
> I am sure its my lack of understanding of acquisition. I am trying to
> bascially put ldap user object 'on top' of the aquisition line (with the
> ldapproxy at the bottom), but obviously failing in doing so. Any ideas?

I'm not familiar with LDAPUserFolder (its not really a user object but a user 
container, isn't it?) but the error you're getting is a security error -- the 
Python Script checks for security attributes before it accesses attributes. 
You need to add the appropriate security declarations in your product before 
it can be used inside PyScript

You might try the verbose-security directive in zope.conf to debug stuff like 
that; I hope it is available in the version of Zope you're running (I'm on 
2.10)

As a hack to disable all security checks on a class you can add the attribute 
__allow_access_to_unprotected_subobjects__ = 1 , effectively disabling 
security. This of course should only be done if you trust your users!

hth
peter.



> Cheers,
>
>   Joerg
>
>
>
> 8< excerpt from code ---
>
> class LDAPProxy(Folder):
>
> meta_type='LDAPProxy'
>
> def __init__(self, id, remoteid,title='',REQUEST=None):
> self.id = id
> self.title = title
> self.remoteid = remoteid
>
> def __of__(self, parent):
> if not hasattr(parent,'aq_base'):
> return self
> folder,id = self.remoteid.split(':')
> acl = parent.restrictedTraverse(folder)
> remote = acl.getUser(id)
> return Folder.__of__(self,parent.__of__(remote))
>
> --- teststructure--
>
> /testfolder/
>ldapproxy (LDAPProxy)
>acl_users/
>testscript (.py)
>
>
> 8< testscript -
> return context.ldapproxy.dn
>
> traceback--
> Traceback (most recent call last):
>   File "/home/joerg/zope/Zope-2.8.5/lib/python/ZPublisher/Publish.py",
> line 113, in publish
> request, bind=1)
>   File "/home/joerg/zope/Zope-2.8.5/lib/python/ZPublisher/mapply.py",
> line 88, in mapply
> if debug is not None: return debug(object,args,context)
>   File "/home/joerg/zope/Zope-2.8.5/lib/python/ZPublisher/Publish.py",
> line 40, in call_object
> result=apply(object,args) # Type s to step into published object.
>   File
> "/home/joerg/zope/Zope-2.8.5/lib/python/Shared/DC/Scripts/Bindings.py",
> line 311, in __call__
> return self._bindAndExec(args, kw, None)
>   File
> "/home/joerg/zope/Zope-2.8.5/lib/python/Shared/DC/Scripts/Bindings.py",
> line 348, in _bindAndExec
> return self._exec(bound_data, args, kw)
>   File
> "/home/joerg/zope/Zope-2.8.5/lib/python/Products/PythonScripts/PythonScript
>.py", line 323, in _exec
> result = f(*args, **kw)
>   File "Script (Python)", line 1, in testscript
>   File
> "/home/joerg/zope/Zope-2.8.5/lib/python/AccessControl/ImplPython.py",
> line 727, in guarded_getattr
> aq_acquire(inst, name, aq_validate, validate)
>   File
> "/home/joerg/zope/Zope-2.8.5/lib/python/AccessControl/ImplPython.py",
> line 669, in aq_validate
> return validate(inst, object, name, v)
>   File
> "/home/joerg/zope/Zope-2.8.5/lib/python/AccessControl/ImplPython.py",
> line 563, in validate
> self._context)
>   File
> "/home/joerg/zope/Zope-2.8.5/lib/python/AccessControl/ImplPython.py",
> line 293, in validate
> accessed, container, name, value, context)
>   File
> "/home/joerg/zope/Zope-2.8.5/lib/python/AccessControl/ImplPython.py",
> line 808, in raiseVerbose
> raise Unauthorized(text)
> Unauthorized: Unable to find __roles__ in the container and the
> container is not wrapped.  Access to 'dn' of test, acquired through
> (LDAPProxy at /testfolder/ldapproxy), denied.


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Acquisition / proxying object

2008-02-25 Thread Peter Sabaini
On Monday 25 February 2008 22:45:24 Joerg Baach wrote:
> > I should have mentioned that in order for verbose-security to work you
> > also need to switch to the python security implementation -- did you do
> > that?
>
> Yes, I did.
>
> > If yes, you should see lines like these in your event.log:
>
> No, don't :-(

Strange... 

> But somehow I have the feeling it has more to do with the 'and the
> container is not wrapped' part of the message. Not that I can make sense
> of it ;-)

Yes, definitely. Its just with VerboseSecurity its easier to debug...

Another option: put a debugger breakpoint (eg. "import pdb; pdb.set_trace()") 
at the place where the "Unauthorized" exception is raised and inspect the 
objects 

peter.



> Cheers,
>
>   Joerg


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Acquisition / proxying object

2008-02-25 Thread Peter Sabaini
On Monday 25 February 2008 21:31:46 Joerg Baach wrote:
> Hi Peter,
>
> > I'm not familiar with LDAPUserFolder (its not really a user object but a
> > user container, isn't it?) but the error you're getting is a security
> > error -- the Python Script checks for security attributes before it
> > accesses attributes. You need to add the appropriate security
> > declarations in your product before it can be used inside PyScript
>
> Well, even with: __allow_access_to_unprotected_subobjects__ = 1 I get
> the same error. VerboseSecurity is also on. :-(

I should have mentioned that in order for verbose-security to work you also 
need to switch to the python security implementation -- did you do that? 

"security-policy-implementation python" in zope.conf

If yes, you should see lines like these in your event.log:

2008-02-25T22:30:18 DEBUG ImplPython Unauthorized: Your user account does not 
have the required permission.  Access to 'manage' of (Application at ) 
denied. Your user account, Anonymous User, exists at /acl_users. Access 
requires one of the following roles: ['Manager']. Your roles in this context 
are ['Anonymous'].

peter.


> Cheers,
>
>   Joerg


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Acquisition / proxying object

2008-02-25 Thread Peter Sabaini
ps.: http://www.zope.org/Documentation/Books/ZDG/current/Security.stx has old 
but AFAIK still good info

On Monday 25 February 2008 22:45:24 Joerg Baach wrote:
> > I should have mentioned that in order for verbose-security to work you
> > also need to switch to the python security implementation -- did you do
> > that?
>
> Yes, I did.
>
> > If yes, you should see lines like these in your event.log:
>
> No, don't :-(
>
> But somehow I have the feeling it has more to do with the 'and the
> container is not wrapped' part of the message. Not that I can make sense
> of it ;-)
>
> Cheers,
>
>   Joerg


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Acquisition / proxying object

2008-02-26 Thread Peter Sabaini
On Monday 25 February 2008 23:52:26 Joerg Baach wrote:
> Hi *,
>
> > But somehow I have the feeling it has more to do with the 'and the
> > container is not wrapped' part of the message. Not that I can make sense
> > of it ;-)
>
> Mmm, after even more searching, and not understanding I found
>
> http://www.mail-archive.com/[EMAIL PROTECTED]/msg11438.html
>
> and changed my code to:
>
>
> def __of__(self, parent):
> '''foo'''
> if not hasattr(parent,'aq_base'):
> return self
>
> folder,id = self.remoteid.split(':')
> acl = parent.unrestrictedTraverse(folder)

You're now doing no security checks on traversal, probably thats why you don't 
get any Unauthorized exceptions :-)

- peter.


> remote = acl.getUser(id)
>
> return Acquisition.ImplicitAcquisitionWrapper(aq_base(self),
>
>  aq_base(remote).__of__(parent))
>
> Now, this actually seems to work. If only I knew why
>
>
> Cheers,
>
>   Joerg


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Managing Zope objects in Subversion

2008-03-02 Thread Peter Sabaini
On Sunday 02 March 2008 14:17:31 [EMAIL PROTECTED] wrote:
> Dear all
>
> We use Zope for the  user interface part of our software product.
> We currently export the whole folder hierarchy into a .zexp file and
> maintain this file in Subversion.
>
> I'm looking for a way to manage a folder structure as individual
> Zope objects in Subversion.

If read-only access is enough, maybe this is for you:

http://www.infrae.com/download/FileSystemSite

hth,
peter.


>
> In fact, maintaining the Zope objects in the file system would suffice,
> there is no need to edit them with external editors or to be able
> to use Subversion from within Zope (we use TurtoiseSVN).
>
> We're using:
> - Zope 2.10
> - Windows
> - DTML (yes) Documents and Methods; lots of external methods; some
> images;
>   and a low number of various other Zope objects.
> - Zope Objects and particularly Folders have security settings using
> custom roles
>
> I've browsed/googled and looked into books, and found a few products
> and hints, but most of them seem to be very outdated or not applicable
> to a Windows environment.
>
> Hence I would be very grateful for hints about the "state-of-the-art"
> way to achieve this.
>
> Thank you and best regards
> Martin
>
> 
>
> COMIT AG - A Swisscom Company
> Martin Gfeller, Senior Manager
> Risk Management - Quantax
> Pflanzschulstrasse 7
> CH-8004 Zurich
> Switzerland
>
> mailto:[EMAIL PROTECTED]
> http://www.comit.ch/
> http://www.quantax.com/ - Market Risk & Return
>
> ___
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] define a class in a python script

2008-03-05 Thread Peter Sabaini
On Wednesday 05 March 2008 10:21:32 Yuri wrote:
> Hi, all!
>
>  I would like to define a class inside a python script (so I can catalog
> it and use catalog to store info, as the tutorial about catalog
> everything suggests).

The default Script(Python) objects dont support class definition, because of 
security constraints. 

One easy option would be to just use some other object, eg. a "File" and use 
its properties. 

Another option (with more initial effort, but easier to maintain later on) is 
to implement a custom Product; have a look at 
http://www.zope.org/Documentation/Books/ZDG/current on how to do this.

hth
peter.



> So I've done:
>
> 
> class Autore:
>  " classe per il catalogo "
>
>  def set_autore(self, autore=''):
>   """ setta l'autore """
>   self.autore=autore
>
>  def set_variante(self, variante=''):
>   """ setta l'autore """
>   self.variante = variante
>
>  def variante(self):
>   """ ritorna la variante """
>   return self.variante
>
>  def set_qualificazione(self, qualificazione=''):
>   """ setta la qualificazione """
>   self.qualificazione = qualificazione
>
>  def qualificazione(self):
>   """ ritorna la qualificazione """
>   return self.qualificazione
>
>
> un_autore = Autore()
> un_autore.set_autore('prova')
> un_autore.set_variante('una variante')
> un_autore.set_qualificazione('una qualificazione')
>
> print un_autore.variante()
> print un_autore.qualificazione()
>
> return printed
>
> ==
>
> but zope complains about I can call the methods of this class:
>
> *Error Type: Unauthorized*
> *Error Value: You are not allowed to access set_autore in this context
>
> So, what can I do? How can I create virtual objects to be cataloged?
> *
> ___
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Multithreading sessions

2008-05-23 Thread Peter Sabaini
On Friday 23 May 2008 17:09:49 Jon Emmons wrote:
> Jaroslav and everyone,
>
> I have made the changes Jaroslav suggested and I cannot get Zope to serve
> even 2 sessions simultaneously.
>
> In our testing, one client will start a query to the data servers.  Another
> will try to simply get the logon page to be served.  Zope will simply sit
> there and wait until the DB returns its results for the first user before
> doing anything at all for the second.  The 2nd user is not hitting the DB
> server.  The python script accessing the data is waiting for the results
> for the first user.  Could python be the problem?

I very much doubt it. Zope (and Python) can easily serve many concurrent 
sessions.

You'll need to find out what exactly makes Zope hang and where it hangs. One 
option to do this is to attach with gdb to the Python process and figure it 
out from the backtrace. 
http://www.upfrontsystems.co.za/Members/jean/zope-notes/debug-spinning-zope 
talks about that a bit

Another option is to use the Deadlock Debugger product (I haven't used that 
personally though): 
http://www.zope.org/Members/nuxeo/Products/DeadlockDebugger

hth,
peter.



> I am running python 2.4.4.
>
> Is it possible that I missed a flag or something when I build the Zope?
>
> Thanks for your suggestions so far, but I think I have missed a fundamental
> setup step that allows zope to multithread sessions.
>
> If I were echoing what was being served to the clients, shouldn't I see it
> interwoven?  I don't, it is always (client 1's results) then (client 2's
> results)... very atomic.
>
> Thanks again,
>
> Jon Emmons
>
>
>
> -Original Message-
> From: Jaroslav Lukesh [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 23, 2008 9:37 AM
> To: Jon Emmons; zope@zope.org
> Subject: Re: [Zope] Multithreading sessions
>
> Hi Jon,
>
> I use 24 zserver-threads and I have here defined number of ZoDB connections
> (pool-size):
>
> in your instance etc/zope.conf look for that section:
>
> 
> # Main FileStorage database
> 
>   path $INSTANCE/var/Data.fs
> 
> mount-point /
> cache-size 1000
> pool-size 24
> 
>
> Please pay attention, if you have bunch of cache, your RAM shoul be
> exhausted.
>
> Regards, JL.
>
> - Original Message -
> From: "Jon Emmons" <[EMAIL PROTECTED]>
>
> > I had already gone into zope.conf and added the line:
> >
> > zserver-threads 10
> >
> > This seemed to have no effect.  Is that what you mean?
> > You think I should bump it higher?  100 maybe?
>
> ___
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )




signature.asc
Description: This is a digitally signed message part.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Zope2 + Twisted

2009-03-05 Thread Peter Sabaini
I'd like to run a Twisted client in Zope 2.10 (for a legacy app).

How do I do that? Simply loading twisted.internet is probably not a good idea 
since Twisted would not work well with ZServer threads, right?

One thing I tried was enabling Twisted in zope.conf but that gives me the 
following stacktrace (abbr):

  ...
  File "/usr/local/zope/2.10/src/Zope-2.10.7-
final/lib/python/ZConfig/matcher.py", line 188, in constuct 
s = st.datatype(s)  
 
  File "/usr/local/zope/2.10/src/Zope-2.10.7-
final/lib/python/Zope2/Startup/datatypes.py", line 349, in __init__ 
raise ImportError("You do not have twisted installed.") 
 
ImportError: You do not have twisted installed. 
   


I've got Twisted on my Pythonpath though.

TIA,
peter.



signature.asc
Description: This is a digitally signed message part.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Zope2 + Twisted

2009-03-05 Thread Peter Sabaini
On Thursday 05 March 2009 18:46:33 you wrote:
> could this be satisficed by putting an apache proxy in front of both zope
> and twisted?

No, not really -- I'd like to use a client written on top of Twisted in a Zope 
product. So, I'd need the twisted reactor and libraries running in the Python 
VM that runs Zope. Which should be no problem except I suspect that I 
shouldn't be using the (threaded) ZServer then, because I think that would 
mess with twisted (which is not threadsafe for the most part). 

I thought if I'd switch to the twisted http server implementation that would 
take care of that -- no threaded ZServer, no problem. Except that doesn't seem 
to work as advertised, since the zope.app.twisted package is not present, and 
the one on PyPI seems to be geared towards Zope3, AFAICT.

Is that so? Is there an alternative zope.app.twisted package for Zope2?

thx,
peter.


> On Thu, Mar 5, 2009 at 6:17 AM, Peter Sabaini  wrote:
> > I'd like to run a Twisted client in Zope 2.10 (for a legacy app).
> >
> > How do I do that? Simply loading twisted.internet is probably not a good
> > idea
> > since Twisted would not work well with ZServer threads, right?
> >
> > One thing I tried was enabling Twisted in zope.conf but that gives me the
> > following stacktrace (abbr):
> >
> >  ...
> >  File "/usr/local/zope/2.10/src/Zope-2.10.7-
> > final/lib/python/ZConfig/matcher.py", line 188, in constuct
> >s = st.datatype(s)
> >  File "/usr/local/zope/2.10/src/Zope-2.10.7-
> > final/lib/python/Zope2/Startup/datatypes.py", line 349, in __init__
> >raise ImportError("You do not have twisted installed.")
> > ImportError: You do not have twisted installed.
> >
> >
> > I've got Twisted on my Pythonpath though.
> >
> > TIA,
> > peter.
> >
> >
> > ___
> > Zope maillist  -  Zope@zope.org
> > http://mail.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://mail.zope.org/mailman/listinfo/zope-announce
> >  http://mail.zope.org/mailman/listinfo/zope-dev )



signature.asc
Description: This is a digitally signed message part.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Zope2 + Twisted

2009-03-05 Thread Peter Sabaini
On Thursday 05 March 2009 23:33:40 you wrote:
> On Thu, Mar 5, 2009 at 18:59, Peter Sabaini  wrote:
> > So, I'd need the twisted reactor and libraries running in the Python
> > VM that runs Zope. Which should be no problem except I suspect that I
> > shouldn't be using the (threaded) ZServer then, because I think that
> > would mess with twisted (which is not threadsafe for the most part).
>
> Well, then you could probably set the ZServer to only use one thread.
> That means you need many ZServers with a load balancer in front
> instead.
>
> > I thought if I'd switch to the twisted http server implementation that
> > would take care of that -- no threaded ZServer, no problem. Except that
> > doesn't seem to work as advertised, since the zope.app.twisted package is
> > not present, and the one on PyPI seems to be geared towards Zope3,
> > AFAICT.
>
> I'm pretty sure the Zope2 implementation doesn't use zope.app.twisted.

Zope2/Startup/datatypes.py tries to import it

> However, the Zope 2 implementation is again not thread safe, and will
> only work with one thread per server, so you don't actually gain
> anything in using it. Besides, I don't think anyone actually used it
> after I implemented it. Which is why it's still marked as
> experimental, and would probably best be removed again.

Hm, the default zope.conf says twisted should be supported as an HTTP server 
replacement -- is that a bug?  

Thanks,
peter.




signature.asc
Description: This is a digitally signed message part.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Dependent ZCA utility registration ?

2010-05-12 Thread Peter Sabaini
I have trouble registering utilities which depend on the presence of
other utilities; eg. I have a package A where I want to register utility
B which depends on registration of utility C. 

I tried to register B by putting registration in the __init__.py of A,
which fails because at import time C is not yet registered. 

Registration by subscribing to the utility registration event handler
for C also failed, because by the time the handler gets called, the
utility C is not yet installed. 

My current workaround involves registration upon the IDatabaseOpen
event, which is doubly ugly because Zope 2.10 doesnt send that event out
of the box -- I send it in a monkey-patched Zope2.App.startup module.  

What is the canonical way to do this?

Thanks, 
peter.

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] zope timeouts

2010-07-20 Thread Peter Sabaini
Hm, just some quick ideas -- thread 3 is busy doing a stat64() , should
usually done quickly. And thread 4 is doing some kind of string
operation (comparison), which also shouldn't take long except if you
have a huge dataset. Is this backtrace repeatable, ie. does it hang in
the same syscalls?

Are you maybe running on NFS or something like that? 

hth,
peter.


On Tue, 2010-07-20 at 17:00 +0200, Michele Marcionelli wrote:
> Ciao Jens
> 
> thank you for your answer. Now since I'm new with "gdb" I have some questions.
> I did following. I created a file called "gdb_batch" with following content:
> 
> info threads
> thread 1
> bt
> thread 2
> bt
> thread 3
> bt
> thread 4
> bt
> thread 5
> bt
> 
> and run the "gdb" command like this
> 
> gdb python $(cat Z2.pid) --batch -x gdb_batch  > gdb_bt.log 2>&1
> 
> Can you maybe help me to "decode" the output (see attachment)?
> 
> For instance: what does this mean?
> 
> (gdb) info threads
>   5 Thread 0xb712bb90 (LWP 7532)  0x005fd410 in __kernel_vsyscall ()
>   4 Thread 0xb672ab90 (LWP 7533)  lookdict_string (mp=0xb78c4714, 
> key=0xb7c19db8, hash=1293002269) at Objects/dictobject.c:331
>   3 Thread 0xb5d29b90 (LWP 7534)  0x005fd410 in __kernel_vsyscall ()
>   2 Thread 0xb5328b90 (LWP 7535)  0x005fd410 in __kernel_vsyscall ()
> * 1 Thread 0xb7fc16c0 (LWP 7174)  0x005fd410 in __kernel_vsyscall ()
> 
> What does mean the "*"? And what is the "difference" between the threads 
> 1,2,3,5 (with the __kernel_vsyscall) and the 4?
> 
> What should I look for?
> 
> Thank you,
> Michele
> 
> 
> 
> On Jul 20, 2010, at 14:54 , Jens Vagelpohl wrote:
> 
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> > 
> > Hi Michele,
> > 
> > I would consider the coincience with strace "reviving" the process a red
> > herring. When strace runs it does not influence the process you are
> > watching with it, except for telling you what OS-level calls are made.
> > 
> > The most common reason for such timeouts are problems with software that
> > tries to use other network resources during the running request to talk
> > to services like RDBMS systems, LDAP, etc. If these background
> > connections hang for some reason you'll end up with a hanging Zope
> > thread. Enough of them and Zope itself appears to hang.
> > 
> > When your process hangs you should be able to attach to it using "gdb"
> > and printing a stack trace for each thread. That may give you a big clue
> > where the problem is.
> > 
> > jens
> > 
> > 
> > On 7/20/10 13:53 , Michele Marcionelli wrote:
> >> Hello
> >> 
> >> I'm running an old version of Zope which is required by our corporate 
> >> design using also an older version of the CMS Silva:
> >> 
> >>Linux Distribution: Red Hat Enterprise Linux Server release 5.5
> >>Linux Kernel: 2.6.18-194.8.1.el5PAE
> >>Zope: 2.8.9.1
> >>Python: 2.3.6 (with several modules, like: ldap, pil, mysql, pyxml, ...)
> >>Silva: 1.5.13
> >> 
> >> My problem ist that my zope server hat timeouts on displaying pages after 
> >> a while that it has been started (currently this "while" is approx. 15 
> >> minutes). The only thing that helps is restarting zope.
> >> 
> >> By accident I discovered about two month ago, that running an "strace -f" 
> >> on the zope process, "reactivated" it... so I could live with this hack 
> >> until yesterday.
> >> 
> >> Now I'm running "strace" permanently (with all the disadvantages) and zope 
> >> works "fine" for about 1 to 1.5 hours.
> >> 
> >> Here is a short recurring output of "strace":
> >> 
> >>> [pid 13408] <... futex resumed> )   = 0
> >>> [pid 13406] futex(0xbcc12c0, FUTEX_WAIT_PRIVATE, 0, NULL 
> >>> [pid 13405] futex(0xbcc12c0, FUTEX_WAKE_PRIVATE, 1 
> >>> [pid 13408] futex(0xbcc12c0, FUTEX_WAKE_PRIVATE, 1 
> >>> [pid 13407] <... futex resumed> )   = 0
> >>> [pid 13405] <... futex resumed> )   = 1
> >>> [pid 13408] <... futex resumed> )   = 1
> >>> [pid 13405] futex(0xbcc12c0, FUTEX_WAIT_PRIVATE, 0, NULL 
> >>> [pid 13408] futex(0xbcc12c0, FUTEX_WAIT_PRIVATE, 0, NULL 
> >>> [pid 13406] <... futex resumed> )   = 0
> >>> [pid 13406] futex(0xbcc12c0, FUTEX_WAIT_PRIVATE, 0, NULL 
> >>> [pid 13407] futex(0xbcc12c0, FUTEX_WAKE_PRIVATE, 1) = 1
> >>> [pid 13405] <... futex resumed> )   = 0
> >>> [pid 13407] futex(0xbcc12c0, FUTEX_WAKE_PRIVATE, 1 
> >>> [pid 13405] futex(0xbcc12c0, FUTEX_WAIT_PRIVATE, 0, NULL 
> >>> [pid 13408] <... futex resumed> )   = 0
> >>> [pid 13407] <... futex resumed> )   = 1
> >>> [pid 13407] futex(0xbcc12c0, FUTEX_WAIT_PRIVATE, 0, NULL 
> >>> [pid 13405] <... futex resumed> )   = -1 EAGAIN (Resource temporarily 
> >>> unavailable)
> >> 
> >> 
> >> I need definitively help... Any idea?
> >> 
> >> Thx,
> >> Michele
> 
> 
> ___
> Zope maillist  -  Zope@zope.org
> https://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  https://mail.zope.