Re: [Zope-dev] Setting vars in expression eval() namespace

2001-02-22 Thread Steve Alexander

Julio Maia wrote:

  Hi,
 
  I'm trying to create a tag to evaluate the expression passed to it,
  adding in the expression eval namespace a variable that contains
  the result of dtml processing of the tag's block. For instance, the
   following construct:
 
  dtml-bvar "foo(a=1)" var="block"
some text dtml-var "1+2"
  /dtml-bvar
 
  would invoke the expression "foo(a=1)" with a variable named 'block'
   set to 'some text 3' in the expression's namespace (btw, is it
  possible to achieve this using regular dtml?).

This may be too simple example, but how about:

dtml-var "foo(a=1, block=('some text %s' % (1+2)))"

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net


___
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] Setting vars in expression eval() namespace

2001-02-22 Thread Julio Maia

On Wed, Feb 21, 2001 at 10:53:54PM +, Steve Alexander wrote:
 Julio Maia wrote:
 
  
  This is not going to be handy once the block is composed by a large dtml
  block. I wonder if dtml-var shouldn't support the syntax I've described
  above.
 
 I suggest instead using a PythonScript, and using the DTML class that you
 can import from the Products.PythonScripts.standard module.
 
 You can use this to render DTML on the fly, as you wish.

I guess it would be better to allow constructs as:

dtml-var "table('main','col')"
   dtml-var "font('standard')"Some text/dtml-var 
/dtml-var

Where 'table' and 'font' are PythonScripts that return the implicit blocks passed to 
them (these blocks may have a default variable name in the expression's namespaces) 
enclosed by the correspondent html blocks, with the format ('main, 'standard') mapped 
to html attributes/values using some dictionaries. This could help to separate logic 
and presentation in dtml code with a minor syntax addition.

___
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] DTML Documents/Folders in ZClasses fail to accessanything

2001-02-22 Thread Itai Tavor

Steve Alexander wrote:

Itai Tavor wrote:

Hi,

I got a ZClass 'Test', with a DTML Method 'view' containing 
dtml-var id, and a DTML Document 'view2' with the same line. 
instance/view works. instance/view2 returns (ZDebug output):

From SimpleItem.py:

"""Direct use of the 'id' attribute is deprecated - use getId()"""

The difference you're seeing is because the DTML Method is acquiring the
id attribute, whereas you're getting the DTML Document's own id
attribute.

Thanks, but it's got nothing to do with getId... I just used id 
because it's easy to write. I get the same behavior if I try to view 
meta_type, or a property that is defined on a propertysheet in the 
ZClass. And the fact that the DTML Document uses its own attributes 
shouldn't cause Unauthorized, should it? It should just show a 
different attribute, or acquire the attribute if it doesn't have it.

I just tried it again with a clean install of Zope 2.3.0. In a DTML 
Document, this works (name is a property in the ZClass propertysheet):

dtml-with "PARENTS[0]"
   dtml-var name
   dtml-var meta_type
/dtml-with

But these fail with Unauthorized: dtml-var name, dtml-var 
meta_type. The dtml-var title_or_id in standard_html_header fails 
as well.

I also repeated the folder test: In a DTML Method stored inside a 
folder in the ZClass, dtml-var name works, but dtml-var 
title_or_id fails.

So what do we have? I can't use title_or_id on DTML Documents, so 
it's useless for use in standard_html_header (and title_or_id uses 
getId, so it should work). I can't access ZClass properties from the 
DTML Document unless I use dtml-with - meaning no acquisition. And I 
can't access properties of the DTML Document (like meta_type) unless 
they are accessed using a method call (like getId()). This can't be 
right.

I find it hard to believe that if this is really a bug, it didn't 
bother anybody else until now. On the other hand, these tests seem to 
show a problem with security checks on objects in ZClasses that 
create their own context. So what am I still missing here?

Itai
-- 
--
Itai Tavor  -- "Je sautille, donc je suis."--
[EMAIL PROTECTED]--   - Kermit the Frog --
-- --
-- "If you haven't got your health, you haven't got anything"  --


___
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] Setting vars in expression eval() namespace

2001-02-22 Thread Steve Alexander

Julio Maia wrote:

 
 This is not going to be handy once the block is composed by a large dtml
 block. I wonder if dtml-var shouldn't support the syntax I've described
 above.

