Re: [Zope-dev] Re: simpler TALES. (was Re: TALES idea: tupleunpacking)

2003-08-14 Thread Paul Winkler
blargh, sorry about the .htm extension and resulting MIME confusion...
i forgot to rename it when i was done playing with it, even though
it was only really an html file for the first 5 minutes.

-- 

Paul Winkler
http://www.slinkp.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 )


Re: [Zope-dev] Zope.app() dance with 2.7

2003-08-14 Thread Erik A . Dahl
Chris,

I took the code from zopectl that is uses to do the debug thing and 
scripts now work.  Here is the code...

import os
if (os.environ.has_key('ZOPEVERSION') and
os.environ['ZOPEVERSION'] == '2.7'):
from Zope.Startup.options import ZopeOptions
from Zope.Startup import handlers as h
from App import config
opts=ZopeOptions()

opts.configfile=os.path.join(os.environ['ZOPE_HOME'],'etc/zope.conf')
opts.realize()
h.handleConfig(opts.configroot,opts.confighandlers)
config.setConfiguration(opts.configroot)
from Zope.Startup import dropPrivileges
dropPrivileges(opts.configroot)

You need to set ZOPEVERSION to 2.7 for it to work.  Is there a better 
way to figure out the current zope version?  It would be nice if the 
Zope module had a __version__ that you could check (or is there one 
somewhere else that I missed).

I'm running this against the code from cvs but I bet it would work with 
2.7.0b1

-EAD

On Thursday, August 7, 2003, at 12:18  PM, Chris Withers wrote:

Chris McDonough wrote:
You can use zopectl debug to do this.
What about when you're not debugging?

What about scripts that pump stuff into Zope and the like?

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 )


___
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] Re: [Zope] CacheManager missing in 2.6.2b4 :-(

2003-08-14 Thread Chris Withers
[moving to Zope-Dev]

Jamie Heilman wrote:
That depends on the cache replacement policy you need.  If you're not
tied to LFU then you can just switch to using my MemoryCache product.
(With all the various caveats surrounding it, of course, python 2.2,
patching Zope, etc.)  
Why Python 2.2? What's the patching you do? What's 'etc'?

Have you submitted a collector issue for all this? If so, I might try and work 
on it some time, although it's not an area I specialise in :-(
I wonder if anyone on this list could help out?

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 )


[Zope-dev] error in BTreeFolder2

2003-08-14 Thread robert
I tried to delete a couple of elements from a BTreeFolder2
and got the following traceback:

Exception traceback
Time2003/08/10 21:46:29.655 GMT+2
User Name (User Id) robert (robert)
Request URL 
http://localhost:8080/Zehnder/sonntag/portal_memberdata/manage_delObjects
Exception Type  NameError
Exception Value global name 'sys' is not defined

Traceback (innermost last):

* Module ZPublisher.Publish, line 98, in publish
* Module ZPublisher.mapply, line 88, in mapply
* Module ZPublisher.Publish, line 39, in call_object
* Module OFS.ObjectManager, line 447, in manage_delObjects
* Module Products.BTreeFolder2.BTreeFolder2, line 363, in _delObject

NameError: global name 'sys' is not defined

-- 
mit freundlichen GrĂ¼ssen

Robert Rottermann
www.redCOR.ch


___
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] security issue

2003-08-14 Thread Dieter Maurer
Toby Gustafson wrote at 2003-8-14 04:35 -0700:
  ...
 I am having a problem accessing a function defined in a product I have
  created and installed.
  ...
  From that script I try to call the
  function with the lines:
  
 from Products.StoreEvent import StoreEvent
  
 ...
  
 storeEvents = StoreEvents.searchForStoreEvents(context, ...)
  
  ...
  You are not allowed to access searchForStoreEvents in this
  context.
  
  I have read the security document at:
  
 http://www.zope.org/Documentation/Books/ZDG/current/Security.stx
  
  and have tried adding several things to my StoreEvent.__init__.py file,
  such as:
  
 modulesecurity = ModuleSecurityInfo()
 modulesecurity.declarePublic( \
   'Products.StoreEvent.searchForStoreEvents')
 modulesecurity.apply(globals())

ModuleSecurityInfo is quite complex. I do not understand it completely.

However, I see one error in your code: in your declarePublic,
one StoreEvent is missing.
Your seachForStoreEvents is at
'Products.StoreEvent.StoreEvent.searchForStoreEvents'

  However, nothing seems to work.  Anybody have any idea what I am doing
  wrong.

