[Zope-Checkins] SVN: zdaemon/trunk/src/zdaemon/tests/testzdrun.py testRunIgnoresParentSignals(): Try to fix an

2005-12-15 Thread Tim Peters
Log message for revision 40791:
  testRunIgnoresParentSignals():  Try to fix an
  intermittent test-killing race between this test
  and zdrun.py fighting over who deletes the
  test socket first.
  

Changed:
  U   zdaemon/trunk/src/zdaemon/tests/testzdrun.py

-=-
Modified: zdaemon/trunk/src/zdaemon/tests/testzdrun.py
===
--- zdaemon/trunk/src/zdaemon/tests/testzdrun.py2005-12-15 16:58:31 UTC 
(rev 40790)
+++ zdaemon/trunk/src/zdaemon/tests/testzdrun.py2005-12-15 20:30:13 UTC 
(rev 40791)
@@ -248,7 +248,22 @@
 # Kill the process.
 send_action('exit\n', zdrun_socket)
 finally:
-shutil.rmtree(tmp)
+# Remove the tmp directory.
+# Caution:  this is delicate.  The code here used to do
+# shutil.rmtree(tmp), but that suffers a sometimes-fatal
+# race with zdrun.py.  The 'testsock' socket is created
+# by zdrun in the tmp directory, and zdrun tries to
+# unlink it.  If shutil.rmtree sees 'testsock' too, it
+# will also try to unlink it, but zdrun may complete
+# unlinking it before shutil gets to it (there's more
+# than one process here).  So, in effect, we code a
+# 1-level rmtree inline here, suppressing errors.
+for fname in os.listdir('.'):
+try:
+os.unlink(os.path.join(tmp, fname))
+except os.error:
+pass
+os.rmdir(tmp)
 
 def testUmask(self):
 # people have a strange tendency to run the tests as root

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/ New zdaemon.

2005-12-15 Thread Tim Peters
Log message for revision 40794:
  New zdaemon.
  
  Should repair the latest intermittent failures in
  testRunIgnoresParentSignals.
  

Changed:
  _U  Zope/branches/2.9/lib/python/

-=-

Property changes on: Zope/branches/2.9/lib/python
___
Name: svn:externals
   - ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1
BTrees svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/BTrees
persistent svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/persistent
ThreadedAsync  svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/ThreadedAsync
transactionsvn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/transaction
ZEOsvn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/ZEO
ZODB   svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/ZODB
ZopeUndo   svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/ZopeUndo
zdaemon-r 39732 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon
pytz   svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0b1/src/pytz
zodbcode   
svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0b1/src/zodbcode
ClientCookie   
svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0b1/src/ClientCookie
mechanize  
svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0b1/src/mechanize

   + ZConfigsvn://svn.zope.org/repos/main/ZConfig/tags/ZConfig-2.3.1
BTrees svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/BTrees
persistent svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/persistent
ThreadedAsync  svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/ThreadedAsync
transactionsvn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/transaction
ZEOsvn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/ZEO
ZODB   svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/ZODB
ZopeUndo   svn://svn.zope.org/repos/main/ZODB/tags/3.6.0b4/src/ZopeUndo
zdaemon-r 40792 svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon
pytz   svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0b1/src/pytz
zodbcode   
svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0b1/src/zodbcode
ClientCookie   
svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0b1/src/ClientCookie
mechanize  
svn://svn.zope.org/repos/main/Zope3/tags/Zope-3.2.0b1/src/mechanize


___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


Re: [Zope-dev] RFV: Unicode in Zope 2

2005-12-15 Thread TAHARA Yusei
Hello.

At Fri, 09 Dec 2005 10:11:42 -0500,
Jim Fulton wrote:
 - Common approach to Unicode
 
 In particular, In Zope 3, all text is stored and managed as Unicode.
 The publisher decodes request data and encodes response data.  The vast
 majority of application and library code can ignore encoding issues.
 (The exceptions are applications and frameworks that need to exhange
 text with non-Unicode-aware external systems.)  This has provided
 great simplifications and allowed us to avoid common pitfals from
 mixing Unicode and encoded text.
 
 We need to migrate Zope 2 to use a similar strategy.  We need volunteers
 to brainstorm how this can be done and make one or more proposals.
 This is likely a prerequisite for finishing the publisher and ZPT
 work.

I want to tackle this problem, because I use japanese and I have
experienced the encode/decode error pitfalls in a last few years.
I'm wrong, I didn't touch zope development and didn't read the list
carefully.

In zope2.8, there is a zpt problem and this is a same pitfall.
(unicode and string are mixed in TAL)

--
TAHARA Yusei
[EMAIL PROTECTED]
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Zope tests: 5 OK, 3 Failed

2005-12-15 Thread Stefan H. Holek
Yup, that box is slowly dying on me. I will take down the nightlies  
until I find a new machine to run them on.


Stefan


On 14. Dez 2005, at 15:35, Chris McDonough wrote:

FYI:  These tests appear to be failing due to a race in the tests  
they're exercising that could be exposed if the machine was under  
heavy load or just particularly slow.


--
Anything that happens, happens.  --Douglas Adams


___
Zope-Dev maillist  -  Zope-Dev@zope.org
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: sessions in the presence of conflicts

2005-12-15 Thread Florent Guillaume

[Using zope-dev@ instead of [EMAIL PROTECTED]

Dennis Allison wrote:

A more session-friendly conflict resolution might use:

   1.  if any of the states are invalid (that is, has a key '_invalid')
   return the invalid state.

   2.  if any any of the states attributes ['token','id','_created']
   differ then there is a conflict, raise the conflict exception. 


   3.  order the newState and savedState by modification time (or if that
   cannot be computed, by access time).   

   4.  any key appearing in oldState's dictionary but not appearing in 
   both savedState and newState should be removed from all.  This 
   corresponds to a key-value pair being deleted in one of the 
   transactions.  Insertions will be managed automatically by 
   the updates.


   5.  beginning with the oldest, update oldState dictionary of key-value 
   pairs using the dictionary part of newState and savedState.  Return 
   oldState.


This does several things.  First, it captures independent key-value
changes made in both potentially conflicting transactions.  Second, it
provides a reasonable ordering for multiple (potentially conflicting)
key-value pair updates.  Third, it manages insertions and deletions to the
session variable set in the presence of conflicts.

Does this make sense?  I have yet to figure out how to map a
TransientObject state back to the object it represents, but it clearly
is possible.


I certainly makes sense from a high level description, but the devil is in 
the details. I'd be interested in looking at it if you code something.


Florent

--
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of RD
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 tests: 3 OK, 3 Failed, 2 Unknown

2005-12-15 Thread Zope tests summarizer
Summary of messages to the zope-tests list.
Period Wed Dec 14 12:01:01 2005 UTC to Thu Dec 15 12:01:01 2005 UTC.
There were 8 messages: 8 from Zope Unit Tests.


Test failures
-

Subject: FAILED (failures=1) : Zope-2_7-branch Python-2.4.2 :
Linux
From: Zope Unit Tests
Date: Wed Dec 14 22:13:22 EST 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003797.html

Subject: FAILED : Zope-2_9-branch Python-2.4.2 : Linux
From: Zope Unit Tests
Date: Wed Dec 14 22:17:52 EST 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003800.html

Subject: FAILED : Zope-trunk Python-2.4.2 : Linux
From: Zope Unit Tests
Date: Wed Dec 14 22:19:23 EST 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003801.html


Unknown
---

Subject: UNKNOWN : Zope-2_8-branch Python-2.3.5 : Linux
From: Zope Unit Tests
Date: Wed Dec 14 22:14:52 EST 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003798.html

Subject: UNKNOWN : Zope-2_8-branch Python-2.4.2 : Linux
From: Zope Unit Tests
Date: Wed Dec 14 22:16:22 EST 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003799.html


Tests passed OK
---

Subject: OK : Zope-2_6-branch Python-2.1.3 : Linux
From: Zope Unit Tests
Date: Wed Dec 14 22:08:52 EST 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003794.html

Subject: OK : Zope-2_6-branch Python-2.3.5 : Linux
From: Zope Unit Tests
Date: Wed Dec 14 22:10:22 EST 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003795.html

Subject: OK : Zope-2_7-branch Python-2.3.5 : Linux
From: Zope Unit Tests
Date: Wed Dec 14 22:11:52 EST 2005
URL: http://mail.zope.org/pipermail/zope-tests/2005-December/003796.html

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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: RFV: Unicode in Zope 2

2005-12-15 Thread Martijn Faassen

Florent Guillaume wrote:

Martijn Faassen wrote:

[snip]
What I'm worried about doing this for old code, but some steps will 
probably become clear during the brainstorming session. Migration 
tools that turn strings in the ZODB into unicode ones magically (with 
the ability to spell out exceptions and encoding)? Tricky...


I'd start by adding some deprecation warnings at the places where 
PlacelessTranslationService (or Localizer for that matter) do their 
workarounds so that normally incompatible types are mixed together.


With the most recent Silva under development, we're not using either 
anymore, so someone else would have to do this.


Where would you put the deprecation warning in PTS? It monkey patches 
the ZPT engine, and in particular its StringIO object, to make sure that 
UTF-8 strings and unicode strings, when finally concatenated at the end 
after page template generation, can actually be concatenated as it will 
first encode the unicode strings to UTF-8. The output of the page 
template will then be UTF-8.


In Zope 2 without this in place, the output of the page template will be 
unicode, and if you put in UTF-8 strings (that aren't just ascii), the 
system will give rise to a UnicodeError when this concatenation takes place.


I guess you could put some detection code in PTS's concatenation 
functionality to see whether anything unicode is mixed with non-ascii 
strings, and in that case output one deprecation warning. I have a 
suspicion that you'll see this warning whenever someone views a page 
template in Plone. :)


Regards,

Martijn
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] RFV: Unicode in Zope 2

2005-12-15 Thread Martijn Faassen

Andreas Jung wrote:


--On 9. Dezember 2005 10:11:42 -0500 Jim Fulton [EMAIL PROTECTED] wrote:



We need to migrate Zope 2 to use a similar strategy.  We need volunteers
to brainstorm how this can be done and make one or more proposals.
This is likely a prerequisite for finishing the publisher and ZPT
work.




My ZPT integration of the Z3 templates will definitely only allow 
unicode. Non-unicode content must pass either an encoding or accept that 
it will be converted using utf8 as default encoding to unicode.


Hm, so it auto-decodes non-unicode strings using UTF-8? That's a bit 
dangerous, as you suppress a large class of unicode errors in the code. 
Code that creates UTF-8 strings will be silently accepted. Not as bad as 
what PTS does, at least the output of the ZPT will be unicode, but scary 
nonetheless.


Do you have any impression of how compatible is your code is with 
existing large Zope 2 codebases by the way?


Regards,

Martijn
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] user folder question

2005-12-15 Thread Chris Cole
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


Hey all,
I'm currently trying to setup a custom zope instance for our c.s.
department at school. Currently we run a totally linux infrastructure
with ldap authentication which we would also like to tie into zope. My
question is not how to authenticate against ldap, but I was wondering if
there is a way to disable the default user folder and in automagically
put an ldapuser folder  in its place on creation of a new instance. I'm
kinda new to zope, and I'm sure it's possible, but if someone could at
least point me in the right direction i would appreciate it.