I suggest instead using a PythonScript, and using the DTML class that you
can import from the Products.PythonScripts.standard module.

You can use this to render DTML on the fly, as you wish.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net
 
 



___
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] Setting vars in expression eval() namespace

2001-02-22 Thread Julio Maia

On Wed, Feb 21, 2001 at 10:24:57PM +, Steve Alexander wrote:
 Julio Maia wrote:
 
   Hi,
  
   I'm trying to create a tag to evaluate the expression passed to it,
   adding in the expression eval namespace a variable that contains
   the result of dtml processing of the tag's block. For instance, the
following construct:
  
   dtml-bvar "foo(a=1)" var="block"
 some text dtml-var "1+2"
   /dtml-bvar
  
   would invoke the expression "foo(a=1)" with a variable named 'block'
set to 'some text 3' in the expression's namespace (btw, is it
   possible to achieve this using regular dtml?).
 
 This may be too simple example, but how about:
 
 dtml-var "foo(a=1, block=('some text %s' % (1+2)))"

This is not going to be handy once the block is composed by a large dtml block. I 
wonder if dtml-var shouldn't support the syntax I've described above.

 
 --
 Steve Alexander
 Software Engineer
 Cat-Box limited
 http://www.cat-box.net
 
 

___
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] initializing objects in ZPatterns

2001-02-22 Thread Steve Alexander

Christian Scholz wrote:

 Hi!
 
 I just encountered another problem with ZPatterns (well not exactly with ZPatterns
 but the way I use it.. ;-)
 
 I have some Specialist with a normal rack which stores data persistently in the ZODB.
 Everytime I am creating a new object I want to create an object of another specialist
 on the fly and store it's id inside my first object.
 
 Thus I have setup a SkinScript with the following content:
 
 
   INITIALIZE OBJECT WITH company_address=addresses.createAddress()
 
   WITH addresses.getItem(self.company_address) COMPUTE company_addr=RESULT
 
   STORE company_address IN SELF
 
 The createAddress is called actually and it returns the ID of the new object
 (thus the object is created). Unfortunately the id is not stored inside
 company_address. After reading the new object again this value is still empty
 (and thus also no address object is return by the address specialist). Same happens
 when just using some dummy property and filling it with a fixed string. This
 also disappears..

To get company_address stored, you can probably do something like:

  your_object.manage_changeProperties(company_address=your_object.company_address)

or possibly your_object.propertysheets.NameOfSheet.manage_changeProperties...
depending on what kind of object you're using.

You could have this as a trigger:

WHEN OBJECT ADDED CALL
  self.manage_changeProperties(company_address=self.company_address)


As for whether it is a bug, the implementation of the INITALIZE clause just puts
its attributes directly into the DataSkin's attribute-cache. It appears to be
designed for the behaviour that you see.

You could get the behaviour that you want by making the implementation actually
set the attributes instead. I'm not sure what the other implications of doing
that are, though.

If you're interested, the code is in

  lib/python/Products/ZPatterns/SkinScript/Components.py
about line 71.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net




___
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] usability bug concerning database connections?

2001-02-22 Thread Jim Penny

 regarding Zope 2.3.0:

 I removed a database connection from a top level
 (there is a second one).

 All my ZSQL methods were connected to the first one.
 The user interface now looks like if the second one is
 connected (it is shown as Connection Id). This is confusing.

 It would be better to have some indicator for the broken
 status of the ZSQL methods.

 Just a small bug report :-)

 Jan

Seconded, and it would be really nice to be able to search
by connection ID!  Then if you were changing DA's, you could
find the ones that needed to be changed rather than waiting
for breakage.

Jim Penny


___
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] usability bug concerning database connections?

2001-02-22 Thread Jan-Oliver Wagner

Hi,

regarding Zope 2.3.0:

I removed a database connection from a top level
(there is a second one).

All my ZSQL methods were connected to the first one.
The user interface now looks like if the second one is
connected (it is shown as Connection Id). This is confusing.

It would be better to have some indicator for the broken
status of the ZSQL methods.

Just a small bug report :-)

Jan

-- 
Jan-Oliver Wagner   http://intevation.de/~jan/