The AccessControl.allow_module may be simpler to use
(however, it make available the complete module content).


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] UndoSearch Timeout

2003-08-14 Thread Brian Brinegar
Hello,

We have a ZODB which is about 12 - 14 gigs when packed. We use 
FileStorage, and when anyone clicks Undo eventually times out. This is 
better now that the undoLog does not lock the database.

However if there are not enough transactions to fill the batch Undo is 
useless. So, everytime we upgrade to a new version of Zope I patch 
FileStorage.py to add a timeout. Used to be 3 seconds when the ZODB 
locked, now I've bumped it up to 10 seconds.

Has anyone else had this problem? Would adding the timeout, possibly set 
by an environment variable, be considered by the maintainers?

Thanks,
Brian Brinegar
Engineering Computer Network (ECN)
Purdue University
___
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] Packing (still) hosed in 2.6.2?

2003-08-14 Thread Jeremy Hylton
I don't recall that any of the pack bugs that we fixed caused this sort of
error.  My first guess would be that the file is a bit damaged, perhaps in a
way that the old pack did not check.

Can you run fsdump.py and see if that output sheds any light.  It will give
you a detailed text summary of all the transactions and data records.  You
could use the dump to figure out if, for example, the two numbers in the
error message are indeed transaction header locations.

Jeremy

 -Original Message-
 From: Anthony Baxter [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, August 12, 2003 4:18 AM
 To: [EMAIL PROTECTED]
 Subject: [Zope-dev] Packing (still) hosed in 2.6.2?


 I remember that 2.6 had issues with packing, but I was under the
 impression that they'd been fixed...

 However, attempting to pack a Data.fs in 2.6-current-cvs fails
 for me:

   File /export/01/zope/dev_csr_code/lib/python/ZODB/DB.py, line
 526, in pack
 try: self._storage.pack(t,referencesf)
   File
 /export/01/zope/dev_csr_code/lib/python/ZODB/FileStorage.py,
 line 1503, in pack
 opos = p.pack()
   File /export/01/zope/dev_csr_code/lib/python/ZODB/fspack.py,
 line 680, in pack
 self.gc.findReachable()
   File /export/01/zope/dev_csr_code/lib/python/ZODB/fspack.py,
 line 464, in findReachable
 self.buildPackIndex()
   File /export/01/zope/dev_csr_code/lib/python/ZODB/fspack.py,
 line 486, in buildPackIndex
 self.checkData(th, tpos, dh, pos)
   File /export/01/zope/dev_csr_code/lib/python/ZODB/fspack.py,
 line 189, in checkData
 : %d != %d, dh.tloc, tpos)
   File /export/01/zope/dev_csr_code/lib/python/ZODB/fspack.py,
 line 170, in fail
 raise CorruptedError(s)
 ZODB.fspack.CorruptedError:
 /app/zope/dev_csr_server/var/Data.fs.packtest:9200838:data record
 does not point to transaction header: 17391715 != 9200760

 This is reproducible. The particular Zope that uses this file was
 shut down cleanly before attempting to pack the DB. The code that
 fails to pack is:

 import ZODB
 from ZODB import FileStorage
 filename='/app/zope/dev_csr_server/var/Data.fs.packtest'
 store = FileStorage.FileStorage(filename)
 db = ZODB.DB(store)
 db.pack() # boom.

 Help? I'm using the ZODB that's in the current 2.6 branch of CVS
 - according
 to ZODB/__init__.py it's version 3.1.2. Is a newer version of
 ZODB going to
 help here?

 Anthony