- --Chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDoaCiASJ6G3eRc6ARAk+7AKDpZpgQHZeMnlr0x9bJsgipGOcl3ACfayrw
0U1rhAAyISo7O76otdpVKBo=
=hmSn
-END PGP SIGNATURE-
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] RFV: Unicode in Zope 2

2005-12-15 Thread Andreas Jung



--On 15. Dezember 2005 17:55:16 +0100 Martijn Faassen [EMAIL PROTECTED] 
wrote:

Hm, so it auto-decodes non-unicode strings using UTF-8? That's a bit
dangerous, as you suppress a large class of unicode errors in the code.
Code that creates UTF-8 strings will be silently accepted. Not as bad as
what PTS does, at least the output of the ZPT will be unicode, but scary
nonetheless.

Do you have any impression of how compatible is your code is with
existing large Zope 2 codebases by the way?




I would like to keep the code as strict as possible for now. When the final 
implementation is ready we must test it with Plone and CPS and see what 
problems will occur and how we can deal with them in a sane way (hopefully 
saner than the current implementation). Otherwise we could also stick with 
the current implementation :-) So there is currently no need to hurry..I 
hope to finish the work in January...enough time left for testing.


-aj

pgpsqibkdZvji.pgp
Description: PGP signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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: sessions in the presence of conflicts

2005-12-15 Thread Chris McDonough

Code would be good.

Note that changing the transientobject conflict resolution algorithm  
won't get rid of all write conflict errors, because the BTree-based  
indexes in the transient object container will still conflict during  
a bucket split and other situations that I can't exactly recall  
(they're documented in the BTrees source code).  In fact, before you  
spend a lot of time tuning the TO conflict resolution algorithm, you  
should make sure that the majority of conflicts you're seeing do  
indeed come out of attempting to resolve conflicting transientobject  
states (as per the conflict error traceback).  Conflict resolution  
algorithms are difficult and any algorithm will have DWIM-y  
tradeoffs, so it's useful to keep it as simple as possible.


Note also that if you store your session data in a ZEO server in  
order to do *any* transience write conflict resolution, the ZEO  
server process needs to have Products.Transience on its PYTHONPATH  
(as it needs access to the resolution code).


You also still haven't told us if you've tuned any of the knobs that  
I recommended you tune, so if you haven't, do that first. ;-)


- C

On Dec 15, 2005, at 5:35 AM, Florent Guillaume wrote:


[Using zope-dev@ instead of [EMAIL PROTECTED]

Dennis Allison wrote:

A more session-friendly conflict resolution might use:
   1.  if any of the states are invalid (that is, has a key  
'_invalid')

   return the invalid state.
   2.  if any any of the states attributes ['token','id','_created']
   differ then there is a conflict, raise the conflict  
exception.3.  order the newState and savedState by  
modification time (or if that
   cannot be computed, by access time).  4.  any key  
appearing in oldState's dictionary but not appearing in 
both savedState and newState should be removed from all.   
Thiscorresponds to a key-value pair being deleted in one  
of thetransactions.  Insertions will be managed  
automatically bythe updates.
   5.  beginning with the oldest, update oldState dictionary of  
key-valuepairs using the dictionary part of newState and  
savedState.  ReturnoldState.

This does several things.  First, it captures independent key-value
changes made in both potentially conflicting transactions.   
Second, it

provides a reasonable ordering for multiple (potentially conflicting)
key-value pair updates.  Third, it manages insertions and  
deletions to the

session variable set in the presence of conflicts.
Does this make sense?  I have yet to figure out how to map a
TransientObject state back to the object it represents, but it  
clearly

is possible.


I certainly makes sense from a high level description, but the  
devil is in the details. I'd be interested in looking at it if you  
code something.


Florent

--
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of RD
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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  -  Zope-Dev@zope.org
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: [ZODB-Dev] Re: [Zope-dev] Re: sessions in the presence of conflicts

2005-12-15 Thread Tim Peters
[Chris McDonough]
 Note that changing the transientobject conflict resolution algorithm
 won't get rid of all write conflict errors, because the BTree-based
 indexes in the transient object container will still conflict during a
 bucket split and other situations that I can't exactly recall
 (they're documented in the BTrees source code).

A more readable account is here:

http://www.zope.org/Wikis/ZODB/BTreeConflictResolution

BTrees are mappings too, and looks like Dennis is trying to apply similar
conflict-resolution rules to session mapping objects.

 Conflict resolution algorithms are difficult and any algorithm will
 have DWIM-y tradeoffs, so it's useful to keep it as simple as possible.

Or no more complex as is actually helpful ;-)

 ...

[Dennis Allison]
 I have yet to figure out how to map a TransientObject state back
 to the object it represents, but it clearly is possible.

I didn't see a response to that bit yet, so:  the state of an object P is
whatever P.__getstate__() returns.  Given such a return value `state`, and
some object Q of the same type as P, Q.__setstate__(state) gives Q the same
state P had.  What state means is entirely up to the type's __setstate__()
and __getstate__() implementations (if any).  Objects deriving from
Persistent inherit (by default) implementations that retrieve and update an
instance's __dict__.  BTrees.Length is a good example of a class that
overrides these methods, using an integer as the state.

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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: sessions in the presence of conflicts

2005-12-15 Thread Dennis Allison
Zope 2.8.4, ZODB 3.4.2

Chris,

I'm pretty sure that I mentioned having done that in one of my postings.
I have followed your recommendations, but the problem remains. (um... 
persists grin)

The systems are running a Zope/ZEO combination with a store configuration 
of:

# 
 zodb_db temporary
 # Temporary storage database (for sessions)
 temporarystorage
   name temporary storage for sessioning
 /temporarystorage
 mount-point /temp_folder
 container-class Products.TemporaryFolder.TemporaryContainer
 /zodb_db
# 
# ZEO client storage:
#
zodb_db main
  mount-point /
  # ZODB cache, in number of objects
  cache-size 5000
  zeoclient
server 192.168.0.92:8301
storage 1
var $INSTANCE/var
# ZEO client cache, in bytes
cache-size 20MB
# Uncomment to have a persistent disk cache
client group1-zeo
  /zeoclient
/zodb_db
#

Although the connection to ZEO is via a network port, it runs on the same 
physical hardware.

TemporaryStorage is not transactional.  Does it need to be under MVCC?  

TemporaryStorage does provide a conflict cache to do rudimentary conflict
resolution.  There are several timing and scaling parameters that need to
be considered:

CONFLICT_CACHE_MAXAGE = 60  (seconds)
CONFLICT_CACHE_GCEVERY = 60 (seconds)
RECENTLY_GC_OIDS_LEN = 200

Entries in the recently gc's oids list are those which may be resolvable
by a retry.

These numbers may be too small given the loads we see and the number of 
accesses made to the session variables.  I plan to incrase them to see
if there is any impact.


MAYBE CONFLICTS AND THEIR RESOLUTION ARE NOT THE ROOT CAUSE OF THE SESSION
VARIABLE PROBLEM.  The observed problem is that session variables suddenly
disappear.  At the point of failure due to a KeyError, inspecting the 
SESSION object shows two failure modes:  either all the session variables 
are gone and only the container remains or most of the session variables 
are gone and a few remain.

74769573A2H7SIH2AKo=id: 11343269231636975299, token: 74769573A2H7SIH2AKo, 
contents keys: ['currentTab', 'calendarPage', 'currentCourse', 
'currentTextbook']

and 

77307574A2HTTdXCYYg=id: 11343267811075063138, token: 77307574A2HTTdXCYYg, 
contents keys: []

Access to the session variables are almost alwsys through a pair of 
Scripts(Python).  Occasionally a session variable is read with an 
expression of the form REQUEST['SESSION']['key'].

## Script (Python) getSessionVariable
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=varname
##title=
##
request=container.REQUEST
session=request['SESSION']
return session[varname]

# Script (Python) setSessionVariable
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=var, val
##title=
##
request = container.REQUEST
RESPONSE =  request.RESPONSE
session=request['SESSION']
session[var]=val
request.set( 'SESSION', session )

This all seems right to me.  Any suggestions as to how to localized when 
the session variables get lost?  That might help localize the root cause.

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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: sessions in the presence of conflicts

2005-12-15 Thread Chris McDonough

Trimmed zodb-dev off the cc list.

On Dec 15, 2005, at 2:24 PM, Dennis Allison wrote:

The systems are running a Zope/ZEO combination with a store  
configuration

of:

#
 zodb_db temporary
 # Temporary storage database (for sessions)
 temporarystorage
   name temporary storage for sessioning
 /temporarystorage
 mount-point /temp_folder
 container-class Products.TemporaryFolder.TemporaryContainer
 /zodb_db


OK, that's good.  Having a nonzeo session database is a good thing.




Although the connection to ZEO is via a network port, it runs on  
the same

physical hardware.

TemporaryStorage is not transactional.  Does it need to be under MVCC?


I thought we sewed this one up. ;-)  It is indeed transactional.  See  
our email conversations around 11/15/2005 and beyond.




TemporaryStorage does provide a conflict cache to do rudimentary  
conflict
resolution.  There are several timing and scaling parameters that  
need to

be considered:

CONFLICT_CACHE_MAXAGE = 60  (seconds)
CONFLICT_CACHE_GCEVERY = 60 (seconds)
RECENTLY_GC_OIDS_LEN = 200

Entries in the recently gc's oids list are those which may be  
resolvable

by a retry.

These numbers may be too small given the loads we see and the  
number of

accesses made to the session variables.  I plan to incrase them to see
if there is any impact.


That's fine.


MAYBE CONFLICTS AND THEIR RESOLUTION ARE NOT THE ROOT CAUSE OF THE  
SESSION

VARIABLE PROBLEM.


That's possible.



either all the session variables
are gone and only the container remains or most of the session  
variables

are gone and a few remain.


The former sounds like the session may have expired.  The second  
sounds like it could be due to conflict resolution.  You don't say  
where the KeyError is raised from, that's important.




74769573A2H7SIH2AKo=id: 11343269231636975299, token:  
74769573A2H7SIH2AKo,

contents keys: ['currentTab', 'calendarPage', 'currentCourse',
'currentTextbook']

and

77307574A2HTTdXCYYg=id: 11343267811075063138, token:  
77307574A2HTTdXCYYg,

contents keys: []


Note that these are actually two different session objects (see the  
token).  I don't know if this is meaningful.




Access to the session variables are almost alwsys through a pair of
Scripts(Python).  Occasionally a session variable is read with an
expression of the form REQUEST['SESSION']['key'].

## Script (Python) getSessionVariable
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=varname
##title=
##
request=container.REQUEST
session=request['SESSION']
return session[varname]



How about session.get('varname') instead?  What happens when the  
session expires?  Do you deal with that in your code in some way?




# Script (Python) setSessionVariable
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=var, val
##title=
##
request = container.REQUEST
RESPONSE =  request.RESPONSE
session=request['SESSION']
session[var]=val
request.set( 'SESSION', session )

This all seems right to me.  Any suggestions as to how to localized  
when
the session variables get lost?  That might help localize the root  
cause.




What is request.set('SESSION', session) supposed to do?  Whatever  
it's supposed to be doing is probably not what you think it's doing.   
I actually don't know quite what the impact of doing that would be;  
it would depend on your other code.  Remove that, it can't do  
anything good. ;-)  If you're trying to make sure the session is re- 
stored in the ZODB, you needn't.  You only need to do this for  
mutable variables *in* the session, eg.:


request.SESSION['a'] = {}
a = request.SESSION['a']
a['b'] = 'c'
# here it comes
request.SESSION['a'] = a

I also enumerated other knobs to you in previous emails that could  
help reduce sessioning conflicts (like turning off inband  
housekeeping -- see the Transience.py code for that -- and bumping up  
transient object container timeout resolution via session-timeout- 
resolution in zope.conf in your current config).  Those are the  
things I meant when I said that you hadn't told us whether you had  
taken steps based on recommendations.  I won't enumerate them here  
again here as it should be reasonably easy to go look in the archives  
or your mail history for those recommendations.  I'd suggest trying  
these recommendations before playing around with conflict resolution  
code.  Dunny also suggested trying to mess with the WRITEGRANULIARITY  
in TransientObject.py, FWIW.


- C



___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] buildbot failure in Zope branches 2.9 2.4 Windows 2000 zc-bbwin

2005-12-15 Thread buildbot
The Buildbot has detected a failed build of Zope branches 2.9 2.4 Windows 2000 
zc-bbwin.

Buildbot URL: http://buildbot.zope.org/

Build Reason: changes
Build Source Stamp: 2241
Blamelist: ctheune,jim,tim_one,tseaver,yuppie

BUILD FAILED: failed test

sincerely,
 -The Buildbot

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] FTP Upload killing Zope

2005-12-15 Thread Sidnei da Silva
I would like to merge this patch to all the branches back to Zope 2.7,
anyone would care to review or is against it?

http://www.zope.org/Collectors/Zope/1976

-- 
Sidnei da Silva
Enfold Systems, LLC.
http://enfoldsystems.com
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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: sessions in the presence of conflicts

2005-12-15 Thread Michael Dunstan
On 12/16/05, Dennis Allison [EMAIL PROTECTED] wrote:
 MAYBE CONFLICTS AND THEIR RESOLUTION ARE NOT THE ROOT CAUSE OF THE SESSION
 VARIABLE PROBLEM.  The observed problem is that session variables suddenly
 disappear.

Perhaps your app is tripping over some bug in conflict handling. But
I'd say it is worth entertain other ideas too. For now, just comment
out all of TransientObject._p_resolveConflict and if you still get
errors then you know you have to look elsewhere.

(Sure, some of that elsewhere may well include the conflict resolution
code above _p_resolveConflict.)

Your application and sessions should cope just fine in the face of any
ConflictError. ConflictError's are an essential part of the machinery
that keeps data state consistent.

As Chris mentions, look at how your using sessions and some of the
assumptions you might be making. Might be useful to try with sessions
that don't timeout, set session-timeout-minutes to 0. And try
maximum-number-of-session-objects of 0. Also trying the turning those
knobs the other way, session-timeout-minutes of 1 and
maximum-number-of-session-objects of 2.

For now, stay focused on making sure you maintain a consistent state.
Only once you have a consistent state then is it worth trying to
improve the rate of ConflictErrors. (Which in your case of sessions
lasting for many hours I think the numbers you quote elsewhere are too
small. And, yeah, an alternative implementation for _p_resolveConflict
might help there. Personally I prefer the simple approach of just
commenting that out completely and living with a slightly higher
conflict count.)

Might be worth trying without ZEO in the mix.

Definitely worth the effort, if you have not already, to recreate the
whole system on a separate host that you can feel comfortable making
changes to. Then you can happily tune the various knobs downwards
which may help with trying to observe the problem. For example
session-timeout-minutes of 1.

cheers
michael
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] FTP Upload killing Zope

2005-12-15 Thread Chris McDonough

Looks good!

On Dec 15, 2005, at 4:47 PM, Sidnei da Silva wrote:


I would like to merge this patch to all the branches back to Zope 2.7,
anyone would care to review or is against it?

http://www.zope.org/Collectors/Zope/1976

--
Sidnei da Silva
Enfold Systems, LLC.
http://enfoldsystems.com
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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  -  Zope-Dev@zope.org
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] FTP Upload killing Zope

2005-12-15 Thread Andreas Jung
I would like to consider the 2.7 branch closed for any kind of fixes except 
security related fixes. I don't plan any further 2.7 releases.


-aj

--On 15. Dezember 2005 21:53:38 -0500 Chris McDonough [EMAIL PROTECTED] 
wrote:



Looks good!

On Dec 15, 2005, at 4:47 PM, Sidnei da Silva wrote:


I would like to merge this patch to all the branches back to Zope 2.7,
anyone would care to review or is against it?

http://www.zope.org/Collectors/Zope/1976

--
Sidnei da Silva
Enfold Systems, LLC.
http://enfoldsystems.com
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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  -  Zope-Dev@zope.org
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 )






pgppyaMb5KeBx.pgp
Description: PGP signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Re: Programmatically flushing entries from RAM cache?

2005-12-15 Thread Florent Guillaume

John Barham wrote:

Is it possible to flush a path w/ a specific argument from a RAM cache
from a Python script?

Here's my situation:  I have a script FolderExists() that takes a
single path argument and, after running an SQL query, returns True
or False if the folder path exists or not in the database.  Since the
database query is relatively expensive, I want to cache its result in
RAM.  However, if a folder is created (using another Python script in
the same Zope instance) I want to flush the cached result for the path
(i.e., I don't want to flush all of the cached entries for the
FolderExists method if that can be avoided).


Unfortunately no, it's a deficiency of the simple RAMCacheManager: you can't 
invalidate a key individually, you have to invalidate them all. Changing 
this is probably not too complex, and is (low) on my TODO list (at position 
approx. 136 ;)).


Florent

--
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of RD
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]
___
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] Stepper 1.4.1 Released!

2005-12-15 Thread Chris Withers

Stepper is a framework for performing asynchronous tasks on Zope servers.

This is a bug fix release that corrects some problems with the 1.4.0 
release.


The major bugs fixed for this release were:

- Write conflict errors are now handled in the same way as read conflict
  errors.

- Stepper is no longer left locked if a conflict error occurs.

- Nothing is now logged to the console in quiet mode, even with
  Zope 2.8.

Several other small bugs were also fixed.

For more information, please see: 
http://www.simplistix.co.uk/software/zope/stepper


cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk








___
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] Zope 2.8.4+Latest cygwin installation

2005-12-15 Thread Pascal Peregrina
Hi,

I would like to know if anyone has been able to compile and run Zope
2.8.4 with Cygwin.

I just installed cygwin with latest stable packages.

I compiled python 2.4.2 (I know, not the supported version, so I am
about to try 2.3.5 now)
I had issues with the socket module, and from google I applied a
workaround that worked fine :
in Modules/socketmodule.c
Change :
#if defined(__sgi)  !defined(INET_ADDRSTRLEN)
#define INET_ADDRSTRLEN 16
#endif
To :
/*#if defined(__sgi)  !defined(INET_ADDRSTRLEN)*/
#define INET_ADDRSTRLEN 16
/*#endif*/

I made several python tests and all looks fine.

Then I compiled Zope 2.8.4 without any issue.

But when I run it, I get this error:

Site Error
An error was encountered while publishing this resource. 

exceptions.TypeError

Sorry, a site error occurred.

Traceback (innermost last): 

Module ZPublisher.Publish, line 187, in publish_module_standard 
Module Products.Localizer, line 58, in new_publish 
Module ZPublisher.Publish, line 144, in publish 
Module Zope2.App.startup, line 174, in zpublisher_exception_hook 
Module App.ZApplication, line 60, in __bobo_traverse__ 
Module UserDict, line 17, in __getitem__ 
Module ZODB.Connection, line 704, in setstate 
Module ZODB.Connection, line 760, in _setstate 
Module ZODB.serialize, line 495, in setGhostState 
Module ZODB.serialize, line 488, in getState 
Module ZODB.serialize, line 436, in _persistent_load 
Module ZODB.Connection, line 208, in get 
Module ZODB.serialize, line 482, in getGhost 
TypeError: Acquirer.__new__(Application) is not safe, use
Persistence.Persistent.__new__()

Does anyone know what I can do ?

Thanks a lot.

Pascal


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.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.8.4+Latest cygwin installation

2005-12-15 Thread Pascal Peregrina
Ok, just found it has already been reported several months ago, even with 
python 2.3.x: 
http://www.zope.org/Collectors/Zope/1725

Does someone know of any kind of temporary workaround for this ?

Thanks !

Pascal

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Pascal Peregrina
Envoyé : jeudi 15 décembre 2005 12:25
À : zope@zope.org
Objet : [Zope] Zope 2.8.4+Latest cygwin installation

Hi,

I would like to know if anyone has been able to compile and run Zope
2.8.4 with Cygwin.

I just installed cygwin with latest stable packages.

I compiled python 2.4.2 (I know, not the supported version, so I am
about to try 2.3.5 now)
I had issues with the socket module, and from google I applied a
workaround that worked fine :
in Modules/socketmodule.c
Change :
#if defined(__sgi)  !defined(INET_ADDRSTRLEN)
#define INET_ADDRSTRLEN 16
#endif
To :
/*#if defined(__sgi)  !defined(INET_ADDRSTRLEN)*/
#define INET_ADDRSTRLEN 16
/*#endif*/

I made several python tests and all looks fine.

Then I compiled Zope 2.8.4 without any issue.

But when I run it, I get this error:

Site Error
An error was encountered while publishing this resource. 

exceptions.TypeError

Sorry, a site error occurred.

Traceback (innermost last): 

Module ZPublisher.Publish, line 187, in publish_module_standard 
Module Products.Localizer, line 58, in new_publish 
Module ZPublisher.Publish, line 144, in publish 
Module Zope2.App.startup, line 174, in zpublisher_exception_hook 
Module App.ZApplication, line 60, in __bobo_traverse__ 
Module UserDict, line 17, in __getitem__ 
Module ZODB.Connection, line 704, in setstate 
Module ZODB.Connection, line 760, in _setstate 
Module ZODB.serialize, line 495, in setGhostState 
Module ZODB.serialize, line 488, in getState 
Module ZODB.serialize, line 436, in _persistent_load 
Module ZODB.Connection, line 208, in get 
Module ZODB.serialize, line 482, in getGhost 
TypeError: Acquirer.__new__(Application) is not safe, use
Persistence.Persistent.__new__()

Does anyone know what I can do ?

Thanks a lot.

Pascal


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.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 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] batching help

2005-12-15 Thread Nicolas Georgakopoulos
Hello all , I'm trying to display on the same page a table with (3 
columns) with content from a list . I'm trying to batch the results so 
that every 3 elements anothe row is created.

Can anyone give me a clue how to do that ?

this is my code:


table tal:define=Rnumber 
python:context.cm1.content.specialfile.getList('link_list') ; batch 
python:modules['ZTUtils'].Batch(Rnumber,size=3,start=0)

   th colspan=3Main Title/th
   trthTitle 1/ththTitle 2/ththTitle 3/th/tr
   tr
   td tal:repeat=num batch
   span tal:condition=python:num  3 
