Re: [Zope] maintaining session variables using zeocluster

2009-09-14 Thread Paul Winkler
On Mon, Sep 14, 2009 at 11:39:56AM -0400, Tres Seaver wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> nair rajiv wrote:
> > Hellol,
> > 
> > We are using a zeocluster with six clients and use pound for
> > load balancing betwwen them. However I am having problems
> > using session variables. I think that session variables are maintained
> > separately for  each client  i.e  a value set to sesssion variable
> > when pound
> > sends a request to one client cannot be retreived when a request is
> > sent to some other client. What can be done in such a situation ?
> 
> You can either:
> 
>  - Mount the session storage over ZEO (google "zeo session storage").
> 
>  - Use a non-ZODB-based sessioning implementation, e.g. the one in
>mcdutils:  http://agendaless.com/Members/tseaver/software/mcdutils/

Or configure Pound for "session affinity" - send all requests for the
same session to the same back-end server.
Read the "Sessions" section of http://www.apsis.ch/pound/

The problem with this approach is that it tends to reduce the
effectiveness of load-balancing.

-- 

Paul Winkler
http://www.slinkp.com
___
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] Question about ZSyncer

2009-07-22 Thread Paul Winkler
That is supposed to work, if you enable the "relative paths" option.
In fact, that was how I did most of my testing when I added that feature.

But I don't work on ZSyncer at all anymore.  If it doesn't work, I
can't really help.

- PW

On Wed, Jul 22, 2009 at 6:20 AM, Ajay Deshpande wrote:
> Hi All:
>
> I would like to know if the ZSyncer product can sync data between two DBs on
> the same instance rather than two instances themselves.
> Any help is greatly appreciated.
>
> TIA,
> R
>
> --
> "And the trees are all kept equal
> By hatchet, axe, and saw"
> ___
> Zope maillist  -  z...@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 )
>
>



-- 
http://www.slinkp.com
___
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] ZSyncer fails to do authenticate under Zope 2.11

2009-07-16 Thread Paul Winkler
No, sorry, I have never tried to run it with Zope later than 2.9 and I
have zero time to experiment with it.

- PW

On Thu, Jul 16, 2009 at 09:26:20AM -0600, Dennis Allison wrote:
> Pleas for assistance aside, any ideas as to what might be broken?  We depend
> upon this Product in our development process.
> 
> On Thu, Jul 16, 2009 at 8:37 AM, Paul Winkler  wrote:
> 
> > Nobody (including me) is maintaining ZSyncer  at all.
> >
> > I'll take this opportunity to once again call for volunteers to take
> > up the reins... anybody care enough about ZSyncer to maintain it?
> >
> > - Paul
> >
> > On Wed, Jul 15, 2009 at 06:01:58PM -0700, Dennis Allison wrote:
> > > I am getting 401 errors with ZSyncer-0.7.1 using a configuration which
> > > worked with Zope 2.9 and an earler version of the ZSyncer product.  Both
> > > use Python 2.4.  Has anyone seen this problem?  Can you recommend a fix?
> > > Is the CVS version of ZSyncer on Sourceforge a better choice?
> >
> > --
> >
> > Paul Winkler
> > http://www.slinkp.com
> > ___
> > 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 )
> >

-- 

Paul Winkler
http://www.slinkp.com
___
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] ZSyncer fails to do authenticate under Zope 2.11

2009-07-16 Thread Paul Winkler
Nobody (including me) is maintaining ZSyncer  at all.

I'll take this opportunity to once again call for volunteers to take
up the reins... anybody care enough about ZSyncer to maintain it?

- Paul

On Wed, Jul 15, 2009 at 06:01:58PM -0700, Dennis Allison wrote:
> I am getting 401 errors with ZSyncer-0.7.1 using a configuration which 
> worked with Zope 2.9 and an earler version of the ZSyncer product.  Both 
> use Python 2.4.  Has anyone seen this problem?  Can you recommend a fix?
> Is the CVS version of ZSyncer on Sourceforge a better choice?

-- 

Paul Winkler
http://www.slinkp.com
___
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] Touching an object / updating the modification time

2009-03-30 Thread Paul Winkler
On Sat, Mar 28, 2009 at 01:02:58PM +0100, Jakob Schou Jensen wrote:
> Hi Paul,
> 
> Doing a
> 
>some_image._p_changed = 1
> 
> gives me an error:
> 
>"_p_changed" is an invalid attribute name because it starts with "_".
> 
> Do you know what I am doing wrong?

Ah, I didn't realize you are doing this in "untrusted" code.
http://docs.zope.org/zope2/zope2book/source/ScriptingZope.html#script-security

Another approach would be to just change any (small) attribute of the
object.  Something like: some_image.title = some_image.title


-- 

Paul Winkler
http://www.slinkp.com
___
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] Touching an object / updating the modification time

2009-03-27 Thread Paul Winkler
On Fri, Mar 27, 2009 at 07:53:33AM -0500, Andreas Jung wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 27.03.2009 7:40 Uhr, Jakob Schou Jensen wrote:
> > Is it possible to update the modification time of an object (in this
> > case an Image object)?
> > 
> > 
> 
> The modification date is stored as 'bobobase_modification_date'
> attribute (DateTime instance).

Note though that you can't set it to an arbitrary value, because the
ZODB will set it to the current time when the transaction commits.

If that's all you want, it's sufficient to do something like:

some_image._p_changed = 1

(and then, if you're running in eg. a zopectl debug prompt, import
transaction; transaction.commit())

-- 

Paul Winkler
http://www.slinkp.com
___
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] TraversalError in custom TALES namespace during Five tests

2008-12-16 Thread Paul Winkler
I've implemented a custom TALES namespace that works fine when tested
in the browser, but blows up in doctests.  Anybody seen behavior like
this?

It appears that during the test, my adapter is looked up fine, but
later when we try to traverse to the method, we end up with a
zope.security._proxy._Proxy wrapper that hides the existence of my
methods. Just to reiterate, the same code *works fine* when
running Zope for real, and I only see this failure during tests.

 Here's the tail end of a test / pdb session:

 41 def traverse(self, name, furtherPath):
 42  -> subject = self._subject
 43 __traceback_info__ = (subject, name, furtherPath)
 44 attr = getattr(subject, name, _marker)
 45 if attr is not _marker:
 46 return attr
 47 if hasattr(subject, '__getitem__'):
(Pdb) n
> /home/pw/builds/slinktopp.openplans.org/builds/20081210/opencore/lib/zope/lib/python/zope/traversing/adapters.py(43)traverse()
-> __traceback_info__ = (subject, name, furtherPath)
(Pdb) n
> /home/pw/builds/slinktopp.openplans.org/builds/20081210/opencore/lib/zope/lib/python/zope/traversing/adapters.py(44)traverse()
-> attr = getattr(subject, name, _marker)
(Pdb) p subject

(Pdb) p name
'member_title'
(Pdb) p subject.member_title
*** AttributeError: 


This appears to indicate that the OpencoreTales instance itself is fine,
but the security wrapper is preventing attribute access.

And here's my zcml:

  

  

  



And here's the relevant part of the implementation:

class OpencoreTales(object):
component.adapts(interface.Interface)
interface.implements(IPathAdapter)

def __init__(self, context):
import pdb; pdb.set_trace()
self.context = context

def member_title(self):
return member_title(self.context)
...

Thanks for any advice,

- Paul Winkler

-- 
http://www.slinkp.com
___
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] Storing unicode in ZODB objects

2008-12-16 Thread Paul Winkler
On Mon, Dec 15, 2008 at 03:52:35PM -0500, Thibaud Morel l'Horset wrote:
>   That's a great tip about setting the content_type charset correctly. The
> way I was handling this so far was to specify it in the header of the page
> that was displaying the text:
>  tal:content="nocall:python:request.response.setHeader('Content-Type','text/html;
> charset=UTF-8')" tal:omit-tag="">

On a stylistic tangent: combining "nocall" with "python" doesn't make
any sense, and I don't believe it has any effect. Nocall's purpose is
to prevent implicitly calling the object traversed at the end of a
*path* expression.

Also, don't use tal:content when you don't actually want to insert the
result of the expression. The most common idiom I've seen when calling
something purely for side effects is to abuse tal:define:



Or, better, put the define in a tag that actually serves a purpose and
you can leave out the omit-tag as well:


 ...


-- 

Paul Winkler
http://www.slinkp.com
___
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] Displaying PIL Images in Zope Templates

2008-09-19 Thread Paul Winkler
On Thu, Sep 18, 2008 at 08:22:37AM +0200, Nico Grubert wrote:
>  > > The  renders "".
>  > > How can I show the image?
> 
>  > Call its tag method.
> 
>  >
> 
> 
> Hi Paul,
> 
> how is the susi going? ;-)

Ah, I sold mine years ago. Nowadays I mostly just play bass. And you? :)
 
> I tried  but I get the 
> following error:
> ---
> Exception TypeTraversalError
> Exception Value   (, 'tag')

Whoops, sorry, I didn't realize these were PIL images, I thought they
were OFS.Image or some such. But I see you already got the solution.

- PW
 

-- 

Paul Winkler
http://www.slinkp.com
___
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] Displaying PIL Images in Zope Templates

2008-09-17 Thread Paul Winkler
On Wed, Sep 17, 2008 at 03:01:55PM +0200, Nico Grubert wrote:
> Hi there
> 
> Is it possible to show several PIL.Image.Image instances in a Zope Page 
> without creating a temporary Zope image object?
> 
> I have an external method that creates a list of
> PIL.Image.Image instances, e.g.
>[,
> 
> ]
> 
> How can I display all images in a Zope page template?
> 
> I tried
> 
>
>
> 
> 
> The  renders "". How can I 
> show the image?

Call its tag method.



-- 

Paul Winkler
http://www.slinkp.com
___
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] documentation for ZCatalog apart from the Zope Book?

2008-09-17 Thread Paul Winkler
On Tue, Sep 16, 2008 at 07:45:45PM +0100, michael nt milne wrote:
> Hi
> 
> Is there any in-depth documentation anywhere on the Zope search facility the
> ZCatalog, how to build indexes and access these. I find that the Zope Book
> online is ok but not quite enough to really get to grips with it.

I assume you are looking at the last version,
http://plope.com/Books/2_7Edition/SearchingZCatalog.stx

Other than that, there's some .txt files in the source that you might
look at. Not sure how helpful they will be, but it's worth a look.
Look under lib/python/Products/ZCatalog/ and
lib/python/Products/PluginIndexes.


-- 

Paul Winkler
http://www.slinkp.com
___
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] Security for objects being called

2008-09-17 Thread Paul Winkler
On Tue, Sep 16, 2008 at 08:55:33AM -0400, Thibaud Morel l'Horset wrote:
> Thanks for the response Paul. I don't see a Proxy tab on Page Templates
> though, only DTML methods: do I need to install an additional product for
> that? or is it configured somewhere else for Templates?

Oops, right you are. Templates don't have proxy roles.

One obvious workaround: Add a dtml method that consists only of
.  Make this dtml method anonymously viewable, and give
it a proxy role of Authenticated.

Then make your real template, and the script it calls, both viewable
only by Authenticated.


-- 

Paul Winkler
http://www.slinkp.com
___
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] Security for objects being called

2008-09-16 Thread Paul Winkler
On Mon, Sep 15, 2008 at 07:44:58PM -0400, Thibaud Morel l'Horset wrote:
> Hello all,
> 
>   I'm trying to figure out how to prevent certain zope objects from being
> called directly but allow them to be called from another object.
> 
>   Here is an example:
>   You have a ZPT page, let's originally call it 'test'
>   test calls a Script(Python) 'script'
> 
>   I want any anonymous user to be able to call 'test' from the web but not
> 'script'. However, I want 'test' to call 'script' and render the contents of
> 'script' to anonymous users through 'test'. I tested this out by making the
> 'script' View permission only available for Authenticated users, and as
> anonymous I can neither hit 'test' nor 'script'.
> 
>   Based on my understanding of the Zope security framework I don't think
> this is possible... hopefully someone can tell me I'm wrong though and show
> me how to do it :)

http://plope.com/Books/2_7Edition/Security.stx#2-62


-- 

Paul Winkler
http://www.slinkp.com
___
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] script calling template

2008-09-11 Thread Paul Winkler
On Wed, Sep 10, 2008 at 07:57:29PM -0700, David Bear wrote:
> I have a script that calls a template.
> 
> The template has a tal expressions like this
> 
>  
> 
> I want my script to call the template in such a way that the string
> 'ploneDoc' is replaced by a different string.
> 
> I'm not sure how to go about parameterizing a tales expressions like
> this.

It is possible, by sticking a question mark in front of ploneDoc; but
afaict you can only use a variable already in the namespace,
i.e. you'd have to define it first.  Like so:

  

But I have literally never seen this obscure feature in real use,
because nobody seems to know about it (I had forgotten it myself), and
because it's not necessary. I'd prefer to have the script just pass in
the object you want, as per this document:
http://plope.com/Books/2_7Edition/BasicScripting.stx#1-3

So, in your script, something like:

doc = context.restrictedTraverse(some_path)
return context.mytemplate(mydoc=doc)

Then, in your template just do:





-- 

Paul Winkler
http://www.slinkp.com
___
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] TAL conditional expression

2008-09-05 Thread Paul Winkler
On Fri, Sep 05, 2008 at 01:05:23PM -0700, David Bear wrote:
> Also, I would like to be able to use the same request object in both my
> template and the macro, but my macro doesn's seem to have access to the same
> request object.

It is the same request.

-- 

Paul Winkler
http://www.slinkp.com
___
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: Problems with buildout and zope.interface

2008-07-30 Thread Paul Winkler
On Fri, Jul 25, 2008 at 02:53:55PM +0200, Christian Scholz wrote:
>>> So my main question is probably: Is there a way to automate the
>>> process of installing and running virtualenv similar to what
>>> bootstrap.py does for buildout so that people do not need to care
>>> about the virtualenv part?

