Re: [Zope-dev] More Beginner doubts

2003-09-18 Thread Dieter Maurer
Emiliano Marmonti wrote at 2003-9-17 22:51 -0300:
 > Thanks Andrew, I'll try it.
 > Now I'm testing inside Zope and everything looks well, except for:
 > 
 >  self.cat.addIndex('id','FieldIndex' )
 >  self.cat.addIndex('name' ,'FieldIndex' )
 >  self.cat.addIndex('observaciones','FieldIndex' )
 >  get_transaction().commit()
 > 
 > Zope is telling me that from this version (2.6) I could not addIndex
 > here, must be done outside(where?), in the Application (that I haven't).
 > My problem is that I create the catalog inside the class

I have the feeling that you are working on a too low level.

In Zope, you would usually work with a "ZCatalog" instance
and not a "Catalog" instance.

ZCatalog's "addIndex" has the signature you expect.
"Catalog"'s "addIndex" has the signature "addIndex(name,indexObject)".
See at "ZCatalog.addIndex" code to find out how to convert
an index type into an index.



Dieter

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


[Zope-dev] Problems with ZODB and persistence

2003-09-18 Thread Emiliano Marmonti
Hello all

Finally could find where and how to add indexes in the actual way (think
so). Now I have another problem that have no idea how to fix it. Could
add objects into a ZODB separate database, could add the catalog and the
index, but when the database has one element, with every operation
(inclusive opening it) this message appears from Zope:

'App.PersistentExtra' module has no attribute 'Autor'

>From Python

  File C:\Archivos de programa\Zope\lib\python\ZODB\Connection.py, line
534, in etstate
  File C:\Archivos de programa\Zope\lib\python\ZODB\Connection.py, line
178, in_persistent_load
(Info: ('\x00\x00\x00\x00\x00\x00\x00\x0e', ('App.PersistentExtra',
'Autor')))
  File C:\Archivos de programa\Zope\lib\python\ZODB\Connection.py, line
138, in __getitem__
(Info: ('\x00\x00\x00\x00\x00\x00\x00\x0e',
'((U\x13App.PersistentExtraq\x01U\x05Autorq\x02tq\x03Nt.}q\x04(U\x02idq\x05U\x0822596451q\x06U\x04nameq\x07U\x0f

Juana Silviaq\x08U\robservacionesq\tU\x0bpruebaq\nu.'))
  File C:\Archivos de programa\Zope\lib\python\ZODB\DB.py, line 122, in
_classFa
ctory
AttributeError: 'App.PersistentExtra' module has no attribute 'Autor'

Simply, I have no idea what is happening, have searched over
App.PersistentExtra but...what is Somebody knows where could I find
an example (that works and is updated) for doing this kind of tasks?

My code is:
-
import sys
import ZODB
import Persistence
from Persistence import Persistent
from ZODB.FileStorage import FileStorage
from Products.ZCatalog.Catalog import Catalog
from Products.PluginIndexes.FieldIndex.FieldIndex import FieldIndex

class Autor(Persistent):
 id=''
 name=''
 observaciones=''

 def __init__(self,id,nombre,comments):
 self.name = nombre
 self.id = id
 self.observaciones = comments

 def setName(self,nombre):
 self.name = nombre

 def setId(self,id):
 self.id = id

 def setObs(self,comments):
 self.observaciones = comments

 def getName(self):
 return self.name

 def getId(self):
 return self.id


class Autores:
 def __init__( self, file='dcAuthor.fs' ):
self.file= file
self.db  = ZODB.DB( FileStorage( file ) )
self.co  = self.db.open()
self.root= self.co.root()
if self.root.has_key( 'cat' ):
 self.cat= self.root['cat']
else:
 self.cat= Catalog()
  ### This is, how I get it to work
 self.cat.aq_parent= self.root
 self.root['cat']= self.cat

 ### Add indexes to the Catalog-Class
 ### The names must match the fields of the Person-Class!

  indice = FieldIndex('id')
 self.cat.addIndex('id',indice )
 otroIndice = FieldIndex('name')
 self.cat.addIndex('name' ,otroIndice )
###self.cat.addIndex('observaciones','FieldIndex' )
 get_transaction().commit()

 def setAutor( self, autor ):
 uid= id( autor )
 self.root[uid]= autor
 print "Guardada como:"+str(uid)

### Let the Catalog know from this object
self.cat.catalogObject( autor, uid )
get_transaction().commit()

 def searchAutor( self, **kw ):
r= self.cat.searchResults( kw )
paths= self.cat.paths
root = self.root
k= []
for i in r:
 id= i.data_record_id_
 k.append( root[paths[id]] )
return k

 def close ( self ):
self.db.close()



def AddAutor(nombre,documento,obs):
   autor = Autor(documento,nombre,obs)
   autores = Autores()
   autores.setAutor(autor)
   autores.close()

def GetAutor(expresion):
   autores = Autores()
   listaAutores=autores.searchAutor(name=expresion)
   autores.close()
   listaretorno=[]
   for au in listaAutores:
  listaretorno.append(au.getName())
   return listaretorno



I've seen that if I no close() the database, only obtain Error 500 from
the server. GetAutor and AddAutor are called from DTML.

Well, thanks a lot again.
Emiliano.


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


Re: [Zope-dev] AW: [Summary] Caching prob with AHCM and headers

2003-09-18 Thread seb bacon
Fred Yankowski wrote:
I use Squid as an HTTP accelerator in front of ZServer.  What do
last-modified headers have to do with this discussion?  
I thought that was how this thread started.  I must have mis-read something.

I use a standard HTTP Cache Manager for all our caching needs - I have 
yet to find the granuality allowed by CPM necessary.

Aha, I didn't realize that an HTTP Cache Manger can now handle FSDV
objects.  That does seem to make the CMF CPM unnecessary for my
purposes.  (I'm using Zope 2.6.1, CMF 1.4, and Plone 1.1alpha2).
FYI, it's nothing to do with the Cache Manager code, it's the FSObjects 
which have been changed to support *it*.

seb

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


Re: [Zope-dev] AW: [Summary] Caching prob with AHCM and headers

2003-09-18 Thread Fred Yankowski
On Thu, Sep 18, 2003 at 11:09:57AM +0100, seb bacon wrote:
> I use squid, which doesn't require last-modified headers.  I guess 
> that's not an option for you, or you'd probably already be using it ;-) 
>  But in any case, I don't see why Shane's suggestion of uncommenting 
> the last-modified line shouldn't work.

I use Squid as an HTTP accelerator in front of ZServer.  What do
last-modified headers have to do with this discussion?  Anyway, I have
a strong preference for working with stock code, rather than patching
Zope itself or any of the products.

> I use a standard HTTP Cache Manager for all our caching needs - I have 
> yet to find the granuality allowed by CPM necessary.

Aha, I didn't realize that an HTTP Cache Manger can now handle FSDV
objects.  That does seem to make the CMF CPM unnecessary for my
purposes.  (I'm using Zope 2.6.1, CMF 1.4, and Plone 1.1alpha2).

> (BTW, in the CMF you can associate FS Objects with named cache managers 
> by adding a file called foo.dtml.metadata with the following contents::

I'm able (I realize just now) to associate FS objects with an HTTP
Cache Manager directly from the cache managers Associate tab in the
ZMI, just like other cache-managable types.

> The only class of request for which I need to have a separate policy is 
> requests from people who are actually editing a site.  I have created a 
> customised HTTP Cache Manager which doesn't cache requests for specified 
> URLs.  I then instruct site editors to edit the site using, e.g. 
> 'edit.mysite.com' and to view it using 'www.mysite.com'.

Interesting approach.

An HTTP Cache Manager has properties allowing it to be associated with
an external "downstream" cache such as Squid, so that when a cached
object is updated in Zope the cache manager notifies the external
cache to purge the corresponding URL.  But my few experiments with
that (some months back, on an earlier version of Zope) showed that
Zope would send a NOTIFY message with a different URL than the one
that squid had associated with particular object, apparently because
of URL path transformations caused by virtual hosting and/or skin
lookup; so the old version of the updated object would remain in the
squid cache.  I wonder if that works better now.  I'll try a few
tests...

P.S.  Even if the NOTIFY interaction above worked right, that still
would not address the problem where a page template does not change,
but the generated content on that page does.  I can see where a site
author/editor might want to get a fresher view of such pages than is
necessary for a random visitor.

-- 
Fred Yankowski  [EMAIL PROTECTED]   tel: +1.630.879.1312
OntoSys, IncPGP keyID: 7B449345fax: +1.630.879.1370
www.ontosys.com 38W242 Deerpath Rd, Batavia, IL 60510-9461, USA

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


Re: [Zope-dev] Zope 2.7 final?

2003-09-18 Thread Chris McDonough
I think it's only been about two weeks, actually.  But, yes, it will be
some time before 2.7 final is released.  I expect another two or three
beta cycles before final, so possibly a month or maybe even two.

On Thu, 2003-09-18 at 11:13, Andrew Veitch wrote:
> Just wondering what the latest on Zope 2.7 is, it's been nearly a month
> since the last release. We're looking forward to it, there's some changes
> that will help us a lot but we don't want to deploy on a beta.
> 
> Andrew
-- 
Chris McDonough <[EMAIL PROTECTED]>
Zope Corporation


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


[Zope-dev] Zope 2.7 final?

2003-09-18 Thread Andrew Veitch
Just wondering what the latest on Zope 2.7 is, it's been nearly a month
since the last release. We're looking forward to it, there's some changes
that will help us a lot but we don't want to deploy on a beta.

Andrew

-- 
Logical Progression Ltd, 20 Forth Street, Edinburgh EH1 3LH, UK
Tel: +44 (0)131 550 3733 Web: http://www.logicalprogression.net/


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


[Zope-dev] PCGI-Problem

2003-09-18 Thread Andre Schubert
Hi all,

i have a little problem.
We have several Zope's running in our company.
Versions are 2.5.1,2.6.1,2.6.2. All are running on Redhat Linux.
All versions have the same problem, if i access them via pcgi and hit the Restart
button in the Control Panel then the server goes down.
If i do the same via ZServer port 8080 everything works fine.

Has anybody found the same problem or is it a misconfiguration ?


Many thanks in advance for your help.

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


Re: [Zope-dev] AW: [Summary] Caching prob with AHCM and headers

2003-09-18 Thread seb bacon
Fred Yankowski wrote:
That makes sense.  Is there a way to do that with the CMF 1.4
version of the "CPM"?  One could, I suppose, test the names of the
FSDV folders in CPM predicates, but that seems a royal PITA.  That's
why I'm making do with one-size-fits-all CPM policy for now.
Here's how I handle caching, for the record.

I use squid, which doesn't require last-modified headers.  I guess 
that's not an option for you, or you'd probably already be using it ;-) 
 But in any case, I don't see why Shane's suggestion of uncommenting 
the last-modified line shouldn't work.

I use a standard HTTP Cache Manager for all our caching needs - I have 
yet to find the granuality allowed by CPM necessary.  I add 2 or 3 cache 
managers to the site (e.g. slow_http and fast_http).  I associate 
templates which need a fast turnaround (e.g. the home page) with 
fast_http and others (e.g. the site map) with slow_http.

(BTW, in the CMF you can associate FS Objects with named cache managers 
by adding a file called foo.dtml.metadata with the following contents::

 [default]
 cache=fast_http
)
The only class of request for which I need to have a separate policy is 
requests from people who are actually editing a site.  I have created a 
customised HTTP Cache Manager which doesn't cache requests for specified 
URLs.  I then instruct site editors to edit the site using, e.g. 
'edit.mysite.com' and to view it using 'www.mysite.com'.

HTH

seb

--

   [] j a m k i t
 web solutions for charities
seb bacon
T:  020 7549 0520
F:  020 7490 1152
M:  07968 301 336
W: www.jamkit.com


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


[Zope-dev] Catalog performance

2003-09-18 Thread zhimin
John Barratt wrote:

> If you can't use catalog metadata as Seb suggests (eg. you are actually
> accessing many attributes, large values, etc.) and if indeeed memory is
> the problem (which seems likely) then you can ghostify the objects that
> were ghosts to begin with, and it will save memory (unless all those
> objects are already in cache).
>
> The problem with this strategy though is that doc.getObject() method
> used in your code activates the object and hence you won't know if it
> was a ghost already or not.  To get around this you can shortcut this
> method and do something like :
>
> docs = container.portal_catalog(meta_type='Document', ...)
> for doc in docs:
>  obj = doc.aq_parent.unrestrictedTraverse(doc.getPath())
>  was_ghost = obj._p_changed is None
>  value = obj.attr
>  if was_ghost:obj._p_deactivate()

Just my 2 cents observation...
I ran this code and monitored the page "Cache extreme detail" in ZMI >
ControlPanel > DebugInfo.
With this method, the object was not loaded. However the intermediate
objects that the unrestrictedTraverse() passed by were loaded into memory.
e.g. If doc.getPath() is '/x/y/z/myobject', myobject was not loaded but x,
y, and z were loaded into memory.

I also tried the method suggested by Seb. This did not load myobject as
well as x, y, and z into memory:
http://mail.zope.org/pipermail/zope-dev/2003-September/020450.html

The information on deactivating object into ghost state is very helpful.
Thanks!

cheers,
zhi min




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