tal:replace=structure num content goes here.. /span

   /td
   /tr
 !--  tr

   td tal:repeat=num batch
   span tal:replace=structure num 
Material goes here /span

   /td
   /tr --  
   /table

___
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] batching help

2005-12-15 Thread Dragos Chirila

Hi

I suggest to use the following function that

def get_grouped_list(self, seq=[], size=3):
#get the list with all items grouped
return [seq[i:i+size] for i in range(0, len(seq), size)]

that takes as parameter a list and goups items in slices with length = size.

 def get_grouped_list(seq=[], size=3):
... return [seq[i:i+size] for i in range(0, len(seq), size)]
...
 l = [1,2,3,4,5,6,7,8]
 get_grouped_list(l)
[[1, 2, 3], [4, 5, 6], [7, 8]]
 get_grouped_list(l, 4)
[[1, 2, 3, 4], [5, 6, 7, 8]]


Then iterating this is something like:

tr tal:repeat=slice python:someobject.get_grouped_list(yourlist)
td tal:repeat=item slice
span tal:replace=item /
/td
/tr


Hope this will help.
Dragos


Nicolas Georgakopoulos wrote:
Hello all , I'm trying to display on the same page a table with (3 
columns) with content from a list . I'm trying to batch the results so 
that every 3 elements anothe row is created.

Can anyone give me a clue how to do that ?

this is my code:


table tal:define=Rnumber 
python:context.cm1.content.specialfile.getList('link_list') ; batch 
python:modules['ZTUtils'].Batch(Rnumber,size=3,start=0)

   th colspan=3Main Title/th
   trthTitle 1/ththTitle 2/ththTitle 3/th/tr
   tr
   td tal:repeat=num batch
   span tal:condition=python:num  3 
tal:replace=structure num content goes here.. /span

   /td
   /tr !--  tr
   td tal:repeat=num batch
   span tal:replace=structure num 
Material goes here /span

   /td
   /tr 
-- /table

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




--
Dragos Chirila
Programmer, Finsiel Romania (http://www.finsiel.ro)
44A, Ficusului St. - 013975 Bucharest
Tel: +40 21 2320193, Fax: +40 21 2329807
Jabber: [EMAIL PROTECTED]
___
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] Unauthorized exception when trying to access a list item

2005-12-15 Thread Jonathan


- Original Message - 
From: Cameron Beattie [EMAIL PROTECTED]

To: zope@zope.org
Sent: Thursday, December 15, 2005 1:25 AM
Subject: Re: [Zope] Unauthorized exception when trying to access a list item





Cameron Beattie wrote:

I am trying to access a value in a list. The script getDIDS_list is 
passed a list called listoflists:

list = listoflists
ret = []
tup = (0,1,2)
factortup = (1,2)
factor = 2
for i in range(len(list)):
#   1 == 1
 if i in tup:
   if i in factortup:
  x = list[i] * factor
etc

The code is a bit strange due to my testing. However zope gets upset 
when trying to evaluate list[i]:


You are not allowed to access '1' in this context

Whats in your list?  A protected item?  Does this happen everytime or 
just with '1'?

David

The list consists of something like this: [61282125371L, 1, 6, 0]. It 
happens whatever element I try to access.


I tried the following test script:

list = [61282125371L, 1, 6, 0]
ret = []
tup = (0,1,2)
factortup = (1,2)
factor = 2
for i in range(len(list)):
if i in tup:
  if i in factortup:
 x = list[i] * factor
 print x

return printed


and it returned:

2
12

No errors, so it must be something else.


Jonathan


___
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] Trapping zope exceptions in python script

2005-12-15 Thread Andreas Jung



--On 15. Dezember 2005 08:03:22 -0500 Jonathan [EMAIL PROTECTED] wrote:



- Original Message - From: J Cameron Cooper



It seems strange that one can, using plain vanilla python scripts,  trap
bare 'try/excepts' (and I agree with Andreas that this is not a good
thing to do!) and that one can trap python built-in exceptions, but that
one cannot trap zope exceptions.  Why allow python scripts to trap zope
exceptions using a bare try/except (and then have to re-raise everything
except the target zope exception), but not allow python scripts to target
specific zope exceptions?  I don't see the reasoning behind this approach.

My 2 cents: PythonScripts are restricted and are *not* thought to be a full 
replacement for Python modules. If you need this functionaltiy consider 
writing a Zope Product, using external methods or using TrustedExecutables.


-aj

pgpQyEjsXil5w.pgp
Description: PGP signature
___
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] Trapping zope exceptions in python script

2005-12-15 Thread Tino Wildenhain

Jonathan schrieb:



...
It seems strange that one can, using plain vanilla python scripts,  trap 
bare 'try/excepts' (and I agree with Andreas that this is not a good 
thing to do!) and that one can trap python built-in exceptions, but that 
one cannot trap zope exceptions.  Why allow python scripts to trap zope 
exceptions using a bare try/except (and then have to re-raise everything 
except the target zope exception), but not allow python scripts to 
target specific zope exceptions?  I don't see the reasoning behind this 
approach.


Well you can trap any exception which happens between your
try and except. But not outside of these, of course.
This is true everywhere (not even python only ;)

Which exceptions do you believe you might be not able
to catch?

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Trying zope on Linux

2005-12-15 Thread Allen Huang
I'm trying zope on linux but I have come a cross a problem.I windows, I simply changedthe portnumber from 8080 to 80 inzope.conf so I could get to my site without typeing the port.But in Linux, I did the same thing but it always tells me that some other server already occupied this port. (and I just started too, so there shouldn't be any server. right??)I'm now trying to figure out what server to close but with no luck at all.. can someone help me so I can display my site on port 80?
	
		Yahoo! Shopping 
Find Great Deals on Holiday Gifts at Yahoo! Shopping ___
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] Trying zope on Linux

2005-12-15 Thread Andreas Jung



--On 15. Dezember 2005 05:20:33 -0800 Allen Huang [EMAIL PROTECTED] wrote:


I'm trying zope on linux but I have come a cross a problem.

  I windows, I simply changed the port number from 8080 to 80 in
zope.conf  so I could get to my site without typeing the port.
  But in Linux, I did the same thing but it always tells me that some
other server already occupied this port. (and I just started too, so
there shouldn't be any server. right??)
  I'm now trying to figure out what server to close but with no luck at
all..
  can someone help me so I can display my site on port 80?



The recommended way is to run Zope on some unpriveledged port and use 
Virtual hosting with Apache or Squid. CHeck the Virtual Hosting chapter of 
the Zope Book for details.


-aj



pgpBKX4UPFZtr.pgp
Description: PGP signature
___
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] Trapping zope exceptions in python script

2005-12-15 Thread Jonathan


- Original Message - 
From: Tino Wildenhain [EMAIL PROTECTED]

To: Jonathan [EMAIL PROTECTED]
Cc: zope@zope.org
Sent: Thursday, December 15, 2005 8:18 AM
Subject: Re: [Zope] Trapping zope exceptions in python script



Jonathan schrieb:



...
It seems strange that one can, using plain vanilla python scripts,  trap 
bare 'try/excepts' (and I agree with Andreas that this is not a good 
thing to do!) and that one can trap python built-in exceptions, but that 
one cannot trap zope exceptions.  Why allow python scripts to trap zope 
exceptions using a bare try/except (and then have to re-raise everything 
except the target zope exception), but not allow python scripts to target 
specific zope exceptions?  I don't see the reasoning behind this 
approach.


Well you can trap any exception which happens between your
try and except. But not outside of these, of course.
This is true everywhere (not even python only ;)

Which exceptions do you believe you might be not able
to catch?


I encountered this situation while trying to trap 'BadRequest'.

Jonathan 



___
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] Trying zope on Linux

2005-12-15 Thread Tino Wildenhain

Allen Huang schrieb:


I'm trying zope on linux but I have come a cross a problem.
 
I windows, I simply changed the port number from 8080 to 80 
in zope.conf  so I could get to my site without typeing the port.
 
But in Linux, I did the same thing but it always tells me that some 
other server already occupied this port. (and I just started too, so 
there shouldn't be any server. right??)
 
I'm now trying to figure out what server to close but with no luck at all..
 
can someone help me so I can display my site on port 80?




You can basically do the same in Linux. You need to start
zope as root (it switches to nobody or your configured user
from zope.conf) to be able to bind port 80 - and you
have to make sure no other program currently binds there
(as apache or the like)

netstat -lntp  should tell you.

Recommended, however (even more for productive sites)
is at least a simple apache running in front of zope
and zope using unprivilegued port (1024) and
possibly non privilegued user even on start.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


RE: [Zope] Zope 2.8.4+Latest cygwin installation

2005-12-15 Thread Pascal Peregrina
Ok, in case anyone is interested, this nasty code change made it :

In Zope-2.8.4-final/lib/python/ZODB/serialize.py:

Change :
return klass.__new__(klass, *args)

To :
try:
result=klass.__new__(klass, *args)
except TypeError:
result=Persistent.__new__(klass, *args)

return result

Pascal

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Pascal Peregrina
Envoyé : jeudi 15 décembre 2005 12:51
À : zope@zope.org
Objet : RE: [Zope] Zope 2.8.4+Latest cygwin installation

Ok, just found it has already been reported several months ago, even with 
python 2.3.x: 
http://www.zope.org/Collectors/Zope/1725

Does someone know of any kind of temporary workaround for this ?

Thanks !

Pascal

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Pascal Peregrina
Envoyé : jeudi 15 décembre 2005 12:25
À : zope@zope.org
Objet : [Zope] Zope 2.8.4+Latest cygwin installation

Hi,

I would like to know if anyone has been able to compile and run Zope
2.8.4 with Cygwin.

I just installed cygwin with latest stable packages.

I compiled python 2.4.2 (I know, not the supported version, so I am
about to try 2.3.5 now)
I had issues with the socket module, and from google I applied a
workaround that worked fine :
in Modules/socketmodule.c
Change :
#if defined(__sgi)  !defined(INET_ADDRSTRLEN)
#define INET_ADDRSTRLEN 16
#endif
To :
/*#if defined(__sgi)  !defined(INET_ADDRSTRLEN)*/
#define INET_ADDRSTRLEN 16
/*#endif*/

I made several python tests and all looks fine.

Then I compiled Zope 2.8.4 without any issue.

But when I run it, I get this error:

Site Error
An error was encountered while publishing this resource. 

exceptions.TypeError

Sorry, a site error occurred.

Traceback (innermost last): 

Module ZPublisher.Publish, line 187, in publish_module_standard 
Module Products.Localizer, line 58, in new_publish 
Module ZPublisher.Publish, line 144, in publish 
Module Zope2.App.startup, line 174, in zpublisher_exception_hook 
Module App.ZApplication, line 60, in __bobo_traverse__ 
Module UserDict, line 17, in __getitem__ 
Module ZODB.Connection, line 704, in setstate 
Module ZODB.Connection, line 760, in _setstate 
Module ZODB.serialize, line 495, in setGhostState 
Module ZODB.serialize, line 488, in getState 
Module ZODB.serialize, line 436, in _persistent_load 
Module ZODB.Connection, line 208, in get 
Module ZODB.serialize, line 482, in getGhost 
TypeError: Acquirer.__new__(Application) is not safe, use
Persistence.Persistent.__new__()

Does anyone know what I can do ?

Thanks a lot.

Pascal


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.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 maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Trapping zope exceptions in python script

2005-12-15 Thread Jonathan

Andreas wrote:



My 2 cents: PythonScripts are restricted and are *not* thought to be a full
replacement for Python modules. If you need this functionaltiy consider
writing a Zope Product, using external methods or using TrustedExecutables.




If python scripts are restricted from accessing zExceptions (for security 
reasons???) then why allow python scripts to trap zExceptions in bare 
try/excepts?  If the logic for not allowing zExceptions in plain vanilla 
python scripts is for security reasons, then allowing bare try/excepts would 
seem to be a security hole (though, I don't see the rationale for this).


My 2 cents.

Jonathan


___
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] batching help

2005-12-15 Thread Nicolas Georgakopoulos

Dragos Chirila wrote:


Hi

I suggest to use the following function that

def get_grouped_list(self, seq=[], size=3):
#get the list with all items grouped
return [seq[i:i+size] for i in range(0, len(seq), size)]

that takes as parameter a list and goups items in slices with length = 
size.


 def get_grouped_list(seq=[], size=3):
... return [seq[i:i+size] for i in range(0, len(seq), size)]
...
 l = [1,2,3,4,5,6,7,8]
 get_grouped_list(l)
[[1, 2, 3], [4, 5, 6], [7, 8]]
 get_grouped_list(l, 4)
[[1, 2, 3, 4], [5, 6, 7, 8]]


Then iterating this is something like:

tr tal:repeat=slice python:someobject.get_grouped_list(yourlist)
td tal:repeat=item slice
span tal:replace=item /
/td
/tr


Hope this will help.
Dragos


Nicolas Georgakopoulos wrote:

Hello all , I'm trying to display on the same page a table with (3 
columns) with content from a list . I'm trying to batch the results 
so that every 3 elements anothe row is created.