Yes, you can write a custom virtualenv bootstrap script as documented
here:
http://pypi.python.org/pypi/virtualenv#creating-your-own-bootstrap-scripts

You can then distribute just your bootstrap script, and all somebody
has to do is download and run it (assuming they have python).  The
bootstrapper will then fetch and run virtualenv, install easy_install
into the virtualenv, and do anything else you put in your
bootstrapper.

Personally I've never tried combining virtualenv and buildout.

-- 

Paul Winkler
http://www.slinkp.com
___
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] manage_cutObjects/manage_pasteObjects problem ...

2008-07-30 Thread Paul Winkler
Just a quick note:

On Fri, Jul 25, 2008 at 03:20:23PM +0200, Giampiero Benvenuti wrote:
> I think the problem is your 4th line: copy_info = 
> obj_parent.manage_cutObjects((context.getId()))
> copy_info should be the object you want to cut
>
> it should be something like this:
> ...
> src=context.your_cut_context[obj_id]
> context.your_cut_context.manage_cutObjects([src])
>
> dst=context.your_paste_context
> dst.manage_pasteObjects(src)

Sorry Giampiero, you're just guessing, and you're guessing wrong.  The
original poster's code was correct*.  Dieter's suggestion is a better
approach to troubleshoot this problem.


*well, almost correct. There's a common Python mistake on one line:

 copy_info = obj_parent.manage_cutObjects((context.getId()))
   
You think you're creating a tuple there, but you're not.
To create a tuple of size 1, you need a trailing comma:

 copy_info = obj_parent.manage_cutObjects((context.getId(),))

But that's not causing your problem; manage_cutObjects() "helpfully"
wraps a string argument in a tuple for you.

-- 

Paul Winkler
http://www.slinkp.com
___
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: Deployment Best Practices?

2008-07-13 Thread Paul Winkler
On Sun, Jul 13, 2008 at 01:20:53PM -0400, Philipp von Weitershausen wrote:
> Jeff McNeil wrote:
>> I'd love to be able to just drop an egg on the file system and tell
>> Zope "Here, go load that one now" via configuration alone.
>
> You could also write your own ZCML directive (+ a handler) that does that. 
> Then you'd only ever have to change your application's site.zcml to load a 
> new plugin.

There's also this:
http://pypi.python.org/pypi/z3c.autoinclude


-- 

Paul Winkler
http://www.slinkp.com
___
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: Cache

2008-06-25 Thread Paul Winkler
On Wed, Jun 25, 2008 at 07:12:53PM +0100, Miles wrote:
> Kereoz wrote:
>> On Wed, Jun 25, 2008 at 1:13 PM, Andreas Jung <[EMAIL PROTECTED]> wrote:
>>> As you can see from the HTML code: something like
>>>
>>> app.Control_Panel.Database..manage_minimize()
>>>
>>> should work.
>> I was thinking about the zope command line tools such as zopectl or so.

I don't think doing it in zopectl will do what you want.  AFAIK, the
cache that method minimizes is the in-memory object cache.  zopectl
runs in a separate process, which will have its own cache; so calling
manage_minimize() in a zopectl script will not affect the running Zope
server.

Instead you could write a script that uses wget or python's httplib or
similar to connect to the running Zope server and send the same
request that submitting the form in the ZMI would send.

None of this has anything to do with caches on disk, so I may be
misunderstanding what you want. The only disk cache I know of that's
relevant to ZODB is the ZEO client cache, which I don't believe is
affected by manage_minimize(). I don't think there is any API for
cleaning stuff out of it.

> You could also use something like
>
> $ PYTHONPATH=/usr/local/Zope-2.9.6/lib/python 
> /usr/local/Zope-2.9.6/bin/zeopack.py -p $PORT -S $STORAGE -d $PACKDAYS

That's for packing the storage, which is totally different.


-- 

Paul Winkler
http://www.slinkp.com
___
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] Call for new ZSyncer maintainer

2008-06-11 Thread Paul Winkler
Hi folks,

ZSyncer (http://sourceforge.net/projects/zsyncer) is in need of a new
maintainer.

Once in a while I get a question about ZSyncer.  Sadly I have to face
the fact that I have not been actively maintaining it for quite some
time: I haven't used ZSyncer at all for over a year, have made no
commits in that time, and no releases for over two years.

So, while I'd be happy to do some paid work on ZSyncer if your
employer really needs something done, I've clearly abdicated my
leading role in ZSyncer's community (is there one?).

Anybody care enough about it to step up?  If so, contact me off-list.
I would be happy to provide support during a transitional period.


Summary of current status:

* There are several fixes in CVS that should probably be released as
  0.7.2, but I'm not sure if they're adequately tested.

* Tests pass under zope 2.9; untested with 2.10 or trunk.

* The code is, in my opinion, badly in need of refactoring and cleaning up.

* There is a suite of ZopeTestCase tests. Should probably be broken up
  into smaller cases.

-- 

Paul Winkler
http://www.slinkp.com
___
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: zope-memory-readings

2008-05-30 Thread Paul Winkler
On Fri, May 30, 2008 at 3:56 PM, Tres Seaver <[EMAIL PROTECTED]> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Peter Bengtsson wrote:
>> Check it out
>> http://code.google.com/p/zope-memory-readings/
>>
>> Perhaps useful
>
> Looks really cool.  Thanks for releasing it!

Yeah. It also looks nicely non-zope-specific.
All it really needs to do its job is a PID and a log file in apache's
common format.
The only zope-specific stuff is just a couple lines of code that uses
a path to a Zope instance to find those.

-- 
http://www.slinkp.com
___
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] ZSyncer & Zope 2.10

2008-04-01 Thread Paul Winkler
On Mon, Mar 31, 2008 at 09:41:11AM -0400, Craig Chasseur wrote:
> Hello All,
> 
> We've recently completed an upgrade to Zope 2.10.5 on one of our servers and 
> we've begun to encounter problems with ZSyncer. We use ZSyncer to synchronize 
> objects between this server and another running Zope 2.9.8 (both have ZSyncer 
> 0.7.1 installed). When attempting to "put" folders from the 2.10 server to 
> the 2.9 server, the process hangs and nothing is transferred. However, when 
> we attempt to put individual objects, we are successful.
> 
> Does anyone know what might be the cause of this issue? ZSyncer 0.7.1, which 
> is the latest release, claims that it may not be compatible with Zope 2.9 and 
> up, but we were able to use it successfully before this most recent upgrade 
> to 2.10. If anyone is aware of a fix or a workaround, or simply has an 
> insight into why this breaks for us, I would greatly appreciate the help.


I've never tried ZSyncer with Zope 2.10; I don't have any guesses what
your problem is.

Have you tried syncing between two 2.10 instances? In general, you
move data from 2.X to 2.X-1 at your own risk, whether using ZSyncer or
the import/export tab in the ZMI.

I've been the "official" ZSyncer maintainer for about 5 years now, but
honestly I've barely touched it since 2005, since in its current state
it works well enough on the rare occasions that I need it. If somebody
else cares enough about ZSyncer to maintain it, please contact me.

Otherwise, to be crassly honest, I'm unlikely to do any
ZSyncer-related work unless somebody pays me to do so.

-- 

Paul Winkler
http://www.slinkp.com
___
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] ZSyncer & Zope 2.10

2008-03-31 Thread Paul Winkler
On Mon, Mar 31, 2008 at 09:41:11AM -0400, Craig Chasseur wrote:
> Hello All,
> 
> We've recently completed an upgrade to Zope 2.10.5 on one of our servers and 
> we've begun to encounter problems with ZSyncer. We use ZSyncer to synchronize 
> objects between this server and another running Zope 2.9.8 (both have ZSyncer 
> 0.7.1 installed). When attempting to "put" folders from the 2.10 server to 
> the 2.9 server, the process hangs and nothing is transferred. However, when 
> we attempt to put individual objects, we are successful.
> 
> Does anyone know what might be the cause of this issue? ZSyncer 0.7.1, which 
> is the latest release, claims that it may not be compatible with Zope 2.9 and 
> up, but we were able to use it successfully before this most recent upgrade 
> to 2.10. If anyone is aware of a fix or a workaround, or simply has an 
> insight into why this breaks for us, I would greatly appreciate the help.

I've never tried ZSyncer with Zope 2.10; I don't have any guesses what
your problem is.

Have you tried syncing between two 2.10 instances? In general, you
move data from 2.X to 2.X-1 at your own risk, whether using ZSyncer or
the import/export tab in the ZMI.

I've been the "official" ZSyncer maintainer for about 5 years now, but
honestly I've barely touched it since 2005, since in its current state
it works well enough on the rare occasions that I need it. If somebody
else cares enough about ZSyncer to maintain it, please contact me.

Otherwise, to be crassly honest, I'm unlikely to do any
ZSyncer-related work unless somebody pays me to do so.

-- 

Paul Winkler
http://www.slinkp.com
___
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 Paul Winkler
On Mon, Mar 03, 2008 at 12:29:06AM +0100, Martijn Jacobs wrote:
> Hi Martin.
>
> Maybe http://dirstorage.sourceforge.net/index.html is something for you.

That's not really relevant to the original post.  Think of it as a
different database backend that still stores non-human-readable binary
data.

Regarding Dieter's suggestion:

>> When I remember right, Tres has a product that allows to
>> dump and restore standard Zope objects to/from the file system.
>> I forgot its name but you should be able to find it via
>> your favorite search engine.

It's called FSDump.
http://www.zope.org/Members/tseaver/FSDump
Definitely worth a try.

-- 

Paul Winkler
http://www.slinkp.com
___
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] When to use a relational database

2008-02-09 Thread Paul Winkler
On Thu, Feb 07, 2008 at 07:14:46PM -0800, Tim Nash wrote:
> Why does storing a single document lead to close to 120 objects being
> inserted?

I'd bet almost all of that is updates to catalog indexes and metadata.

> Is it something related to plone or is this the case for all
> ZPT storing? Is it similarly true for the storing of DTML documents?

You're confused. The relative speed of ZPT and DTML have only to do
with rendering time.  As far as the ZODB is concerned, they are
equivalent.


-- 

Paul Winkler
http://www.slinkp.com
___
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] test, please ignore

2008-01-22 Thread Paul Winkler
I haven't received any mail from zope.org in quite while...

-- 
http://www.slinkp.com
___
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] Defining a dictionary in ZPT?

2007-11-01 Thread Paul Winkler
On Thu, Nov 01, 2007 at 12:48:04PM +, michael nt milne wrote:
> Hi
> 
> I've got this piece of code which is returning a keyerror on 'results' as I
> haven't set up a dictionary for the variables.
(snip)
> 
> 
> First Name 
> 

"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] storing python objects

2007-10-25 Thread Paul Winkler
On Thu, Oct 25, 2007 at 03:19:10PM -0700, David Bear wrote:
> but I've never seen this documented anywhere. Is it possible to store
> basic python objects directly in zodb?

http://www.zope.org/Documentation/Books/ZDG/current/Persistence.stx

-- 

Paul Winkler
http://www.slinkp.com
___
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] How to know what are zope doing now?

2007-09-19 Thread Paul Winkler
You might also consider turning on the trace log.  I've sometimes done
troubleshooting by eyeballing that file and/or using
requestprofiler.py.  This is useful if some requests are taking so
long that zope seems to hang.  But DeadlockDebugger might be easier to
use.

- P

On Thu, Sep 20, 2007 at 01:33:55AM +0200, Garito wrote:
> Hi!
> Every night my Zope server has 99% cpu usage and, sometimes, the server
> stops to serve pages
> 
> There are any way to know what the Zope server is doing in real time?
> 
> I know I could look at event.log or z2.log but I would like to know the
> activity in real time
> 
> Is this posible?
> 
> How can I know what my server is doing?

-- 

Paul Winkler
http://www.slinkp.com
___
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] How to upgrade Python in older Zope?

2007-09-11 Thread Paul Winkler
On Tue, Sep 11, 2007 at 07:36:18AM -0700, Tit-Liviu Leontin wrote:
> Folks,
> 
> 
> I desperately need support for large filesystem so the data.fs file can 
> exceed 2 GB.
> 
> I can only make minimal changes to the existing set-up, which consists of 
> Zope 2.5.1 (binary release, with Python 2.1.3) on Windows Server 2003 and 
> NTFS.
> 
> >From what I've read, the issue is with the old Python not having LFS 
> >enabled, so I thought I'd just upgrade it to 2.2.3 which has LFS enabled.
> 
> The question is, how do I do that? Windows installer for Python doesn't know 
> what to upgrade in the Zope install, so I'm thinking to copy the right files 
> from the extracted Python 2.2.3 in Zope folders.

That sounds like a really bad idea. From the Zope 2.5.1 release notes:

  * Zope requires Python 2.1 (Python 2.2 is currently *not* supported)


You should NOT assume that warning was put there for no reason :-)

Also, there's not a whole lot of expertise in this community on
building for Windows; we seem to be a linux/unix-heavy crowd. You'd better
stick to the binary releases and not mess with them, unless you can
find a bona-fide expert to help you.  Anyone? :-)

Meanwhile you might try migrating a *copy* of your Data.fs to Zope
first to Zope 2.6.4 (still uses Python 2.1.x) and then to Zope 2.7.7
(uses Python 2.3.x).

FWIW I recall 2.5 to 2.6 being a painless upgrade.  I think 2.7 was a
little more involved. The most likely problem to watch out for is
security-related issues: your code might accidentally rely on a
security weakness that was subsequently tightened, so you get
permission denied at unexpected times until your code and/or
configuration is fixed.  Install and turn on VerboseSecurity, it's a
big help with things like that.


-- 

Paul Winkler
http://www.slinkp.com
___
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] Deleting a file in Python

