[Zope-dev] ZCatalog API

2001-09-30 Thread E. Seifert

Hi list,

as I'm not very familiar with the internals of ZCatalog I have a question to
all you API experts:

Why does ZCatalog.py (under Zope 2.4.1) specify a 'addIndex' permission for
a method called 'manage_delIndexes' although there is no such method? The
only method I could find to delete Indexes is 'manage_deleteIndex'.

Can anyone comment on this?

TIA
Erich



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

2001-09-30 Thread Steve Alexander

E. Seifert wrote:

 Hi list,
 
 as I'm not very familiar with the internals of ZCatalog I have a question to
 all you API experts:
 
 Why does ZCatalog.py (under Zope 2.4.1) specify a 'addIndex' permission for
 a method called 'manage_delIndexes' although there is no such method? The
 only method I could find to delete Indexes is 'manage_deleteIndex'.
 
 Can anyone comment on this?


Well, considering that there's these methods in ZCatalog:

   manage_addColumn
   manage_delColumns
   manage_addIndex
   manage_deleteIndex

... manage_deleteIndex is obviously the odd one out.

Especially as it allows you to delete several indexes in one go.

I suggest it be renamed manage_delIndices or manage del_Indexes.


manage_clearIndex also operates on multiple indexes, so that should 
become manage_clearIndexes.

Funnily enough, the ZCatalog regression test at
./regressiontests/regressionCatalogTiming.py uses this call:

   manage_delIndexes([x])

which supports renaming manage_deleteIndex to manage_delIndexes.

However,  while dtml/catalogIndexes.dtml uses manage_delIndexes,
./dtml/manageIndex.dtml uses manage_deleteIndex.

manage_reindexIndex should also become manage_reindexIndexes, as it 
requires a sequence of ids. Also, manage_reindexIndex doesn't have an 
associated permission.

There's a few more place this touches, although all the changes are in 
ZCatalog.py and manageIndex.dtml.


Congratulations, you've found a bug!

This would have been more obvious if ZCatalog were using the new 
declarative security assertions, as the declaration would be right next 
to the method definition.


Here's a first-draft patch, for comments etc.
I haven't looked at the documentation of the API, so that might need 
changing too.


--
Steve Alexander
Software Engineer
Cat-Box limited


*** ZCatalog.py.orig
--- ZCatalog.py
***
*** 196,202 
'manage_catalogView', 'manage_catalogFind',
'manage_catalogSchema', 'manage_catalogIndexes',
'manage_catalogAdvanced', 'manage_objectInformation',
!   
'manage_catalogReindex', 'manage_catalogFoundItems',
'manage_catalogClear', 'manage_addColumn', 'manage_delColumns',
'manage_addIndex', 'manage_delIndexes', 'manage_main',
--- 196,202 
'manage_catalogView', 'manage_catalogFind',
'manage_catalogSchema', 'manage_catalogIndexes',
'manage_catalogAdvanced', 'manage_objectInformation',
!   'manage_reindexIndexes', 'manage_clearIndexes',
'manage_catalogReindex', 'manage_catalogFoundItems',
'manage_catalogClear', 'manage_addColumn', 'manage_delColumns',
'manage_addIndex', 'manage_delIndexes', 'manage_main',
***
*** 422,430 
  RESPONSE.redirect(URL1 + 
'/manage_main?manage_tabs_message=Index%20Added')
  
  
! def manage_deleteIndex(self, ids=None, REQUEST=None, RESPONSE=None,
  URL1=None):