Intevation GmbH  http://intevation.de/
FreeGIShttp://freegis.org/

___
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] Acquisition muddleness solved!

2001-02-22 Thread richard

[EMAIL PROTECTED] wrote:
 A simple enough scenario:
 Python 1.5.2 (#1, Sep 30 2000, 18:08:36)  [GCC 2.95.3 19991030
 (prerelease)] on linux-i386
 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
  import ExtensionClass
  import Acquisition
  class A(ExtensionClass.Base):
 ...  def foo(self):
 ...   print repr(self), type(self)
 ...
  class B(Acquisition.Implicit):
 ...  pass
 ...
  a=A()
  print repr(a), type(a)
 A instance at 80ec588 extension class __main__.A at 80eb1e0
  a.b=B()
  print repr(a.b), type(a.b)
 B instance at 80dc9c0 extension class
 Acquisition.ImplicitAcquirerWrapper at 401460e0
  a.b.foo()
 A instance at 80ec588 extension class __main__.A at 80eb1e0
 
 Now, I would've expected to see a.b.foo() print out exactly the same
 information as repr(a.b), type(a.b). In fact, I even scrounged up the
 Acquisition doc (it really isn't that easy to find these days...) and I can
 quote from it in support of what I believe should be happening:
 
 '''
   Acquisition and methods
 
 Python methods of objects that support acquisition can use
 acquired attributes as in the 'report' method of the first example
 above.  When a Python method is called on an object that is
 wrapped by an acquisition wrapper, the wrapper is passed to the
 method as the first argument.  This rule also applies to
 user-defined method types and to C methods defined in pure mix-in
 classes.
 '''

OK, I figured it out. The method foo requires an instance of A to work, and
a.b isn't one, but a is.

Makes life a little more difficult, but at least we know how it works now.


Richard

-- 
Richard Jones
[EMAIL PROTECTED]
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)

___
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 Lazy Results

2001-02-22 Thread Johan Carlsson

 Casey Duncan [EMAIL PROTECTED] wrote:
  
  Yes, you always get all the meta-data. However, does
  anyone know how the "used" argument of
  ZCatalog.searchResults works, or why you would use it?
 
 'used' tells you the names of the indexes which actually
 participated in the search (as distinct from those you
 asked for).

What does this meen?

Example, What's the different between:

  searchResults(used=(index1,index2), index1='kalle', index2='kaviar')

and;

  searchResults(index1='kalle', index2='kaviar')


(Are used supposed to be a tuple?)

TIA,
Johan Carlsson


___
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] ZClass - Python Product

2001-02-22 Thread Tom Deprez

Hi,

Is there a way to convert a running application with ZClass to Python
Products without loosing data?

Even better :

Is there a tool which converts a ZClass in a rough Python Product Code? So
that we've already the python source code and only have to make to code
cleaner?

Thanks in advance,

Tom.


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

2001-02-22 Thread Chris Withers

Johan Carlsson wrote:
 
  Casey Duncan [EMAIL PROTECTED] wrote:
  
   Yes, you always get all the meta-data. However, does
   anyone know how the "used" argument of
   ZCatalog.searchResults works, or why you would use it?
 
  'used' tells you the names of the indexes which actually
  participated in the search (as distinct from those you
  asked for).
 
 What does this meen?
 
 Example, What's the different between:
 
   searchResults(used=(index1,index2), index1='kalle', index2='kaviar')
 
 and;

Damn, where's this documented?
I think this is _exactly_ what I've been looking for for ages, especially, I'm
guessing, that if you don't specify 'used' then:

1. It's assumed all indexes take part in the search
2. All parameters that aren't supplied are assumed to be blank, and therefore
will match anything?

Am I on the right track?

Furthermore, is there any way I can tell ZCatalog that nothing means nothing,
not everything?

For example, if I do searchResults(age=''), I want only records with a blank age
record, _not_ all the records.

Okay while I'm here, one final one.

We have the sort_on and sort_order parameters, they'll return stuff ordered
like:

Aardvark
Badger
anteater
bird

Whereas most humans would think the following would be more readable:

Aardvark
anteater
Badger
bird

I guess ZCatalog uses cmp somewhere along the line. IS there any way I can pass
in a different cmp function for a given index?

Hah, just thought of one last one ;-)