___
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] Re: [Zope] CacheManager missing in 2.6.2b4 :-(

2003-08-14 Thread Jamie Heilman
Chris Withers wrote:
 Jamie Heilman wrote:
 That depends on the cache replacement policy you need.  If you're not
 tied to LFU then you can just switch to using my MemoryCache product.
 (With all the various caveats surrounding it, of course, python 2.2,
 patching Zope, etc.)  
 
 Why Python 2.2? What's the patching you do? What's 'etc'?

2.2 because 2.1 lacks ruthless efficiency.  The stock OFS/Cache.py is
insecure, and lacking features I want, thus, I rewrote it and included
patches to adapt the existing managers to the improved API.  There is
no third thing.

 Have you submitted a collector issue for all this? If so, I might try and 
 work on it some time, although it's not an area I specialise in :-(
 I wonder if anyone on this list could help out?

Yes and no.  Its issue 911.  Working on it would require:
$ cd your-zope-cvs-head
$ w3m -dump http://audible.transient.net/zope/Cache.py  lib/python/OFS/Cache.py
$ w3m -dump http://audible.transient.net/zope/cmassoc.diff | patch -p0
$ w3m -dump http://audible.transient.net/zope/cachemanagers.diff | patch -p0
$ # screw with the headers to lib/python/OFS/Cache.py to replace \
ZopeCorp's eyesore of a copyright preamble
$ cvs commit

Of course I'd happily invite peer review of my code.

But none of that will fix that RAM Cache Manager's waste memory.
Again, its just a choice that was made in RCM's design, less
processing overhead w/the potential for more memory usage.

-- 
Jamie Heilman   http://audible.transient.net/~jamie/
Most people wouldn't know music if it came up and bit them on the ass.
-Frank Zappa

___
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.app() dance with 2.7

2003-08-14 Thread Chris Withers
Chris McDonough wrote:
What about when you're not debugging?

What about scripts that pump stuff into Zope and the like?
That would be zopectl run.
Hmmm... for trivialities sake, say what I had before was a script called 
x.py:

import Zope
app = Zope.app()
app.Catalog.catalog_object(app.document1)
What would x.py need to look like now, and how would I use zopectl run 
to run it?

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 )


[Zope-dev] Packing (still) hosed in 2.6.2?

2003-08-14 Thread Anthony Baxter
I remember that 2.6 had issues with packing, but I was under the
impression that they'd been fixed...

However, attempting to pack a Data.fs in 2.6-current-cvs fails 
for me:

  File /export/01/zope/dev_csr_code/lib/python/ZODB/DB.py, line 526, in pack
try: self._storage.pack(t,referencesf)
  File /export/01/zope/dev_csr_code/lib/python/ZODB/FileStorage.py, line 1503, in 
pack
opos = p.pack()
  File /export/01/zope/dev_csr_code/lib/python/ZODB/fspack.py, line 680, in pack
self.gc.findReachable()
  File /export/01/zope/dev_csr_code/lib/python/ZODB/fspack.py, line 464, in 
findReachable
self.buildPackIndex()
  File /export/01/zope/dev_csr_code/lib/python/ZODB/fspack.py, line 486, in 
buildPackIndex
self.checkData(th, tpos, dh, pos)
  File /export/01/zope/dev_csr_code/lib/python/ZODB/fspack.py, line 189, in checkData
: %d != %d, dh.tloc, tpos)
  File /export/01/zope/dev_csr_code/lib/python/ZODB/fspack.py, line 170, in fail
raise CorruptedError(s)
ZODB.fspack.CorruptedError: /app/zope/dev_csr_server/var/Data.fs.packtest:9200838:data 
record does not point to transaction header: 17391715 != 9200760

This is reproducible. The particular Zope that uses this file was 
shut down cleanly before attempting to pack the DB. The code that 
fails to pack is: 

import ZODB
from ZODB import FileStorage
filename='/app/zope/dev_csr_server/var/Data.fs.packtest'
store = FileStorage.FileStorage(filename)
db = ZODB.DB(store)
db.pack() # boom.

Help? I'm using the ZODB that's in the current 2.6 branch of CVS - according
to ZODB/__init__.py it's version 3.1.2. Is a newer version of ZODB going to
help here?

Anthony


___
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] FileUpload questions

2003-08-14 Thread J Cameron Cooper


  I have been looking at the FileUpload class defined in HTTPRequest.py
but am still a little confused about how it works.
  When a form is submitted with an input type=file ..., where are the
contents of the uploaded file stored?  Is it automatically stored in the
ZODB, or is it stored in memory until some other code (like that in
Image.py) stores it?
  The reason I am asking is that I want to store uploaded files on the
file system instead of in the ZODB.  (We are running Zope behind an Apache
web server, so the uploaded files will be placed under Apache's document
root so they can be served directly by Apache.)  Being new to Zope and
Python, it is not clear to me exactly how to go about this.
 

Don't bother mucking around in the core. The right way to do it is to 
use a Product that stores data on the fiesystem, acting as a facade.

Look at LocalFS, ExtFile/ExtImage, ExternalFile, and possibly APE. 
Probably LocalFS or ExternalFile are most interesting to you.

