Re: [Zope-dev] Benchmarks: DTML vs. ZPT?

2002-02-08 Thread Chris Withers

Richard Jones wrote:
 
 That's only during parsing - the result of the ZPT parse is a highly
 optimised rendering structure.

Not highly optimised enough if what Martijn says is true ;-)

cheers,

Chris

___
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] Using psycopg cursor in a product

2002-02-08 Thread de ZORZI Frederic

 Hi all,
 Is it possible to use cursors and their functions (dictfetchall, 
 fetchone...)  with zpsycopg connection ?
 

Easy stupid :) :

conn = getattr(self, self.connection_id)
db = conn().db

curs = db.cursor()
curs.execute(select * from support limit 2)
return %s % curs.dictfetchall()


Now, how about managing transactions ?


___
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] Using psycopg cursor in a product

2002-02-08 Thread Federico Di Gregorio

Il ven, 2002-02-08 alle 12:47, de ZORZI Frederic ha scritto:
  Hi all,
  Is it possible to use cursors and their functions (dictfetchall, 
  fetchone...)  with zpsycopg connection ?
  
 
 Easy stupid :) :
 
 conn = getattr(self, self.connection_id)
 db = conn().db
   
 curs = db.cursor()
 curs.execute(select * from support limit 2)
 return %s % curs.dictfetchall()
 
 
 Now, how about managing transactions ?

zope manages them for you. you get a commit() at the end of the page and
a rollback() in case of an uncatched exception. if you want to do
transaction management yourself, create your own connection/cursor in an
external method.

ciao,
federico

-- 
Federico Di Gregorio
Debian GNU/Linux Developer  Italian Press Contact[EMAIL PROTECTED]
INIT.D Developer   [EMAIL PROTECTED]
 One key. One input. One enter. All right. -- An american consultant
   (then the system crashed and took down the *entire* network)



msg09360/pgp0.pgp
Description: PGP signature


[Zope-dev] Possible PUT_factory enhancement

2002-02-08 Thread Chris Withers

Hi,

PUT_factory's are cool, but you always have to write them as external methods,
which sucks.

What would people feel if I made an enhancement to Hookable_PUT.py that let you
return either an object _or_ a metatype?

cheers,

Chris

___
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] Benchmarks: DTML vs. ZPT?

2002-02-08 Thread Jim Penny

On Fri, Feb 08, 2002 at 11:29:39AM +, seb bacon wrote:
 Well, I just ran a very naive test and it suggests that zpt may be about
 twice as slow as dtml.
 
 I made a DTML Method, and a ZPT, identical to each other, containing
 only HTML:
 
   html 
Test
   /html
 
 Then I ran the ab benchmarking tool against each method, thus:
 
   # ab -n 500 http://localhost:8005/zpt_test/dtml
 
 The results are reproduced below, along with the profiling information
 (sorry if it wraps badly)
 
 seb

snip - snip.

This is indeed very interesting.  I also had an impression that ZPT was
sometimes evaluating things that it did not need to in the presence
of conditional tags.

How does the timing compare with a Script Python and with an external 
method on your machine?

(Yes, I understand they are very different from ZPT and dtml, but I
think this might be useful information for a Zope architect. And this 
would give a common baseline.)


Jim Penny

___
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] Benchmarks: DTML vs. ZPT?

2002-02-08 Thread Shane Hathaway

seb bacon wrote:
 Well, I just ran a very naive test and it suggests that zpt may be about
 twice as slow as dtml.
 
 I made a DTML Method, and a ZPT, identical to each other, containing
 only HTML:
 
   html 
Test
   /html
 
 Then I ran the ab benchmarking tool against each method, thus:
 
   # ab -n 500 http://localhost:8005/zpt_test/dtml
 
 The results are reproduced below, along with the profiling information
 (sorry if it wraps badly)

This is useful information, but it's hard to make sense of it.  For one 
thing, where are the calls to BaseRequest.traverse() in the ZPT test? 
Also, the info seems to suggest that ZPT took 7.810 seconds (total) to 
pt_render(), while DTML took 0.640 seconds (total) to __call__(), but 
there's no suggestion as to why.

