[Zope-dev] property type

2003-02-06 Thread Tim McLaughlin
According to docs and testing (in the interpreter) I can make a 
read-only calculated attribute using property() (I know that setters do 
not work w/ non-new-style classes).  So I tried the following:

class CMixin:
  def getter(self):
return 'test'
  prop = property(getter)

and when I try to mix in this object w/ a Folder object, the instance 
returns property object at 0x8b45edc for the 'prop' attribute.  Is 
this an issue with pickling or something else?

Cheers,
Tim
--
Tim McLaughlin
Chief Technology Officer
Siteworx, Inc... Set your site on the future!
703.390.5421


msg12579/pgp0.pgp
Description: PGP signature


Re: [Zope-dev] property type

2003-02-06 Thread Steve Alexander
Tim McLaughlin wrote:

According to docs and testing (in the interpreter) I can make a 
read-only calculated attribute using property() (I know that setters do 
not work w/ non-new-style classes).  So I tried the following:

class CMixin:
  def getter(self):
return 'test'
  prop = property(getter)

and when I try to mix in this object w/ a Folder object, the instance 
returns property object at 0x8b45edc for the 'prop' attribute.  Is 
this an issue with pickling or something else?

In Zope 2, the ExtensionClass that is the C base class used for 
Persistent classes, doesn't work with python 2.2 properties.

--
Steve Alexander



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


Re: [Zope-dev] property type

2003-02-06 Thread Steve Alexander
Steve Alexander wrote:

Tim McLaughlin wrote:


According to docs and testing (in the interpreter) I can make a 
read-only calculated attribute using property() (I know that setters 
do not work w/ non-new-style classes).  So I tried the following:

class CMixin:
  def getter(self):
return 'test'
  prop = property(getter)

and when I try to mix in this object w/ a Folder object, the instance 
returns property object at 0x8b45edc for the 'prop' attribute.  Is 
this an issue with pickling or something else?


In Zope 2, the ExtensionClass that is the C base class used for 
Persistent classes, doesn't work with python 2.2 properties.

But, you can use a ComputedAttribute to get much the same effect.

--
Steve Alexander



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


[Zope-dev] Unsynced ZEO Clients and Undo

2003-02-06 Thread Brian R Brinegar
Hello,

We've run into a problem with Zope 2.5.1 and ZEO 1 where a user does an
Undo and some of the ZEO clients reflect the change and others do not. I
believe it has to do with caches getting out of sync. Is this a known
problem? It has happened to us at least 4 times that I know of. Usually we
will restart all of the clients and remove the caches, to fix the problem,
but this is not desirable.

Thanks,
-Brian Brinegar
 ECN Web Systems Developer
 Purdue University
 West Lafayette, IN


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



[Zope-dev] Making private documents viewable by members in CMF

2003-02-06 Thread David Cain
CMF comes with a default workflow with three states: private, pending,
and published. When an object is in the private state, only the user who
created it and site managers can view and change it.

How do I change the roles or security to allow Members to view each
others private documents without making them managers?

David Cain
Senior Web Developer, Information Systems Department 
Syracuse University Library
Syracuse, New York 13244-2010
(315) 443-5923
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]


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



Re: [Zope-dev] Making private documents viewable by members in CMF

2003-02-06 Thread Gilles Lenfant
(Untested but should work)

Make your own workflow with DCWorkflow (search and install that CMF extra
product)
DC Workflow comes with a pre-built workflow that acts like the CMF default
workflow
Edit the private state of the workflow in the permissions tab.
Grant the View permission to Members.
Associate this workflow to the appropriate content types.

HTH

--Gilles Lenfant