http://sourceforge.net/projects/localfs
http://zope.org/Members/arielpartners/ExternalFile
http://zope.org/Members/MacGregor/ExtFile
http://hathaway.freezope.org/Software/Ape
 --jcc

___
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] Re: [Zope] CacheManager missing in 2.6.2b4 :-(

2003-08-14 Thread Jamie Heilman
Chris Withers wrote:
 Jamie Heilman wrote:
 2.2 because 2.1 lacks ruthless efficiency.
 
 That, on its own, is not a very helpful statement ;-)
 What are the differences between 2.1 and 2.2 that you care about?

2.2 is installed on my machines, 2.1 isn't.  It might work in 2.1 for
all I know, but I'm not going to bother back-patch it even if it is
possible, I'm simply not interested in supporting old versions of
Python.  (and no, I don't run Zope 2.6.x)
 
 The stock OFS/Cache.py is
 insecure, and lacking features I want, thus, I rewrote it and included
 patches to adapt the existing managers to the improved API.  There is
 no third thing.
 
 Have you got a collector issue / Fishbowl proposal anywhere that is 
 looking to get this accepted? What reasons could people have for not 
 liking this new Cache.py?

Yes, No, Read the collector issue.

 $ # screw with the headers to lib/python/OFS/Cache.py to replace \
 ZopeCorp's eyesore of a copyright preamble
 
 With what? This kind of comment is a bit inflamatory and not at all 
 helpful :-(

I'm just saying don't forget to add the preamble if you do check it in
over the old library.  (my Cache.py doesn't have it)  Or don't.  I
don't care either way.

-- 
Jamie Heilman   http://audible.transient.net/~jamie/
It's almost impossible to overestimate the unimportance of most things.
-John Logue

___
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] Re: simpler TALES. (was Re: TALES idea: tupleunpacking)

2003-08-14 Thread Shane Hathaway
Paul Winkler wrote:
On Wed, Jul 30, 2003 at 04:49:19PM -0400, Shane Hathaway wrote:
If you want to look for a solution, consider using *only* Python 
expressions--no path expressions.  You'll get a lot of mileage that way, 
but at the expense of syntax clashes.  Who knows, you might find a 
pretty good solution.


This stuff is hard :-\   Attached is what I've been able to come up with.
(ducking)
I must say that using only Python expressions is crippling in a couple 
of ways.  First, it's not true Python if you're only allowed to write 
expressions.  Many language features require statements.  Second, we 
established earlier that Python expressions in templates should have a 
python: prefix, but if every expression uses it, it would be 
repetitious enough to be annoying.

Python's syntax is good, but there are certain uses it doesn't cover 
well.  As another example of something Python syntax doesn't quite fit, 
I've been pondering lately how to translate the ever-useful 'find' shell 
command into Python function calls.  The Python version always seems to 
come out a lot more complicated.

find . -name '.*' -a -type d -prune -o -name '*.py' -print

Shane

___
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] ZCVSMixin Import Error

2003-08-14 Thread Declan Shanaghy
Has anyone ever got an error similar to the one below when
trying to import files thru ZCVSMixin (AFTER they were
exported from same application)
The file was not modified in any way but it refuses to
re-import after being exported.



Failed Imports
/var/workspace//350nice/products/orderitnice/zopecontent/portal_skins/orderitnice/Contacts/addAddress.xml



Failed Messages
Traceback (most recent call last):
  File
/var/workspace/350nice/zope/lib/python/Products/ZCVSMixin/ZCVSMixin.py,
line 924, in filesToObjects
ob=self._container_p_jar().importFile(fname)
  File
/var/workspace/350nice/zope/lib/python/ZODB/ExportImport.py,
line 72, in importFile
raise POSException.ExportError, 'Invalid export header'
ExportError: Invalid export header

___
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] Packing (still) hosed in 2.6.2?

2003-08-14 Thread Dieter Maurer
Anthony Baxter wrote at 2003-8-12 18:18 +1000:
  I remember that 2.6 had issues with packing, but I was under the
  impression that they'd been fixed...
  
  However, attempting to pack a Data.fs in 2.6-current-cvs fails 
  for me:
  ...
  raise CorruptedError(s)
  ZODB.fspack.CorruptedError: 
  /app/zope/dev_csr_server/var/Data.fs.packtest:9200838:data record does not point to 
  transaction header: 17391715 != 9200760
  
  This is reproducible. The particular Zope that uses this file was 
  shut down cleanly before attempting to pack the DB. The code that 
  fails to pack is: 