Can anyone give me a clue how to do that ?

this is my code:


table tal:define=Rnumber 
python:context.cm1.content.specialfile.getList('link_list') ; batch 
python:modules['ZTUtils'].Batch(Rnumber,size=3,start=0)

   th colspan=3Main Title/th
   trthTitle 1/ththTitle 2/ththTitle 3/th/tr
   tr
   td tal:repeat=num batch
   span tal:condition=python:num  3 
tal:replace=structure num content goes here.. /span

   /td
   /tr !--  tr
   td tal:repeat=num batch
   span tal:replace=structure num 
Material goes here /span

   /td
   /tr 
-- /table

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




Thanks for your suggestion Dragos , I want to do it the zope batch way 
(I suppose it is simpler) if I can...

I will keep in mind your function if nothing else can be done.

Thanks again.
___
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] Trapping zope exceptions in python script

2005-12-15 Thread Tino Wildenhain

...


Try:

context.afolder.manage_delObjects(['someitem'])

where 'someitem' does not exist in 'afolder'


works:

try:
   context.afolder.manage_adlObjects(['nonexistent'])
except Exception,x:
   if 'BadRequest' in repr(x):
  print bad request
   else:
  raise x

:-)

(Ok, this _is_ ugly, but at least works. Certainly these
exception types should be importable or even immediately
available for python scripts)



___
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] Trapping zope exceptions in python script

2005-12-15 Thread Jonathan
- Original Message - 
From: Tino Wildenhain [EMAIL PROTECTED]

To: Jonathan [EMAIL PROTECTED]; zope@zope.org
Sent: Thursday, December 15, 2005 8:48 AM
Subject: Re: [Zope] Trapping zope exceptions in python script



...


Try:

context.afolder.manage_delObjects(['someitem'])

where 'someitem' does not exist in 'afolder'


works:

try:
   context.afolder.manage_adlObjects(['nonexistent'])
except Exception,x:
   if 'BadRequest' in repr(x):
  print bad request
   else:
  raise x

:-)

(Ok, this _is_ ugly, but at least works. Certainly these
exception types should be importable or even immediately
available for python scripts)



Interesting work-around, but I agree that these exception types should be 
immediately available in plain vanilla python scripts.


Jonathan 



___
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] Trapping zope exceptions in python script

2005-12-15 Thread Andreas Jung



--On 15. Dezember 2005 09:08:20 -0500 Jonathan [EMAIL PROTECTED] wrote:


- Original Message - From: Tino Wildenhain [EMAIL PROTECTED]
Interesting work-around, but I agree that these exception types should be
immediately available in plain vanilla python scripts.




Patches + tests are welcome :-)

-aj

pgp4Ivu8J9Dnz.pgp
Description: PGP signature
___
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] Trying zope on Linux

2005-12-15 Thread Robert Boyd
On 12/15/05, Allen Huang [EMAIL PROTECTED] wrote:


 I'm trying zope on linux but I have come a cross a problem.

 I windows, I simply changed the port number from 8080 to 80 in zope.conf  so
 I could get to my site without typeing the port.

 But in Linux, I did the same thing but it always tells me that some other
 server already occupied this port. (and I just started too, so there
 shouldn't be any server. right??)


You may be using a distro that starts Apache on boot. Check your init
scripts. If you want Zope running on 80, you'll need to either disable
the init script starting that other server, or configure that other
server to run on a different port if you really want that service.

That said, I agree with others about the standard way of running Zope
(unprivileged user, high port, behind Apache or other).

RB
___
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] Trapping zope exceptions in python script

2005-12-15 Thread Tino Wildenhain

Andreas Jung schrieb:



--On 15. Dezember 2005 09:08:20 -0500 Jonathan [EMAIL PROTECTED] wrote:


- Original Message - From: Tino Wildenhain [EMAIL PROTECTED]
Interesting work-around, but I agree that these exception types should be
immediately available in plain vanilla python scripts.




Patches + tests are welcome :-)



Yes, Jonathan: please file a bug report - best with a list
of Exceptions to be made available :-)

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Zope 2.8.4+Latest cygwin installation

2005-12-15 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Pascal Peregrina wrote:
 Ok, in case anyone is interested, this nasty code change made it :
 
 In Zope-2.8.4-final/lib/python/ZODB/serialize.py:
 
 Change :
 return klass.__new__(klass, *args)
 
 To :
 try:
 result=klass.__new__(klass, *args)
 except TypeError:
 result=Persistent.__new__(klass, *args)
 
 return result


I think Jim is the only one who could explain what you see.  I can't
even find the place in the code which generates that error:

$ find . -name *.py -o -name *.c | xargs grep is not safe
./RestrictedPython/RCompile.py:The UNPACK_SEQUENCE opcode is not
safe because it extracts
./zope/security/untrustedpython/builtins.py:# It's better to say
what is safe than it say what is not safe
./ZODB/tests/testmvcc.py:It is not safe, however, to read the current
revision of a because
$



 
 Pascal
 
 -Message d'origine-
 De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Pascal 
 Peregrina
 Envoyé : jeudi 15 décembre 2005 12:51
 À : zope@zope.org
 Objet : RE: [Zope] Zope 2.8.4+Latest cygwin installation
 
 Ok, just found it has already been reported several months ago, even with 
 python 2.3.x: 
 http://www.zope.org/Collectors/Zope/1725
 
 Does someone know of any kind of temporary workaround for this ?
 
 Thanks !
 
 Pascal
 
 -Message d'origine-
 De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Pascal 
 Peregrina
 Envoyé : jeudi 15 décembre 2005 12:25
 À : zope@zope.org
 Objet : [Zope] Zope 2.8.4+Latest cygwin installation
 
 Hi,
 
 I would like to know if anyone has been able to compile and run Zope
 2.8.4 with Cygwin.
 
 I just installed cygwin with latest stable packages.
 
 I compiled python 2.4.2 (I know, not the supported version, so I am
 about to try 2.3.5 now)
 I had issues with the socket module, and from google I applied a
 workaround that worked fine :
 in Modules/socketmodule.c
 Change :
 #if defined(__sgi)  !defined(INET_ADDRSTRLEN)
 #define INET_ADDRSTRLEN 16
 #endif
 To :
 /*#if defined(__sgi)  !defined(INET_ADDRSTRLEN)*/
 #define INET_ADDRSTRLEN 16
 /*#endif*/
 
 I made several python tests and all looks fine.
 
 Then I compiled Zope 2.8.4 without any issue.
 
 But when I run it, I get this error:
 
 Site Error
 An error was encountered while publishing this resource. 
 
 exceptions.TypeError
 
 Sorry, a site error occurred.
 
 Traceback (innermost last): 
 
 Module ZPublisher.Publish, line 187, in publish_module_standard 
 Module Products.Localizer, line 58, in new_publish 
 Module ZPublisher.Publish, line 144, in publish 
 Module Zope2.App.startup, line 174, in zpublisher_exception_hook 
 Module App.ZApplication, line 60, in __bobo_traverse__ 
 Module UserDict, line 17, in __getitem__ 
 Module ZODB.Connection, line 704, in setstate 
 Module ZODB.Connection, line 760, in _setstate 
 Module ZODB.serialize, line 495, in setGhostState 
 Module ZODB.serialize, line 488, in getState 
 Module ZODB.serialize, line 436, in _persistent_load 
 Module ZODB.Connection, line 208, in get 
 Module ZODB.serialize, line 482, in getGhost 
 TypeError: Acquirer.__new__(Application) is not safe, use
 Persistence.Persistent.__new__()
 
 Does anyone know what I can do ?
 
 Thanks a lot.

- --
===
Tres Seaver  +1 202-558-7113  [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDoX+I+gerLs4ltQ4RAnnCAJ93gKFJn8j/BPXK91RuuTMutLzrHACgtB56
NH2tqYHS/JPITSoVefuqkRU=
=CCbu
-END PGP SIGNATURE-

___
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] List within a list - how to use in a page template

2005-12-15 Thread Chris Withers

David H wrote:

# python script
# input:  a tuple named tup of index items to include in list of lists, 
eg (1,3) and the list of lists
#example input:  listoflists = [[61282125371L, 1, 6, 0], [61282125379L, 
1, 6, 0], [61282825240L, 6, 6, 0]]

#example tup: (1,3)

ret = []
for i in range(len(listoflists)):
 if i in tup:
   ret.append(x[i])
return ret



Hmmm, I'd hypothesise that whatever is returning that list of lists is 
what needs to change :-S


Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
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] dynamic js lists

2005-12-15 Thread Chris Withers

[EMAIL PROTECTED] wrote:

script type=text/javascript

snip js mess

/script


That looks like pure javascript, right?

In which case it's a pure js problem and this is the wrong list ;-)

Try #javascript on irc.freenode.net...

cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
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] Plone not installing on Zope

2005-12-15 Thread Qass
Hi:

I installed Zope 2.8.4 and moved all folders from the untarred Plone
2.1.1 download to the Products folder of the instance of Zope I'm
running in my home directory. I have Python 2.3.5. However, as the
Plone installation instructions mention, Plone Site does not show up
in the drop down menu of items in the ZMI. I've tried different
versions of Plone to no avail. What am I doing wrong here?

Thanks

Qass
___
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] Plone not installing on Zope

2005-12-15 Thread Andreas Jung