2007-08-27 Thread Paul Winkler
On Sat, Aug 25, 2007 at 07:35:06AM -0400, [EMAIL PROTECTED] wrote:
> but I can't figure out where context.* is documented.

It depends what kind of object context is.
To find out, you may find this product useful:
http://plone.org/products/docfindertab

Here is a good start reference for Zope 2 APIs... it was never
"finished" or updated for zope later than 2.7, but it's a lot
better than nothing:
http://www.plope.com/Books/2_7Edition/AppendixB.stx

-- 

Paul Winkler
http://www.slinkp.com
___
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] missing images

2007-08-07 Thread Paul Winkler
Sounds like a previously reported bug,
http://sourceforge.net/tracker/index.php?func=detail&aid=1352783&group_id=28073&atid=392340

I think this is fixed in CVS, but the original reporter never
replied. Can you try ZSyncer from CVS and let me know?

cvs -d:pserver:[EMAIL PROTECTED]:/cvsroot/zsyncer login

cvs -z3 \
 -d:pserver:[EMAIL PROTECTED]:/cvsroot/zsyncer \
 co -P ZSyncer

If that doesn't help, unfortunately I am on vacation for the rest of
the month so I won't be able to look at this until September at the
earliest.

-PW

On Tue, Aug 07, 2007 at 09:45:28AM -0700, baiewola wrote:
> I recently installed ZSyncer 0.7.1 in Zope 2.7.2, added a ZSyncer
> object and configured it. It sync'd perfectly. Today, when I clicked
> the sync tab to sync, I noticed that all of the images that indicate
> whether an item is okay, out of date, etc., are showing up as question
> marks. 
> 
> The only thing that changed is that I put Zope behind Apache Sunday
> evening. But I can't specifically trace it to that action, because I
> didn't test ZSyncer right after putting it behind Apache.
> 
> Has anyone seen this, and if so can you tell me how to resolve it?
> 
> Thanks!
> 
> 
>
> 
> Looking for a deal? Find great prices on flights and hotels with Yahoo! 
> FareChase.
> http://farechase.yahoo.com/
> ___
> 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 )

-- 

Paul Winkler
http://www.slinkp.com
___
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] Unit Testing DTML and ZPT

2007-07-26 Thread Paul Winkler
On Thu, Jul 26, 2007 at 01:09:54PM +0200, Marco Bizzarri wrote:
> The problem is what you're trying to test (and, therefore, to assert).
> Checking for equality is too fine grained, where you would check for
> the structure of the zpt, for example. A little parser could be
> useful.

testbrowser might come in handy:
http://plone.org/documentation/tutorial/testing/functional-tests/view?searchterm=import

It's also good to keep the "design for testing" adage in mind.  Keep
it granular.  Do as much logic and data preparation as possible in
product methods or scripts, which can be tested individually.  Then
your templates simply present this data.

-- 

Paul Winkler
http://www.slinkp.com
___
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] How to import a basic class in Script (Python)

2007-07-18 Thread Paul Winkler
On Wed, Jul 18, 2007 at 12:26:06PM +0300, Tudor Gabriel wrote:
> I've searched Zope Help and it mentions in there that i have to make a
> new dir in Products called whatever and add to __init__.py the
> allowimport or something like that, for my package.
> 
> i tried that too ... same error (haven't restarted zope after... should
> i?) .

Yes. Changes to filesystem code require a restart.

-- 

Paul Winkler
http://www.slinkp.com
___
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: comments toggling not working for Zope Book etc

2007-06-21 Thread Paul Winkler
Because that version of the book is outdated. Try here:
http://www.plope.com/Books/2_7Edition

That newer version (2.7) stalled "in development" a couple years ago,
but it's already much improved and extended since the 2.6 version.

Many (most?) of the comments from the 2.6 version have been addressed
in the text.

-PW


On Thu, Jun 21, 2007 at 07:49:50PM +0100, michael nt milne wrote:
> ok, just wondering what the reason for that was? I used to find them very
> useful especially on install etc. If it is a CSS thing they should still be
> available via a URL etc..
> 
> On 6/20/07, Michael Haubenwallner <[EMAIL PROTECTED]> wrote:
> >
> >michael nt milne schrieb:
> >> Hi
> >>
> >> Just wondering if the comments toggling is working for the Zope book.
> >Have
> >> tried in Internet Explorer and Firefox but they seem to be off
> >permanently.
> >>
> >>
> >http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ZopeArchitecture.stx
> >>
> >
> >You are right, display of comments has been disabled in CSS by the end
> >of December 2006.
> >
> >Hth,
> >Michael
> >
> >--
> >http://www.zope.org/Members/d2m
> >http:/planetzope.org
> >
> >___
> >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 )
> >
> 
> 
> 
> -- 
> michael

> ___
> 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 )


-- 

Paul Winkler
http://www.slinkp.com
___
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] a couple of basic questions

2007-06-20 Thread Paul Winkler
On Wed, Jun 20, 2007 at 10:02:01AM -0400, [EMAIL PROTECTED] wrote:
> > i tryed to call it using sql_do_something = 
> > context['db/sql_do_something'] hoping that maybe using aquisition 
> > ... i can get the script ... but i get the message that he can't 
> > find the object. 
> 
> Maybe context['db']['sql_do_something'].  I don't remember. 

Close but no cigar.  Dictionary-style item access does NOT use
acquisition:

   foo['bar']['baz'] works iff bar is in foo and baz is in bar.

Object-style attribute access DOES use acquisition:

   foo.bar.baz works if bar is in (or can be acquired by) foo, and baz
   is in (or can be acquired by) bar.

Finally, restrictedTraverse() is your friend:

   foo.restrictedTraverse('bar/baz') works like foo.bar.baz


-PW

-- 

Paul Winkler
http://www.slinkp.com
___
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] Creating a ZCatalog to catalog the newly created objects using ZClasses

2007-06-10 Thread Paul Winkler
On Sun, Jun 10, 2007 at 07:19:47PM +0200, Dieter Maurer wrote:
> kamal hamzat wrote at 2007-6-10 13:21 +0100:
> > ...
> >Instead use either through-the-web scripting with Zope Page Templates, 
> >PythonScripts etc. or write a Zope product."
> >
> >Please can somebody point me to "How to" for any of these new recommended 
> >ways.
> 
> The Zope Developper Guide, although quite old, still contains valuable
> information about Zope product writing.

Here are some other useful links:
http://wiki.zope.org/zope2/DiskBasedProduct


-- 

Paul Winkler
http://www.slinkp.com
___
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: MemoryError exception when importing a zexp file

2007-05-31 Thread Paul Winkler
On Thu, May 31, 2007 at 09:55:26AM +0200, Sascha Welter wrote:
> ... Did you verify with plohn people (e.g. on a Plone
> mailing list) that current plone versions can be imported/exported?
> (Because the last time I made the mistake to do a project with
> plone you couldn't import/export a plone site -- or rename it, move it
> to another instance or anything similar for that matter -- without major
> pain. It's been a while though, so things could have changed.)

I spent several hours recently to import a .zexp of a Plone 2.0 site.
Got nowhere.

One suggestion I got (which I wasn't able to follow) was the
following.  If you have access to the original server, try this:

1) Make a full backup of the entire ZODB, eg. using repozo.py.
2) Set up a new Zope instance with all the same products installed,
using your new backup copy of the ZODB.
3) Go into the ZMI for this new instance, and delete everythign EXCEPT this
plone site.
4) Pack the database to get rid of all the other stuff.  Or make a new
clean backup.

There. You now have a Data.fs that contains only your Plone site.
Instead of importing the .zexp, just mount the database at the
appropriate path.

Disclaimer: I haven't tried this yet.

> Summary: Go and ask the plone people, if you can't import anyway, the
> whole exercise is in vain.

+1

-- 

Paul Winkler
http://www.slinkp.com
___
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] Scaling problems, or something else?

2007-05-16 Thread Paul Winkler
On Wed, May 16, 2007 at 05:13:27PM +0200, Gaute Amundsen wrote:
> On Wednesday 16 May 2007 07:52, Gerhard Schmidt wrote:
> > All our frontendservers have 8gig ram. Zope gets major performance Problems
> > when it reaches the limit of physical memory. Check your system if the.
> > So having 2 zope Processes on the same system increases the Problem.
> >
> We do actually, have two. From a time we just "hadd to do something"!
> Consolidation time...

Well, maybe.  Is it an SMP box?  You can happily run 1 Zope process
per CPU. I'm told that recent versions of Linux should be pretty good
at keeping CPU affinity without any special configuration.

> At some point Varnish url rewriting wil be good enough, and then we can cut 
> apache out of it too..

I highly doubt Apache will become your bottleneck anytime soon :) But
of course it's one more thing to admin.

-- 

Paul Winkler
http://www.slinkp.com
___
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] Scaling problems, or something else?

2007-05-16 Thread Paul Winkler
On Wed, May 16, 2007 at 04:24:56PM -0500, Jens Vagelpohl wrote:
> There's a difference between scaling and making something faster. ZEO  
> makes a single instance slower, right. But you can deal with more  
> requests concurrently using ZEO. That's what I consider "scaling".

Agreed.  But at the same time, I don't think it makes sense to keep
deploying more and more badly tuned instances. That's what I consider
"blind shotgun scaling" :) You need to scale, but you also need to
tune - and you need to be pragmatic about which is the appropriate
approach at any given point in time.

-- 

Paul Winkler
http://www.slinkp.com
___
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] Scaling problems, or something else?

2007-05-16 Thread Paul Winkler
On Wed, May 16, 2007 at 10:47:11AM -0500, Jens Vagelpohl wrote:
> On 16 May 2007, at 10:13, Gaute Amundsen wrote:
> >Hm.. yes, that's the way we have been inclined.. just skip the  
> >whole ZEO
> >thing, and go straight for Varnish integration. Lotts of old sinns  
> >that have
> >to be paid off for that to work for everything however..
>
> I don't think he advocates removing ZEO. That would be silly.

Why? I don't think ZEO is a panacea that magically makes apps faster
in all cases.  If you're not CPU-bound, the added network overhead and
increased chance of write conflicts might be a net loss.  Based on
everything he's said so far, it sounds like Gaute still has plenty of
headroom on his CPU.

As for the other benefits of ZEO:

- multiple ZEO clients does allow you better responsiveness with high
concurrency, but you can also try increasing the number of threads to
get the same effect without the added network overhead.

- not using ZEO means that Zope is a single point of failure. Can't
argue with that :)

--

Paul Winkler
http://www.slinkp.com
___
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] Scaling problems, or something else?

2007-05-15 Thread Paul Winkler
On Tue, May 15, 2007 at 12:00:52PM +0200, Gaute Amundsen wrote:
> I set cache-size to 1 last night, up from the default.
> I felt I had to try that before I had a grap in place, so I don't have good 
> numbers to estimate tha change, but with about 20 hits a sec on apache, there 
> was close to 50 loads the last hour, and just 3000 writes. 
> Does that look reasonable?

Not really. Too many loads; you're getting a lot of cache misses and
blowing out the cache a lot. Keep on doubling the cache size until
your whole working set is in RAM all the time.

> The built in help seems to indicate I should increase the cache until reads 
> approaches zero..?

Yeah, for some definition of "approaches".  I think a more realistic
minimum would be number of threads * number of ZODB writes (since each
write potentially invalidates one cached object per thread).

It's hard to quantify the point at which you're caching enough, but
you're not even close.

> > Also, I don't think you've mentioned what sort of app this is.
> > Is it mostly reads or are there lots of writes?
> > "Mostly reads" is a lot easier to optimize :)
> >
> Big CMS system with about 70 virtual domains.

Based on your activity graph, you do indeed have a lot more reads than
writes.

What's the CMS based on? Plone? Silva?
Chris W. had a good point about the catalog.

Do you have blobby data in the ZODB? (large images or files)?  Those
tend to play havoc with zodb cache activity, since one OFS.Image is
stored as an arbitrarily long chain of small persistent objects.  So
whereas a Plone Document or a Page Template needs only one entry in
the cache, an Image might need hundreds.

--

Paul Winkler
http://www.slinkp.com
___
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] Scaling problems, or something else?

2007-05-10 Thread Paul Winkler
On Thu, May 10, 2007 at 02:10:40AM +0200, Gaute Amundsen wrote:
> On Wednesday 09 May 2007 16:41, Paul Winkler wrote:
> > On Wed, May 09, 2007 at 12:07:54PM +0200, Gaute Amundsen wrote:
> So there is no other possible limit in a zope instance than IO or CPU?

Well, there's RAM of course.  If you run out and start swapping a lot,
that's a big problem :)

btw, if you haven't come across this yet, I recommend reading
Chris McDonough's "Scaling Zope" presentation. It's a couple years old
but still a very good place to start:
http://www.plope.org/misc/szweb/img0.html

> Something out of Control_Panel/Database/main/manage_activity
>  perhaps?

Very helpful if the trouble is ZODB I/O.  Have a look at the activity
graph and see if you're getting lots of loads... might mean your ZODB
cache is too small and is getting thrashed.

Also, I don't think you've mentioned what sort of app this is.
Is it mostly reads or are there lots of writes?
"Mostly reads" is a lot easier to optimize :)

> Is there a way to get that data out without going through port 8080?

Don't think so. But I've never looked.

> Maybe I wil start logging the responstime directly like that! 
> Hm.. good idea :)

If you need that, the trace log can also tell you exactly what the
response time per request is.

> > - DeadlockDebugger may be informative.
> >   http://www.zope.org/Members/nuxeo/Products/DeadlockDebugger
> >
> Sounds a little drastic on a production server, but it may stil come
> to that..  Ought to test it out on another server I guess.

Definitely test-drive it on a scratch server, but production is where
you really need it :-)

re. trace log:
> That looks interesting, except that it can take 15 minutes or more
> to restart zope when load is at the worst. I could try it outside of
> peak ours I guess.