Okay, we have sort_on, which lets me sort on one index. Is there any way I can
provide a secondary sort key?

something like
searchResults(age='',sort_on=(('lastname','normal'),('firstname','normal'),'('salary','reverse')))
would eb a dream.

Wow, that turned into a ZCatalog wishlist... any ideas if any of it is
available, and if not, hwo hard it would be to achieve?

cheers,

Chris

___
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 Lazy Results

2001-02-22 Thread Tres Seaver

On Thu, 22 Feb 2001, Johan Carlsson wrote:

  Casey Duncan [EMAIL PROTECTED] wrote:
   
   Yes, you always get all the meta-data. However, does
   anyone know how the "used" argument of
   ZCatalog.searchResults works, or why you would use it?
  
  'used' tells you the names of the indexes which actually
  participated in the search (as distinct from those you
  asked for).
 
 What does this meen?
 
 Example, What's the different between:
 
   searchResults(used=(index1,index2), index1='kalle', index2='kaviar')
 
 and;
 
   searchResults(index1='kalle', index2='kaviar')

There is no practical difference, unless you are "federating"
queries across multiple catalogs;  the 'used' parameter is there
solely to accumulate a record of the indices used in the search.
 
 (Are used supposed to be a tuple?)

It should be something supporting the mapping interface.  Here is
how it is used (from 'lib/python/Products/ZCatalog/Catalog.py'):

  if used is None: used={}
  for i in self.indexes.keys():
  try:
  index = self.indexes[i].__of__(self)
  if hasattr(index,'_apply_index'):
  r=index._apply_index(args)
  if r is not None:
  r, u = r
  for name in u:
  used[name]=1

In other words, "Nothing to see here;  move along." :)

Tres.
-- 
===
Tres Seaver[EMAIL PROTECTED]
Digital Creations "Zope Dealers"   http://www.zope.org


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

2001-02-22 Thread Chris Withers

Tres Seaver wrote:
 
 Chris, this necrohippophilic sadism has to stop!

Erm? I think my education is lacking... what does that mean? :-S

 "most humeans"
 does *not* map to "English speakers who prefer case-insensitive
 collation."

I disagree but it's not worth arguing about. However, the people who pay my
salary feel that way which means I care ;-)

 case-insensitive search / sort, then create a method on your
 object which does the approprate case-flattening, and index that
 instead of the "real" attribute.

Thanks, I always forget the flexibility of ZCatalog :-) That said, how hard
would it be to alter ZCatalog so you could override the comparison function it
uses? It feels like a ,cmp=cmp argument to the added search index consructor,
then a self._cmp = cmp in the constructor, followed by a query and replace on
cmp with self._cmp in the search index source. But I might be completely wrong
:-(

Apart from that, any ideas how I'd search for a record where the indexed
attribute is blank or the secondary sort stuff?

cheers,

Chris

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

2001-02-22 Thread Steve Alexander

Chris Withers wrote:

 Tres Seaver wrote:
 
 Chris, this necrohippophilic sadism has to stop!
 
 
 Erm? I think my education is lacking... what does that mean? :-S

necrohippo philic sadism
dead-horse-loving act of deliberate harm upon

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net


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

2001-02-22 Thread Tres Seaver

On Thu, 22 Feb 2001, Chris Withers wrote:

 Tres Seaver wrote:
  
  Chris, this necrohippophilic sadism has to stop!
 
 Erm? I think my education is lacking... what does that mean? :-S

"Beating a dead horse". :)

  "most humeans"
  does *not* map to "English speakers who prefer case-insensitive
  collation."
 
 I disagree but it's not worth arguing about. However, the
 people who pay my salary feel that way which means I care ;-)
 
  case-insensitive search / sort, then create a method on your
  object which does the approprate case-flattening, and index that
  instead of the "real" attribute.
 
 Thanks, I always forget the flexibility of ZCatalog :-) That
 said, how hard would it be to alter ZCatalog so you could
 override the comparison function it uses? It feels like a
 ,cmp=cmp argument to the added search index consructor, then a
 self._cmp = cmp in the constructor, followed by a query and
 replace on cmp with self._cmp in the search index source. But I
 might be completely wrong :-(

The comparison function is built into the structure the  of the
index, and is not swappable "on-the-fly".  When the catalog
allows "drop-in" indexes, then you could define a
CaseInsensitifeUnIndex class which implemented the semantics you
prefer (but I still think it should be done at the application
level, as I described above).
 
 Apart from that, any ideas how I'd search for a record where
 the indexed attribute is blank or the secondary sort stuff?

"Trust the source, Luke!" is the best answer I've got.

Tres.
-- 
===
Tres Seaver[EMAIL PROTECTED]
Digital Creations "Zope Dealers"   http://www.zope.org


___
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] ZCatalog madness. (Must log in as emergencyuser.)