--On 15. Dezember 2005 09:27:11 -0600 Qass [EMAIL PROTECTED] wrote:


Hi:

I installed Zope 2.8.4 and moved all folders from the untarred Plone
2.1.1 download to the Products folder of the instance of Zope I'm
running in my home directory. I have Python 2.3.5. However, as the
Plone installation instructions mention, Plone Site does not show up
in the drop down menu of items in the ZMI. I've tried different
versions of Plone to no avail. What am I doing wrong here?



Use the plone-users mailing list (plone.org - contact).

-aj



pgpJGh9ce5sdj.pgp
Description: PGP signature
___
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: Fwd: [Zope] zopectl or runzope just won't start zope

2005-12-15 Thread Chris Withers

These sounds like Plone questions best asked on a Plone list...

Chris

Qass wrote:

Thanks for your reply fm.

The python version in my path is 2.3.5 and both
python and zope were build from source.  Zope is installed in /opt
which is where the python 2.3.5 is too.

I got rid of the zope instance I had running earlier and created a new
instance in my home directory.

Now when I run zopectl start from the /bin in the instance in my home
directory I get the following error:

. Traceback (most recent call last):
  File /opt/zope-2.8.4/lib/python/zdaemon/zdrun.py, line 719, in ?
main()
  File /opt/zope-2.8.4/lib/python/zdaemon/zdrun.py, line 716, in main
d.main(args)
  File /opt/zope-2.8.4/lib/python/zdaemon/zdrun.py, line 243, in main
self.run()
  File /opt/zope-2.8.4/lib/python/zdaemon/zdrun.py, line 256, in run
self.opensocket()
  File /opt/zope-2.8.4/lib/python/zdaemon/zdrun.py, line 278, in opensocket
sock.bind(tempname)
  File string, line 1, in bind
socket.error: (2, 'No such file or directory')

I then tried to run 'runzope' and got the following which don't look
like errors:

/home/blah/zope/Products/PortalTransforms/TransformEngine.py:18:
DeprecationWarning: The module, 'Products.CMFCore.CMFCorePermissions'
is a deprecated compatiblity alias for 'Products.CMFCore.permissions';
 please use the new module instead.
  from Products.CMFCore import CMFCorePermissions
/home/blah/zope/Products/CMFCore/utils.py:629: DeprecationWarning:
format_stx() will be removed in CMF 1.6. Please use
StructuredText.StructuredText.HTML instead.
  DeprecationWarning)
/home/sra/zope/Products/kupu/__init__.py:23: DeprecationWarning: The
Zope package has been renamed to Zope2. Import of a package named
'Zope' is deprecated and will be disabled starting in Zope 2.11.
  import Zope
/home/blah/zope/Products/CMFFormController/__init__.py:25:
DeprecationWarning: The product_name parameter of ToolInit is
deprecated and will be ignored in CMF1.6: CMFFormController
  product_name='CMFFormController', icon='tool.gif',
/home/blah/zope/Products/GroupUserFolder/__init__.py:99:
DeprecationWarning: The product_name parameter of ToolInit is
deprecated and will be ignored in CMF1.6: GroupUserFolder
  , icon=tool.gif
/home/sra/zope/Products/MimetypesRegistry/__init__.py:34:
DeprecationWarning: The product_name parameter of ToolInit is
deprecated and will be ignored in CMF1.6: MimetypesRegistry
  icon=tool.gif,
/home/blah/zope/Products/PloneLanguageTool/__init__.py:17:
DeprecationWarning: The product_name parameter of ToolInit is
deprecated and will be ignored in CMF1.6: PloneLanguageTool
  icon='tool.gif',
/home/sra/zope/Products/PortalTransforms/__init__.py:35:
DeprecationWarning: The product_name parameter of ToolInit is
deprecated and will be ignored in CMF1.6: PortalTransforms
  icon=tool.gif,
/home/blah/zope/Products/ResourceRegistries/__init__.py:20:
DeprecationWarning: The product_name parameter of ToolInit is
deprecated and will be ignored in CMF1.6: ResourceRegistries
  icon = 'tool.gif',
/home/blah/zope/Products/kupu/plone/__init__.py:31:
DeprecationWarning: The product_name parameter of ToolInit is
deprecated and will be ignored in CMF1.6: kupu
  icon=kupu_icon.gif,

I finally made it to the ZMI, moved the folders from the untarred
Plone tarball into the Products folder in the instance running in my
home directory and restart the zope instance using runzope. I expect
to see Plone Site in the drop down menu on the right but don't. I do
a Plone Language Tool. Could you help me figure out why Plone Site
won't show up.

Thank you very much for your time.

Qass

On 12/14/05, Floyd May [EMAIL PROTECTED] wrote:


First, I would recommend against changing anything in any file at this point
except configuration files.

Next, verify that the correct python version is being used.  It's easy to
have two pythons side-by-side on the same linux system.  If you built Zope
from source, you (probably) should build python from source as well.
However, if you used an installable package for Zope, I would recommend
staying with whatever version pairing of Zope/Python that your Linux
distribution has by default.  It's simpler that way, and will probably solve
your problem.  I know that I've built Zope before where it's pointed at the
wrong python version, and got things all screwed up for me.  Use `which
python` -V (those are backtics) to figure out the version that your $PATH
points to by default.

If you *are* building from source, verify that you used
--with-python=/path/to/python2.3.5 when you ran the
configure script for Zope.  The configure script should(?) tell you if
there's a problem with any module dependencies.  Again, if building Zope
from source, it's probably best that you use a python built from source as
well.

Good Luck!
fm


On 12/14/05, Qass [EMAIL PROTECTED] wrote:


Hi:

I'm new to zope and yesterday installed zope 2.8.4 on a linux system
running python 2.3.5
Having followed installation instructions I got to 

Re: [Zope] Unauthorized exception when trying to access a list item

2005-12-15 Thread Chris Withers

Cameron Beattie wrote:


The list consists of something like this: [61282125371L, 1, 6, 0]. 


Are you _sure_ this is a plain python list?

Looking at its format, and the apparently weird nature of your other 
questions, are you maybe abusing a relational database somewhere in this 
 spider's web? ;-)


Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
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] HTTP compressed response

2005-12-15 Thread Dieter Maurer
Gabriel Genellina wrote at 2005-12-12 15:45 -0300:
 ...
 def enableHTTPCompression(self,REQUEST={},force=0,disable=0,query=0):
and I think I should invoke it with REQUEST=REQUEST to enable compression 
only when the client browser can handle it.
But I dont know WHEN to do the call - should it be in (every) template used 
to generate a response?

You must call the method on any RESPONSE you want compression to be enabled.

Usually, you put it in a generally used template or macro
(e.g. main_template or standard_html_header, respectively).

-- 
Dieter
___
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] user account defined outside context of object being accessed

2005-12-15 Thread Dieter Maurer
Kees de Brabander wrote at 2005-12-13 22:40 +0100:
 ...
  Module AccessControl.ImplPython, line 449, in validate
  Module AccessControl.ImplPython, line 774, in raiseVerbose
Unauthorized: Your user account is defined outside the context of the object
being accessed.  Access to 'f1_index' of (Folder at /f1), acquired through
(Folder at /f1/f11/f111), denied. Your user account, user1, exists at
/f1/f11/acl_users. Access requires one of the following roles:
['Authenticated', 'Manager', 'Owner', 'student'].

A user defined in /f1/f11/acl_users tries to access the protected
/f1/f1_index. This is not allowed by Zope security system:
a user defined in a user folder can only access protected objects
governed by this user folder.

In your case, all objects at or below /f1/f11 is governed by
your user folder (/f1/f11/acl_users). /f1/f1_index does not lie
within this hierarchy and is therefore not governed.

-- 
Dieter
___
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] XML-RPC within ZOPE

2005-12-15 Thread Dieter Maurer
Jan-Ole Esleben wrote at 2005-12-11 19:10 +0100:
Is it at all impossible to use XML-RPC _within_ a ZOPE architecture?

In principle yes.

Be careful however: it is easy to introduce deadlocks!

  When during request processing you call back into the same
  Zope via XML-RPC, the calling out request will not complete
  until the XML-RPC returns a result (this always holds for
  calls, XML-RPC or other, to an external or internal server).

  Zope has a limited amount of workers (the default is 4) able
  to execute requests. If there are no free workers, requests
  have to wait for one.

  Now imagine that as many requests arrive as there are workers
  and each of them wants to perform an XML-RPC against the
  same Zope. Then you have a deadlock: none of the XML-RPC requests
  will finish, because there are no free workers. An no worker
  will ever become free again, because each of them waits for
  its XML-RPC to finish.

Therefore, you should directly call internal resources (rather
than use XML-RPC).


-- 
Dieter
___
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] Re: [ZODB-Dev] sessions in the presence of conflicts

2005-12-15 Thread Dieter Maurer
Dennis Allison wrote at 2005-12-14 12:58 -0800:
 ...
_p_resolveConflict(self, oldState, savedState, newState) 

returns the state of the object after resolving different changes.  The 
arguments are:

   oldState   -- state of the object at the beginning of the current 
transaction (mutable)
   savedState -- state currently stored in the database.  This state 
 was written after oldState and reflect changes made
 by a transaction that committed before the current
 transaction (immutable)
   newState   -- state after changes made by the current transaction 
(immutable)
 ...
It seems to me that we can do much better for sessions because we know a
bit about the semantics of sessions.  A session object is a
dictionary-like object mapping key-value pairs.  Adding or deleting keys
or changing the value associated with a key are independent operations and
do not conflict unless the keys are duplicated in both the transactions.  
Any conflict resolution mechanism needs to be able to manage multiple keys
independently since the session object is modified as a unit.   In 
addition, new keys may be added and old keys deleted; any conflict 
resolution mechanism at the key level needs to be comprehend those 
operations.

A more session-friendly conflict resolution might use:

   1.  if any of the states are invalid (that is, has a key '_invalid')
   return the invalid state.

   2.  if any any of the states attributes ['token','id','_created']
   differ then there is a conflict, raise the conflict exception. 

   3.  order the newState and savedState by modification time (or if that
   cannot be computed, by access time).   

newState is always after savedState (saveState represents
a formerly committed state, newState the current state the
commit of which failed).

   4.  any key appearing in oldState's dictionary but not appearing in 
   both savedState and newState should be removed from all.  This 
   corresponds to a key-value pair being deleted in one of the 
   transactions.  Insertions will be managed automatically by 
   the updates.

That looks doubtful: It means, if any of the transactions deletes
the key, then it should be removed. You favour deletion a bit.

   5.  beginning with the oldest, update oldState dictionary of key-value 
   pairs using the dictionary part of newState and savedState.  Return 
   oldState.
 ...

-- 
Dieter
___
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] Trapping zope exceptions in python script

2005-12-15 Thread J Cameron Cooper

Jonathan wrote:

Andreas wrote:




My 2 cents: PythonScripts are restricted and are *not* thought to be a full
replacement for Python modules. If you need this functionaltiy consider
writing a Zope Product, using external methods or using TrustedExecutables.





If python scripts are restricted from accessing zExceptions (for 
security reasons???) then why allow python scripts to trap zExceptions 
in bare try/excepts?  If the logic for not allowing zExceptions in plain 
vanilla python scripts is for security reasons, then allowing bare 
try/excepts would seem to be a security hole (though, I don't see the 
rationale for this).


