Re: [Zope-dev] New version of BTreeFolder

2000-08-29 Thread Kapil Thangavelu

Kapil Thangavelu wrote:
 
 Shane Hathaway wrote:

  BTW has anyone done any semi-formal speed tests?  It's rumored that a
  custom getattr in Python can cause a bit of a slowdown.  We could write
  a custom getattr in C to solve the problem.  But we don't want to do
  any premature optimization.
 
  Shane
 
 I'll work on some tests.
 
 Kapil


semi-formal test

i ran some basic tests comparing a btree folder against a folder. i'm
not sure about my testing methodology but here are the results. the test
code is at the end of this email. 

the first pair of numbers is a timed creation test for size xxx of DTML
Documents.

the second pair of numbers is a timed test for len(objectIds())

the third pair of numbers is a timed test for attribute access with a
call to 
int(dtmldoc.title_or_id()) # all the ids are stringed numbers

my test box is running mandrake 7.1 with 512 M ram, dual proc celerons
550s (oc'd)

some quick conclusions. the btree folder is slower on average for
creation by anywhere from 15-25% andt btree's __getattr is on average
almost twice as slow as the folder's getattr.


order folder followed by btreefolder

for size 100
0.0974419116974 :::0.126843929291
0.000378012657166 :::0.000354051589966
0.0101770162582 :::0.0186030864716

for size 100
0.0978569984436 :::0.125252962112
0.000376105308533 :::0.000353932380676
0.0101470947266 :::0.0185579061508

for size 500
0.52112698555 :::0.657492995262
0.00154399871826 :::0.00154197216034
0.0524510145187 :::0.0956329107285

for size 500
0.53660595417 :::0.714686989784
0.00154197216034 :::0.00157594680786
0.0532569885254 :::0.100463986397

for size 1000
1.11411702633 :::1.4010369
0.00302505493164 :::0.00306105613708
0.105547070503 :::0.193196058273

for size 1000
1.12388503551 :::1.58762395382
0.00370097160339 :::0.00381696224213
0.106634020805 :::0.194367051125

for size 2000
2.60056698322 :::3.20675897598
0.007483959198 :::0.00741696357727
0.216197967529 :::0.396993994713

for size 2000
2.64964604378 :::3.26421093941
0.0074850320816 :::0.00761103630066
0.214147925377 :::0.40997505188

for size 5000
9.50434195995 :::11.0002789497
0.0184400081635 :::0.018413901329
0.533676981926 :::0.997251987457

just to be fair i reversed the positions and
did a second set of runs with only 1 run per size as
the results were consistent with the first set.

for size 100
0.128319978714 :::0.10124707222
0.000413060188293 :::0.000383019447327
0.018816113472 :::0.0104240179062

for size 100
0.12813603878 :::0.101204037666
0.00040602684021 :::0.000380039215088
0.0188159942627 :::0.0105849504471

for size 500
0.681550979614 :::0.546862006187
0.00152194499969 :::0.00160706043243
0.0983099937439 :::0.0540620088577


for size 1000
1.47808301449 :::1.17385303974
0.00308799743652 :::0.00319290161133
0.197283029556 :::0.108732938766

for size 5000
11.1204429865 :::9.15097498894
0.015163064003 :::0.0150960683823
1.00954806805 :::0.535046935081


Despite this evidence. at size 5000, looking at the btreefolder contents
in the management screen was near instaneous while the folder took
almost a minute. based on the above evidence though that has more to do
with the interface than the underlying speed of the folder methods.

night.

Kapil

test code to follow.

external method


import time
import os
import Products.BTreeFolder

def btest(self, REQUEST, =None):
''' '''
if not : =100

results = []
bf = Products.BTreeFolder.BTreeFolder.BTreeFolder()
bf.id = 'btree_test_b'  
self._setObject(bf.id, bf)  

id = 'btree_test_f'
rf = self.manage_addFolder(id)

# creation test for completeness

stime = time.time()
for num in xrange():
self.btree_test_b.manage_addDTMLDocument(str(num))
etime = time.time()

result = etime-stime
#self.get_transaction().commit()

stime = time.time()
for num in xrange():
self.btree_test_f.manage_addDTMLDocument(str(num))
etime = time.time()

results.append(result, etime-stime)

# access test   
stime = time.time()
len(self.btree_test_b.objectIds())
etime = time.time() 
result = etime-stime

stime = time.time()
len(self.btree_test_f.objectIds())
etime = time.time()
results.append(result, etime-stime)

# iteration test
stime = time.time()
for oid, item in self.btree_test_b.objectItems():
int(item.title_or_id())
etime = time.time()
result=etime-stime

stime = time.time()
for oid, item in self.btree_test_f.objectItems():
int(item.title_or_id())
etime = time.time()
results.append(result, etime-stime)

return results

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts 

[Zope-dev] Help: mod_python+ZPublisher and authentication

2000-08-29 Thread Gilles Lavaux

Hello,

This is not exactly a Zope question, but I hope that some of you will be
able to help me:

I am using mod_python + ZPublisher + Ztemplate on a apache server and now I
would like to restrict the access of some
 pages served by the ZHandler.py.

How to do it??

Do I have to put a rewrite rule in apache? The Zhandler.py seams to reply
all the time a 200 code to apache, do I have
 to modify it to send back an 'Unauthorized' code??( I don't know how to
raise the 'Unauthorized' error from the python
 module I am publishing)



Thanks for any help


Gilles Lavaux



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




RE: [Zope-dev] Re: ANNOUNCE: Zope 2.2.1 released - breaks my zclass instances too.

2000-08-29 Thread Brian Lloyd

 Brian, the tranalyser reported a clean (old) data.fs and I 
 don't use any
 python base classes for any of my zclasses - however, in the interests
 of my own sanity, I'm pleased to report success with an old recipe - I
 started with a fresh Data.fs and cleaned out some cruft from 
 my Products
 folder. After removing all the stuff I'm not using now (ZopePTK and
 ZDConfera/ZDiscussions products in particular), I was able to 
 import my
 zclasses and then the major application folder - everything looks fine
 now and seems to work.
 
 Lesson may be that a Data.fs which works with an earlier zope version
 may fail when upgrading to 2.2.1 - if so, try 

