[Zope-dev] ZCatalog

2001-03-30 Thread Marco Nova

Hello Guys,

I'm a newbie about python and zope (about a week and a half till now), so
probably most of what I say now is probably wrong.

I was trying to customize the ZDiscussion product with file upload, editing
of previous posts and deletes of old posts and I guess I've find a bug in
the ZCatalog.uncatalogObject method.

In the code there is:

for btree in (data, paths):
try:
del btree[rid]
except KeyError:
LOG('Catalog', ERROR, ('uncatalogObject unsuccessfully '
   'attempted to delete rid %s '
   'from paths or data btree.' %
rid))
else:
try: self.__len__.change(-1)
  except AttributeError:
  pass # No managed length

that means for each successfull unindex item, the __len__ counter will be
decreased by 2, that's wrong.
The correct code should look like:

for btree in (data, paths):
try:
del btree[rid]
except KeyError:
LOG('Catalog', ERROR, ('uncatalogObject unsuccessfully '
   'attempted to delete rid %s '
   'from paths or data btree.' %
rid))
try: self.__len__.change(-1)
except AttributeError:
  pass # No managed length

Or if we want to handle situations where the unindexs are unsuccessfull, we
have to rewrite better the method with the use of transactions.

That's all.

Regards,

Marco Nova
Tera S.p.A.


P.S.

Zope Version  Zope 2.3.1b2 (binary release, python 1.5.2, win32-x86)  
Python Version  1.5.2 (#0, Jul 30 1999, 09:52:18) [MSC 32 bit (Intel)]  
System Platform  win32  

___
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] Medusa and HTTP/1.1

2001-03-30 Thread Seb Bacon

I've been yelling at my ISP (BTopenworld) for having a badly configured
transparent proxy cache, which caches all content *unless* the source
specifies otherwise.  It's been really messing up my development, and of
course it's a concern for my users too.  Hopefully they'll sort it out.

Anyway, while I was researching for ammunition, I read all the HTTP/1.1
specs (RFC2068).  Interestingly although the RFC strongly recommends
making unvalidated objects uncacheable, it stops short of forbidding it.
I wondered if it might be a good idea to make the ZServer more HTTP/1.1
compliant, by always adding validators to all objects (at present
validators are only added to image / file objects).  This is the
recommended behaviour for servers.  

In the case of the ZServer, I guess the correct behaviour would be to
have every page object return a Last-modified header, which defaults to
the modified date of the newest component of the page.  This behaviour
could then be modified using cache managers like the Accelerated HTTP
Cache Manager.  

Just wondered what anyone else thought.

seb




___
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] ZCatalog

2001-03-30 Thread Chris McDonough

 So if a a method raise an exception all the things done (that involve
zodb)
 in the method will be rolled back ?

Yes.

Actually, I need to clarify that.  ZODB doesn't handle this for you.  Zope
does.  When a request in Zope starts, a transaction is started.  If the
response is sent back without an error, the transaction is committed.  If
anything prevents the response from being sent back, the transaction is
aborted.





___
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] Problem with Hotfix 2000-10-11 on 2.1.6

2001-03-30 Thread Brian Lloyd

 If installed on 2.1.6, the product shows up as broken, since it
 tries to run
 "from OFS.ObjectManager import aq_base", which fails, since aq_base wasn't
 available in ObjectManager before 2.2.1 (!).

 Therefore I guess the Hotfix won't work for any versions prior to 2.2.1.
 According to the README, those versions are still vulnerable.


 Could somebody give me a hint if and how it's possible to backport the
 Hotfix to Zope 2.1.6 ?

You could add this to the hotfix module:

def aq_base(object):
  return getattr(object, 'aq_base', object)

...and use that instead of importing it.


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] Medusa and HTTP/1.1

2001-03-30 Thread Dieter Maurer

Seb Bacon writes:
  In the case of the ZServer, I guess the correct behaviour would be to
  have every page object return a Last-modified header, which defaults to
  the modified date of the newest component of the page.  This behaviour
  could then be modified using cache managers like the Accelerated HTTP
  Cache Manager.  