Yeah, restart during off hours and leave it enabled until you have one
episode of peak load slowdown.


-- 

Paul Winkler
http://www.slinkp.com
___
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] Scaling problems, or something else?

2007-05-09 Thread Paul Winkler
On Wed, May 09, 2007 at 12:07:54PM +0200, Gaute Amundsen wrote:
> Just a quick call for ideas on this problem we have...
> 
> Setup: 
> Zope 2.7.5 (~180 sites) -> apache (-> varnish for 1 high profile site)
> 
> Most noticeable symtoms: 
> Takes 30 sec. or more to serve a page, or times out.
> Sporadic problem, but allways during general high load.
> Lasts less than 1 hour. 
> Restarting zope does not help.
> Lots of apache processes in '..reading..' state
> Apache accesses and volume is down.
> Server load is unchanged, and < 2.0
> Apache processes is way up (~250 aganinst <40)
> Netstat "established" connections is WAY up (~650 aganist < 50)

The increase in netstat connections and apache processes indicates
lots of simultaneous traffic, but it's interesting that Apache
accesses is down.  Since hits are logged only on completion, it may be
that many of the requests are hung.

> Is this zope hitting some sort of limit and just letting Apache hang? 
> Would setting up ZEO on the same box make a difference,

ZEO doesn't buy you any performance unless you have multiple Zope
clients reading from it, and a load balancer in front.  This will help
IF your application is CPU-bound, which yours is not (I assume by
server load you mean CPU).

ZEO can actually *hurt* if you're IO-bound, because it adds network
overhead to ZODB reads and writes. It's very bad if you have large
Image or File objects (which you probably shouldn't have in the ZODB
anyway).

> or would it be better 
> to extend varnish coverage?

Probably a good idea anyway... but you want to find out what the
problem really is.

> What would you do to pinpoint the problem?

I'd first try hitting Zope directly during the problem to see if the
slowdown is there.  If so, I'd then try either:

- DeadlockDebugger may be informative.
  http://www.zope.org/Members/nuxeo/Products/DeadlockDebugger

- Enable Zope's trace log and use requestprofiler.py to see if there
  is a pattern to the requests that trigger the problem.  Eg. maybe
  all your zope worker threads are waiting on some slow IO task. See
  the logger section of zope.conf.


-- 

Paul Winkler
http://www.slinkp.com
___
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] Zope 2 Development Best Practices

2007-04-13 Thread Paul Winkler
On Fri, Apr 13, 2007 at 03:30:06PM -0600, Edward Pollard wrote:
> Greetings,
> 
> A few years back our institution adopted Zope to support some CMS- 
> like development on a zero-dollar budget. We achieved our primary  
> goals in no time at all, and we very happy.
> 
> Since that time we have used Zope to deliver a number of solutions to  
> our organization.
> 
> However, as the complexity of our operation increases, it becomes  
> more and more apparent that our coding standards for Zope are very  
> low. We've leaned on the existing Zope community - adopting code,  
> borrowing ideas, trying to learn - but have never seen anything that  
> helps us better understand the philosophy and structure that would  
> underly a strong understanding of Zopishness.
> 
> For instance, here are a few gems from our playbook. Please note  
> first that everything works to our needs and we are trying to find a  
> way out of the darkness. We're smart folks, but I fear we have  
> strayed far from the path of wisdom and light.
> 
> - We have never developed a python based product, although we have  
> hung a gigantic amount of external methods off of a half dozen pages  
> to make it go. And yes, we use ZClasses (shock)
> 
> - We have solved problems by modifying the ZServer source code
>
> - We have developed entire database driven products inside external  
> methods.
> 
> - Every Z SQL Method we have has a python script associated with it  
> to massage input and output (and manually enforces security).
> 
> Of course, a google of Zope Best Practices just brings me a bunch of  
> Plone development stuff. That is of no use.
> 
> So where is the knowledge I seek to be found? Understanding that open  
> source products are prone to such abuses, I've not been able to find  
> anything as a starting ground to reform our ways.

You might start here:

http://wiki.zope.org/zope2/DiskBasedProduct
http://wiki.zope.org/zope2/Testing
http://wiki.zope.org/zope2/BestPractices

-- 

Paul Winkler
http://www.slinkp.com
___
Zope maillist  -  [EMAIL PROTECTED]
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] Please Help - Extracting Info From ZEXP File

2007-04-13 Thread Paul Winkler
On Fri, Apr 13, 2007 at 12:36:13PM -0500, s wrote:
> I just took over a website that was done in Zope/Plone. The person formerly
> responsible for it was not helpful to the client or me in the transition
> process. Basically he emailed a ZEXP file to me, told me it contains
> everything I need, and washed his hands of the whole project.

The .zexp cannot contain everything you need.  It will contain all the
data (assuming he didn't miss anything), but that data can only be
loaded if you have a zope system running with all the correct
third-party software installed.  You should insist on being provided
with:

- Zope version

- Name and version number for every subdirectory of
  $INSTANCE_HOME/Products/
  (including, of course, Plone)
  ... usually each subdirectory will have a file named version.txt

- Name and version number for every add-on Python package installed to
  the system, if any.

Without this information, you will be unable to load the .zexp.

--

Paul Winkler
http://www.slinkp.com
___
Zope maillist  -  [EMAIL PROTECTED]
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] Problem with using versions.

2007-04-11 Thread Paul Winkler
On Wed, Apr 11, 2007 at 01:53:42PM -0500, Catherine E. Reinehr wrote:
> I had no idea versions were so buggy; I
> wouldn't have used them in the first place if I had.  :/

Not your fault, all the old documentation encourages people to use
them :(

-- 

Paul Winkler
http://www.slinkp.com
___
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] xmlrpc error handling

2007-04-11 Thread Paul Winkler
On Wed, Apr 11, 2007 at 01:38:21PM -0400, Kevin wrote:
> In order to avoid zodb implosion, is it sufficient to raise an xmlrpclib
> Fault object from a method where some validation was not successful?

yes.

> Will zope abort transactions

yes.

> and avoid an other avoidable bad things
> from happening?

as long as your application is designed well with regard to
transaction boundaries, you'll be fine.  Inconsistencies could arise
if your app does something weird like manually commit a transaction
and start a new one before the exception is raised...

> Do I have to use fault or can I raise just any error an
> ZPublisher.xmlrpc will marshall it
> into ?

The latter. Try it and see :)

AFAICT any uncaught exception will be published as an xmlrpc fault.
But then I think you don't have control of the fault code, if you care
about that.


-- 

Paul Winkler
http://www.slinkp.com
___
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] Problem with using versions.

2007-04-11 Thread Paul Winkler
On Wed, Apr 11, 2007 at 09:00:12AM -0500, Catherine E. Reinehr wrote:
> I'm running 2.6.2.  What's the most recent stable release?  2.10.3?

Yes, but the Version feature was removed after zope 2.7.

>From the changelog for zope 2.8:
"* Removed Version objects from the add menu. Versions are agreed to be
a feature that should not be used as it is not well implemented and
allows for data loss."

> I hate to say this, but my Zope knowledge is very limited.  I'm really only
> using it because it's what my predecessor used to build the web site in the
> first place, and she's not a whole lot of help now.  

That's never a fun situation to be in with any technology...  if your
budget affords it, it might be cost effective to bring in a consultant
for a short time to explore your predecessor's system and get you up
to speed on it.

To learn about versions, read this:
http://www.plope.com/Books/2_7Edition/ZopeServices.stx#1-3

especially note the "Caveat: Versions and ZCatalog" which might be
related to your problems (just guessing... we don't know if you're
using a ZCatalog).

> I went here (http://wiki.zope.org/ZODB/FileStorageBackup) to read up on
> backups, but I'm afraid it doesn't make a whole lot of sense to me.

We can't guess which parts don't make sense to you :)
Maybe come back with more specific questions here or on IRC?  The
#zope channel on irc.freenode.net is often quiet, but there's a lot of
knowledgable zope people in #plone and that channel is more active.

-- 

Paul Winkler
http://www.slinkp.com
___
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] manipulating zodb from independent database connection

2007-04-10 Thread Paul Winkler
On Tue, Apr 10, 2007 at 10:19:43PM -0700, Tim Nash wrote:
> Does anybody have a script available that shows how to insert objects
> into the ZODB root['Application'] from a non-zope process outside the
> Zope application? Everytime I try to read root['Application'] I get a
> page template error.
> 
> I'm using zope 2.5 (matches a book I like)

You can do whatever you like, but you're not likely to find many
people still running 2.5 on this list... so you might get less useful
help than you would like.

> and doing like so:
> 
> >>> from ZODB import FileStorage, DB
> >>>storage = FileStorage.FileStorage('Data.fs')
> >>>db = DB(storage)
> >>>connection = db.open()
> >>>root = connection.root()
> 
> Also, can the ZODB be altered this way on a running Zope instance?

Not with FileStorage. Only one process at a time can open a
FileStorage.

If you would use ZEO instead, then it would be possible. Your code
above would then be modified to use ClientStorage instead of
FileStorage.  But I don't know exactly what the code would look like
in zope 2.5, I haven't run that version in years.  I vaguely remember
needing a custom_zodb.py file to set up ClientStorage.  If you would
upgrade to a more recent Zope (2.7 or later), then ZEO is available
out of the box just by uncommenting some lines in the example
zope.conf.  And you would also get a script at bin/zopectl that's
perfect for this kind of job.  Your own script would be invoked as an
argument to zopectl, like:

 ./bin/zopectl run path/to/my/script

... and you would get the root application automatically set up for
you and bound as "app".

But you still need to use ZEO.

-- 

Paul Winkler
http://www.slinkp.com
___
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] VirtualHostBase VHM keyword doesn't work.

2007-04-10 Thread Paul Winkler
On Wed, Apr 11, 2007 at 12:23:14AM -0400, Mark, Jonathan (Integic) wrote:

> Zope 2.9 says in the Virtual Host Monster About Tab: "For example,
> suppose Zope is running on port 8080 behind an Apache running on
> port 80. You place a Virtual Host Monster in the Zope root Folder,
> and use Apache to rewrite "/(.*)" to
> http://localhost:8080/VirtualHostBase/http/www.buystuff.com:80/buystuff.com/VirtualHostRoot/$1.";
> 
> However, the following in my Apache 2.2 httpd file does not work:
> 
> 
> RewriteEngine on
> DocumentRoot /var/www
> Servername goodbyeken.com
> RewriteRule /(.*)  
> http://goodbyeken.com:8080/VirtualHostBase/http/www.goodbyeken.com:80/goodbyeken.com/VirtualHostRoot/$1
> 
> 
> The above directive results in a Zope "resource not found" error.

It would be useful if you could tell us WHAT resource is not found.
Check your logs.  Your zope access log is very useful when trying to
configure rewrite rules; you can see exactly what path Apache request.

> I have a Virtual Host Monster called myVHM in my Zope root
> directory. myVHM is able to do redirections that do not include the
> VirtualHostBase keyword.  Why doesn't the VirtualHostBase keyword
> work?

It does.  My first guess would be that you don't have a folder named
"goodbyeken.com".

-- 

Paul Winkler
http://www.slinkp.com
___
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] include?

2007-03-28 Thread Paul Winkler
On Wed, Mar 28, 2007 at 11:00:51AM -0400, Katie wrote:
> We're almost finished getting the new site done completely in zope using css
> and mySql. We have an older portion of the old site done in php thought that
> we don't really want to re-write. We'd like to include it in the dtml
> document page that has all the common elements of every page but I'm at a
> loss of a way to do it other than using an inline frame. Is there a dtml
> include that takes a url string the way the  tag renders the
> associated file?

this is old but might still be useful:
http://kebasdata.sourceforge.net/


-- 

Paul Winkler
http://www.slinkp.com
___
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] dynamically generating sql queries?

2007-03-28 Thread Paul Winkler
On Wed, Mar 28, 2007 at 02:52:26PM +, siva k wrote:
> Hi,
> I have five fields in the database author1,author2..author5.
> Trying to generate a parameter for the select_sql method called result,
> I run into an error -cannot add type "int" to string. Could you please
> say how to concatenate a string and a number?

this is a simple python mistake, nothing to do with zope really...
in your example:
result="'%s%d' % (field, index)"

>   result="field+index">

... the stuff in quotes is a python expression, so the normal python
rules apply. One solution:

result="'%s%d' % (field, index)"

> or is there a better way to generate 5 different sql quesries and display 
> the result?

I guess that select_sql is a separate zsql method that is called by
this one?

One option would be to replace the dtml you showed us with a Script
(Python) which calls select_sql and passes it appropriate parameters.

Something like this (may need adjustment, I'm not sure I understand
your example code):

for i in range(1, 6):
 print context.select_sql(field=result, language=language)
return printed

-- 

Paul Winkler
http://www.slinkp.com
___
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] Attribute error

2007-03-23 Thread Paul Winkler
On Fri, Mar 23, 2007 at 02:56:31PM -0500, Catherine E. Reinehr wrote:
> Hi,
> 
> I'm pretty new to Zope; I inherited the system when I started my new job.
> We use it to manage a college web site.  I noticed yesterday that several
> pages in our "Student Services" section will no longer load.  Every time I
> try, I get this:
> 
> Error Type: AttributeError
> Error Value: visible
> 
> And I have no idea what it means or how to fix it.  Any suggestions would be
> much appreciated.
> 
> Thanks,
> Catherine

Not enough information... so the first thing to do is go into the zope
management interface, click on the /error_log link, and find your
error listed there.  Click on it to get a more complete traceback.
Reply here with that information and you're more likely to get a
useful response.

-- 

Paul Winkler
http://www.slinkp.com
___
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] How can I reset zope time???