2001-02-22 Thread Erik Enge

Right.

This is the traceback I get, after doing a search (searchResults) - which
goes fine by teh way - and then trying to do an
getobject(x.data_record_id_) as a non-emergencyuser user get up an login
box and press escape:

Unauthorized

Sorry, a Zope error occurred.

Traceback (innermost last):
  File
/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
222, in publish_module
  File
/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
187, in publish
  File
/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
171, in publish
  File /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/mapply.py,
line 160, in mapply
(Object: candidate_search)
  File
/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
112, in call_object
(Object: candidate_search)
  File /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/OFS/DTMLMethod.py,
line 189, in __call__
(Object: candidate_search)
  File
/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/DocumentTemplate/DT_String.py,
line 538, in __call__
(Object: candidate_search)
  File
/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/DocumentTemplate/DT_In.py,
line 702, in renderwob
(Object: candidateEngine(REQUEST))
Unauthorized: 0

Right.  Your average unauthorized I should think.  Next, if I log in as
the emergencyuser, this is what I get: 

Traceback (innermost last):
  File
/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
222, in publish_module
  File
/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
187, in publish
  File /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/Zope/__init__.py,
line 221, in zpublisher_exception_hook
(Object: Traversable)
  File
/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
171, in publish
  File /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/mapply.py,
line 160, in mapply
(Object: candidate_search)
  File
/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
112, in call_object
(Object: candidate_search)
  File /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/OFS/DTMLMethod.py,
line 189, in __call__
(Object: candidate_search)
  File
/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/DocumentTemplate/DT_String.py,
line 538, in __call__
(Object: candidate_search)
  File
/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/DocumentTemplate/DT_In.py,
line 711, in renderwob
(Object: candidateEngine(REQUEST))
  File /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/OFS/Traversable.py,
line 107, in absolute_url
(Object: CatalogAware)
AttributeError: (see above)

Error Type: AttributeError
Error Value: 'string' object has no attribute 'get'


The get thing is probably from me trying to call absolute_url on the
objects it returns.  Calling atributes works, though.

Strange.  Doing getobject as a non-emergencyuser doesn't owrk, and when I
have logged in the objects I get seems to be somewhat fubar.

Help is greatly appretiated. 

(PS.  I seem to recall a checkin in hte CVS about unrestrictedTraverse in
one of the files belonging to the Catalog, could this has something to do
with it?)

Zope 2.3.1b1 on Linux.


___
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] initializing objects in ZPatterns

2001-02-22 Thread Christian Scholz

Hi!

  I just encountered another problem with ZPatterns (well not exactly with ZPatterns
  but the way I use it.. ;-)
  
  I have some Specialist with a normal rack which stores data persistently in the 
ZODB.
  Everytime I am creating a new object I want to create an object of another 
specialist
  on the fly and store it's id inside my first object.
  
  Thus I have setup a SkinScript with the following content:
  
  
INITIALIZE OBJECT WITH company_address=addresses.createAddress()
  
WITH addresses.getItem(self.company_address) COMPUTE company_addr=RESULT
  
STORE company_address IN SELF
  
  The createAddress is called actually and it returns the ID of the new object
  (thus the object is created). Unfortunately the id is not stored inside
  company_address. After reading the new object again this value is still empty
  (and thus also no address object is return by the address specialist). Same happens
  when just using some dummy property and filling it with a fixed string. This
  also disappears..
 
 To get company_address stored, you can probably do something like:
 
   your_object.manage_changeProperties(company_address=your_object.company_address)
 
 or possibly your_object.propertysheets.NameOfSheet.manage_changeProperties...
 depending on what kind of object you're using.
 
 You could have this as a trigger:
 
 WHEN OBJECT ADDED CALL
   self.manage_changeProperties(company_address=self.company_address)