This can be quite tricky, as it is not obvious at all what are the
components of a page.


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] ANN: Proposal for ZCatalog drop-in indexes

2001-03-30 Thread Dieter Maurer

Chris McDonough writes:
  I'd like comments on this proposal if you've got the time:
  
  http://dev.zope.org/Wikis/DevSite/Proposals/DropInIndexes
Looks good.

When you are changing the indexing and catalog stuff:

  *  make the interface "index" public, such that
 it can be used from outside the ZCatalog

  *  standardize the result type of index searches
 such that partial search results can easily be
 combined

  *  provide operators "union", "intersection"
 and "difference" on search results.


What would you gain?

 We could leave the rigit search interface of the ZCatalog
 and provide flexible queries that and/or subqueries
 against different indexes.

 Especially CMFTopic would profit much from this.


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] ANN: Proposal for ZCatalog drop-in indexes

2001-03-30 Thread Chris McDonough

Thanks, Dieter, I've added these comments to the Wiki.

- Original Message - 
From: "Dieter Maurer" [EMAIL PROTECTED]
To: "Chris McDonough" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, March 30, 2001 2:52 PM
Subject: Re: [Zope-dev] ANN: Proposal for ZCatalog "drop-in" indexes


 Chris McDonough writes:
   I'd like comments on this proposal if you've got the time:
   
   http://dev.zope.org/Wikis/DevSite/Proposals/DropInIndexes
 Looks good.
 
 When you are changing the indexing and catalog stuff:
 
   *  make the interface "index" public, such that
  it can be used from outside the ZCatalog
 
   *  standardize the result type of index searches
  such that partial search results can easily be
  combined
 
   *  provide operators "union", "intersection"
  and "difference" on search results.
 
 
 What would you gain?
 
  We could leave the rigit search interface of the ZCatalog
  and provide flexible queries that and/or subqueries
  against different indexes.
 
  Especially CMFTopic would profit much from this.
 
 
 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 )
 


___
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] ANNOUNCE: Zope 2.3.1 final released

2001-03-30 Thread Brian Lloyd

Hello all,

  Zope 2.3.1 final has been released - you can download it from
  Zope.org:

http://www.zope.org/Products/Zope/2.3.1/

  Zope 2.3.1 contains fixes for a number of issues that have come up
  since 2.3.0, including the fixes for the issues addressed by the 02/23
  and 03/08 hotfixes. It also contains a number of changes to address
  issues with ZCatalog. New data structures have been introduced to reduce
  the number of conflict errors caused by object indexing under some types
  of usage, and to reduce the amount of object database bloat that occurs
  when indexed objects change frequently.

  The changes to ZCatalog have been designed so that newly created
  ZCatalog objects will take advantage of the new data structures.
  Existing ZCatalog objects will continue to work with the old
  data structures, but will not gain any of the benefits of the
  new code. It is possible to upgrade an existing ZCatalog object
  to use the new data structures by following the How-To at:

http://www.zope.org/Members/mcdonc/HowTos/UpgradeToNewCatalog

  Many thanks go to those who helped exercise the new code and
  the catalog upgrade process during the beta cycle. Many thanks as
  well to Jim Fulton, Chris McDonough and Andreas Jung for their
  hard work and the prodigious amount of unit tests produced for
  the new (and old) Catalog code!

  With the 2.3.1 release we have added a Linux Itanium binary distribution.
  Note that the Itanium binary is bundled with Python 2.0 instead of
  Python 1.5.2. This release (Zope-2.3.1-linux2-ia64-alpha.tgz) is
  named with "alpha" because it is the first for the platform. All unit
  tests pass and moderate testing has found no problems (actually, any
  problems you find are more likely to be issues with Zope on Python 2.0
  rather than issues with the platform).

  **IMPORTANT NOTE** for users of the source release or users of
  the "diff" update releases

  Users of the Zope source releases should note that this release
  contains changes to C code. If you are using a source release (or
  the source diff update), be sure to run 'w_pcgi.py' or 'wo_pcgi.py'
  as appropriate before starting Zope to ensure that your binaries
   are rebuilt.

  Also, there has been some recent work on getting Zope to run on
  the Mac OS X platform. As a result of this work, the names of
  certain C extension modules were changed to avoid symbol name
  clashes on systems with a global dynamic module namespace. The
  result of this is that if you install a diff update over an
  existing installation, you need to do a few things manually:

- If you are using a source release and apply the source
  update, visit the directories 'lib/python/BTrees' and
  'lib/python/Shared/DC/xml/pyexpat'. In each, run
  'make clean' and remove any .so files in those directories
  before rebuilding the extensions.

- If you are running a binary release and have applied the
  diff update for your platform, before restarting Zope visit
  the 'lib/python/BTrees' directory and remove any .so (or .pyd)
  files that do *not* have names beginning with an underscore and
  in the directory 'lib/python/Shared/DC/xml/pyexpat',
  remove the file 'pyexpat.so' (or .pyd)


  For more information on what is new in this release, see the
  CHANGES.txt and HISTORY.txt files for the release:


http://www.zope.org/Products/Zope/2.3.1/CHANGES.txt

http://www.zope.org/Products/Zope/2.3.1/HISTORY.txt


  Note that we have also posted "diff" updates as .tgz files
  that will let you easily upgrade an existing 2.3.x site.
  These updates are available for those currently using the
  2.3.x source release or the 2.3.x binary releases.

  To apply a differential update to your site:

- download the appropriate .tgz file from zope.org

- shutdown your Zope process

- copy the .tgz to your Zope directory and extract it

- SEE THE NOTE ABOVE!!

- run w_pcgi or wo_pcgi *if you are not using a binary release*

- restart your process


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] ZPatterns Image Archive Project

2001-03-30 Thread Michael R. Bernstein

"Phillip J. Eby" wrote:
 
 At 05:27 PM 3/30/01 -0800, Michael R. Bernstein wrote:
 Now I am working on a ArchiveImage ZClass that holds 'meta'
 information about an image, such as the description, a date,
 and keywords.
 
 I want to have one Rack for each image size that I want to
 store.
 
 Just out of curiousity, why do you want seperate racks for each size?  Are
 they being stored in different ways or have different behavioral
 requirements (e.g. different classes) apart from their size?  If not, there
 is probably no reason to have multiple racks.

Well, I want to store several versions of each image. Let's
take a simplified case where I want the original image and a
thumbnail, both of which need to appear as subobjects of the
ZClass with the meta-data.

If I store all the RackImages (originals and thumbnails) in
one Rack, how do I differentiate between them, so that
'/Archive/001/thumbnail' and 'Archive/001/original' show the
appropriate images? It just seemed simpler to create a
'thumbnail' Rack and an 'original' Rack.

 I realize that I need to tie the Racks together in the
 specialist using SkinScripts
 
 SkinScript doesn't do anything to tie racks together or to a Specialist -
 it's just a way of describing where the data comes from/goes to for a
 particular Rack.

That's what I meant, sorry. The RackImages need to appear to
be attributes of the ZClass, and I'll use SkinScripts to
accomplish that.

 Where do I put the separate Racks? do I create a specialist
 for each Rack (seems unneccessary) or do I put several Racks
 in the same Specialist?
 
 Several in the same, if they are providing objects which fill the same role
 in your overall application.

And do the RackImages Racks go into the same Specialist as
the ZClass Rack?

 The DTML I am using to instantiate RackImages in the Rack
 for example, is as follows:
 
 dtml-let ni="newItem(REQUEST.id)"
  dtml-call "ni.manage_edit(REQUEST.title,'')"
  dtml-call "ni.manage_upload(REQUEST.file)"
 /dtml-let
 
 But this code only works for a Rack named defaultRack, which
 I can obviously only have one of.
 
 Just use the name of the rack, e.g.:
 
 dtml-let ni="rackOne.newItem(REQUEST.id)", etc.

Ok, thanks! That works (Duh).

Michael Bernstein.

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