Maybe, the Data.fs was already corrupted before you
switched to 2.6.2.

Does the problem remain after a fsrecover?


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 )


Re: [Zope-dev] error in BTreeFolder2

2003-08-14 Thread Shane Hathaway
robert wrote:
I tried to delete a couple of elements from a BTreeFolder2
and got the following traceback:
Exception traceback
Time2003/08/10 21:46:29.655 GMT+2
User Name (User Id) robert (robert)
Request URL 
http://localhost:8080/Zehnder/sonntag/portal_memberdata/manage_delObjects
Exception Type  NameError
Exception Value global name 'sys' is not defined
Traceback (innermost last):

* Module ZPublisher.Publish, line 98, in publish
* Module ZPublisher.mapply, line 88, in mapply
* Module ZPublisher.Publish, line 39, in call_object
* Module OFS.ObjectManager, line 447, in manage_delObjects
* Module Products.BTreeFolder2.BTreeFolder2, line 363, in _delObject
NameError: global name 'sys' is not defined
A more recent version of BTreeFolder2 fixes this.

http://hathaway.freezope.org/Software/BTreeFolder2

Shane

___
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] pre-export and post-import hooks.

2003-08-14 Thread Romain Slootmaekers
Yo,

I have an object for which I'd like to have pre-export and post 
import-hooks.

After some code browsing, I found the ObjectManager api with
the manage_exportObject method.
overwriting this for the export looks good, but the problem is that this 
only works when called directly on the object, and not when you export a 
container of the object in question.

Is there an easy solution to this problem ?

Romain Slootmaekers







___
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] security issue

2003-08-14 Thread Toby Gustafson

Hello,

   I am having a problem accessing a function defined in a product I have
created and installed.

   The product is called StoreEvent, and it was created using the
PloneMinimalInstall as a guide.

   In the StoreEvent product is a file called StoreEvent, which contains a
function searchForStoreEvents.  This function is outside of the StoreEvent
class which is also defined in the file.

   I have created a page template which contains a form, and when the form
is submitted, a script is executed.  From that script I try to call the
function with the lines:

   from Products.StoreEvent import StoreEvent

   ...

   storeEvents = StoreEvents.searchForStoreEvents(context, ...)

When I bring up the page and submit it, I get a popup asking me to enter a
username and password.  When I cancel that, I get an error page with the
message You are not allowed to access searchForStoreEvents in this
context.

I have read the security document at:

   http://www.zope.org/Documentation/Books/ZDG/current/Security.stx

and have tried adding several things to my StoreEvent.__init__.py file,
such as:

   modulesecurity = ModuleSecurityInfo()
   modulesecurity.declarePublic( \
 'Products.StoreEvent.searchForStoreEvents')
   modulesecurity.apply(globals())

However, nothing seems to work.  Anybody have any idea what I am doing
wrong.

Thanks in advance,
--Toby.
---
Toby Gustafson
Senior Software Engineer
Tyrell Software Corporation
Email: [EMAIL PROTECTED]
---



___
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] FileUpload questions

2003-08-14 Thread Jamie Heilman
Toby Gustafson wrote:
When a form is submitted with an input type=file ..., where are the
 contents of the uploaded file stored?  Is it automatically stored in the
 ZODB, or is it stored in memory until some other code (like that in
 Image.py) stores it?

Its stored in a temporary file as defined by the tempfile module.

-- 
Jamie Heilman   http://audible.transient.net/~jamie/
We must be born with an intuition of mortality.  Before we know the words
 for it, before we know there are words, out we come bloodied and squalling
 with the knowledge that for all the compasses in the world, there's only
 one direction, and time is its only measure.  -Rosencrantz

___
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] FileUpload questions

2003-08-14 Thread Toby Gustafson
Hello,

   I have been looking at the FileUpload class defined in HTTPRequest.py
but am still a little confused about how it works.

   When a form is submitted with an input type=file ..., where are the
contents of the uploaded file stored?  Is it automatically stored in the
ZODB, or is it stored in memory until some other code (like that in
Image.py) stores it?

   The reason I am asking is that I want to store uploaded files on the