2007-03-23 Thread Paul Winkler
On Fri, Mar 23, 2007 at 04:52:18PM +0100, Sascha Welter wrote:
> (Fri, Mar 23, 2007 at 09:03:55AM +0100) Jens Vagelpohl wrote/schrieb/egrapse:
> > This issue appears when product authors naively use the database  
> > modification time instead of defining their own field in which to  
> > store modification time data. They would have full control if they  
> > used their own time stamps. Most product authors simply don't know  
> > what the possible consequences are, or when/how the database  
> > modification timestamps are changing.
> 
> Zwiki of course uses its own timestamp attribute: last_edit_time
> 
> The original poster likely got in this mess by not using the Zwiki
> methods to mass-revert the stuff.

Moral of the story is: don't do insane things with your system clock,
the results are undefined.

More generally, don't try giant shotgun workarounds ...
a) if you don't know what the effects will be
b) if you don't really understand your original problem
c) if you don't have a backup in case your "solution" causes a bigger problem

Flem, I'm sorry this happened to you, but sorry to say your attempted
solution was a really bad idea and it's not really fair to blame the
software for that.

The best thing you could do is restore from the backup you made before
you messed with the system clock.

If you didn't make one, you may have to truncate the database to a
transaction previous to when all this happened.  Make another backup
copy of Data.fs before doing that, of course.

The basic idea is: find the position in the Data.fs file that contains
the first transaction that occurred at your "in the future" date, and
delete the rest of the file after that point.

This is assuming you haven't already packed the database and thrown
away the old transactions you want to recover.

There isn't really an "official" way to truncate as far as I know, and
I don't remember the details, but the links here might help (look
under the word "truncate"): http://wiki.zope.org/zope2/ZODB

Also check the archives of the zodb-dev mailing list, there has been
some recent discussion of ways to truncate the database file,
the topic was "roll back filestorage zodb to a certain date".

lib/python/ZODB/fsrecover.py may be helpful for finding those transactions.



--

Paul Winkler
http://www.slinkp.com
___
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] dtml Z SQL doubt

2007-03-22 Thread Paul Winkler
On Thu, Mar 22, 2007 at 08:11:21AM -0400, Allen Schmidt Sr. wrote:
> Just use REPLACE instead of INSERT.
> If REPLACE statement is able to determine a unique value for a row and 
> sees that that unique value exists for a row, the valued will be 
> updated. If it does not exist, a new row will be inserted. This is what 
> I use with MySQL.

Or, depending on what you want, the INSERT...ON DUPLICATE KEY UPDATE
syntax can be used.
http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html

Note that both of these idioms are specific to MySQL and not portable
to other databases.

-PW


-- 

Paul Winkler
http://www.slinkp.com
___
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] build a safe proxy

2007-03-15 Thread Paul Winkler
On Thu, Mar 15, 2007 at 09:19:29PM +0100, Eric Br?hault wrote:
> No :-)
> I just want to run untrusted Python code using exec

Why exec? That's nearly always a terrible idea.

-PW

-- 

Paul Winkler
http://www.slinkp.com
___
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] Two mysql / timestamp related fixes

2007-03-08 Thread Paul Winkler
On Thu, Mar 08, 2007 at 02:07:56PM +0100, Gaute Amundsen wrote:
> this is definitely connected to the timestamp  column, because this change 
> fixed it:
> 
> diff /usr/lib/zope/lib/python/Products/ZMySQLDA/db.py 
> /usr/lib/zope/lib/python/Products/ZMySQLDA/db.py~
> 173d172
> < conv[FIELD_TYPE.TIMESTAMP] = DateTime_or_None
> 
> I have found no mention of this anywhere?
> Have anyone else had this problem

Yes, I've observed the same thing, and worked around it with a similar
patch.


-- 

Paul Winkler
http://www.slinkp.com
___
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] Problem On Rebuild

2007-03-05 Thread Paul Winkler
On Mon, Mar 05, 2007 at 02:11:45PM -0500, [EMAIL PROTECTED] wrote:
> -Original Message-
> From: [EMAIL PROTECTED]
> To: zope@zope.org; [EMAIL PROTECTED]
> Sent: Mon, 5 Mar 2007 2:19 PM
> Subject: Re: [Zope] Problem On Rebuild
> 
> 
> >I missed the beginning of this thread so i don't know if i missed something 
> >relevant, but url rewriting in general is often done within >the front-end 
> >web server (eg. Apache). 
>  
> Logical, but this isn't done at the Web server. These sites go
> through Pound, which is a reverse proxy, then are actually served by
> Zope itself.
>
> Then again, perhaps they're rewritten in Zope's Web server! Where
> would that be, for 2.7.8?

Most likely you have a Virtual Host Monster instance, with some
configuration on the Mappings tab.
See http://www.plope.com/Books/2_7Edition/VirtualHosting.stx


-- 

Paul Winkler
http://www.slinkp.com
___
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] How to create a global variable?

2007-02-22 Thread Paul Winkler
On Thu, Feb 22, 2007 at 11:50:51AM +0100, jerome prudent wrote:
> Hi!
> I've a python script which creates a dictionnary each time it's called. This
> dictionnary is always the same. I would increase the performance if I could
> generate and cache the dictionnary once, then reuse it. I'm looking for a
> space like REQUEST.SESSION that is the same for each user of my website
> (other solutions are welcome).
> 
> Do you know how to do that?

RAM Cache Manager.


-- 

Paul Winkler
http://www.slinkp.com
___
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] How to get REST friendly urls from sql database

2007-02-21 Thread Paul Winkler
On Wed, Feb 21, 2007 at 12:32:30PM +0100, Gaute Amundsen wrote:
> On Tuesday 20 February 2007 17:39, Paul Winkler wrote:
> 
> > Another option is that the object at /articles could be an instance
> > of a class that looks something like:
> >
> > class MyArticleContainer():
> >
> > def __before_publishing_traverse__(self, unused, request):
> > # Save the rest of the path as 'traverse_subpath'.
> > request.set('traverse_subpath',
> > reversed(request['TraversalRequestNameStack']))
> > # Tell the publisher to stop traversing now.
> > request['TraversalRequestNameStack'][:] = []
> >
> > def __call__(self, *args, **kw):
> > subpath = self.REQUEST['traverse_subpath']
> > data = get_data_however_you_like(subpath)
> > return data
> >
> >
> > For background, read the stuff about traversal hooks at
> > http://wiki.zope.org/zope2/ZPublisher
> 
> 
> Hm.. that looks more like what I had in mind when I posted, but allso quite a 
> bit more overhead than rewriterules.
> At least for me that has never written a product.

Well, it may feel like a lot of work to you the first time :-)

> I will have to think about that one..
> Would you care to elaborate a little bit on what the tradeoffs would be?

My approach might be good if:

- the logic for looking up articles is more complex than can be
comfortably expressed using apache rewrite rules, and/or

- the logic for looking up articles requires state that's internal to zope.


You could instead follow Andreas' suggestion and use a through-the-web
Script.  It might look something like:

article_id = traverse_subpath[-1]
data =  context.get_the_data_somehow(article_id)
return data

Your URLs would then look like:

http://example.com/folder_id/script_id/article_id

Note that naming the script index_html doesn't really help, because
http://example.com/folder_id/article_id wouldn't invoke the script.

--

Paul Winkler
http://www.slinkp.com
___
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] How to get REST friendly urls from sql database

2007-02-20 Thread Paul Winkler
On Tue, Feb 20, 2007 at 04:37:41PM +0100, Andreas Jung wrote:
> --On 20. Februar 2007 16:30:43 +0100 Gaute Amundsen <[EMAIL PROTECTED]> wrote:
> 
> >Hi.
> >
> >Normally a url to an article in our CMS system would look roughly like
> >this: http://www.dom.tld/aritcles/25245
(snip)
> >Anybody have any ideas on how this might be done?
> 
> How about Apache rewrite rules or a script called index_html that fetches
> the object by its ID? That's pretty much boring straight-forward stuff :-)

Another option is that the object at /articles could be an instance
of a class that looks something like:

class MyArticleContainer():

def __before_publishing_traverse__(self, unused, request):
# Save the rest of the path as 'traverse_subpath'.
request.set('traverse_subpath',
reversed(request['TraversalRequestNameStack']))
# Tell the publisher to stop traversing now.
request['TraversalRequestNameStack'][:] = []

def __call__(self, *args, **kw):
subpath = self.REQUEST['traverse_subpath']
data = get_data_however_you_like(subpath)
return data


For background, read the stuff about traversal hooks at
http://wiki.zope.org/zope2/ZPublisher


-- 

Paul Winkler
http://www.slinkp.com
___
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: Zope 2 and Zope 3

2007-02-15 Thread Paul Winkler
On Thu, Feb 15, 2007 at 11:50:38AM +0100, Philipp von Weitershausen wrote:
> What's already possible is to have a minimal ZODB with only one 
> persistent object: a SQLObject or SQLAlchemy container. That's a 
> container (e.g. like a folder) whose items aren't persisted in the ZODB 
> but come from a relational database.

This works fine in a Zope 2 / Five world too.  We have apps that have
nothing in the ZODB but a Z*DA instance.  Then we have zope 3 views
and adapters that acquire that instance and use it to talk to the
database, using ZSQL to build the queries. We haven't drunk the ORM
cool-aid yet. :)

In other words: The ZODB may be there but you can pretty much ignore
it if you don't need it :)

> You seem to already have come to the conclusion that having code live in 
> both the filesystem and the ZODB can be painful. I think a good first 
> step for you would be to migrate your remaining ZODB-based code to the 
> filesystem. That not only makes deployment easier, you're also free to 
> refactor it then (e.g. using Zope 3 idioms). In the long run, this also 
> means saying good-bye to things like External Methods because they 
> require code on the filesystem and configuration in the ZODB.

+1

Here's my off-the-cuff attempt at "How To Safely Move A Big Legacy App
Out of the ZODB".

First, get and install FSDump (google for it).

Add a Dumper to a folder containing DTML (it works recursively on
child folders too), configure the Dumper, click the "Save and dump"
button, and voila, there's your code on the filesystem.  It'll store
properties too, in files named like *.metadata.

Then you need a way to use the stuff from the filesystem.
FileSystemSite would be ideal, because it understands those .metadata
files: http://www.infrae.com/download/FileSystemSite

Using it is a bit non-obvious if you're not familiar with CMF, from
which it was extracted.  You'll need to create a minimal Product on
the filesystem that consists of:

- a directory in Products, let's call it Products/mystuff
- an __init__.py at Products/mystuff/__init__.py that looks like this:

   from Products.FileSystemSite.DirectoryView import registerDirectory
   registerDirectory('mysubdir, globals())

- a subdirectory at Products/mystuff/mysubdir.  Put the files and
  directories you dumped in here.

That's it. Restart Zope, add an instance of Filesystem Directory View,
and you'll be prompted for the directory to choose; the only choice
will be the "mysubdir" you registered above. Click OK and you're done.

Check this new Product into source control and rejoice.

One gotcha - files ending in .dtml will be treated as DTML Methods,
not DTML Documents. So if you relied on the semantic difference
between those, you will have some issues to sort out.

Another gotcha - you'll need another plan to deal with those External
Methods, since AFAIK neither Dumper nor FileSystemSite will handle
them.

One expedient if slightly tedious technique would be to just move the
External Method files out of Extensions/ and into
$INSTANCE_HOME/lib/python/.  Then use calls to allow_module() so they
can be imported by through-the-web code (google will tell you more
about that).  Then, delete each external method from the ZMI and in
its place add a Script (Python) with the same id.  Such a script would
have a body something like:

   from my_ext_method_module import myExternalMethodFunction
   return myExternalMethodFunction(arguments)

Once that's done, those scripts can be Dumped into your filesystem
code, and all the DTML that includes calls to them should work.

A final gotcha - if you have ZClasses, I can't help you :)


At this point, you have the same application you started with, it's
just on the filesystem.  Not as clean as a rewrite, but a hell of a
lot more expedient - faster and less risky.

Next you'll want to start adding regression tests to your product
(ZopeTestCase and Zelenium might be useful tools). Then you have a
safety net so you can confidently start refactoring as needed.  *This*
is when you can start thinking about rewriting stuff :-)

I'd put this email somewhere on zopewiki.org, but it seems to be down
at the moment (Bad Gateway).

> It is certainly possible to execute filesystem-based DTML (using
> Globals.DTMLFile).

Right.  But that's a bit of a pain when you have dozens or hundreds of
DTML methods and your first priority is just to get stuff out of the
ZODB and into source control without breaking anything.

-- 

Paul Winkler
http://www.slinkp.com
___
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] python script syntax

2007-02-14 Thread Paul Winkler
On Wed, Feb 14, 2007 at 11:42:59PM +, garry saddington wrote:
> I want to do something like this in a script:
> 
> forms='7L'
> 
> context.forms.manage_addFolder('filey')
> 
> ie. substitute the variable 'forms' for the correct value but I can not
> get the syntax correct, can anyone help?

Look up getattr() in Python's documentation.


-- 

Paul Winkler
http://www.slinkp.com
___
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] Client Disconnected

2007-01-29 Thread Paul Winkler
On Mon, Jan 29, 2007 at 11:25:20AM -0500, Brian Brinegar wrote:
> Occasionally a client in our ZEO setup will lose it's connection to the
> ZEO Server. I suspect some user is trying to commit something that is
> taking excessively long, perhaps uploading a very large file.
> 
> Anyway, when a client is disconnected should it not try to reconnect?
> The min-disconnect-poll and max-disconnect-poll are set to the default.
> 
> It seems that the clients NEVER reconnect until Zope is restarted. Any
> suggestions on how to automate this?

Sounds like it might be the old "firewall decided to drop your
connection without letting you know" problem.
http://aspn.activestate.com/ASPN/Mail/Message/zope-list/2916870

-- 

Paul Winkler
http://www.slinkp.com
___
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] debugging a wayward zope process

2007-01-24 Thread Paul Winkler
Google for "deadlock debugger" and "debug spinning zope".

-PW