Well, the first one seems to work, but the SkinScript trigger does not unfortunately.
So I will try to incorporate this into my other code (which is a bit more tricky
as I automated all the property handling stuff). But thanks anyway!

 As for whether it is a bug, the implementation of the INITALIZE clause just puts
 its attributes directly into the DataSkin's attribute-cache. It appears to be
 designed for the behaviour that you see.
 
 You could get the behaviour that you want by making the implementation actually
 set the attributes instead. I'm not sure what the other implications of doing
 that are, though.
 
 If you're interested, the code is in
 
   lib/python/Products/ZPatterns/SkinScript/Components.py
 about line 71.

ok, thanks, will have a look at that.

cheers,
  Christian


___
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] Storing part of an object on the file system

2001-02-22 Thread John D. Heintz

Andy,

I'm just checking an assumption that I'm making about the Ext* Products:
They do no work out of the box with ZEO, right?

That is, they would require some sort of shared network drive for all 
ZEO clients to functions correctly.

Thanks,
John

Andy McKay wrote:

 Actually just follow up I realised I never told you how I solved this
 problem. I compacted all data types into File, Image or DTML Document. Since
 I had ExtFile and ExtImage I chopped those into one class called it
 ExtThing, and the wrote classes off it. ExtFile and ExtImage I cut and
 pasted (not complete) for the most part.
 
 Then I wrote a class that called ExtHTML that is a DTML Document that
 overrides the munge() and read() read functions. Instead I passed those onto
 ExtThing. And there you go a DTML Document that has the main body stored on
 the local file system.
 
 Thanks McGregor.
 --
   Andy McKay.
 
 
 - Original Message -
 From: "Andy McKay" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, February 08, 2001 4:15 PM
 Subject: [Zope-dev] Storing part of an object on the file system
 
 
 
 Ok whack idea #34... Well sort of, the idea was sparked by ExtFile (yes
 
 its
 
 all his fault honest). We want to have files on the file system for many
 reasons which I won't go into now, just take it for granted. But we also
 want some of the objects information to be in the standard data.fs, so we
 can catalog it use acquisition provide a simple interface to it and so on.
 So far you are saying thats ExtFile and you are right.
 
 But we want to extend it to any object anywhere, instead of storing the
 
 data
 
 attribute in the object and pickling it in the ZODB I want to be able to
 store the data attribute on the file system. This gives us loads of
 advantages we also thought this would be extremely useful to other people.
 We've bounced around ideas on how to do this and here the only two so far:
 
 -we could overload the data attribute with a class that on Pickling
 
 into
 
 the ZODB instead writes it on to the filesystem...
 -we could in the ZODB put a hack to say if pickling something with so
 and so attribute do this instead...
 
 I feel like this something I should just not be doing, but it would be
 
 great
 
 if I could get it work...
 
 --
   Andy McKay.
 
 
 
 
 ___
 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 )



-- 
. . . . . . . . . . . . . . . . . . . . . . . .

John D. Heintz | Senior Engineer

1016 La Posada Dr. | Suite 240 | Austin TX 78752
T 512.633.1198 | [EMAIL PROTECTED]

w w w . d a t a c h a n n e l . c o m


___
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] Storing part of an object on the file system

2001-02-22 Thread Andy McKay

 That is, they would require some sort of shared network drive for all 
 ZEO clients to functions correctly.

Im no expert on ZEO, but I believe that is the case.


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

2001-02-22 Thread Andy McKay

 I disagree but it's not worth arguing about. However, the people who pay
my
 salary feel that way which means I care ;-)

Ive been taking the Larry Wall approach to this when people tell me the
correct way to do things:

"A Perl script is "correct" if it gets the job done before your boss fires
you."

The simple fact is many non-technical users dont give a hoot about the
underlying python reasons or computer science, its just common to see a
case-insensitive sort.

And yes it can be done in ZCatalog and dtml-in with a little fiddling.
--
  Andy McKay.



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

2001-02-22 Thread Casey Duncan

--- Andy McKay [EMAIL PROTECTED] wrote:
  I disagree but it's not worth arguing about.
 However, the people who pay
 my
  salary feel that way which means I care ;-)
 
 Ive been taking the Larry Wall approach to this when
 people tell me the
 correct way to do things:
 
 "A Perl script is "correct" if it gets the job done
 before your boss fires
 you."
 