Shane



 
 1. DTML Method
 
 HTML transferred:   1 bytes
 Requests per second:88.15 [#/sec] (mean)
 Time per request:   11.34 [ms] (mean)
 Time per request:   11.34 [ms] (mean, across all concurrent
 requests)
 Transfer rate:  21.16 [Kbytes/sec] received
 
  ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   5010.0900.0005.5800.011 profile:0()
   5010.0500.0005.4900.011 Publish.py:367(pm)
   5010.0200.0005.4400.011
 Publish.py:206(publish_module)
   5010.2000.0005.4200.011 Publish.py:122(publish)
   5010.7300.0012.2300.004
 BaseRequest.py:231(traverse)
   5010.2000.0001.4800.003 mapply.py:104(mapply)
   5010.0500.0000.9900.002
 Publish.py:111(call_object)
   5000.1700.0000.9300.002
 DTMLMethod.py:168(__call__)
   5000.3100.0010.6400.001 DT_String.py:434(__call__)
   5010.0200.0000.5600.001
 BaseResponse.py:125(outputBody)
   5010.1000.0000.4300.001
 __init__.py:247(recordMetaData)
 
 -
 
 2. ZPT
 
 HTML transferred:   10500 bytes
 Requests per second:47.65 [#/sec] (mean)
 Time per request:   20.99 [ms] (mean)
 Time per request:   20.99 [ms] (mean, across all concurrent
 requests)
 Transfer rate:  11.48 [Kbytes/sec] received
 
  ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   5050.1300.000   13.1200.026 profile:0()
   5050.0200.000   12.9900.026 Publish.py:367(pm)
   5050.0800.000   12.9700.026
 Publish.py:206(publish_module)
   5050.3100.001   12.2200.024 Publish.py:122(publish)
   5050.0500.0008.3700.017 mapply.py:104(mapply)
   5050.0100.0008.3200.016
 Publish.py:111(call_object)
   5050.0400.0008.3100.016 Bindings.py:322(__call__)
   5050.0500.0008.2700.016
 Bindings.py:342(_bindAndExec)
   5000.2200.0008.1400.016
 ZopePageTemplate.py:238(_exec)
   5000.1100.0007.8100.016
 PageTemplate.py:143(pt_render)



___
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] copy paste 'leakage'

2002-02-08 Thread Matthew T. Kromer

Martijn Faassen wrote:

Hey,

I'm running into a weird problem I'm not sure how to tackle. I've
noticed that under some circumstances it takes a long time to copy
and paste a ParsedXML object. This seems to happen in a clean Zope,
at least in the Zope root, though it doesn't seem to happen in folders.
I've also had it happen in Folderish objects in an app, though *sometimes*
the problem wouldn't occur. Quite peculiar.

I noticed that it wasn't only slow; it was generated huge amounts of
useless volume for the ZODB as seen in the database management screen;
objects a couple of K big generally cause a meg or two of leak when
the copy process is 'slow'.

I concluded the copy process is this slow because Zope is somehow
copying far more data than intended.

But I don't know what; I need to get a clue in order to tackle this problem,
and this is as far as I've gotten. I've speculated somekind of weird
acquisition wrapper issues may be involved (certainly possible with ParsedXML),
which cause other objects to be copied, or possibly the same XML nodes
to be copied, multiple times, even though I can't find them. But perhaps
someone else has run into this problem before and can give me some idea
on where to start looking.

Regards,

Martijn


Martijn, under Zope 2.5, there's a utilites/ZODBTools/fstest.py program 
which can be used to take a look at your Data.fs file -- if you run it 
 with -v -v (two verbose flags) it will print a line for each object in 
every transaction.

If you look at the tail end of the output, you should be seeing the 
transactions performed last.  You should be able to do some degree of 
differenentiation based on that to figure out the volume of objects 
being copied in the FileStorage.

-- 
Matt Kromer
Zope Corporation  http://www.zope.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] copy paste 'leakage'

2002-02-08 Thread Shane Hathaway

Martijn Faassen wrote:
 Another data point. Copy  paste of ParsedXML documents is normal
 and fast when the object is in a folder not surrounded by too
 many other folders (or objects in general, not sure yet). If I create
 a bunch of very large folders sitting next to the ParsedXML document
 that I'm going to copy, the copying process slows down and generates
 a lot of extraneous megs that I can then clean out again from the ZODB.
 
 Somehow the document is being affected by its environment, though I 
 doubt I have the full story yet (I did have problems with folders that
 were not filled with anything else before).

The manage_beforeDelete() and manage_afterAdd() events are propagated to 
subfolders, meaning that a whole lot of objects have to wake up every 
time you add or remove something.  Or it might be manage_afterClone() 
being called, which is very similar.  You could add a temporary print 
statement to ObjectManager.manage_after* to see just how often the 
methods are getting called.

The solution?  Event management.  Make objects register to receive events.

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 )