On Wed, Jan 24, 2007 at 03:11:52PM -0500, Timothy Ball wrote:
> I have a zope server (2.7.4) that I maintain and every now and then the
> python process that's running zope goes heywire and eats all of the cpu
> resources and basically make my website stop responding. Does anyone have
> any clues as to how I can debug this problem?
> 
> I'm not the best python coder but I do know how to use pdb. And I'm looking
> for sorta where and what pieces would be the best place to start putting the
> trace() bits.
> 
> ... but really any sort of guidance would help... here's a small bit from ps
> aux showing a bit of what I mean, but when it *really* goes heywire it
> just eats all of my cpu and causes the load to shoot up near the 50s (on a
> dual opteron 275 processor machine)
> 
> USER   PID %CPU %MEMVSZ   RSS TTY  STAT START   TIME COMMAND
> zecms 4062 12.6  8.9 830640 718768 ?   Sl   Jan19 972:32
> /thingie/src/bin/python
> /thingie/src/opt/Zope2/lib/python/Zope/Startup/run.py -C
> /www/zed/src/var/zope/etc/zope.conf
> 
> TIA,
> --timball

> ___
> 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 )


-- 

Paul Winkler
http://www.slinkp.com
___
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] Zope hangs and Python eats all memory

2007-01-15 Thread Paul Winkler
On Mon, Jan 15, 2007 at 01:22:39PM +0100, Nico Grubert wrote:
> Dear list members,
> 
> I am running Zope 2.9.6. on a 64-Bit Suse Linux 10.1 machine (9 Gbyte of 
> RAM) with Python 2.4.3. installed.
> From time to time, Zope hangs and I cannot access it anymore. I tried 
> to use the "Zope DeadlockDebugger" but if my Zope hangs I cannot call 
> the URL "http://myzopesite:8080/manage_debug_threads?secret_password"; to 
> let Zope DeadlockDebugger show any useful information. Zope does not 
> response.
> If Zope hangs, the python process eats all the memory and the machine 
> starts to swap.
> 
> The "top" command in the shell tells me: 
> -
> Tasks:  91 total,   2 running,  89 sleeping,   0 stopped,   0 zombie
> Cpu(s): 10.4%us,  0.4%sy,  0.0%ni, 89.0%id,  0.2%wa,  0.0%hi,  0.0%si
> Mem:   9041256k total,  9025124k used,16132k free,10604k buffers
> Swap:  4208988k total,  4208988k used,0k free, 9472k cached
> 
>   PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+  COMMAND 
> 
> 29992 wwwrun16   0 12.0g 8.3g 2860 S   19 95.9   3:52.66 python
> -
> 
> There are several add-ons for Zope installed, like:
>  - "Psycopg" Postgres Database Adapter
>  - "mxODBCDA" ODBC Database Adapter
>  - LDAPUserfolder
>  - "Silva" Content Management System
>  - PIL
> 
> Furthermore, I see a lot of Conflict Errors in the "event.log" like e.g.:
> -
> ZPublisher.Conflict ConflictError at 
> /VirtualHostBase/http/193.134.202.20:80/mysite/VirtualHostRoot/: 
> database conflict error (oid 0x0435, class BTrees._OOBTree.OOBTree, 
> serial this txn started with 0x036aeb14ab1c4b88 2007-01-15 
> 12:04:40.104030, serial currently committed 0x036aeb1d0cc5d099 
> 2007-01-15 12:13:02.993605) (80 conflicts (0 unresolved) since startup 
> at Mon Jan 15 11:44:55 2007)
> -
> 
> These kind of Conflict errors occur almost every minute.
> It might be that these errors have something to do with it but I am not 
> sure.
> 
> How can I figure out what exactly causes Zope to hang?
> If you need more information, please let me know.
> 
> Thanks in advance...
> 
> Regards,
> Nico

It sounds to me like you are simply experiencing "swap death".  Zope
isn't really hung - it's just using so much memory that you're
"forever" waiting on disk I/O to handle all those pages.  The system
should recover eventually if there's no more load; but unfortunately
the typical case is that once you start swapping badly, user requests
keep piling up in the queue, so things only continue to get worse.

I'm impressed at your stats though. I've never had a box with 8 GB of
RAM, much less got Zope to use up all of it :-)
 
Have you tried the "debug spinning zope" recipe?
http://www.zopelabs.com/cookbook/1073504990
that might give you a clue how you got into this state.

unfortunately since the whole system is swapping like crazy, working
at the shell is probably no fun either :-)

P.S. How's your SU700 treating you? I sold mine years ago :)

-- 

Paul Winkler
http://www.slinkp.com
___
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] SSL and Apache

2007-01-11 Thread Paul Winkler
On Thu, Jan 11, 2007 at 12:25:26PM -0500, [EMAIL PROTECTED] wrote:
> [EMAIL PROTECTED] wrote on 01/11/2007 12:07:37 PM:
> 
> > Hi,
> > 
> > I am writing a thesis about the security of Zope and have these
> > questions. I am wondering if this is the right place to ask.
> > 
> > Is Zope behind Apache the only solution to provide SSL connection to 
> Zope?
> 
> No, but it is the most common setup.  Zope is believed to be very secure,
> but it has had, in no way, the amount of exposure, and thus 
> battle-hardening
> that Apache has.
> 
> Moreover using another web server in front of Zope has other benefits --
>   1)  Static content can usually be displayed faster using a system tuned
>   for static content, rather than one tuned for dynamic content.
>   2)  URL-rewriting makes it possible to transparently distribute site
>   site content to multiple Zope versions or multiple machines.
>   3)  In some circumstances, the front-end webserver can provide caching
>   services, reducing the load on the Zope portion.

I would add 4) the front-end server can provide "sanitizing" of
requests from buggy or malicious clients.

A search of the mail archives will find many people advising the same
thing. I recently experienced it myself. I wasted a lot of time
recently trying to find out why Zope was leaking memory on XML-RPC
requests *only* from a certain client. The leak was small, but under
load, Zope would exhaust the system's memory after a few days. I could
never determine the cause, nor could I provoke the leak with other
clients.

Then one day, the client switched from one Java XML-RPC library (an
old version of the Apache xmlrpc library) to another (Redstone I
think), and immediately the symptom stopped. Zope's memory usage
became quite stable. Nothing else was changed.

A good, battle-tested reverse proxy in front of Zope should help
protect against that kind of thing.

--

Paul Winkler
http://www.slinkp.com
___
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] Isn't DTML more like what other frameworks do?

2007-01-09 Thread Paul Winkler
On Tue, Jan 09, 2007 at 08:31:29PM +0100, Maciej Wisniowski wrote:
> > As for me, I am lazy. ZPT does things in a way that few other frameworks do,
> > although Ruby's Amrita2 sort of resembles ZPT.

Not really. It's more closely related to the Meld family (pymeld,
pymeldlite, meld3), and to XMLC.

> > Displaying phantom  text in a static page  which will
> > not be there dynamically is not superior to DTML.
> > It is just more confusing. I have never learned ZPT
> > well and I may never do so.
>
> There is also Twiddler from Simplistix. It is something
> pretty new and interesting. It claims that there is no
> need to learn new templating language.

Twiddler also looks very similar to the Meld family.  Looks nice, but
I haven't had time to get a sense of what distinguishes it from meld3.

> I'm not using dtml, only if I have to modify existing code,
> but it is painful. Often I don't know what happens and where
> from are all these variables :)
> Other thing is, that AFAIR dtml is faster than ZPT.

My feeling about the DTML-vs-ZPT debate is that it can basically be
reduced to the following chart:


FEATURE | DTML  |  ZPT|
+---+-+
potential for   |   | |
confusion due to| Lots  | A little|
implicit magic? |   | |
+---+-|
"familiar" syntax?  | Yes   | No  |
+---+-|
round-trip with | Hell no   | Maybe, with |
an HTML designer?   |   | some pain   |
+---+-|
Useful for  | Yes   | Not really  |
non-X(HT)ML?|   | |
+---+-|
Prevents invalid| No| Yes |
markup? |   | |
+---+-+


So, you have to ask yourself which of the above you care about for the
projects you work on. With Zope, I am typically doing HTML or XML,
usually with somebody else doing the design. For me, ZPT has nice
advantages.

OTOH, sometimes we're doing ZSQL so we use DTML syntax for that.  ZPT
would be useless for building SQL queries.

--

Paul Winkler
http://www.slinkp.com
___
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] Recovering from Data.fs

2007-01-09 Thread Paul Winkler
On Tue, Jan 09, 2007 at 06:49:11PM +, Rowan Woodhouse wrote:
> Hi,
> 
> I'm trying to recover a zope instance from a hardware failure. The
> only thing I have left is the backed up Data.fs file. I'm not entirely
> sure which version of Zope was used but I think it was 2.9 (certainly
> not 3), or what the install paths were for the instance or zope.
> 
> When I try and use the backed Data.fs in a new zope instance I get the
> following error:
> 
> 
> Site Error
> 
> An error was encountered while publishing this resource.
> 
> Error Type: AttributeError
> Error Value: __getitem__

We need the full traceback.
Look in your new instance, for the event log in the logs/ dir.
That should contain the error and the full traceback.

> >From my understanding the paths for the zope instance have to be the
> same for Data.fs to work correctly. Is that correct?

No, Data.fs should be portable.

-- 

Paul Winkler
http://www.slinkp.com
___
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] want to get the url in python script

2006-12-13 Thread Paul Winkler
Oh, and if you just want to get the url of the context,
that's normally:

context.absolute_url()

On Wed, Dec 13, 2006 at 10:50:00AM -0500, Kate Legere wrote:
> I'm getting an attribute error finding pyUrlQuote from this:
> 
> quote = context.pyUrlQuote
> 
> Is there another way I can get the url? Has this been replaced?
> 
> Katie
> 
> ___
> 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 )

-- 

Paul Winkler
http://www.slinkp.com
___
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] want to get the url in python script

2006-12-13 Thread Paul Winkler
On Wed, Dec 13, 2006 at 10:50:00AM -0500, Kate Legere wrote:
> I'm getting an attribute error finding pyUrlQuote from this:
> 
> quote = context.pyUrlQuote
> 
> Is there another way I can get the url? Has this been replaced?

I've been working with zope since 2000 and never heard of pyUrlQuote.
So I strongly suspect it's something local to your application.

- what kind of object is context in this case?
maybe it's expected to be an instance of something that has
a pyUrlQuote method, but you're calling this code in a
different context?

- maybe pyUrlQuote is a Python Script or some other persistent
object, and you're in some other part of the folder tree where
you can't acquire it from parent folders?

hard to guess with so little information... sorry.

-- 

Paul Winkler
http://www.slinkp.com
___
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: My Sad Tale Of Woe

2006-11-30 Thread Paul Winkler
On Thu, Nov 30, 2006 at 08:52:40AM -0800, Nancy Donnelly wrote:
> From: Paul Winkler <[EMAIL PROTECTED]>
> 
> > What shell are you using? That's not how you set an environment
> > variable in any of the bourne-style shells (sh, bash, ksh).
> > For those, you would use:
> >
> > export PYTHONPATH=/usr/local/zope/278/lib/python:$PYTHONPATH
> 
> 
> 
> I'm using bash. I tried export and it didn't recognize it. I thought set was 
> the same. What do?

If the command:

 export FOO=bar

... does not work, AFAIK you can't possibly be running bash.

Try running "ps" with no arguments to be sure.  The first thing it
shows should be your current shell, with the program name identified
in the CMD column.

-- 

Paul Winkler
http://www.slinkp.com
___
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: My Sad Tale Of Woe

2006-11-30 Thread Paul Winkler
On Thu, Nov 30, 2006 at 01:04:48AM -0800, Nancy Donnelly wrote:
> Okay, yahooing around I found I have to set the path. But I still get this 
> error:
> 
> [EMAIL PROTECTED]:zope/instance2/var (177) set 
> PYTHONPATH=/usr/local/zope/278/lib/python
> [EMAIL PROTECTED]:zope/instance2/var (178) python 
> /usr/local/zope/278/lib/python/ZODB/fsrecover.py Data.fs Data.fs.recover
> Traceback (most recent call last):
>   File "/usr/local/zope/278/lib/python/ZODB/fsrecover.py", line 80, in ?
> import ZODB
> ImportError: No module named ZODB
> 
> The python is the correct one. I re-set python so that the one that comes up 
> first in the path is the one Zope uses.

What shell are you using? That's not how you set an environment
variable in any of the bourne-style shells (sh, bash, ksh).
For those, you would use:

 export PYTHONPATH=/usr/local/zope/278/lib/python:$PYTHONPATH

And it's not how you set environment vars in tcsh either.
For that, you would use:

 setenv PYTHONPATH /usr/local/zope/278/lib/python:$PYTHONPATH

In both cases you would normally append the existing PYTHONPATH as
shown here, but that's not your current problem.

I'm not clear on what exactly "set" does in tcsh;
in bash it sets positional parameters, which isn't what you want:

[EMAIL PROTECTED] ~ $ echo $FOO

[EMAIL PROTECTED] ~ $ set FOO=bar
[EMAIL PROTECTED] ~ $ echo $FOO

[EMAIL PROTECTED] ~ $ echo $1
FOO=bar
[EMAIL PROTECTED] ~ $ export FOO=bar
[EMAIL PROTECTED] ~ $ echo $FOO
bar



-- 

Paul Winkler
http://www.slinkp.com
___
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] Existence and truth

2006-11-28 Thread Paul Winkler
On Tue, Nov 28, 2006 at 10:24:51PM +, Mark Barratt wrote:
> The radio inputs return name="listed" and value 0 or 1
> 
> This works OK, but in the radio input code,
> 
> tal:attributes="checked python:test(listed,'checked',None);
> 
> *always* returns 'checked'

(snip)

> So what basic fact/knowledge am I missing?