- Original Message -
From: David Cain [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, February 06, 2003 7:53 PM
Subject: [Zope-dev] Making private documents viewable by members in CMF


| CMF comes with a default workflow with three states: private, pending,
| and published. When an object is in the private state, only the user who
| created it and site managers can view and change it.
|
| How do I change the roles or security to allow Members to view each
| others private documents without making them managers?
|
| David Cain
| Senior Web Developer, Information Systems Department
| Syracuse University Library
| Syracuse, New York 13244-2010
| (315) 443-5923
| mailto:[EMAIL PROTECTED]
| mailto:[EMAIL PROTECTED]
|
|
| ___
| Zope-Dev maillist  -  [EMAIL PROTECTED]
| http://mail.zope.org/mailman/listinfo/zope-dev
| **  No cross posts or HTML encoding!  **
| (Related lists -
|  http://mail.zope.org/mailman/listinfo/zope-announce
|  http://mail.zope.org/mailman/listinfo/zope )
|
|



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



[Zope-dev] override __of__

2003-02-06 Thread Tim McLaughlin
Is there any way to override __of__ on an object?  I've tried it but for 
whatever reason, Implicit.__of__(self, object) says that self is not an 
Acquirer even though the object is a subclass of Implicit.  I would 
implement in a traverse hook, but attribute access of that object won't 
do traversal. :(

Cheers,
Tim

--
Tim McLaughlin
Chief Technology Officer
Siteworx, Inc... Set your site on the future!
703.390.5421


msg12585/pgp0.pgp
Description: PGP signature


Re: [Zope-dev] override __of__

2003-02-06 Thread Chris McDonough
Is this what you're trying to do?

Starting debugger
   /home/chrism/projects/TIProject/bin/python -i -c import user;import
Zope;app=Zope.app() 

 from Acquisition import Implicit
 class Foo(Implicit):
... def __of__(self, parent):
... return Implicit.__of__(self, parent)
... 
 f = Foo()
 g = Foo()
 f.__of__(g)
Foo instance at 8ad6940


On Thu, 2003-02-06 at 16:16, Tim McLaughlin wrote:
 Is there any way to override __of__ on an object?  I've tried it but for 
 whatever reason, Implicit.__of__(self, object) says that self is not an 
 Acquirer even though the object is a subclass of Implicit.  I would 
 implement in a traverse hook, but attribute access of that object won't 
 do traversal. :(
 
 Cheers,
 Tim
 
 -- 
 Tim McLaughlin
 Chief Technology Officer
 Siteworx, Inc... Set your site on the future!
 703.390.5421



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



[Zope-dev] RE: [Zope] Time module in python scripts

2003-02-06 Thread sean . upton
I hope you all don't mind, but I've moved this to Zope-dev.  I would like to
propose that it be possible without modification (default behavior) in a
future version of Zope to import the time module and its methods safely into
TTW Python Scripts.

I haven't used this yet in TTW code (I've had to work around it), but it
seems like it might be good to un-restrict it, especially for CMF
installations that heavily utilize date metadata.
time.localtime(time.time()) is, AFAICT, the only way to determine if you are
in standard or DST at any point in time during the year.  You can't have a
page-template appropriately display correct times for content from multiple
time-zones without this (I'm sure many CMF installations will need this),
and it seems silly to write an external method for this; allowing import of
the time module is a good workaround, but I would suggest it be enabled by
default in Zope.

My particular use-case is AP newswire stories which are in EST/EDT.  The
timezone offset changes for this twice a year, and having a fixed
calculation based upon some assumption of a fixed timezone offset in my own
timezone (PST/PDT) won't work.  I need to be able to know my own timezone
offset to do the math, and for this I need to use
time.localtime(time.time())[8] to get it.  I'm sure community sites and
things like blogs, or anything else that works across the geographic
boundaries of differing time zones could use this too.

Thoughts?

Sean

-Original Message-
From: Chris McDonough [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 06, 2003 2:01 PM
To: Chris Muldrow
Cc: '[EMAIL PROTECTED]'
Subject: Re: [Zope] Time module in python scripts


Apparently.  See /lib/python/Products/PythonScripts/README.txt or the
Zope Developer's Guide Security chapter for info on how to enable it...

- C


On Thu, 2003-02-06 at 16:49, Chris Muldrow wrote:
 I'm trying to do
 Import time
 Time=time.time()
 
 in a Python Script, but I'm getting login prompts and Error Value: You
are
 not allowed to access time in this context messages. Is the time module
one
 that's restricted in Python Script?
 Chris
 
 
 ___
 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 )



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

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



Re: [Zope-dev] RE: [Zope] Time module in python scripts

2003-02-06 Thread Tim Hoffman
Hi

I wonder why DateTime().parts() results is different to 
time.localtime(time.time()) or at least returns less info than the
latter.

It would seem a change to DateTime would be in order ?

Tim


On Fri, 2003-02-07 at 06:30, [EMAIL PROTECTED] wrote:
 I hope you all don't mind, but I've moved this to Zope-dev.  I would like to
 propose that it be possible without modification (default behavior) in a
 future version of Zope to import the time module and its methods safely into
 TTW Python Scripts.
 
 I haven't used this yet in TTW code (I've had to work around it), but it
 seems like it might be good to un-restrict it, especially for CMF
 installations that heavily utilize date metadata.
 time.localtime(time.time()) is, AFAICT, the only way to determine if you are
 in standard or DST at any point in time during the year.  You can't have a
 page-template appropriately display correct times for content from multiple
 time-zones without this (I'm sure many CMF installations will need this),
 and it seems silly to write an external method for this; allowing import of
 the time module is a good workaround, but I would suggest it be enabled by
 default in Zope.
 
 My particular use-case is AP newswire stories which are in EST/EDT.  The
 timezone offset changes for this twice a year, and having a fixed
 calculation based upon some assumption of a fixed timezone offset in my own
 timezone (PST/PDT) won't work.  I need to be able to know my own timezone
 offset to do the math, and for this I need to use
 time.localtime(time.time())[8] to get it.  I'm sure community sites and
 things like blogs, or anything else that works across the geographic
 boundaries of differing time zones could use this too.
 
 Thoughts?
 
 Sean
 
 -Original Message-
 From: Chris McDonough [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 06, 2003 2:01 PM
 To: Chris Muldrow
 Cc: '[EMAIL PROTECTED]'
 Subject: Re: [Zope] Time module in python scripts
 
 
 Apparently.  See /lib/python/Products/PythonScripts/README.txt or the
 Zope Developer's Guide Security chapter for info on how to enable it...
 
 - C
 
 
 On Thu, 2003-02-06 at 16:49, Chris Muldrow wrote:
  I'm trying to do
  Import time
  Time=time.time()
  
  in a Python Script, but I'm getting login prompts and Error Value: You
 are
  not allowed to access time in this context messages. Is the time module
 one
  that's restricted in Python Script?
  Chris
  
  
  ___
  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 )
 
 
 
 ___
 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 )
 
 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://mail.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists - 
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope )



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



[Zope-dev] What makes Zope twirl?

2003-02-06 Thread Paul Winkler
Or: when zope goes into a nonresponsive state,
what can you do to diagnose the cause?

The even that prompts this question:

Our production system (2 zeo clients) went down today.
Platform: Linux 2.4, Zope 2.5.1 from source (wo_pcgi), 
Python 2.1.3 from source, running behind Apache
for one site, and a custom java proxy for another site
(don't ask). ZServer is not exposed to anything
except the servers running Apache and the Java proxy.

All the zope processes were still running,
CPU usage was low (almost nil for python), * 
there was plenty of free physical memory  swap. 
Yet Zope was not responding to requests.
A look at the access logs revealed that
zope had not logged anything since the time
we noticed the outage. Nothing
unusual before that except AltaVista crawling our site
(a measly 2 requests / second).

A restart seemed to fix everything, though one
of the zeo servers went down again (same symptoms)
about 20 minutes after starting. Restarted it again
and both servers have been fine for hours now.

This seems to be rare; I haven't seen it before on
this particular server, but I saw a similar wedge
on our dev machine about 3 weeks ago.

I've looked at ALL the logs (access log, zeo log,
zope stdout / stderr log) and found nothing at all
unusual, just the aforementioned AltaVista crawl
and a couple of RAM Cache errors from non-pickleable
objects that I need to dis-associate from the cache.
But none of this is new.

Is it time for Big M? WOuld that give me anything
useful?


* this does not sound like other zope spins
I have heard of, in which python eats 99% CPU
indefinitely due to (probably) an application error.
see for example:
http://www.zopezen.org/Members/zopista/News_Item.2003-01-28.1025 


-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's CAPTAIN STETOSCOPE!
(random hero from isometric.spaceninja.com)

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



[Zope-dev] Zope Server Control

2003-02-06 Thread Shane Hathaway
Zope-Dev'ers,

Just for fun, I made a mockup (using QT Designer) of a Zope server control 
and monitoring GUI.  It's purely nonfunctional--just an idea.  Check it 
out here:

http://hathaway.freezope.org/Images/controller_snapshot.png

It's not fancy, but it's complete: you can watch and control multiple
servers from a single place.  The flashing yellow LED-like indicators
would give you a great deal of confidence that information is flowing.  
It sure would be appealing.  Anyone want to take this on? :-)

supplying-endless-ideas-for-vaporware-ly y'rs, Shane

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