Re: [Zope-dev] 2.5.0 locale problems

2002-02-08 Thread Leonardo Rochael Almeida


Hi,

You shouldn't be messing with locale in a Zope product. In a threaded
Python app, setting locale affects all threads, and there are a number
of parts in Zope which depend on correct locale information. You should
respect whatever locale was set in Zope initialization (by environment
vars or thru the -L parameter)

Why do you want to change the locale anyway?

On Fri, 2002-02-08 at 12:33, Igor Stroh wrote:
 are there any known problems with zope 2.5.0 and locale module? This piece
 of code [1] produces an error when I try to refresh/install a product that
 contains the code, though it works just fine if I just execute it in the
 python shell. The same product works well in zope 2.4.2...
 
 [1]:
 
 import locale
 locale.setlocale(locale.LC_ALL, '')

-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.


___
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] Newbie: manage_add DTML access to product variables

2002-02-08 Thread R. David Murray

On Tue, 5 Feb 2002, John Hall wrote:
 1.  How do I format an object to use in a dtml-in loop?  (I'm thinking
 it needs to be a list of dict's).

dtml-in will accept four differen formats:  a list of objects with
attributes, a list of values, a list of dicts, or a list of pairs.

A list of objects is the most common case, and you get access to the
attributes by name inside the loop.  A list of values can only
be accessed using dtml-var sequence-item, which gives you access
to each item in the list in turn.  For a list of dicts you want
to specify the 'mapping' keyword on dtml-in, in which case the
keys of each dict can be used in dtml-var statements.  I'm not
100% sure what the list of pairs does, but I think one of the
two items in the pair goes into sequence-key and the other into
sequence-item.

 2.  How do I access a function or variable in a Product's python code
 directly from DTML (or how do I add a callable method in Zope's DTML
 namespace from a Product's python code?)  I think my major problem
 here is lack of understanding of how Products are accesible within
 the DTML namespace.

If you make the right security declarations you can probably access
a class variable from dtml.  What might be easier, though, is to
use the binding feature of DTMLFile to make the list available
when the method is called, via pre-declaration in your Product:


  [code that defines your class, including the class variable listOfMethods]

  yourAddMethod = DTMLFile('dtml/addForm',globals(),
listOfMethod = yourclass.listOfMethods)

I'm not 100% sure this is going to solve your problem, but I've some
some stuff along these lines successfully, so it might.

--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] Module changes not taking in external method

2002-02-08 Thread Ted Skolnick

Hi I am a zope newbie getting started by using external methods.   I am
importing modules from another package in my external methods and having
some problems.  When I change code in the external method, I see thos
changes take right away when I call the method from the browser.  But when I
change code in the imported modules, I don't see the changes take until I
reboot zope.   Is zope cacheing my modules?  Any thoughts?

thanks,
Ted


___
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] Benchmarks: DTML vs. ZPT?

2002-02-08 Thread Dieter Maurer

Joachim Werner writes:
  Has anyone done any performance comparisons between DTML and ZPT yet? The
  reason I'm asking is that we did some first(completely unscientific) tests
  and had the impression that ZPT were actually quite a bit SLOWER than DTML -
  and I just can't believe that ...
While essential parts of DTML rendering is implemented in C,
ZPT rendering is pure Python...


Dieter

___
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] Transaction error on Zopesite DB

2002-02-08 Thread Dieter Maurer

Scott Burton writes:
  I keep getting a transaction error which renders my entire ODB unwritable on 
  Zopesite.com just about everyday.
This may happen when there is an exception during the second
step of the two phase commit. We had such a problem with an
old version of FSSession (fixed long ago).

Activate logging (-- achives) and see whether you find a hint
in the log file.