[snip]

Well hell, what's good enough for Perl is good enough
for... *slaps self silly*

C'mon, are you really seriously gonna back up
reasoning for Zope features by quoting Larry Wall???
8^)


=
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-

__
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.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] ZCatalog madness. (Must log in as emergencyuser.)

2001-02-22 Thread Chris McDonough

I'm not sure why this isn't in 2.3.1b1, but yes, the code in getobject was
changed to use unrestrictedTraverse for this very reason.

- Original Message -
From: "Erik Enge" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, February 22, 2001 10:33 AM
Subject: [Zope-dev] ZCatalog madness. (Must log in as emergencyuser.)


 Right.

 This is the traceback I get, after doing a search (searchResults) - which
 goes fine by teh way - and then trying to do an
 getobject(x.data_record_id_) as a non-emergencyuser user get up an login
 box and press escape:

 Unauthorized

 Sorry, a Zope error occurred.

 Traceback (innermost last):
   File
 /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
 222, in publish_module
   File
 /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
 187, in publish
   File
 /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
 171, in publish
   File /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/mapply.py,
 line 160, in mapply
 (Object: candidate_search)
   File
 /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
 112, in call_object
 (Object: candidate_search)
   File /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/OFS/DTMLMethod.py,
 line 189, in __call__
 (Object: candidate_search)
   File

/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/DocumentTemplate/DT_String.py,
 line 538, in __call__
 (Object: candidate_search)
   File
 /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/DocumentTemplate/DT_In.py,
 line 702, in renderwob
 (Object: candidateEngine(REQUEST))
 Unauthorized: 0

 Right.  Your average unauthorized I should think.  Next, if I log in as
 the emergencyuser, this is what I get:

 Traceback (innermost last):
   File
 /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
 222, in publish_module
   File
 /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
 187, in publish
   File /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/Zope/__init__.py,
 line 221, in zpublisher_exception_hook
 (Object: Traversable)
   File
 /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
 171, in publish
   File /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/mapply.py,
 line 160, in mapply
 (Object: candidate_search)
   File
 /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/ZPublisher/Publish.py, line
 112, in call_object
 (Object: candidate_search)
   File /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/OFS/DTMLMethod.py,
 line 189, in __call__
 (Object: candidate_search)
   File

/usr/local/Zope-2.3.1b1-linux2-x86/lib/python/DocumentTemplate/DT_String.py,
 line 538, in __call__
 (Object: candidate_search)
   File
 /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/DocumentTemplate/DT_In.py,
 line 711, in renderwob
 (Object: candidateEngine(REQUEST))
   File /usr/local/Zope-2.3.1b1-linux2-x86/lib/python/OFS/Traversable.py,
 line 107, in absolute_url
 (Object: CatalogAware)
 AttributeError: (see above)

 Error Type: AttributeError
 Error Value: 'string' object has no attribute 'get'


 The get thing is probably from me trying to call absolute_url on the
 objects it returns.  Calling atributes works, though.

 Strange.  Doing getobject as a non-emergencyuser doesn't owrk, and when I
 have logged in the objects I get seems to be somewhat fubar.

 Help is greatly appretiated.

 (PS.  I seem to recall a checkin in hte CVS about unrestrictedTraverse in
 one of the files belonging to the Catalog, could this has something to do
 with it?)

 Zope 2.3.1b1 on Linux.


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



Re: [Zope-dev] ZCatalog stuff

2001-02-22 Thread Andy McKay

 Well hell, what's good enough for Perl is good enough
 for... *slaps self silly*
 
 C'mon, are you really seriously gonna back up
 reasoning for Zope features by quoting Larry Wall???
 8^)

Why not ? (sometimes) he makes sense ;) 

--
  Andy McKay.


___
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] initializing objects in ZPatterns

2001-02-22 Thread Christian Scholz

Hi!

 To get company_address stored, you can probably do something like:
 
   your_object.manage_changeProperties(company_address=your_object.company_address)
 
 or possibly your_object.propertysheets.NameOfSheet.manage_changeProperties...
 depending on what kind of object you're using.

I've now tried