I would imagine that not allowing these exceptions to be imported in 
trusted code is simply an oversight. The mechanism involved is not a 
you may not import this type of thing, but rather a you may import 
this statement. It is easy to miss safe but rarely used pieces.


If you have a list of exceptions you would like to have available, go 
and file a bug report. A patch would be even better.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

Enfold Systems, LLC
http://www.enfoldsystems.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] batching help

2005-12-15 Thread J Cameron Cooper

Nicolas Georgakopoulos wrote:

Dragos Chirila wrote:


Hi

I suggest to use the following function that

def get_grouped_list(self, seq=[], size=3):
#get the list with all items grouped
return [seq[i:i+size] for i in range(0, len(seq), size)]

that takes as parameter a list and goups items in slices with length = 
size.


 def get_grouped_list(seq=[], size=3):
... return [seq[i:i+size] for i in range(0, len(seq), size)]
...
 l = [1,2,3,4,5,6,7,8]
 get_grouped_list(l)
[[1, 2, 3], [4, 5, 6], [7, 8]]
 get_grouped_list(l, 4)
[[1, 2, 3, 4], [5, 6, 7, 8]]


Then iterating this is something like:

tr tal:repeat=slice python:someobject.get_grouped_list(yourlist)
td tal:repeat=item slice
span tal:replace=item /
/td
/tr

Nicolas Georgakopoulos wrote:

Hello all , I'm trying to display on the same page a table with (3 
columns) with content from a list . I'm trying to batch the results 
so that every 3 elements anothe row is created.

Can anyone give me a clue how to do that ?

this is my code:


table tal:define=Rnumber 
python:context.cm1.content.specialfile.getList('link_list') ; batch 
python:modules['ZTUtils'].Batch(Rnumber,size=3,start=0)

   th colspan=3Main Title/th
   trthTitle 1/ththTitle 2/ththTitle 3/th/tr
   tr
   td tal:repeat=num batch
   span tal:condition=python:num  3 
tal:replace=structure num content goes here.. /span

   /td
   /tr !--  tr
   td tal:repeat=num batch
   span tal:replace=structure num 
Material goes here /span

   /td
   /tr 
-- /table
Thanks for your suggestion Dragos , I want to do it the zope batch way 
(I suppose it is simpler) if I can...

I will keep in mind your function if nothing else can be done.


The ZTUtils batching is mostly for batching between pages. It's probably 
easier to do it in a Python script.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

Enfold Systems, LLC
http://www.enfoldsystems.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] Re: [Zope-dev] user folder question

2005-12-15 Thread Jens Vagelpohl
redirecting this to the normal zope list where it makes more sense,  
please continue there


On 15 Dec 2005, at 16:58, Chris Cole wrote:


Hey all,
I'm currently trying to setup a custom zope instance for our c.s.
department at school. Currently we run a totally linux infrastructure
with ldap authentication which we would also like to tie into zope. My
question is not how to authenticate against ldap, but I was  
wondering if

there is a way to disable the default user folder and in automagically
put an ldapuser folder  in its place on creation of a new instance.  
I'm

kinda new to zope, and I'm sure it's possible, but if someone could at
least point me in the right direction i would appreciate it.


If you're talking about instance as in installing a Zope  
$INSTANCE_HOME, then you could prepare a ZODB where you have done  
all that manually and re-use that for every instance you build out.  
If you run ZEO and they all connect to the same database there is no  
need - you switch it out once and all instances see that.


jens

___
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-dev] user folder question

2005-12-15 Thread J Cameron Cooper

On 15 Dec 2005, at 16:58, Chris Cole wrote:

I'm currently trying to setup a custom zope instance for our c.s.
department at school. Currently we run a totally linux infrastructure
with ldap authentication which we would also like to tie into zope. My
question is not how to authenticate against ldap, but I was  wondering if
there is a way to disable the default user folder and in automagically
put an ldapuser folder  in its place on creation of a new instance.  I'm
kinda new to zope, and I'm sure it's possible, but if someone could at
least point me in the right direction i would appreciate it.


If you do replace the top user folder with one that depends on an 
outside source, you better learn how to use the Emergency User. 
Because you will at some point mis-configure the LDAPUserFolder and lock 
yourself out.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

Enfold Systems, LLC
http://www.enfoldsystems.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] Re: Zope 2.8.4+Latest cygwin installation

2005-12-15 Thread Jim Fulton

I have no idea what the original symptom or situation was, so
I can't really comment.  I'll note, however, that the error
refered to in Pascal's reply results from a wart in Python's
type-definition protocols that I thought I had fixed, but maybe
I proposed fixing it and didn't get around to it. :(

More specific would be helpful. Is a custom C type involved here?

Jim

Tres Seaver wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Pascal Peregrina wrote:


Ok, in case anyone is interested, this nasty code change made it :

In Zope-2.8.4-final/lib/python/ZODB/serialize.py:

Change :
   return klass.__new__(klass, *args)

To :
   try:
   result=klass.__new__(klass, *args)
   except TypeError:
   result=Persistent.__new__(klass, *args)

   return result




I think Jim is the only one who could explain what you see.  I can't
even find the place in the code which generates that error:

$ find . -name *.py -o -name *.c | xargs grep is not safe
./RestrictedPython/RCompile.py:The UNPACK_SEQUENCE opcode is not
safe because it extracts
./zope/security/untrustedpython/builtins.py:# It's better to say
what is safe than it say what is not safe
./ZODB/tests/testmvcc.py:It is not safe, however, to read the current
revision of a because
$





Pascal

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Pascal Peregrina
Envoyé : jeudi 15 décembre 2005 12:51
À : [EMAIL PROTECTED]
Objet : RE: [Zope] Zope 2.8.4+Latest cygwin installation

Ok, just found it has already been reported several months ago, even with python 2.3.x: 
http://www.zope.org/Collectors/Zope/1725


Does someone know of any kind of temporary workaround for this ?

Thanks !

Pascal

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Pascal Peregrina
Envoyé : jeudi 15 décembre 2005 12:25
À : [EMAIL PROTECTED]
Objet : [Zope] Zope 2.8.4+Latest cygwin installation

Hi,

I would like to know if anyone has been able to compile and run Zope
2.8.4 with Cygwin.

I just installed cygwin with latest stable packages.

I compiled python 2.4.2 (I know, not the supported version, so I am
about to try 2.3.5 now)
I had issues with the socket module, and from google I applied a
workaround that worked fine :
in Modules/socketmodule.c
Change :
#if defined(__sgi)  !defined(INET_ADDRSTRLEN)
#define INET_ADDRSTRLEN 16
#endif
To :
/*#if defined(__sgi)  !defined(INET_ADDRSTRLEN)*/
#define INET_ADDRSTRLEN 16
/*#endif*/

I made several python tests and all looks fine.

Then I compiled Zope 2.8.4 without any issue.

But when I run it, I get this error:

Site Error
An error was encountered while publishing this resource. 


exceptions.TypeError

Sorry, a site error occurred.

Traceback (innermost last): 

Module ZPublisher.Publish, line 187, in publish_module_standard 
Module Products.Localizer, line 58, in new_publish 
Module ZPublisher.Publish, line 144, in publish 
Module Zope2.App.startup, line 174, in zpublisher_exception_hook 
Module App.ZApplication, line 60, in __bobo_traverse__ 
Module UserDict, line 17, in __getitem__ 
Module ZODB.Connection, line 704, in setstate 
Module ZODB.Connection, line 760, in _setstate 
Module ZODB.serialize, line 495, in setGhostState 
Module ZODB.serialize, line 488, in getState 
Module ZODB.serialize, line 436, in _persistent_load 
Module ZODB.Connection, line 208, in get 
Module ZODB.serialize, line 482, in getGhost 
TypeError: Acquirer.__new__(Application) is not safe, use

Persistence.Persistent.__new__()

Does anyone know what I can do ?

Thanks a lot.



- --
===
Tres Seaver  +1 202-558-7113  [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDoX+I+gerLs4ltQ4RAnnCAJ93gKFJn8j/BPXK91RuuTMutLzrHACgtB56
NH2tqYHS/JPITSoVefuqkRU=
=CCbu
-END PGP SIGNATURE-



--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.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 )


[Zope] à l'aide

2005-12-15 Thread adeline nombre
bonjourje suis un débutant. je veux installer zope sur la debian. mais j'ai remarqué un repertoire /usr/lib/zope. j'ai donc conclu que zope a été installé avec mon system debian. maintenant comment faire pour démarer zope. dois-je faire un start et où?  merci
		 Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
Téléchargez la version beta.___
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] user folder question

2005-12-15 Thread Chris Cole
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


Hey all,
I'm currently trying to setup a custom zope instance for our c.s.
department at school. Currently we run a totally linux infrastructure
with ldap authentication which we would also like to tie into zope. My
question is not how to authenticate against ldap, but I was wondering if
there is a way to disable the default user folder and in automagically
put an ldapuser folder  in its place on creation of a new instance. I'm
kinda new to zope, and I'm sure it's possible, but if someone could at
least point me in the right direction i would appreciate it.

- --Chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDob1SASJ6G3eRc6ARAsY6AJ0Zt52lG+zsg10QlCGB3lq3SUCswQCgu3S1
lmDaYgZV2/MgPz7foC1EaJc=
=5/ig
-END PGP SIGNATURE-
___
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] user account defined outside context of object being accessed

2005-12-15 Thread Kees de Brabander

- Original Message - 
From: Chris Withers [EMAIL PROTECTED]
To: Kees de Brabander [EMAIL PROTECTED]
Cc: zope@zope.org
Sent: Thursday, December 15, 2005 4:24 PM
Subject: Re: [Zope] user account defined outside context of object being
accessed


 Kees de Brabander wrote:
  Unauthorized: Your user account is defined outside the context of the
object
  being accessed.  Access to 'f1_index' of (Folder at /f1), acquired
through
  (Folder at /f1/f11/f111), denied. Your user account, user1, exists at
  /f1/f11/acl_users. Access requires one of the following roles:
  ['Authenticated', 'Manager', 'Owner', 'student'].

 Looks like you were inadvertantly taking advantage of a security hole in
 Zope that got plugged. That said, your example was extremely complicated.

Well, that's life ;)


 Can you come up with as simple an example as possible so that we can
 maybe help you out?

I can't make the example more simple than I did.
I guess it boils down to the fact that a user defined in a user folder
somewhere farther down along a path cannot acquire objects higher up that
path when the acquisition of the view permission of that object or its
container is disabled and the view permission granted again to specific
roles. This was possible up to zope version 2.7.3, but not anymore from
2.7.8. Somewhere in between this was changed, but I could not find an
explicit reference. I used this construction a lot of times, so I have to
restructure several applications. I guess that's life as well.
Thanks anyway, cb


___
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] à l'aide

2005-12-15 Thread Tino Wildenhain
Am Donnerstag, den 15.12.2005, 19:58 +0100 schrieb adeline nombre:
 bonjour
 je suis un débutant. je veux installer zope sur la debian. mais j'ai
 remarqué un repertoire /usr/lib/zope. j'ai donc conclu que zope a été
 installé avec mon system debian. maintenant comment faire pour démarer
 zope. dois-je faire un start et où?