!  del an index 
  if not ids:
  return MessageDialog(title='No items specified',
  message='No items were specified!',
--- 422,430 
  RESPONSE.redirect(URL1 + 
'/manage_main?manage_tabs_message=Index%20Added')
  
  
! def manage_delIndexes(self, ids=None, REQUEST=None, RESPONSE=None,
  URL1=None):
!  del indexes 
  if not ids:
  return MessageDialog(title='No items specified',
  message='No items were specified!',
***
*** 436,444 
  if REQUEST and RESPONSE:
  RESPONSE.redirect(URL1 + 
'/manage_main?manage_tabs_message=Index%20Deleted')
  
! def manage_clearIndex(self, ids=None, REQUEST=None, RESPONSE=None,
  URL1=None):
!  del an index 
  if not ids:
  return MessageDialog(title='No items specified',
  message='No items were specified!',
--- 436,444 
  if REQUEST and RESPONSE:
  RESPONSE.redirect(URL1 + 
'/manage_main?manage_tabs_message=Index%20Deleted')
  
! def manage_clearIndexes(self, ids=None, REQUEST=None, RESPONSE=None,
  URL1=None):
!  clear indexes 
  if not ids:
  return MessageDialog(title='No items specified',
  message='No items were specified!',
***
*** 462,468 
  if obj is not None:
  self.catalog_object(obj, p, idxs=[name]) 
  
! def manage_reindexIndex(self, ids=None, REQUEST=None, RESPONSE=None, URL1=None):
   Reindex indexes from a ZCatalog
  if not ids:
  return MessageDialog(title='No items specified',
--- 462,468 
  if obj is not None:
  self.catalog_object(obj, p, idxs=[name]) 
  
! def manage_reindexIndexes(self, ids=None, REQUEST=None, RESPONSE=None, 
URL1=None):
   Reindex indexes from a ZCatalog
  if not ids:
  

Re: [Zope-dev] KeyError on UnIndex.keyForDocument

2001-09-30 Thread Florent Guillaume

From what I remember, it happened even after a complete catalog cleaning
and repopulation. We were using Zope 2.3.3 and CMF at the time. That was
on a production server so there was a bit of time pressure on us :) thus
the hazy recollection.

Florent Guillaume
Nuxeo


Chris McDonough  [EMAIL PROTECTED] wrote:
 Yeah, I could see this error being raised if you had just added an index 
   to use as the sort index and it didn't have all objects indexed within 
 it yet...
 
 And yes, if this is what it is, it's a bug.  But it's structural and not 
 operational... we need to think a bit about what it means to add an 
 unpopulated index to an existing catalog.  Currently you just need to 
 know that you must reindex the catalog.
 
 - C
 
 
 
 
 Florent Guillaume wrote:
  I had something like that. It turned out that I was doing a catalog
  query, sorting on an index that didn't exist on some of the objects.
  I made sure the index existed on all my objects.
  But still I'd be inclined to consider this a bug.
  
  Florent Guillaume
  Nuxeo
-- 
Florent Guillaume, Nuxeo SARL (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:[EMAIL PROTECTED]

___
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] [Bug] DateTime(string) uses GMT as timezone

2001-09-30 Thread Dieter Maurer

Unfortunately

DateTime(year,month,day) != DateTime(%d-%d-%d % (year,month,day))

The former uses the local timezone (which I think is right)
while the latter uses GMT+0 (which seems not right).

Thinks are quite bad, as the latter is used to convert
:date form values into DateTime objects.


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] [Bug] DateTime(string) uses GMT as timezone

2001-09-30 Thread Steve Alexander

Dieter Maurer wrote:

 Unfortunately
 
   DateTime(year,month,day) != DateTime(%d-%d-%d % (year,month,day))
 
 The former uses the local timezone (which I think is right)
 while the latter uses GMT+0 (which seems not right).
 
 Thinks are quite bad, as the latter is used to convert
 :date form values into DateTime objects.


See also here:

http://lists.zope.org/pipermail/zope-dev/2001-August/012974.html



I get different times from a string, depending whether I use '-' or '/'
as a date delimiter.

   from DateTime.DateTime import DateTime
   DateTime('2001-08-20').pCommonZ()
'Aug. 20, 2001 12:00 am GMT+0'
   DateTime('2001/08/20').pCommonZ()
'Aug. 20, 2001 12:00 am GMT+1'
  

I find the difference a tad surprising.

Is this a bug or a feature?

If it's a bug, I'll work on a fix.

I'm guessing this is a feature; perhaps using the '-' delimiter suggests
I'm trying to use ISO formatting.

I'm running this in a GMT+1 timezone btw.

Zope latest from CVS, Python 2.1.


I never got a reply as to whether it was a bug or a feature, so I didn't 
work on a fix.

--
Steve Alexander
Software Engineer
Cat-Box limited



___
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] Read only ZEO

2001-09-30 Thread Dieter Maurer

Tim Hoffman writes:
  In some of the overview documents discussing ZEO, there is reference
  to a ZEO client potentially mounted a ZSS in read only mode. (I want
  to have some ZEO's in read/write as well)
When you start Zope with the -R option (I think, look at
z2.py!), it is in read-only mode.

  I have been trying to work out how this might be achieved
  but have pretty much drawn a blank, has anyone done this I
  have any idea how I might go about doing such a thing.
There is a patch at

  http://www.dieter.handshake.de/pyprojects/zope

which allows Zope to be started with a read only storage.

Maybe, you can adapt it for ZEO.


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] how to accept an arbitrary parameter/anti-NIMDA script

2001-09-30 Thread Dieter Maurer

marc lindahl writes:
  I'm looking at how to get this anti-NIMDA script to work in zope (
  http://pc.xs4all.nl/default.ida)
  
  The thing is, it's called with a parameter (trying to cause a buffer
  overflow).   For example:
  
  
  /default.ida?XXX
  
  
  X%u9090%u6858%ucbd3%u7801%u9090%u6858%ucbd3%u7801%u9090%u6858%ucbd3%
  u7801%u9090%u9090%u8190%u00c3%u0003%u8b00%u531b%u53ff%u0078%u%u00=a
  
  
  That site has a default.ida which will pass back a perlscript that turns off
  that particular machine's virus under certain cases... sounds like a good
  thing.  But how can I get an object called default.ida to accept anything
  passed after the ? and what kind of object (python script?) should it be?
It can be anything with an explicit or implicit REQUEST parameter.

You can look at REQUEST.form, e.g. REQUEST.form.items().


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] how to accept an arbitrary parameter/anti-NIMDAscript