This kind of thing is usually a mistaken type assumption.
I bet your radiobutton is setting it to "0" rather than 0.


-- 

Paul Winkler
http://www.slinkp.com
___
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: error with simple python script loop

2006-11-28 Thread Paul Winkler
On Tue, Nov 28, 2006 at 08:28:47AM +, Maurits van Rees wrote:
> Christian Steinhauer, on 2006-11-24:
> > i cant use pdb on zope?s python script i think?
> 
> You can, if you put this small (two lines) program in your Products
> dir:
> 
> svn://svn.zope.org/repos/main/Products.enablesettrace
> 
> Not meant for production sites.

I still prefer zdb, because you can actually see and step through the
script code.
http://www.simplistix.co.uk/software/zope/zdb

-- 

Paul Winkler
http://www.slinkp.com
___
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] error with simple python script loop

2006-11-24 Thread Paul Winkler
On Fri, Nov 24, 2006 at 02:46:25PM +0100, Christian Steinhauer wrote:
> ... i cant use pdb on zope´s python script i think? 

Normally true, but you can google for Chris Withers' "zdb" product
which allows debugging from scripts very nicely.

--PW

___
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] Checking in pages, scripts, and sql methods to SVN

2006-11-17 Thread Paul Winkler
On Fri, Nov 17, 2006 at 08:33:15AM +0800, Sinang, Danny wrote:
> Hello,
>  
> Is there a Zope product out there that would allow me to check into SVN
> my Zope objects (i.e. TAL pages, Python scripts, and ZSQLMethods) ?
>  
> If not, can anyone here show me some skeleton code to :
>  
> 1. Enumerate these objects
> 2. Reference them as files 

FSDump will dump stuff from a folder to the filesystem.
http://www.zope.org/Members/tseaver/FSDump

Then, replace the folder with a FileSystemSite
or one of the alternatives. 
http://wiki.zope.org/zope2/FileSystemSite
  
-- 

Paul Winkler
http://www.slinkp.com
___
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] Zope Alternative

2006-11-15 Thread Paul Winkler
On Wed, Nov 15, 2006 at 07:35:48AM -0800, Hafeliel wrote:
> My thanks to everyone who took the time to reply.
> 
> Here's what I'm hearing:
> 
> [1] Many of you agree that the Zope Book is woefully
> incomplete.  Paul, for example, was kind enough to
> point out that the Image class is a descendent of the
> Persistent class.
> 
> I opened my Zope Book back up to see how I could have
> missed this, and as I expected, the book doesn't show
> this ancestorage.  In fact, the Persistent class isn't
> listed in Appendix B at all.

The paper books for zope 2 are all ancient. REALLY ancient.
The latest is here:
http://www.plope.com/Books/2_7Edition
It's also a bit old, but it has a *lot* of updates since the paper
version and even since the previous online edition.

IMO the community badly needs somebody to overhaul the Zope Book and
Zope Developers' Guide. Unfortunately, that's a *very* labor-intensive
job, and pretty much everybody with sufficient knowledge has too much
paying work to do that, myself included.  Kudos to Chris McDonough
and the contributors for getting the 2.7 edition as far as it got.

Meanwhile, zopewiki.org is very very useful.
 
> If you do not like the direction I'm headed, then by
> all means, do not follow.  Stick with Zope and enjoy
> it, but I personally think that a light-weight
> alternative that doesn't protect us from doing what we
> want to do would be better.

FWIW, there's lots of those.  Pylons maybe?

> [5] Several of you defended Zope by saying that it
> evolved to be the beast that it is.  Frankly, that's a
> terrible reason to live with a mess.

A large number of working deployments, OTOH, is a very good reason to
not throw away the past :)

>  Sometimes it
> takes starting over to get going in the right
> direction.

A couple of people have mentioned Zope 3 already...
We've been in the process of "starting over" for several years
now.  

There's simultaneously an evolution of Zope 2 to use more and more of
Zope 3.  Unfortunately this means zope 2 is going to get bigger before
it can get smaller. Read the archives of the zope3-dev list for some
ideas on how this might all pan out... Jim's message "Two visions" from
Feb. of this year.

People like to start from scratch, but sooner or later they
end up reinventing all the features they threw away :)
We're trying to find a way not to throw out all the good stuff.

> That's why I'm pushing to making it an Apache module. 

There has been some work done on running zope under Apache.
Google for modzope.

> Apache is wildly popular and used in a tremendous
> number of servers.  It already does most everything,
> so why re-invent the wheel?  Let's just add on the few
> missing pieces so we can give developers the tools
> they need to build the rest of the car.

"does most everything"?  "few missing pieces"? How can you compare
an HTTP server to a full-featured web development framework?

> So follow if you dare, help if you'd like, but shout
> your insults at my back.  I see no reason to stick
> around a community that treats me like this when I'm
> only trying to help.

FWIW, while I do think you have some misconceptions of where zope is 
going, I do think the tone got a lot harsher than necessary.

I haven't posted on your wiki because I prefer mailing lists.

-- 

Paul Winkler
http://www.slinkp.com
___
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] Emergency Meltdown! Help!

2006-11-14 Thread Paul Winkler
On Tue, Nov 14, 2006 at 04:06:39PM -0800, Nancy Donnelly wrote:
> HELP!

First thing I'd do is find the event log and see what's in it
recently...

-- 

Paul Winkler
http://www.slinkp.com
___
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] Zope Alternative

2006-11-12 Thread Paul Winkler
On Sun, Nov 12, 2006 at 05:54:35PM -0600, Perry Smith wrote:
> Also... I don't watch this email with an eagle eye, but why haven't  
> you just asked?  These guys are terrific at answering questions and  
> pointers.  Watch:
> 
> What module should I look at to help track down where the attributes  
> of an image are coming from?

this is inherited from the Persistent class in ZODB.
You're looking for bobobase_modification_time,
for hysterical raisins.  

Note however that it's updated on *any* transaction commit that touches
the object in question, which often isn't granular enough for apps that
care about things like mod time.  If you want something else, CMF has
examples of doing the DublinCore date stuff.  IIRC Philip's book has
examples of doing dublin core in the zope 3 style.
 
Happy to prove this particular point ;-)

-- 

Paul Winkler
http://www.slinkp.com
___
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] Restricted Traverse

2006-11-11 Thread Paul Winkler
On Sun, Nov 12, 2006 at 12:57:21AM +1100, Andrew Milton wrote:
> +---[ Nancy Donnelly ]--
> | Could someone tell me what's wrong with this code?
> | 
> |  | tal:define="global url python:here.absolute_url(relative=None) + '/
> | index_frame.pt#quotes'"
> | />
> |  | tal:define="root python:container.restrictedTraverse(url)"
> | tal:replace="structure python:here.printSiteMap(root, 12)"
> | />
> | 
> | --or--
> | 
> |  | tal:define="root python:container.restrictedTraverse(here.absolute_url
> | (relative=None) + '/index_frame.pt#quotes')"
> | tal:replace="structure python:here.printSiteMap(root, 12)"
> | />
> | 
> | 
> | I'm trying to automate that restrictedTraverse.
> 
> absolute url returns a string prefixed with "http(s)://", unless the relative
> parameter evaluates to true None doesn't do that.
> 
> Try using relative = True

Aside from that, and the problem with '#quotes' as Andrew pointed out,
absolute_url() is just not safe to use with restrictedTraverse(), since
the url takes virtual hosting into account and thus may add or remove
parts of the path.  This technique tends to work fine during local
development and then as soon as you deploy to a server with virtual
hosting configured, boom, everything breaks. No fun.
So, Don't Do That.
See http://www.plope.com/Books/2_7Edition/AppendixB.stx#2-394

When creating paths for use with restrictedTraverse(),
you should always use getPhysicalPath() instead.

In this particular case, I suspect you don't even need to do that.
Try:

 tal:define="root python:here.restrictedTraverse('index_frame.pt')"

which can be spelled a bit more simply as:

 tal:define="root nocall:here/index_frame.pt"


-- 

Paul Winkler
http://www.slinkp.com
___
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: Can't Track Simple Bug

2006-11-11 Thread Paul Winkler
On Fri, Nov 10, 2006 at 11:01:26PM -0800, Nancy Donnelly wrote:
> 75From: Tres Seaver <[EMAIL PROTECTED]>
> 
> > The script you are using to start Zope with looks like it must be
> > 'zctl', the ancient precursor to the current 'zopectl':  it 'execed' its
> > Python config file (which is what you have here).  That version was
> > never shipped with Zope, and has not been in active use by its authors
> > (I'm one of them) for more than three years now.
> > 
> 
> Hmm. Okay. I took over this box recently. So, how do I change things? Here's 
> my current zopectl:

Have a look at the configuration section of the zope book:
http://www.plope.com/Books/2_7Edition/InstallingZope.stx#1-13

But since your instance has some old-style gunk you'll
want to make sure you get the new-style scripts and config files
in place. To do that, the easiest thing is probably:

- shut down zope.
- make a backup copy of your existing instance.
- delete all files in INSTANCE_HOME/etc and INSTANCE_HOME/bin
  (you did make that backup right??)
- go to your ZOPE_HOME, /usr/local/zope/278
- run "./bin/mkzopeinstance.py
- follow the prompts. When it asks for Directory,
  give your full INSTANCE_HOME path.
- Edit INSTANCE_HOME/etc/zope.conf.
  There will be lots of comments in there explaining
  the various directives. Hopefully you can figure
  out how the various things in your old zope.conf
  translate to the new format.

-- 

Paul Winkler
http://www.slinkp.com
___
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] How To Convert Files To Page Templates?

2006-11-07 Thread Paul Winkler
On Tue, Nov 07, 2006 at 03:14:40AM -0800, Nancy Donnelly wrote:
> That helped a lot! I yahoo'd (can't google any more since they've sold out to 
> the interests gathering our personal data for Homeland Security) 
> "put_factory" and got this code snippet:
> 
> if ext == 'dtml': 
>   from OFS.DTMLDocument import DTMLDocument
>  
>   return DTMLDocument( '', __name__=name )
> 
> So...how would I rewrite that to change it into a page template? And, more 
> importantly, where is the documentation to do so? Yahooing didn't help on 
> this. I went to my Zope installation to:
> {INSTALLATION}/lib/python/OFS
> to hunt around, but no script pointing to some "PTDocument" like there is 
> with DTML.

I think you want ZopePageTemplate from lib/python/Products/PageTemplates/


-- 

Paul Winkler
http://www.slinkp.com
___
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] external method strangeness

2006-10-18 Thread Paul Winkler
On Wed, Oct 18, 2006 at 06:13:38PM +0100, garry saddington wrote:
> Can anyone explain what is happening here. I am using Saxon to transform
> an xml file(source) using a stylesheet(style) the result is then written
> to Postgres. The contents of source are uploaded in Zope and passed to
> the external method as a string. When I run this external method:
> 
> import psycopg, string, re, subprocess
> def scholarpack_xml_transform(source):
> f=open('/opt/scholarpack/ancillary/source.xml','w')
> f.write(source) 

I have no idea what's causing your problem, but this raises
red flags for me: if two people upload sources at the same time,
you'll have problems here. If you really really must read/write
files on the filesystem, either use locks or use python's
tempfile module.