Usually, the Data.fs is not really corrupted and a simple
Zope restart is enough to get working again.


Dieter

___
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] Module changes not taking in external method

2002-02-08 Thread R. David Murray

On Fri, 8 Feb 2002, Ted Skolnick wrote:
 Hi I am a zope newbie getting started by using external methods.   I am
 importing modules from another package in my external methods and having
 some problems.  When I change code in the external method, I see thos
 changes take right away when I call the method from the browser.  But when I
 change code in the imported modules, I don't see the changes take until I
 reboot zope.   Is zope cacheing my modules?  Any thoughts?

No, but it *is* actively rereading the external method when the timestamp
on the source file changes (assuming you are running in -D mode).  Zope
has no way to notice changes to the imported module source files, so
it doesn't know to reread things when they change.

--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] RELEASED - StandaloneZODB 1.0 final

2002-02-08 Thread Barry A. Warsaw


I'm please to announce the release of StandaloneZODB, the Python
object persistency system also known as the Z Object Database.  ZODB
is the object-oriented database underlying Zope; the StandaloneZODB
project's goal is to provide those same facilities to non-Zope related
Python applications.

Today we are releasing StandaloneZODB 1.0 final.  A brief description
of the changes since release candidate 1 is outlined below.

StandaloneZODB is based on the same code as the ZODB in Zope, albeit
on a separate release branch.  Its inspiration comes from Andrew
Kuchling's StandaloneZODB project on SourceForge.  While there are
still some differences, the Standalone 1.0 release is the first on the
path toward convergence.  Subsequent releases should complete the
merge of Andrew's and Zope Corporation's packages.

The StandaloneZODB release includes the following components:

- Core ZODB, including the persistence machinery
- Standard storages such as FileStorage
- Supporting modules such as ExtensionClass
- The persistent BTrees modules
- ZEO
- Experimental Berkeley storages
- Some documentation wink

See the README file for details on building and installing
StandaloneZODB.  For details on using ZODB, see Andrew's included user
guide.

StandaloneZODB 1.0 is released under the ZPL 2.0.  It should be
compatible with all Python versions from Python 2.1 to Python 2.2.  It
may or may not work with versions earlier than Python 2.1.

Download StandaloneZODB-1.0 from:

http://www.zope.org/Products/StandaloneZODB

and visit the StandaloneZODB Wiki page at:

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

See also:

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

for more information about our long-range ZODB plans.

Enjoy,
-Barry

Barry A. Warsaw
Zope Corporation, Pythonlabs
[EMAIL PROTECTED]

 snip snip 
What's new in StandaloneZODB 1.0 final?
Release date: 08-Feb-2002
===

All copyright notices have been updated to reflect the fact that the
ZPL 2.0 covers this release.

Added a cleanroom PersistentList.py implementation, which multiply
inherits from UserDict and Persistent.

Some improvements in setup.py and test.py for sites that don't have
the Berkeley libraries installed.

A new program, zeoup.py was added which simply verifies that a ZEO
server is reachable.  Also, a new program zeopack.py was added which
connects to a ZEO server and packs it.

___
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] ZMI textareas on Windows IE6 are '100%+' wide, cause scrolling inconvenience

2002-02-08 Thread Jeff Kowalczyk

On my Zope 2.5.0 running on WindowsXP/IE6, the ZMI's textarea boxes, for
things like editing PageTemplates, becomes too wide for the frame when
the vertical scrollbar is required, causing an inconvenient
side-scrolling behavior. The frame must be scrolled sideways to view the
text areas's scrollbars, which then obsures the far left of the
textarea.

This is the code in question (for a PT edit page, there are many others)
  Expand macros when editing
/td
  /tr
  tr
td align=left valign=top colspan=4
  div style=width: 100%;
  textarea name=text:text wrap=off style=width: 100%;
cols=40 rows=15lt;html metal:define-macro=pagegt;

Would it not help to make the textarea and div width 90% or so to
account for the potential width of the side-scroll bar on the right-hand
ZMI frame? Or even better, this could become a preference setting, since
some users will have very narrow scrollbars or extreme vertical
resolutions. After all, there is a cols/rows insertion right next to it,
perhaps a new preference setting is easy enough to add...


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