[Zope] ZSQL caching question

Schmidt, Allen J. aschmidt@nv.cc.va.us
Mon, 12 Nov 2001 14:24:56 -0500


We have a section of our site delivering online classifieds which are
imported from text file into a Microsoft Access2000 DB and retrieved using
ZSQL methods connecting to Access with a ZODBC adapter. Works fine. Most of
the expensive ZSQL methods are cached in the Advanced tab.

To make the switch to MySQL, I copied the whole Classifieds folder and
renamed it. Then created a MySQL connection to the new database and went
into each ZSQL method and pointed them to the new MySQL DA. I checked the
caches and they are still there.

Problem: Even for one user while testing, the site section is VERY SLOW. Our
admin says while monitoring the MySQL DB the connections go way up and it
loads up the server.

Question: Are the caches 'moving' along with the ZSQL methods when the DB
connection was changed? Grasping at straws but it should be faster than
using Access. The other site we converted to MySQL from Access did not have
the problem and never thought to check the caches...it just worked and was
much faster.

Any ideas or am I just missing something?

Thanks
Allen




-----Original Message-----
From: Jason Earl [mailto:jason.earl@simplot.com]
Sent: Monday, November 12, 2001 2:14 PM
To: csnorville@fedex.com
Cc: zope@zope.org
Subject: Re: [Zope] File I/O in Zope


csnorville@fedex.com writes:

> Hi Everyone, 

Hello

> I am fairly new to Zope and I need some assitance on something that
> I know is fundamental so please don't beat up on me too bad ;-)

I haven't been a member of this list for too terribly long, but the
folks here seem to be pretty darn friendly.

> I am try to open a file with a Python Script in Zope for content
> manipulation. This is a text file, I basically want to read a
> number, operate on it and write it back out.  However when I try to
> get my file handle I get;

You are going to need to use an External Method (or a Product) for
this.  The Zope based Python scripts only offer a "safe" subset of
Python.  Opening files on the filesystem is not a part of this "safe"
subset.

> file=open("/home/chris/misernumber", "r+") 
> 
> Zope Error 
> 
>            Zope has encountered an error while publishing this resource.
> 
>            Error Type: NameError 
>            Error Value: global name 'open' is not defined 
> 
> I tried creating the file as a Zope object but I get the same error.
> Again I know this is fundamental. If ya'll can help me with this, or
> at least point me to some documentation it would be deeply
> appreciated.

There probably is a way to do this with Zope objects, but it wouldn't
be using open().  There is a whole slew of methods for manipulating
Zope objects, check the Zope API section in the Zope Book.

Depending on what you are actually trying to do there might be a more
Zope-like way of accomplishing it than with the External Method
hammer, but without knowing what you are trying to do it is hard to
guess what that more Zope-like thing should be.

Jason

_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )