[Zope-dev] Re: Still i18n:attributes DeprecationWarning on Zope head!

2003-09-17 Thread Chris Withers
Godefroid Chapelle wrote:
Sidnei and I have corrected branch 2.7. Currently, DeprecationWarnings 
are meant to stay on HEAD. 
Indeed, this is a good thing...

Those Deprecation Warnings are emitted from TAL/TALGenerator.py.

Feel free to replace the message by something more explicit to you.
I know that, the error message is fine, but there are tests that need to be 
corrected. Since you know this syntax very well, please can you check out the 
Zope HEAD, search for tal:attributes and fix and broken tests? I think there are 
only a few files that need to be changed...

cheers,

Chris

___
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-17 Thread Chris Withers
Fred Yankowski wrote:
	python: content.meta_type == 'Filesystem Image'
Do you have any content with this metatype?
There is nothing in the portal_catalog with that meta_type.  But there
are lots of objects with that type:  most everything in
portal_skins/plone_images/, for example.
Oh, I getcha now... hmmm.. since these are served from disk anyway, what would 
be the benefit in caching them?

(Dim memories suggest that OFS.Image.Image does some work to circumvent caching, 
that's probabyl why they'er not being cached...)

cheers,

Chris

___
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] Etag support in page templates

2003-09-17 Thread Chris Withers
Jens Vagelpohl wrote:
+1

Along with that the MS Author Via header garbage should at least be 
governed by some configuration flag.
+ as many things as I'm allowed ;-)

Then I can finally stop patching production servers that serve up MS office 
files for download...

Chris

___
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] Etag support in page templates

2003-09-17 Thread Chris Withers
Jamie Heilman wrote:
  Solution A)
 Solution B)
The correct answer, of course, is to do both...

Sorry, but not everyone fronts Zope with a proxy (yes, of coruse they should 
Jamie, but you have to understand not everyone is qutie as godlike as wants to 
get going as quickly as possible so they can try thing out, not as correctly as 
possible... hence the use case of Zope running standalone on a Win98 laptop ;-)

In addition, some people's proxies may not be capable of adding the required 
headers.

Finally, if support is added back, I'd like to see if via an API, so I can 
configure at the application level what headers are sent and from where.

I wonder if RESPONSE.setHeader() is sufficient for this?

cheers,

Chris

___
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-17 Thread Tres Seaver
On Wed, 2003-09-17 at 07:26, Chris Withers wrote:
 Fred Yankowski wrote:
 
python: content.meta_type == 'Filesystem Image'
 
 Do you have any content with this metatype?
  
  There is nothing in the portal_catalog with that meta_type.  But there
  are lots of objects with that type:  most everything in
  portal_skins/plone_images/, for example.
 
 Oh, I getcha now... hmmm.. since these are served from disk anyway, what would 
 be the benefit in caching them?
 
 (Dim memories suggest that OFS.Image.Image does some work to circumvent caching, 
 that's probabyl why they'er not being cached...)

Two reasons:

  - Browser caches know about the HTTP headers, too. 

  - Accelerators (Squid, Apache w/ mod_proxy and caching), cache content
to reduce load on the appserver.

Both kinds of caching are Good Things (TM) for sites where Zope is or
can be the bottleneck, and where absolute freshenss is not a
requirement.  Even serving 304s is *much* slower in Zope than serving
from the Squid cache, for instance.

Tres.
-- 
===
Tres Seaver[EMAIL PROTECTED]
Zope Corporation  Zope Dealers   http://www.zope.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] Beginner doubts

2003-09-17 Thread Emiliano Marmonti
Hello all

I'm newbie with Zope, ZODB and so on. First of all I have choiced Zope
as application server and ZODB because I have to implement a
bibliographical project that handles a lot of hierarchichal data, with
need and will add in few months all the workflow related to send
documents to a reviewer, publish, and have to connect with other
bibliographic system through XML because of this is that I think could
be made very easily with Zope/Plone, isn't it?

The first thing that I've tried to implement is to add functionality for
search/add authors. For the business logic I have made an
external-script that have the abstractions and the persistent-logic.
After all the classes code I have defined two functions for invoking
inside Zope. The entire idea is to put inside a Persistent class
something that adds the functionality to search over the text of the
objects properties. I'have found in this list an example that uses a
Catalog, I think must be another way to search over a ZODB but have not
found any example. For me a catalog is OK, perhaps later will want a
TextIndex, but:

--- code --


import sys
sys.path.append('c:\\Archivos de programa\\Zope\\lib\\python\\')
import ZODB
import Persistence
from Persistence import Persistent
from ZODB.FileStorage import FileStorage
from Products.ZCatalog.Catalog import Catalog

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()
 ## I don't understand what is doing here
 self.cat.aq_parent= self.root
 self.root['cat']= self.cat

 self.cat.addIndex('id','FieldIndex' )
 self.cat.addIndex('name' ,'FieldIndex' )
 self.cat.addIndex('observaciones','FieldIndex' )
 get_transaction().commit()

 def setAutor( self, autor ):
uid= id( autor )
self.root[uid]= autor

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 AddAutor(nombre,obs,documento):
   autores = Autores()
   autor = Autor(documento,nombre,obs)
   autores.setAutor(autor)

def GetAutor(expresion,lista):
   autores = Autores()
   lista=autores.searchAutor(expresion)

--- end of code --

I've tried this code with python. After waiting, python said:

-- python 

 import dcAuthorDefClass
Traceback (most recent call last):
  File stdin, line 1, in ?
  File dcAuthorDefClass.py, line 7, in ?
from Products.ZCatalog.Catalog import Catalog
  File C:\Archivos de
programa\Zope\lib\python\Products\ZCatalog\__init__.py,
line 16, in ?
import ZCatalog, Catalog, CatalogAwareness, CatalogPathAwareness,
ZClasses
  File C:\Archivos de programa\Zope\lib\python\ZClasses\__init__.py,
line 20,
in ?
import ZClass
  File C:\Archivos de programa\Zope\lib\python\ZClasses\ZClass.py,
line 16, in
 ?
import Method, Basic, Property, AccessControl.Role, re
  File C:\Archivos de programa\Zope\lib\python\ZClasses\Method.py,
line 18, in
 ?
import App.Dialogs, ZClasses, App.Factory, App.Product,
App.ProductRegistry
  File C:\Archivos de programa\Zope\lib\python\App\Factory.py, line
19, in ?
import Products, Product
  File C:\Archivos de programa\Zope\lib\python\App\Product.py, line
44, in ?
from Factory import Factory
ImportError: cannot import name Factory

-- end of python 

My problem is that if I could not use a Catalog, what will I use? I
could put a set of objects into a file and recovering by the id, but
could not realize the way to search into the collection of objects and
obtaining a filtered set or list.

Another basic question. My first approach was to develop somenthing
external to Zope to put my abstractions and drive the file storage, is
this correct? Is there another way to map for example an abstraction
with a folder, another abstraction with a file and so on, and for search
using an standard catalog for example?

My last question. Supposing that anybody could help me to make the above

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

2003-09-17 Thread Fred Yankowski
On Wed, Sep 17, 2003 at 10:03:15AM -0400, Tres Seaver wrote:
 On Wed, 2003-09-17 at 07:26, Chris Withers wrote:
  Fred Yankowski wrote:
  
   python: content.meta_type == 'Filesystem Image'
  
  Do you have any content with this metatype?
   
   There is nothing in the portal_catalog with that meta_type.  But there
   are lots of objects with that type:  most everything in
   portal_skins/plone_images/, for example.
  
  Oh, I getcha now... hmmm.. since these are served from disk anyway, what would 
  be the benefit in caching them?
  
  (Dim memories suggest that OFS.Image.Image does some work to circumvent caching, 
  that's probabyl why they'er not being cached...)
 
 Two reasons:
 
   - Browser caches know about the HTTP headers, too. 
 
   - Accelerators (Squid, Apache w/ mod_proxy and caching), cache content
 to reduce load on the appserver.

Right.  I assumed all of that was obvious when I jumped into this
thread.  The CMF Caching Policy Manager object does not itself cache
any objects (unlike the RAM Cache Manager, which does) -- it merely
applies cache control headers to set the freshness of some published
objects so that downstream caches can do real caching and take some
load off of Zope, and perhaps off the network.

My original question concerned a detail of how the CMF Caching Policy
Manager interprets the 'Predicate' of a caching policy:  it seems to
interpret any 'content' object in that predicate as a reference to the
*parent* object of the object being considered for cache header
management.  That made no sense to me, and I pointed to the exact code
involved, but I still don't know if that code is the result of
Undocumented Wisdom or merely a Goof.

Meanwhile, back on the ranch, I'm getting good results with this
policy predicate:

python: content.meta_type == 'Filesystem Directory View'
  
With that, all objects in a Filesystem Directory View get cache
control headers.  The aforementioned Wisdom|Goof prevents me (AFAICT)
from discriminating different meta_types of the individual objects
within the various FSDVs, but so far one policy across all such is
just fine.

-- 
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] AW: [Summary] Caching prob with AHCM and headers

2003-09-17 Thread Fred Yankowski
On Wed, Sep 17, 2003 at 06:25:47PM -0400, Tres Seaver wrote:
 I have wanted to add a binding to the TALES namespace to allow access to
 the skin object for some time:  the current values in the namespace
 are:
 
 'content' -- the skin object's aq_parent

That definition matches the reality, but in CachingPolicyManager.py
in a comment it has this: 

'content' -- the content object itself

which I took at face value for far too long.

 I think we should be adding in another binding, perhaps 'skinned' for
 the skin object, which would allow you to filter on its metatype in your
 predicate.

I would like that.

 I typically want to have skin images, as well as javascript and CSS
 files, cached for much longer than rendered content views. YMMV.

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.

-- 
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] Beginner doubts

2003-09-17 Thread Andrew Bennetts
On Wed, Sep 17, 2003 at 04:07:01PM -0300, Emiliano Marmonti wrote:
[...]
   File C:\Archivos de programa\Zope\lib\python\App\Product.py, line
 44, in ?
 from Factory import Factory
 ImportError: cannot import name Factory
 
 -- end of python 
 
 My problem is that if I could not use a Catalog, what will I use? I

Try doing:

import OFS.Application
OFS.Application.import_products()

(Or alternatively:
import Zope
Zope.startup()
 but this opens an actual ZODB storage, etc, which you don't necessarily
 want to do.)

Catalogs are in a Product, and to use Products you must first call the above
magic.  Obviously in a running Zope this has already been done for you :)

-Andrew.


___
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] More Beginner doubts

2003-09-17 Thread Emiliano Marmonti
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

class Authors:

def  __init__:
  
if self.root.has_key( 'cat' ):
 self.cat= self.root['cat']
else:
 self.cat= Catalog()
 self.cat.aq_parent= self.root
 self.root['cat']= self.cat

### Here come the index

I could not imagine where (and how) could make the indexes. I have seen
a lot of documentation that makes references to addIndex...

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 )


[Zope-dev] Will restrictedTraverse() load every obj into memory?

2003-09-17 Thread zhimin
Hello,

I have a function that returns the object when given a path.

def path2Object(path):
obj = context,restrictedTraverse(path)
return obj

My concern is whether restrictedTraverse(path) will load into memory every
object it traverses through and thus increase memory usage, especially if
it is run very frequently and with different path each time.
e.g. if my path is '/x/y/z/myobj',  will object x, y, and z also get loaded
when the object I really want is myobj? What's the state of x,y,z after
calling restrictedTraverse(path) - loaded or ghost?

If intermediate objects (like x, y, z above) get loaded, is there anyway to
ghostify them to reduce memory usage?
...or is there a memory-economic way to get object by path?

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


Re: [Zope-dev] Will restrictedTraverse() load every obj into memory?

2003-09-17 Thread Andy McKay
Yes, thats what the catalog is for.

[EMAIL PROTECTED] wrote:
Hello,

I have a function that returns the object when given a path.

def path2Object(path):
obj = context,restrictedTraverse(path)
return obj
My concern is whether restrictedTraverse(path) will load into memory every
object it traverses through and thus increase memory usage, especially if
it is run very frequently and with different path each time.
e.g. if my path is '/x/y/z/myobj',  will object x, y, and z also get loaded
when the object I really want is myobj? What's the state of x,y,z after
calling restrictedTraverse(path) - loaded or ghost?
If intermediate objects (like x, y, z above) get loaded, is there anyway to
ghostify them to reduce memory usage?
...or is there a memory-economic way to get object by path?
Many 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 )

--
  Andy McKay
  http://www.agmweb.ca
___
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-17 Thread Tres Seaver
On Wed, 2003-09-17 at 19:10, Fred Yankowski wrote:
 On Wed, Sep 17, 2003 at 06:25:47PM -0400, Tres Seaver wrote:
  I have wanted to add a binding to the TALES namespace to allow access to
  the skin object for some time:  the current values in the namespace
  are:
  
  'content' -- the skin object's aq_parent
 
 That definition matches the reality, but in CachingPolicyManager.py
 in a comment it has this: 
 
 'content' -- the content object itself
 
 which I took at face value for far too long.

Skin objects aren't content, in the CMF, they are software, which is
the source of the semantic mismatch.  Skin images and files are somewhat
anomalous in this regard:  they are treated as skin objects because
they need to be packaged and delivered with the other skin objects, but
they don't pretend to be methods on TV as the other types do.

 
  I think we should be adding in another binding, perhaps 'skinned' for
  the skin object, which would allow you to filter on its metatype in your
  predicate.
 
 I would like that.
 
  I typically want to have skin images, as well as javascript and CSS
  files, cached for much longer than rendered content views. YMMV.
 
 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.

CMF 1.4 makes it easier to leave extensions on files, as well as images,
which means that I have often used a predicate which matches on the
suffix of the name, e.g:

  python: view.endswith( '.png' ) or view.endswith( '.css' )

Tres.
-- 
===
Tres Seaver[EMAIL PROTECTED]
Zope Corporation  Zope Dealers   http://www.zope.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 )