No - thats not the lesson (at least not the right one)... It looks 
like something in the "cruft" didn't want to be unpickled in the 
new installation (most likely due to a missing piece - a required 
product or base class needed by a piece of cruft didn't get moved 
to the new install). A Data.fs from an earlier version should 
always work with a later version so long as all add-ons are 
replicated in the new installation.

Brian Lloyd[EMAIL PROTECTED]
Software Engineer  540.371.6909  
Digital Creations  http://www.digicool.com 



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




Re: [Zope-dev] New version of BTreeFolder

2000-08-29 Thread Shane Hathaway

Kapil Thangavelu wrote:
 semi-formal test
 
 i ran some basic tests comparing a btree folder against a folder. i'm
 not sure about my testing methodology but here are the results. the test
 code is at the end of this email.
 
 (snip)
 
 some quick conclusions. the btree folder is slower on average for
 creation by anywhere from 15-25% andt btree's __getattr is on average
 almost twice as slow as the folder's getattr.

I must say thank you!

Your results look very conclusive.  It would appear, then, that storing
the objects in a BTree actually slows down reads and writes
considerably.  And the only thing that needs to be improved about
folders is the user interface.

The problem with the current Folder UI, you see, is that each object is
loaded from the database every time you look at the folder contents
view.  Additionally, browsers have trouble rendering large tables. 
BTreeFolder gets the contents listing from the _objects attribute and
generates a simple list.  It's just lucky that all platforms I know of
can handle thousands of items in a simple list without any slowdown.

This provided us the data we needed for improving folders.  Thanks
again!

Shane

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




[Zope-dev] ZPatterns bug: Customizers don't rename well

2000-08-29 Thread Steve Alexander

ZPatterns 0-4-1snap1
Zope 2.2.1

To reproduce the error, do this:

  Create a Folder with Customizer support

  Give it a Customizer

  Rename that Customizer

  Press the "Customizers" tab in the folder


Zope Error

Error Type: AttributeError
Error Value: __customizerRegistry__

Traceback (innermost last):
  File /lib/python/ZPublisher/Publish.py, line 222, in publish_module
  File /lib/python/ZPublisher/Publish.py, line 187, in publish
  File /lib/python/Zope/__init__.py, line 221, in
zpublisher_exception_hook
  File /lib/python/ZPublisher/Publish.py, line 171, in publish
  File /lib/python/ZPublisher/mapply.py, line 160, in mapply
(Object: manage_main)
  File /lib/python/ZPublisher/Publish.py, line 112, in call_object
(Object: manage_main)
  File /lib/python/App/special_dtml.py, line 120, in __call__
(Object: manage_main)
(Info: /lib/python/Products/ZPatterns/www/PlugInGroup.dtml)
  File /lib/python/DocumentTemplate/DT_String.py, line 528, in __call__
(Object: manage_main)
  File /lib/python/App/special_dtml.py, line 120, in __call__
(Object: manage_below)
(Info: /lib/python/Products/ZPatterns/www/showCustomizers.dtml)
  File /lib/python/DocumentTemplate/DT_String.py, line 528, in __call__
(Object: manage_below)
  File /lib/python/DocumentTemplate/DT_In.py, line 630, in renderwob
(Object: manage_registry)
  File /lib/python/Products/ZPatterns/Customizers.py, line 63, in
manage_registry
AttributeError: (see above)


The error occurs because the rename method redirects to:

http://puffin.cat-box.net:7080/test/Customizers_

Pressing the "customizers" tab yields the url:

http://puffin.cat-box.net:7080/test/Customizers_/Customizers_/manage_workspace

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net

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




[Zope-dev] Caching a tree tag

2000-08-29 Thread Jeffrey Harris

Hello!

I've got a site set up using Zope, I'm very pleased with it for the most 
part, but I have some complicated threaded discussion pages that use the 
tree tag, and they're taking FOREVER to load.

I'm not completely certain which part of the system is taking so long.  My 
first question is, is there an easy way to profile python routines?  I 
don't know of a quick way, I'd love to hear suggestions.

The second question I have is about the tree tag.  I suspect that my pages 
are taking so long to render because my branches methods are pretty 
expensive.  One possibility for me is to optimize this code.  But I don't 
think this will really solve the problem.

What I'd like to do is cache the tree structure.  I don't want to cache the 
objects, just references to the nodes.  Would this take just a little 
tweaking of the zope internals, or a lot?  Again, I'd love any suggestions.

Finally, how much overhead do you get from the tree tag, relative to an in 
tag, if the branches method is cheap?  If I can't cache Zope's tree 
structure, I will probably make my own tree object storing references to 
the appropriate objects.  Would recursing over this object with an in tag 
give me any performance improvement?

Thanks!

In community,
Jeffrey Harris,
Skyhouse Consulting



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




[Zope-dev] CLIDAzope

2000-08-29 Thread Leonardo Kenji Shikida

how is the status of CLIDAzope ?
will we have it this year?

regards

Kenji

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




Re: [Zope-dev] Re: ANNOUNCE: Zope 2.2.1 released - breaks my zclass instances too.

2000-08-29 Thread Dr. Ross Lazarus

I'm a little confused - which is not unusual, so please bear with me.

I'm absolutely sure that NONE of the things which were broken in the
original Data.fs had the slightest/faintest connection with any of the
products I expunged. It was removing the cruft alone which fixed the
problem. 