2001-09-30 Thread marc lindahl



 From: Dieter Maurer [EMAIL PROTECTED]
 thing.  But how can I get an object called default.ida to accept anything
 passed after the ? and what kind of object (python script?) should it be?
 It can be anything with an explicit or implicit REQUEST parameter.

Meaning DTML method or PythonScript, but not DTML document?


___
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] compiling Zope 2.4.1 on Mac OS 10.1

2001-09-30 Thread Mitchell L Model
Title: compiling Zope 2.4.1 on Mac OS
10.1


Trouble compiling Zope 2.4.1 on Mac OS 10.1:

installed a fresh 10.1 that I just got from
Apple

downloaded the Zope 2.4.1 src

tried 'python wo_pcgi' with both a Python 2.2a4 I just
made and with my previous Python 2.1, both with and without
sudo

Whatever I do, it breaks in the same place. Here's the end
of the output:

sed -f sedscript ./Makefile.pre.in
Makefile.pre
/usr/local/lib/python2.1/config/makesetup
\
 -m
Makefile.pre -c /usr/local/lib/python2.1/config/config.c.in Setup -n
/usr/local/lib/py\
thon2.1/config/Setup.config
/usr/local/lib/python2.1/config/Setup.local
/usr/local/lib/python2.1/co\
nfig/Setup
make -f Makefile
do-it-again
/usr/local/lib/python2.1/config/makesetup
\
 -m
Makefile.pre -c /usr/local/lib/python2.1/config/config.c.in Setup -n
/usr/local/lib/py\
thon2.1/config/Setup.config
/usr/local/lib/python2.1/config/Setup.local
/usr/local/lib/python2.1/co\
nfig/Setup
make
cc -g -O2 -Wall
-Wstrict-prototypes -I/usr/local/include/python2.1
-I/usr/local/include/python2.1 \
-DHAVE_CONFIG_H
-I../Components/ExtensionClass/src -c
././../Components/ExtensionClass/src/Extensi\
onClass.c -o
./ExtensionClass.o
In file included from
/usr/local/include/python2.1/pyport.h:84,
 from
/usr/local/include/python2.1/Python.h:54,
 from
././../Components/ExtensionClass/src/ExtensionClass.h:114,
 from
././../Components/ExtensionClass/src/ExtensionClass.c:61:
/usr/include/math.h:191: warning:
function declaration isn't a prototype
cc -bundle -undefined suppress
./ExtensionClass.o -o
./ExtensionClass.so
/usr/bin/ld: -undefined error must be
used when -twolevel_namespace is in effect
make: *** [ExtensionClass.so] Error
1
Traceback (most recent call
last):
 File wo_pcgi.py,
line 117, in ?
 File wo_pcgi.py,
line 105, in main
 File
/usr/local/src/Zope-2.4.1-src/inst/build_extensions.py,
line 102, in ?

make('lib','python')
 File
/usr/local/src/Zope-2.4.1-src/inst/do.py, line 135, in
make

do('make')
 File
/usr/local/src/Zope-2.4.1-src/inst/do.py, line 104, in
do
 if i and picky:
raise SystemError, i
SystemError: 512

The 'two-level namespace' business is a change from the OX X
developer tools version 10.0 to 10.1.

Anyone know what's going on here and how to fix it?
-- 


 --- Mitchell



Re: [Zope-dev] Zope on Windows/Mac OS X: BatteriesIncludedDistribution

2001-09-30 Thread Richard Jones

On Friday 28 September 2001 22:05, Paul Everitt wrote:
 Whew, what a proposal and what a good sign!

 As several have noted, there are quite a few proposals in the fishbowl
 that deal with different aspects of the problems.  There's also a draft
 proposal that we had here in ZC that expands on the items.  Finally,
 there appear to be a few pieces of software (yours, zctl, zopectl, etc.)
 that try to address aspects.

 I suggest that we all spend some time trying to revisit all the
 proposals, obsolete the ones that are covered elsewhere, and try to find
 the common ground.  There is a dorman zope-packagers mailing list we
 could hijack for these purposes:

http://lists.zope.org/pipermail/zope-packagers/

 I think, with all the various efforts, it is time to agree on some
 standards regarding where configuration data lives and how it looks.

OK, I've joined that list. I did not realise the worm can was this big :)


   Richard

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