WHEN OBJECT ADDED CALL
  
self.propertysheets.data.manage_changeProperties(company_address=self.company_address)

which gives me some Unauthorized error on the method call.

(when doing it manually in some dtml method after newItem() it works ok, though.
And I am logged in as Manager..)

Sometimes I wish Zope would print more about the details of such an response,
e.g. which permissions might be missing..

Anyway, I will keep experimenting with it (also tried to subclass directly from
DataSkin, to override some method which create the company address) but then
I noticed that it always needs to be a ZClass (except I would also implement my
own Rack, I guess..)
Wonder when the basic app will be running.. ;-)

ok, nice evening everybody! :)

-- christian


___
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] initializing objects in ZPatterns

2001-02-22 Thread Steve Alexander

Christian Scholz wrote:


 I've now tried
 
 WHEN OBJECT ADDED CALL
   
self.propertysheets.data.manage_changeProperties(company_address=self.company_address)
 
 which gives me some Unauthorized error on the method call.

Give your skinscript an appropriate proxy role.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net


___
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 madness. (Must log in as emergencyuser.)

2001-02-22 Thread Chris McDonough

You can get the object, but you can't do anything with it.

- Original Message -
From: "Steve Alexander" [EMAIL PROTECTED]
To: "Chris McDonough" [EMAIL PROTECTED]
Cc: "Erik Enge" [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, February 22, 2001 12:38 PM
Subject: Re: [Zope-dev] ZCatalog madness. (Must log in as emergencyuser.)


 Chris McDonough wrote:

  I'm not sure why this isn't in 2.3.1b1, but yes, the code in getobject
was
  changed to use unrestrictedTraverse for this very reason.

 Does that open up a security hole?

 Can I get to an object via the getobject method of ZCatalog that I can't
get to otherwise?

 I thought that was the reason it was changed to restrictedTraverse in the
first place.


 --
 Steve Alexander
 Software Engineer
 Cat-Box limited
 http://www.cat-box.net


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



Re: [Zope-dev] ZCatalog Lazy Results

2001-02-22 Thread Dieter Maurer

Tres Seaver writes:
  'getObject' forces you to "wake up" the catalogued object;
  in a large enough result set, the price is pretty punitive,
  compared to serving the results as cached metadata.
You can batch large result sets: "getObject" would just be
applied to the objects in the batch.

The objects are cached, too (ZODB cache).



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] Setting vars in expression eval() namespace

2001-02-22 Thread Dieter Maurer

Julio Maia writes:
  I'm trying to create a tag to evaluate the expression passed to it, adding in the 
 expression eval namespace a variable that contains the result of dtml processing of 
 the tag's block. For instance, the following construct:
  
  dtml-bvar "foo(a=1)" var="block"
 some text dtml-var "1+2"
  /dtml-bvar
  
  would invoke the expression "foo(a=1)" with a variable named 'block' set to 'some 
 text 3' in the expression's namespace (btw, is it possible to achieve this using 
 regular dtml?).
What a construction! I do not like it.

  However, I couldn't find a way to set a variable in the namespace used in the 
 evaluation of the expression. I've tried to insert an entry in the mappings passed to 
 the expression eval() method as follows:
Push a new mapping onto the namespace (with its "push" method).
Do not forget, to pop it after your tag.


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] Error message traceback

2001-02-22 Thread Philipp von Weitershausen

Hi there,

how do I turn off this annoying traceback that is always printed out when an 
error occurrs? 

-- 
Philipp von Weitershausen
[ *pronounce: "fun Viters-houzen" ]
   Web http://www.philikon.de/

___
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] What's the use of defining permissions for ZClass definition

2001-02-22 Thread Dirksen

Hi,

ZClass definition has a 'Define Permissions' tab. Yet any modification there doesn't 
seem
to affect the ZClass instance's security profile at all. What's the use of that?

Cheers
Dirksen

__
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.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] Error message traceback

2001-02-22 Thread Erik Enge

On Thu, 22 Feb 2001, Philipp von Weitershausen wrote:

 how do I turn off this annoying traceback that is always printed out when an 
 error occurrs? 

Start Zope with out the debugging switch; "-D".  Look in your z2.py file
for expalation of it, and in start (or start.bat on Windows?) to remove
it.


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