Doesn't this (and the other episode reported by Andy) raise the issue of
what we can do to ensure that a broken product or piece of a product
doesn't stop a healthy product and its instances (completely independent
in the sense of not using any of the broken product's base classes or
classes) from working? 

The instances which were broken were multi-level zclasses which included
ObjectManager and CatalogAware in their base classes. The relevant
products were entirely healthy. The things I got rid of included two
broken things which I never tried to fix (ZDConfera, ZDiscussions) plus
some left over stuff (ZopePTK, PTKBase, PTKDemo, Wizard, Membership,
LoginManager and a few other bits and pieces which I didn't need
although they didn't appear broken..) - none of which had any connection
to the broken zclasses in terms that I can understand - other than
sharing/breaking an otherwise healthy ZODB.


Brian Lloyd wrote:

 
  Lesson may be that a Data.fs which works with an earlier zope version
  may fail when upgrading to 2.2.1 - if so, try
 
 No - thats not the lesson (at least not the right one)... It looks
 like something in the "cruft" didn't want to be unpickled in the
 new installation (most likely due to a missing piece - a required
 product or base class needed by a piece of cruft didn't get moved
 to the new install). A Data.fs from an earlier version should
 always work with a later version so long as all add-ons are
 replicated in the new installation.
 
 Brian Lloyd[EMAIL PROTECTED]
 Software Engineer  540.371.6909
 Digital Creations  http://www.digicool.com

-- 

Dr Ross Lazarus
Associate Professor and Sub-Dean for Information Technology
Faculty of Medicine, Room 114, A27, University of Sydney,
Camperdown, NSW 2006, Australia
Tel: (+61 2) 93514429   Mobile: +61414872482  
Fax: (+61 2) 93516646   Email: [EMAIL PROTECTED]

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




[Zope-dev] Redirection and Authentication

2000-08-29 Thread Christian Scholz

Hi!

I had a little problem and just wanted to ask if someone knows an explanation..

The goal: 
I want to show a list of newsitems to the user. If an administrator wants
to change it he should be able to log in and see the same list but with edit-
buttons.

The setup is:

/folder/list- public accessible dtml method which show the list
/folder/edit- protected dtml method

The edit method is protected so that the login requester pops up and asks
for a passwort.
Originally I was simply redirecting back to the list page inside the edit document by

dtml-call "RESPONSE.redirect('./list')"

(the only line in the document)

In list I then check for a login with

dtml-if "REQUEST['AUTHENTICATED_USER'].has_permission('whatever',this())"
.. show edit button here ...
/dtml-if

The problem is now that after the Redirect AUTHENTICATED_USER is again set to
Anonymous (which I tested by printing AUTHENTICATED_USER). If I do no redirect
but put a normal link back to the list document, everything works as expected
(thus showing the edit button).

So has anyone an explanation? (Version is 2.2.0)
(right now I directly include the list again in the edit document by
using dtml-var. Works for this little thing but I assume this only being
a workaround..)

(I also remember having some strange problems with a redirect from python some
time ago. Back then it did not commit the database transaction in Oracle. After
putting a get_transaction().commit() before the redirect made things work again.)

cheers,
  Christian

-- 
Christian Scholz   MrTopf@IRC
COM.lounge  http://comlounge.net/
communication  design   [EMAIL PROTECTED]

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




Re: [Zope-dev] Enhanced permissions for DTMLMethod and DTMLDocument?

2000-08-29 Thread R. David Murray

On Tue, 29 Aug 2000, Christopher J. Kucera wrote:
 I've got a question about permissions of DTMLMethods and DTMLDocuments.  It
 seems to me that if you've given a role the "View management screens"
 permission, any user with that role should be able to view the source code
 for Methods and Documents.  Is there any concurrence here?

No. grin

 I can understand if you don't want that kind of feature bundled in with
 "View management screens," but if that's the case then I think there should
 be a different role that grants these permissions.

My understanding (which may be wrong!) is that 'View management screens'
gives one permission (by convention?) to use 'manage_' methods.  *Which*
manage methods you can use (or even see on the management tabs) is
controlled by other permissions.  So if such an auxiliarry permission
for viewing the contents doesn't exist, it probably would be
useful to create it.  But I don't think view management screens
should automatically give you access to the source code.

--RDM


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




[Zope-dev] Re: [Zope] dtml-tree question

2000-08-29 Thread Hugo Ramos

- Original Message -
From: "Dieter Maurer" [EMAIL PROTECTED]
To: "Hugo Ramos" [EMAIL PROTECTED]
Cc: "ZOPE" [EMAIL PROTECTED]; "EUROZOPE" [EMAIL PROTECTED]
Sent: Tuesday, August 29, 2000 10:22 PM
Subject: Re: [Zope] dtml-tree question


 Hugo Ramos writes:
   Is there a way to use my own self made '+' icon in a tree tag?
   I'dd like to use my own icon only IF i want to... and not change the
python
   source to use my own icon all the time!
 The code is partially there, but incomplete and commented out.

 If you do not mind other extensions as well, I could provide
 a TreeTag patch for several extensions, including the
 icon customization.


hello Dieter,

I've tryied to hack the treetag source already... but there's some kind of
bug in it:

line 566 (original source):
s.append([id,[]])

Why is this trying to append to 's' when 's' has become a tupple somewhere
before this line???... tupples don't accept append!!

This bug is really making me crazy... because it makes an error when
clicking the + icon in a dtml-tree that I must use...



Another thing:
I hacked the source of treetag.py to accept 2 more parameters in the
dtml-tree... icon_mi and icon_pl

The hacked source is in the attach.
Changes go from line 411-427. Of course i defined the 2 new parameters as
None in the file top.

Please somebody help me... I'm running out of ideias...

regards

=
Hugo Ramos - [EMAIL PROTECTED]
ZopersORG - http://www.zopers.org
=
Do not meddle in the affairs of programmers, for they are easy to annoy,
and have all the source code!!!


##
# 
# Zope Public License (ZPL) Version 1.0
# -
# 
# Copyright (c) Digital Creations.  All rights reserved.
# 
# This license has been certified as Open Source(tm).
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions in source code must retain the above copyright
#notice, this list of conditions, and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#notice, this list of conditions, and the following disclaimer in
#the documentation and/or other materials provided with the
#distribution.
# 
# 3. Digital Creations requests that attribution be given to Zope
#in any manner possible. Zope includes a "Powered by Zope"
#button that is installed by default. While it is not a license
#violation to remove this button, it is requested that the
#attribution remain. A significant investment has been put
#into Zope, and this effort will continue if the Zope community
#continues to grow. This is one way to assure that growth.
# 
# 4. All advertising materials and documentation mentioning
#features derived from or use of this software must display
#the following acknowledgement:
# 
#  "This product includes software developed by Digital Creations
#  for use in the Z Object Publishing Environment
#  (http://www.zope.org/)."
# 
#In the event that the product being advertised includes an
#intact Zope distribution (with copyright and license included)
#then this clause is waived.
# 
# 5. Names associated with Zope or Digital Creations must not be used to
#endorse or promote products derived from this software without
#prior written permission from Digital Creations.
# 
# 6. Modified redistributions of any form whatsoever must retain
#the following acknowledgment:
# 
#  "This product includes software developed by Digital Creations
#  for use in the Z Object Publishing Environment
#  (http://www.zope.org/)."
# 
#Intact (re-)distributions of any official Zope release do not
#require an external acknowledgement.
# 
# 7. Modifications are encouraged but must be packaged separately as
#patches to official Zope releases.  Distributions that do not
#clearly separate the patches from the original work must be clearly
#labeled as unofficial distributions.  Modifications which do not
#carry the name Zope may be packaged in any form, as long as they
#conform to all of the clauses above.
# 
# 
# Disclaimer
# 
#   THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
#   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
#   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
#