> f.close
> source= '/opt/scholarpack/ancillary/source.xml'
> style='/opt/scholarpack/ancillary/style.xml'
> source1=source.replace(''','`')
> source2=source1.replace('NLPGaddress','BS7666address')
> p=re.compile("\'")
> source3=p.sub( '`' , source2)
> r = 
> subprocess.Popen(['/opt/scholarpack/ancillary/jre/bin/java','-jar','./saxon.jar',source3,style],
>  stdout = subprocess.PIPE,cwd = '/opt/scholarpack/ancillary/')

Are you just using saxon for xslt processing?  If so, IMO using an
external process for that is severe overkill.  Get lxml and try
something like this:

from lxml import etree
style = etree.XSLT(etree.parse(some_file_object))
transformed = style.apply(source_data)

but again, this doesn't address your immediate problem :)

-- 

Paul Winkler
http://www.slinkp.com
___
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] Zeo Client hanging

2006-10-18 Thread Paul Winkler
On Wed, Oct 18, 2006 at 07:32:38AM +0200, Maciej Wisniowski wrote:
> 
> >
> >zope 2.8.5 + zeo
> >python 2.3.4 (red hat distribution)
> >Red Hat RHEL 4
> >Plone 2.1.2
> >
> >Our zeo clients hang intermittently.  We have no way of reproducing the
> >problem, but it occurs daily.  The client hangs and a restart seems to 
> >fix the
> >problem.
> Install DeadlockDebugger and you'll be able to see what is
> the state of your threads when Zope becomes unresponsive.
> 
> >In the event log with tracing on we get
> >
> >Trace zeo.zrpc.Connection(C) wait(16697) {server:8100} pending, async=0
> >
> >There are hundreds to thousands of these until the server is restarted.
> >
> >In the zeo log we get
> >
> >Error caught in asyncore asyncore.py
> >
> >error:(110,'Connection timed out')
> I'm not sure what these errors are. Maybe firewall between zeo
> server and zeo client closes the connections or something like that?

That was my guess too.
See this thread:
http://aspn.activestate.com/ASPN/Mail/Message/zope-list/2916870

-- 

Paul Winkler
http://www.slinkp.com
___
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] Upgrading Zope

2006-10-18 Thread Paul Winkler
On Wed, Oct 18, 2006 at 02:55:33PM +0200, Nightflyer wrote:
> Hi All,
>   I've been asked to migrate an ancient Zope server from 2.1.x to the
> latest 2.x or 3.x version.

http://zopewiki.org/Upgrading
 
-- 

Paul Winkler
http://www.slinkp.com
___
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] Tab completion in zopectl debug

2006-10-17 Thread Paul Winkler
On Tue, Oct 17, 2006 at 11:43:50PM +, Maurits van Rees wrote:
> This would just be for convenience.  Would this be enough of a
> convenience to put into the Zope source code?

Yes please!
 
-- 

Paul Winkler
http://www.slinkp.com
___
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] Sending XML straight down to a zope

2006-10-13 Thread Paul Winkler
On Thu, Oct 12, 2006 at 09:16:30PM +0200, Dieter Maurer wrote:
> Chris Withers wrote at 2006-10-12 08:35 +0100:
> >Peter Bengtsson wrote:
> >> xml_content = open('validxmlfile.xml').read()
> >> http = httplib.HTTP("localhost", 8080)
> >> http.putrequest("POST", "/uploadExpenseXML")
> >
> >That's not really a valid transaction...
> 
> Why not?
> 
> 
> The real problem is that Zope wrongfully assumes that each
> "POST" with content type "text/xml" is an XML-RPC request.
> 
> That's wrong at least since XML is more widely used on the browser
> side (e.g. XForms).

XML-RPC is not very helpful here.  As usual, its extreme simplicity is
both a blessing and a curse.
The specification, http://www.xmlrpc.com/spec , specifies POST with
content-type of text/xml, and that's all; so you really can't
distinguish XML-RPC from any other xml POST just from the header.

I suppose the publisher could cheat a bit and look in the body for the
required  element.  If missing, it can't be XML-RPC.

It would be more reliable if some configuration was required to specify
when XMLRPC is expected, and when not. But that would break Zope's
longstanding promise that XMLRPC is supported "for free", always,
automatically.

-- 

Paul Winkler
http://www.slinkp.com
___
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] Zope Crashes When Product Breaks

2006-10-11 Thread Paul Winkler
On Wed, Oct 11, 2006 at 11:22:42AM -0400, [EMAIL PROTECTED] wrote:
> Thanks.  I guess I posted to soon.  I changed the port it was listening on 
> and it is working now.  It still is a puzzle why it won't work on that 
> port.  

That often means that you have a zope process lingering that still holds
that port.  Try something like: ps -wax | grep py

-- 

Paul Winkler
http://www.slinkp.com
___
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] manage_beforeDelete

2006-10-09 Thread Paul Winkler
On Fri, Jul 02, 2004 at 07:40:31PM +0200, Garito wrote:
> Hi all!
> 
> I have a class like these:
> 
> class Test(CatalogAware, , OrderedFolder):
> def manage_beforeDelete(self, item, container):
> CatalogAware.manage_beforeDelete(item, container)
> OrderedFolder.manage_beforeDelete(item, container)
> 
> I only put the relevant code
> 
> If I delete de hook to manage_beforeDelete the class works fine (the objects
> disappear from the catalog) but if I put the function the catalog don't
> delete the objects
> 
> any idea?

In Python, anytime you call "unbound" methods (i.e. by referencing
a class rather than an instance), you need to pass an instance -
in this case, self - explicitly.

For example:

def manage_beforeDelete(self, item, container):
CatalogAware.manage_beforeDelete(self, item, container)
OrderedFolder.manage_beforeDelete(self, item, container)


But if your actual code looks like your example, you should have
gotten errors due to missing arguments.

-- 

Paul Winkler
http://www.slinkp.com
___
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] Help! Zope Crashed! Production Server!

2006-10-04 Thread Paul Winkler
http://www.zettai.net/Support/Howto/deadlockDebuggerHowto

On Wed, Oct 04, 2006 at 11:43:25AM -0700, Javier Subervi wrote:
> Hi;
> I'll afford a server to experiment on before year's end, but that doesn't 
> help me today. I was trying to get Python 2.3.5 to work with LDAP on FreeBSD. 
> I built py-ldap2 from ports and directed it to install Python 2.3.5 (because 
> I'm using Zope 2.7.8 because my software won't migrate yet). It built out 
> okay. The person who ran this box previously didn't understand FreeBSD's port 
> system, so he built Python in a different place. I moved all of that for 
> safety's sake (at least, I thought I did), and then ended up moving it all 
> back because I couldn't fire up Zope (I have 2 instances). Then I was able to 
> fire up Zope *and* import LDAP (the latter indicating something from my new 
> installation stuck). When I ps wax I see Zope is working. However, when I 
> surf to sites, or even the IP address, it just hangs! I cleared out 
> log/event.log and touched it and fired up in runzope mode, but there was 
> nothing strange in the event.log! And I've been over that log many times 
> lately, so I
>  would recognize something different. I presume ZServer is hung. How do I 
> trouble-shoot this?
> TIA,
> Javier2
>   
> -
> Do you Yahoo!?
>  Get on board. You're invited to try the new Yahoo! Mail.
> ___
> 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 )


-- 

Paul Winkler
http://www.slinkp.com
___
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] zope gets killed on startup

2006-10-01 Thread Paul Winkler
On Mon, Oct 02, 2006 at 02:22:24AM +0200, Einar N?ss Jensen wrote:
> My zope will not start, after running fine for  a few days, after installing
> plone 2.5, When I try to start it, it just ends with a "killed". How may I
> find out what killed my zope? (I guess I did, in some way, but not how. It
> just suddenly stopped)
> 
> Any help or pointers would be greatly appreciated.

I'm guessing, but perhaps some external process is deciding to kill zope.
The only time that happened to me, it was due to excessive memory
consumption, so linux decided to kill zope.
I would check /var/log/messages.

-- 

Paul Winkler
http://www.slinkp.com
___
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: [z3-five] A Quick Event-based Cataloging How-to for Zope 2

2006-10-01 Thread Paul Winkler
On Fri, Sep 29, 2006 at 11:23:47PM +0100, Chris Withers wrote:
> whit wrote:
> >thanks Chris!
> >
> >-w
> 
> I just wish there was a good and more permenant place to put this...

maybe zopewiki.org?

thanks for the writeup, very useful and readable!

-- 

Paul Winkler
http://www.slinkp.com
___
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] Path expression in Python based script

2006-09-29 Thread Paul Winkler
On Fri, Sep 29, 2006 at 09:00:16AM +0200, Daniel de la Cuesta wrote:
> path="animals"
> items=len(context.sections.path.contentValues())
> 
> 
> When I try to run the script I get an error saying that the variable "path" 
> is not present.
> 
> If i do:
> 
> items=len(context.sections.animals.contentValues())
> 
> everything is ok,
> 
> How can I refer to a variable into a path expression in a Python Based Script?

On the surface this isn't really a zope question, it's basic Python.
You're looking for the getattr() builtin function.  For example:

[EMAIL PROTECTED] ~ $ python
Python 2.4.3 (#1, Jul 27 2006, 13:07:44)
[GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo:
... bar = 1
...
>>> foo = Foo()
>>> foo.bar
1
>>> path = 'bar'
>>> foo.path
Traceback (most recent call last):
  File "", line 1, in ?
AttributeError: Foo instance has no attribute 'path'
>>> getattr(foo, path)
1


Of course, Zope 2 has to complicate things a bit :)
Zope's ObjectManagers, such as Folders, also allow you
to use dictionary syntax to access their children.
So you can do foo[path] as well.

There is a semantic difference, though, in Zope 2: 

* attribute access like getattr(foo, 'bar'),  or foo.bar, falls
  back to using acquisition to look for 'bar' in foo's parent
  folders.

* Item access (like foo['bar']) does not use acquisition, so you'd get an
  immediate KeyError if foo does not contain the named object.

I recommend using item access in all cases except when you know
for sure that you want to use acquisition. Acquisition bugs can be big
time-wasters - e.g. accidentally acquiring a slightly different object
than the one you wanted to use, because the one you expected to find
happens to be missing, or a site admin renamed it, or some such.

-- 

Paul Winkler
http://www.slinkp.com
___
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] POST from Zope to external server and receive RESPONSE

2006-09-28 Thread Paul Winkler
On Thu, Sep 28, 2006 at 10:42:18PM +1000, [EMAIL PROTECTED] wrote:
> I've inherited a project that now needs to post an XML
> packet to an ecommerce gateway, ie a user submits, via
> a form, credit card details which are posted to a Zope
> server. The Zope server then builds an XML packet and
> wants to POST to an external server which will send a
> RESPONSE.
> 
> Can I capture that RESPONSE in Zope or must I use external
> methods and something like Python's httplib.
> 
> I've done similar things with curl lib and C++, php curl
> lib and php.
> 
> Any hints folks?

You'll need to use an external method (or write a simple product).
Then you can use httplib or urllib2, or the python wrappers for curl
(I found curl worked in some weird firewall configurations
that httplib didn't).

But you mention XML. If the remote system is XML-RPC, you'll
want to use python's excellent xmlrpclib, which makes
rpc calls look just like local calls:

remote = xmlrpclib.ServerProxy('http://somewhere/something')
result = remote.someMethod('param1', 'param2')

-- 

Paul Winkler
http://www.slinkp.com
___
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] Remove/Ignore and other HTML tags

2006-09-15 Thread Paul Winkler
On Fri, Sep 15, 2006 at 12:24:36PM -0700, Zhi-Wei Lu wrote:
> Paul,  Thank you for your tip of
> text = container.research[name].read()

Sure. Please keep discussion on the mailing list, thanks.
 
> Actually, in my case it should be
> text = container.research[name].research_description_html
> 
> research_description_html contains abstract in HTML format.
> 
> When I post the the message, I got it wrong, actually I want
> the "text" to preserve HTML  format rather than <P>  as it show  
> in the
> page source,  when it returns to the main index_html from this function.
> 
> Do you know how and where I set the html_quote flag?

No, I don't. All that you showed us of where this text goes is: 

> >> >>rand1="get_random_image()"
> >>cap1="get_folder_title(name=rand1)"
> >>text="get_abstract_sample(name=rand1)">
> >>   
> >>


Presumably the dtml method/document where you found that code 
contains something like: .
I am *guessing* that it looks like 
or .

Remove the html_quote attribute and you should be OK.

But since you say this used to work in zope 2.7,
there is probably some other problem.

It's hard to say without having access to more of your code.
Sorry.

-PW

-- 

Paul Winkler
http://www.slinkp.com
___
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] POST sucks.

2006-09-14 Thread Paul Winkler
On Wed, Sep 13, 2006 at 10:02:56AM +0200, Igor Stroh wrote:
> Doing a lot web services developoment lately, I find tcpflow? very
> usefull (and much easier to use then ethereal), e.g.:
> `tcpflow -c -i eth0 port 8080`
> will sniff on port 8080 (interface eth0) in interactive mode, so
> you'll see the data fly by, already decoded and ready to be
> copy&pasted into SOAPUI? :)
> 
> 
> ?: http://www.circlemud.org/~jelson/software/tcpflow/
> ?: http://www.soapui.org/

Nice! tcpflow is simple and handy.

Anybody know of something like soapui that supports xml-rpc?
Bonus points for json-rpc.

-- 

Paul Winkler
http://www.slinkp.com
___
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] Remove/Ignore and other HTML tags

2006-09-14 Thread Paul Winkler
On Thu, Sep 14, 2006 at 03:52:30PM -0700, Zhi-Wei Lu wrote:
> I am a system administrator who maintains our Zope servers.  I don't  
> know that much
> about python or zope, just enough to upgrade and trouble shooting  
> from time to time.
> Of course, the developers who have developed the system are no longer  
> here.
> 
> I try to move a site from Zope 2.7.4 (python 2.4) to a new server  
> with Zope 2.9.4 (python 2.4.3),
> after some struggle, I have fixed most of the problems, but one that  
> I don't have much clue.  I hope
> that expert here can shed some light for me.
> 
> Here are section of code that displays part the of some abstract
>  rand1="get_random_image()"
> cap1="get_folder_title(name=rand1)"
> text="get_abstract_sample(name=rand1)">
>
> 
> The function get_abstract_sample
> is here
> 
> for object in container.research.objectValues():
>   a = object.getId()
>   if (a == name):
> text = object.research_description_html.read()
>   else:
>  pass
>

Unless you omitted something, that's a really long
and slow way to do this:

 text = container.research[name].read()

Don't iterate over all items when you only care about one of
them and know what it's called :)
But that's not your problem...

> The above code work fine for the 2.7.4 server, but fails for 2.9.4  
> server, it will
> ask for authentication password for 2.9.4, no user/password combination
> will work.  If I  modify it as follows (for 2.9.4 server)
> 
> for object in container.research.objectValues():
>   a = object.getId()
>   if (a == name):
> text = object.research_description_html
> 
> text = str(text)
> 
> return text[0:400] + '...'
> 
> Getting rid of read() for the 2.9.4 server solve the authentication  
> problem and

We don't know what kind of objects you have. But this sounds like
the code for "object" is lacking some security declarations, and zope
2.7 was too permissive.

> display the web page
>  but with some unpleasant
>  and other HTML tags literally (It doesn't for the old 2.7.4 server).
>
> I would love to hear suggestions and advices from this group to get  
> rid of
> the literal  and other HTML tags.  Thank you very much for your help.

Hmm, you never showed us where this text actually gets put into the
page.  In the example you gave, it gets assigned in a 
tag, and that's the last we saw of it.
Perhaps you have something like ?

If so, remove the html_quote attribute.

See http://www.plope.com/Books/2_7Edition/AppendixA.stx#1-20

-- 

Paul Winkler
http://www.slinkp.com
___
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] Jython port of Zope

2006-09-14 Thread Paul Winkler
On Thu, Sep 14, 2006 at 05:38:26PM +0200, Andreas Jung wrote:
> --On 14. September 2006 16:15:57 +0100 [EMAIL PROTECTED] 
> wrote:
> 
> >
> >Hi, does Zope run on Jython, or is anyone working on making it do so? Any
> >pointers would be very helpful.
> 
> Zope only runs on CPython, not on Jython.

... and that is very unlikely to change, since zope ships
with a number of C extensions.

-- 

Paul Winkler
http://www.slinkp.com
___
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 )


  1   2   3   4   >