Even on debian its recommended to install zope from source. 
It isnt all that hard. You need python2.3.5 or higher
and also -dev libs of it. If you run stable your 
python might be too far back and you either install
a backport or python from source - dont forget
zlib1g-dev and zlib1g in this case.

From testing upwards, apt-get install python2.3 python2.3-dev
is enough.

Unpack the tar file from zope.org and follow instructions
in doc/INSTALL.txt there. You dont need to be root
to compile and install zope.

HTH
Tino

PS: lingua franca here is english language


___
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] à l'aide

2005-12-15 Thread Igor Stroh
Tino Wildenhain wrote:
 Am Donnerstag, den 15.12.2005, 19:58 +0100 schrieb adeline nombre:
 
bonjour
je suis un débutant. je veux installer zope sur la debian. mais j'ai
remarqué un repertoire /usr/lib/zope. j'ai donc conclu que zope a été
installé avec mon system debian. maintenant comment faire pour démarer
zope. dois-je faire un start et où?
 
 
 Even on debian its recommended to install zope from source. 

FWIW, did you try to install zope on debian lately? You would
have noticed that it's not all that bad...

Igor
___
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] à l'aide

2005-12-15 Thread Tino Wildenhain
Am Donnerstag, den 15.12.2005, 21:17 +0100 schrieb Igor Stroh:
 Tino Wildenhain wrote:
  Am Donnerstag, den 15.12.2005, 19:58 +0100 schrieb adeline nombre:
  
 bonjour
 je suis un débutant. je veux installer zope sur la debian. mais j'ai
 remarqué un repertoire /usr/lib/zope. j'ai donc conclu que zope a été
 installé avec mon system debian. maintenant comment faire pour démarer
 zope. dois-je faire un start et où?
  
  
  Even on debian its recommended to install zope from source. 
 
 FWIW, did you try to install zope on debian lately? You would
 have noticed that it's not all that bad...

Well, we are happy to have a stable python platform with debian :-)
The little zope compiling does not hurt.
It has gotten much better, thats true. 

___
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] Trapping zope exceptions in python script

2005-12-15 Thread Nikko Wolf

Andreas Jung wrote:




--On 14. Dezember 2005 12:54:56 -0700 Nikko Wolf 
[EMAIL PROTECTED] wrote:



So you could try this instead:

for item in itemList:
   try:
  context.afolder.manage_delObjects([item])
   except:
  continue



Wa... DON'T DO THAT. You should *never* use bare try..excepts 
within Zope applications. This can lead to strange and unpredictable 
behavior.


Can you elaborate on what strange and unpredictable behavior you 
mean?  I'm curious in general, but especially w.r.t. the code above?


BTW, a simple grep of sources in Zope (2.7.6-final) turns up 600+ places 
where a bare except is used, and my Zope instance (which uses Plone) 
contains over 350 more.


Cheers,
Nikko


___
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] Trapping zope exceptions in python script

2005-12-15 Thread Andrew Langmead


On Dec 15, 2005, at 4:01 PM, Nikko Wolf wrote:

Can you elaborate on what strange and unpredictable behavior you  
mean?  I'm curious in general, but especially w.r.t. the code above?


BTW, a simple grep of sources in Zope (2.7.6-final) turns up 600+  
places where a bare except is used, and my Zope instance (which  
uses Plone) contains over 350 more.


Often when you see a bare except, it is after some of the specific  
important exceptions are caught and re-raised:


try:
  something()
except ConflictError:
raise
except:
recover()


Even this is  pretty poor style anyway (If you don't know enough  
about what is going wrong to know what is being thrown, you probably  
shouldn't be in charge of recovering from it.)


The problem with catching and swallowing ConflictError and similar  
internal Zope errors is that  you leave your ZODB in an inconsistent  
state. Roughly, one request has started making modifications to the  
ZODB, then a second request has been making modifications to the same  
object. The ZODB has noticed this, and throws this  ConflictError  
exception. It is expecting this exception to bubble up all the way  
out of your code, throwing away whatever potential modifications you  
have made to the ZODB and having Zope try your code again. (at that  
point, hopefully the task that didn't get the conflict error has  
completed and committed its changes. When your code is run again, it  
will see the new values from the other transaction.


Here an (again very rough) example:

Imagine that you have two collections of objects called unprocessed  
and processed. A group of somethings or someones grab the next item  
in unprocessed, and puts it into processed. If two requests come  
in to grab the next item from unprocessed and put it one of the  
other buckets, at some point. one or both of them will get the  
ConflictError exception. If the exception is swallowed by the code  
both of them will save their copy of the object in processed, and  
where you had one object before you now have two. If these objects  
were student quizzes, two copies of the same quiz will double the  
weight of the score. If these object were loan application, the  
amount of money you were paying out has doubled. All around bad news.



___
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] Re: Triggering the persistence mechanism

2005-12-15 Thread Chris McDonough
There is nothing that needs to be done here.  It's only if you  
*mutate* values stored in the session that you need to do explicit  
persistence triggering.  I provided an example of doing this in my  
last email.


- C

On Dec 15, 2005, at 4:20 PM, Dennis Allison wrote:



Chris McDonnough pointed out a problem with my setSessionVariable
code which I am now fixing.  I want a generic routine to set a session
variable whether it is a simple variable, a list, or a dictionary.

The question is one of triggering the persistence mechanism.  If a
dictionary or list is stored in a session variable, what is needed to
ensure that the setSessionVariable() routine triggers the persistence
mechanism?

Is it adequate to simply read the session variable in the
setSessionVariable() routine prior to writing it when the session  
variable

is a dictionary or list?  Or is something else needed?






___
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] Re: Triggering the persistence mechanism

2005-12-15 Thread Dennis Allison

Yes, I understand that.  This is a development and code organization 
issue.

From the developer's point-of-view there is a special namespace called 
session variables.  What I want to be able to do is have the coders 
call 

getSessionVariable(name) 

to get the current value of the session variable and 

setSessionVariable(name, value) 

to save the value.  The type of the variable should be transparent to the 
programmer--that is, it could be a number, a string, a dictionary, or a 
list.

My question restated: Is there a way to write a generic 
setSessionVariable()routine that handles the mutated values properly
for arbitrary types.

That is, does something like 

def setSessionVariable( name, value ):
request = container.REQUEST
session = request.session
a = session.get(name,0) 
a = value
session[name]=a

manage persistence correctly if value is a dictionary or a list
and mutated from the old value, whatever it may have been.  Or is it 
necessary to specifically include an assignment for each mutated 
component of the dictionary or list?

What happens when the value to be stored is a dictionary of dictionaries
of lists and has been mutated?

Is there an advantage to using the persistent Dictionary and List classes 
in the session rather than ordinary ones?

Thanks again for your insight.


On Thu, 15 Dec 2005, Chris McDonough wrote:

 There is nothing that needs to be done here.  It's only if you  
 *mutate* values stored in the session that you need to do explicit  
 persistence triggering.  I provided an example of doing this in my  
 last email.
 
 - C
 
 On Dec 15, 2005, at 4:20 PM, Dennis Allison wrote:
 
 
  Chris McDonnough pointed out a problem with my setSessionVariable
  code which I am now fixing.  I want a generic routine to set a session
  variable whether it is a simple variable, a list, or a dictionary.
 
  The question is one of triggering the persistence mechanism.  If a
  dictionary or list is stored in a session variable, what is needed to
  ensure that the setSessionVariable() routine triggers the persistence
  mechanism?
 
  Is it adequate to simply read the session variable in the
  setSessionVariable() routine prior to writing it when the session  
  variable
  is a dictionary or list?  Or is something else needed?
 
 
 
 
 

-- 

___
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] Re: Triggering the persistence mechanism

2005-12-15 Thread Chris McDonough

session variables.  What I want to be able to do is have the coders
call

getSessionVariable(name)

to get the current value of the session variable and

setSessionVariable(name, value)

to save the value.  The type of the variable should be transparent  
to the
programmer--that is, it could be a number, a string, a dictionary,  
or a

list.


The two functions you describe are all that you need.



My question restated: Is there a way to write a generic
setSessionVariable()routine that handles the mutated values properly
for arbitrary types.



The simplest implementations are sufficient:

def getSessionVariable(name):
return context.request.SESSION[name]

def setSessionVariable(name, value):
context.request.SESSION[name] = value

Where this behaves in an unexpected manner is if someone stores a  
mutable value in the session, e.g.:


setSessionVariable('a', {})

and *later in the same request* does something like this *without  
ever again calling setSessionVariable*:


a = getSessionVariable('a')
a['foo'] = 'bar'

The programmer has mutated the dictionary, which is a basic type, and  
thus doesn't know anything about persistence.  Since it's mutated,  
and its value isn't stored back into the session explicitly, it will  
eventually disappear when the session data object is ghosted.


The best (and only) way to prevent this is to instruct your  
developers to always explicitly re-persist session variables after  
they mutate them:


a = getSessionVariable('a')
a['foo'] = 'bar'
setSessionVariable('a', a)

There is no sane mechanism to prevent them from needing to do this  
for mutable basic types.



and mutated from the old value, whatever it may have been.  Or is it
necessary to specifically include an assignment for each mutated
component of the dictionary or list?


It is not necessary to do this for each value in the dictionary or  
list.  Just for the dictionary or list itself.




What happens when the value to be stored is a dictionary of  
dictionaries

of lists and has been mutated?


The mutations are lost unless you call setSessionVariable on the top- 
level dictionary.




Is there an advantage to using the persistent Dictionary and List  
classes

in the session rather than ordinary ones?


They avoid the requirement that you think about this, as they are not  
basic types and thus know about persistence and can manage this for you.




Thanks again for your insight.


- C

___
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] ANN: ZSyncer 0.7.0 released

2005-12-15 Thread Paul Winkler
ZSyncer 0.7.0 Released

Version 0.7.0-final (2005/12/15) is available for download from
sourceforge:
http://sourceforge.net/project/showfiles.php?group_id=28073package_id=20913release_id=378551

ZSyncer is a Zope 2 product that allows you to synchronize and compare
objects from one zope (source) to another (destination). It is a lot
more convenient than the old manual export / transfer / import
procedure.


Noteworthy changes since 0.6.2:

Features added:

* We now have two-directional sync! Instead of just sync, we now
  have both put (like the old sync) and get (pulls changes from
  the remote system to the client system). Thanks Alan Milligan!

* new method of ZSyncer and ZSyncerTool: callManyRemote() to call
  multiple arbitrary methods on the remote system and return a list
  of results.

* Pretty complete example skins for ZSyncerTool integration with
  CMF/Plone. See README.txt for more instructions. Doesn't have all
  features yet (e.g. no pull support).

* Should work with Zope 2.8 now!

* The override user stuff is removed from the UI. You now have to
  use the proto://user:[EMAIL PROTECTED] url format. See README.txt for
  more information.

* The (broken) XMLRPC code has been removed.

* New config variable, upload_threshold_kbytes, determines the
  point at which the server spools data to a temp file instead of
  RAM.

* delete now deletes from both local and remote systems.

* SSL connections using ConnectionMgr should now set timeout
  properly.

* Lots of unit tests!

For bugfixes and older changes, see CHANGES.txt.

-- 

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 )