file system instead of in the ZODB.  (We are running Zope behind an Apache
web server, so the uploaded files will be placed under Apache's document
root so they can be served directly by Apache.)  Being new to Zope and
Python, it is not clear to me exactly how to go about this.

   Any suggestions would be appreciated, or if somebody knows where there
is some sample code and could point me to it, that would be great too.

Thanks,
--Toby.
---
Toby Gustafson
Senior Software Engineer
Tyrell Software Corporation
Email: [EMAIL PROTECTED]
---


___
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] pre-export and post-import hooks.

2003-08-14 Thread Dieter Maurer
Romain Slootmaekers wrote at 2003-8-11 13:44 +0200:
  I have an object for which I'd like to have pre-export and post 
  import-hooks.
  
  After some code browsing, I found the ObjectManager api with
  the manage_exportObject method.
  
  overwriting this for the export looks good, but the problem is that this 
  only works when called directly on the object, and not when you export a 
  container of the object in question.
  
  Is there an easy solution to this problem ?

I do not think so.

The APE code (one of Shanes famous products) may show you how to
proceed, when you really need it.


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] why cant i import types

2003-08-14 Thread Declan Shanaghy
Can someone tell me why i cant import types into my python
script in CMF?
When i put either of the following lines as the first line
of my script i get the error that follows

from types import * - produces
Error Type: ImportError
Error Value: from types import * is not allowed

from types import ListType - produces
Error Type: ImportError
Error Value: import of ListType from types is
unauthorized. You are not allowed to access ListType in
this context


___
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] FileUpload questions

2003-08-14 Thread Declan Shanaghy
Its handy enough to implement.

lets say your file parameter is called 'file'...

#os_uploadCacheImage is a Zope External method.
if request.has_key('file'):
  context.os_uploadCacheImage(context.PATH_CACHE,
request['file'], request['file'].filename)

#co-responding implementation for zope external method
os_uploadCacheImage
def uploadCacheImage(self, basePath, file, filename):
  cacheFile = open(basePath + / + filename, wb)
  cacheFile.write(file.read())
  cacheFile.close()


--- J Cameron Cooper [EMAIL PROTECTED] wrote:
 
 
I have been looking at the FileUpload class defined
 in HTTPRequest.py
 but am still a little confused about how it works.
 
When a form is submitted with an input type=file
 ..., where are the
 contents of the uploaded file stored?  Is it
 automatically stored in the
 ZODB, or is it stored in memory until some other code
 (like that in
 Image.py) stores it?
 
The reason I am asking is that I want to store
 uploaded files on the
 file system instead of in the ZODB.  (We are running
 Zope behind an Apache
 web server, so the uploaded files will be placed under
 Apache's document
 root so they can be served directly by Apache.)  Being
 new to Zope and
 Python, it is not clear to me exactly how to go about
 this.
   
 
 Don't bother mucking around in the core. The right way to
 do it is to 
 use a Product that stores data on the fiesystem, acting
 as a facade.
 
 Look at LocalFS, ExtFile/ExtImage, ExternalFile, and
 possibly APE. 
 Probably LocalFS or ExternalFile are most interesting to
 you.
 
 http://sourceforge.net/projects/localfs
 http://zope.org/Members/arielpartners/ExternalFile
 http://zope.org/Members/MacGregor/ExtFile
 http://hathaway.freezope.org/Software/Ape
 
   --jcc
 
 
 ___
 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 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.app() dance with 2.7

2003-08-14 Thread Chris Withers
Chris McDonough wrote:
You can use zopectl debug to do this.
What about when you're not debugging?

What about scripts that pump stuff into Zope and the like?

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] why cant i import types

2003-08-14 Thread robert
For security reasons many of the standard libraries are not allowd to be used 
in Zope. Types is one of them.
You can declare a library as save for use in a python script. How I can not 
say without consulting the documentation.
Robert
Am Friday 15 August 2003 04:18 schrieb Declan Shanaghy:
 Can someone tell me why i cant import types into my python
 script in CMF?
 When i put either of the following lines as the first line
 of my script i get the error that follows

 from types import * - produces
 Error Type: ImportError
 Error Value: from types import * is not allowed

 from types import ListType - produces
 Error Type: ImportError
 Error Value: import of ListType from types is
 unauthorized. You are not allowed to access ListType in
 this context


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

-- 
mit freundlichen GrĂ¼ssen

Robert Rottermann
www.redCOR.ch


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