Re: [Zope] How to make two racks work under one specialist?

2000-12-29 Thread Steve Spicklemire


Hi Dirksen,

   I think the problem you are having has to do with using 'getItem'.

From the SkinScriptSyntax Wiki page:

"If the RESULT is NOT_FOUND, the search for the attribute value falls
through to the next declaration (or attribute provider if the SkinScript
is finished). If there is an OTHERWISE LET clause, the assignments given
there are computed and cached for the remainder of the (sub)transaction..."

This is meant to work automatically for "WITH QUERY ... COMPUTE" scripts,
but in your case the RESULT was _.None, so the test for NOT_FOUND
didn't work. I think you could in principle set up a chain of 
attribute providers:

WITH Deliverables.getItem(self.id) COMPUTE theStandInObject=RESULT or NOT_FOUND

then

WITH self.theStandInObject COMPUTE name OTHERWISE_LET name='not availble'

so that if RESULT is _.None from Deliverables.getItem, then the
'StandIn' will be NOT_FOUND and the COMPUTE will fall through to
the 'OTHERWISE LET' clause. However I don't think this works well when
the existance of the virtual object in the Rack depends on 'theStandInObject'
being found if theStandInObject is NOT_FOUND then the Rack returns
_.None and you're out of luck. Here's a thought...  what if you put a 
'dummy' object somewhere accessable and did this:

WITH Deliverables.getItem(self.id) COMPUTE theStandInObject=RESULT or theDummyObject

then you could set all the attributes of theDummyObject to be whatever you
wanted  and you would never get a RESULT of NOT_FOUND.

-steve

 "Dirksen" == Dirksen  [EMAIL PROTECTED] writes:

Dirksen Hi Steve,

Dirksen It works! Thank you.

Dirksen Still there's a couple of things to be cleared. What's
Dirksen the use of 'otherwise' clause? And is it true that the
Dirksen 1st 'with' clause fails, the whole skinscript process
Dirksen fails (so one 'with' clause is all one skinscript can put
Dirksen up with)?

Dirksen Dirksen



Dirksen __ Do You
Dirksen Yahoo!?  Yahoo! Photos - Share your holiday photos
Dirksen online!  http://photos.yahoo.com/







___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] How to make two racks work under one specialist?

2000-12-28 Thread Steve Spicklemire


Hi Dirksen..

try this:

WITH Deliverables.getItem(self.id) COMPUTE name=((RESULT is _.None) and 'none 
available') or RESULT.name

What are you using as the 'load by accessing attribute' attribute?

-steve


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] How to make two racks work under one specialist?

2000-12-28 Thread Dirksen

Hi Steve,

It works! Thank you.

Still there's a couple of things to be cleared. What's the use of 'otherwise' clause? 
And
is it true that the 1st 'with' clause fails, the whole skinscript process fails (so one
'with' clause is all one skinscript can put up with)?

Dirksen



__
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] How to make two racks work under one specialist?

2000-12-22 Thread Steve Spicklemire


Hi Dirksen,

   OK.. the problem was that DataSkinAddons:DummyDataSkin doesn't
allow access to attributes of 'self'. Once I switched to a differnt
ZClass (which is a direct subclass of DataSkin) then everything
was fine again.. ) just for Facade instances:

I'm now using

WITH Deliverables.getItem(self.id) COMPUTE originalObject=RESULT or NOT_FOUND

with 'loaded by accessing attribute' set to 'originalObject'

and

WITH self.originalObject COMPUTE myName=name, myDescription=description, dueDate

then in the FacadeClass index_html:

dtml-var standard_html_header
I am a facade! dtml-var myName
hr
Description:dtml-var myDescriptionbr
hr
I'm due: dtml-var dueDate

dtml-var standard_html_footer

and all is working OK.  What ZClass are you using for your instances?

-steve

 "Steve" == Steve Spicklemire [EMAIL PROTECTED] writes:

Steve Hi Dirksen,

Steve Hmm.. this is starting to look like a bug. I tried the same
Steve thing with the ZPatterns example. I have a real site using
Steve this technique with ZPatterns-0.4.2a??  and it's working,
Steve so it's probably something introduced in 0.4.3. Here's what
Steve I did:

Steve I created a new Specialist 'Facade' with a
Steve DataSkinAddons:DummyDataSkin as it's storage class and
Steve 'originalObject' as the attribute to check for existence.

Steve Then I put in the following SkinScript:

Steve WITH Deliverables.getItem(self.id) COMPUTE
Steve originalObject=(RESULT is _.None) and NOT_FOUND or RESULT

Steve WITH self.originalObject COMPUTE name

Steve and ran in 'debug mode.' I get the following traceback on
Steve the console when I try to access a known deliverable
Steve through the Facade Specialist:

Steve Traceback (innermost last): File
Steve /usr/local/etc/Zope2a/lib/python/Products/ZPatterns/AttributeProviders.py,
Steve line 304, in _AttributeFor (Object: GAPMixin) File
Steve /usr/local/etc/Zope2a/lib/python/Products/ZPatterns/Expressions.py,
Steve line 122, in eval File
Steve /usr/local/etc/Zope2a/lib/python/DocumentTemplate/DT_Util.py,
Steve line 337, in eval (Object: Deliverables . getItem ( self
Steve . id )) (Info: Deliverables) File string, line 0, in ?
Steve File
Steve /usr/local/etc/Zope2a/lib/python/DocumentTemplate/DT_Util.py,
Steve line 140, in careful_getattr File
Steve /usr/local/etc/Zope2a/lib/python/Products/ZPatterns/Expressions.py,
Steve line 53, in validate File
Steve /usr/local/etc/Zope2a/lib/python/AccessControl/SecurityManager.py,
Steve line 139, in validate File
Steve /usr/local/etc/Zope2a/lib/python/AccessControl/ZopeSecurityPolicy.py,
Steve line 159, in validate Unauthorized: id

Steve I tried stepping through with the debugger... but got lost
Steve in the details of the GAP evaluator. I'll try again after
Steve breakfast and see what I can come up with.

Steve ;-)

Steve Look on the bright side. You're making ZPatterns a better
Steve product.

Steve -steve

 "Dirksen" == Dirksen  [EMAIL PROTECTED] writes:

Dirksen Hi Steve,

Dirksen I've made my experiment simple, by playing with the
Dirksen DumbZPatterns examples, testing one rack under one
Dirksen specialist. Here is the skinscript:

Dirksen WITH Deliverables.getItem(self.id) COMPUTE name=name,
Dirksen dueDate=dueDate, description=description, todoIDs=todoIDs

Dirksen WITH SELF COMPUTE name=name, dueDate='1973/01/01',
Dirksen description='unknown achee', todoIDs=[]

Dirksen The virtual instance is loaded by accessing attribute of
Dirksen 'name'. I thought any calls for inexistent objects in
Dirksen Deliverables would turn out default values. Yet the test
Dirksen result turned out an not_found error. The following
Dirksen modification (change to 'otherwise' clause) didn't make a
Dirksen difference:

Dirksen WITH Deliverables.getItem(self.id) COMPUTE name=name,
Dirksen dueDate=dueDate, description=description, todoIDs=todoIDs
Dirksen OTHERWISE LET name='unknown', dueDate='1973/01/01',
Dirksen description='unknown achee', todoIDs=[]


Dirksen One more question, i.e. the following expression WITH
Dirksen Deliverables.getItem(self.id) COMPUTE name, dueDate,
Dirksen description, todoIDs

Dirksen also trigered the 'not_known' error for every objects in
Dirksen Deliverables. Where goes wrong?

Dirksen Dirksen


Dirksen __ Do You
Dirksen Yahoo!?  Yahoo! Shopping - Thousands of Stores. Millions
Dirksen of Products.  http://shopping.yahoo.com/

Dirksen ___ Zope
Dirksen maillist - [EMAIL PROTECTED]
Dirksen http://lists.zope.org/mailman/listinfo/zope ** No cross
Dirksen posts or HTML encoding!  ** (Related lists -
Dirksen http://lists.zope.org/mailman/listinfo/zope-announce
Dirksen 

Re: [Zope] How to make two racks work under one specialist?

2000-12-22 Thread Steve Spicklemire


Hi Dirksen,

For your 'otherwise' case, could you have a single instance
that serves as an 'unknown' object:

WITH Deliverables.getItem(self.id) COMPUTE 
originalObject=RESULT or NOT_FOUND 
OTHERWISE originalObject=Deliverables.getItem('Unknown')

where it is known that the Deliverables Specialist has an 
instance with id='Unknown'. The problem with OTHERWISE is 
that it only works within the context of a single WITH/COMPUTE,
and if you don't get 'originalObject' then your WITH/COMPUTE
will never fire.

-steve

 "Dirksen" == Dirksen  [EMAIL PROTECTED] writes:

Dirksen Hi Steve,

Dirksen The first thing is, my ZPatterns' version was
Dirksen 0.4.3.b1. So I quickly downloaded b2, which passed my
Dirksen nameorassignlist, but still didn't fixed the fail-through
Dirksen problem.

Dirksen The 2nd thing is, your script turned out just fine in my
Dirksen case when calling existent deliverable objects. It just
Dirksen didn't fail-through, not even the 'otherwise' clause is
Dirksen applied. This is weird!

Dirksen cheers Dirksen


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] How to make two racks work under one specialist?

2000-12-21 Thread Steve Spicklemire


Hi Dirksen,

   Did you say you were using 0.4.3b1 or b2? I think that
this sounds like the bug from b1:

http://lists.zope.org/pipermail/zope-dev/2000-October/007650.html

-steve

 "Dirksen" == Dirksen  [EMAIL PROTECTED] writes:


Dirksen One more question, i.e. the following expression WITH
Dirksen Deliverables.getItem(self.id) COMPUTE name, dueDate,
Dirksen description, todoIDs

Dirksen also trigered the 'not_known' error for every objects in
Dirksen Deliverables. Where goes wrong?

Dirksen Dirksen


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] How to make two racks work under one specialist?

2000-12-20 Thread Dirksen

Hi Steve,

I've made my experiment simple, by playing with the DumbZPatterns examples, testing one
rack under one specialist. Here is the skinscript:

WITH Deliverables.getItem(self.id) COMPUTE
 name=name, dueDate=dueDate, description=description, todoIDs=todoIDs

WITH SELF COMPUTE
 name=name,
 dueDate='1973/01/01',
 description='unknown achee',
 todoIDs=[]

The virtual instance is loaded by accessing attribute of 'name'. I thought any calls 
for
inexistent objects in Deliverables would turn out default values. Yet the test result
turned out an not_found error. The following modification (change to 'otherwise' 
clause)
didn't make a difference: 

WITH Deliverables.getItem(self.id) COMPUTE
 name=name, dueDate=dueDate, description=description, todoIDs=todoIDs
OTHERWISE LET
 name='unknown',
 dueDate='1973/01/01',
 description='unknown achee',
 todoIDs=[]


One more question, i.e. the following expression
WITH Deliverables.getItem(self.id) COMPUTE name, dueDate, description, todoIDs

also trigered the 'not_known' error for every objects in Deliverables. Where goes 
wrong?

Dirksen


__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] How to make two racks work under one specialist?

2000-12-20 Thread Dirksen

Hi Steve,

Deliverables has objects. The call to existent objects are successful. It's the call to
the inexistent objects that doesn't turn out expectedly. But the first thing is whether
my script is correct. Do you thing so? And any other way to test this kind of 
situation,
i.e. passing processing when failure. And what's the best way to debug a skinscript. So
far I can only guess when it comes to debug a skinscript.

And what's wrong with
WITH Deliverables.getItem(self.id) COMPUTE name, dueDate, description, todoIDs

I cooked this up according to the SkinScriptSyntax wiki, but it doesn't work, 
complaining
not_found when calling the existent objects. A change like this fixes the problem:
WITH Deliverables.getItem(self.id) COMPUTE name=name, dueDate=dueDate,
description=description, todoIDs=todoIDs

What's wrong with my assingmentornamelist?

Dirksen

--- Steve Spicklemire [EMAIL PROTECTED] wrote:
 
 Hi Dirksen,
 
To which specialist did you make this change? and did you make
 any other changes? Also (I'm sure this is obvious and I'm 
 really just confirming what I'm already  sure you've checked..)
 is there an item in the Deliverable's rack with the id you checked?
 
 thanks,
 -steve
 
 
 ___
 Zope maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope-dev )
 


__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] How to make two racks work under one specialist?

2000-12-18 Thread Steve Spicklemire


Hi Dirksen,

   Ok.. you need to set the 'load by accessing attribute' field
to 'original_object'. You may need to change your SkinScript to
something like:

WITH getMale(self.id) COMPUTE original_object=(RESULT is _.None) and NOT_FOUND or 
RESULT

So that when getMale returns _.None, the SkinScript returns NOT_FOUND

-steve

 "Dirksen" == Dirksen  [EMAIL PROTECTED] writes:

Dirksen Hi Steve,

Dirksen Both racks are set to be loaded by accessing 'id', which,
Dirksen as you guessed right, don't appear in handling attributes
Dirksen list!

Dirksen This is the simplified skinscript in maleMemberRack: WITH
Dirksen getMale(self.id) COMPUTE original_object=RESULT WITH
Dirksen self.original_object COMPUTE name=id, gender=gender,
Dirksen email=email

Dirksen getMale is a python method: member = getMember(id) if
Dirksen id.gender == 'male': return member

Dirksen Things just go opposite direction in femaleMemberRack.

Dirksen What do you think?

Dirksen Dirksen




Dirksen __ Do You
Dirksen Yahoo!?  Yahoo! Shopping - Thousands of Stores. Millions
Dirksen of Products.  http://shopping.yahoo.com/

Dirksen ___ Zope
Dirksen maillist - [EMAIL PROTECTED]
Dirksen http://lists.zope.org/mailman/listinfo/zope ** No cross
Dirksen posts or HTML encoding!  ** (Related lists -
Dirksen http://lists.zope.org/mailman/listinfo/zope-announce
Dirksen http://lists.zope.org/mailman/listinfo/zope-dev )


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] How to make two racks work under one specialist?

2000-12-17 Thread Dirksen

Hi Steve,

Both racks are set to be loaded by accessing 'id', which, as you guessed right, don't
appear in handling attributes list! 

This is the simplified skinscript in maleMemberRack:
WITH getMale(self.id) COMPUTE original_object=RESULT
WITH self.original_object COMPUTE 
 name=id,
 gender=gender,
 email=email

getMale is a python method:
member = getMember(id)
if id.gender == 'male':
return member

Things just go opposite direction in femaleMemberRack.

What do you think?

Dirksen




__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] How to make two racks work under one specialist?

2000-12-16 Thread Dirksen

I set up two racks in one specialist, one is maleMemberRack, the other 
femaleMemberRack.
Both are loaded by accessing attribute id, and have skinscripts to retrieve data from a
db. Suppose the femaleMemberRack gets loaded first, it finds out from the db that the
'id' is a male, then how can it pass the process to the maleMemberRack?

Dirksen

__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] How to make two racks work under one specialist?

2000-12-16 Thread Steve Spicklemire


Hi Dirksen,

   Hmm... why not have the query that gets data qualify by gender:

SQL Query: getMemberByGender

parameters member_id, gender

select * from members where
  dtml-sqltest member_id type=string and dtml-sqltest gender type=string

Then in the SkinScript for maleMemberRack:

WITH QUERY getMemberByGender(member_id=self.id, gender='male') COMPUTE blah, blah, 
blah 

-steve

 "Dirksen" == Dirksen  [EMAIL PROTECTED] writes:

Dirksen I set up two racks in one specialist, one is
Dirksen maleMemberRack, the other femaleMemberRack.  Both are
Dirksen loaded by accessing attribute id, and have skinscripts to
Dirksen retrieve data from a db. Suppose the femaleMemberRack
Dirksen gets loaded first, it finds out from the db that the 'id'
Dirksen is a male, then how can it pass the process to the
Dirksen maleMemberRack?

Dirksen Dirksen

Dirksen __ Do You
Dirksen Yahoo!?  Yahoo! Shopping - Thousands of Stores. Millions
Dirksen of Products.  http://shopping.yahoo.com/

Dirksen ___ Zope
Dirksen maillist - [EMAIL PROTECTED]
Dirksen http://lists.zope.org/mailman/listinfo/zope ** No cross
Dirksen posts or HTML encoding!  ** (Related lists -
Dirksen http://lists.zope.org/mailman/listinfo/zope-announce
Dirksen http://lists.zope.org/mailman/listinfo/zope-dev )


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] How to make two racks work under one specialist?

2000-12-16 Thread Steve Spicklemire


Hi Dirksen,

   Forgot to mention... you should probably choose some attribute other 
than 'id' as the attribute to check for your DataSkin. The 'id' attribute
is always there... 

-steve

 "Steve" == Steve Spicklemire [EMAIL PROTECTED] writes:

Steve Hi Dirksen,

SteveHmm... why not have the query that gets data qualify by
Steve gender:

Steve SQL Query: getMemberByGender

Steve parameters member_id, gender

Steve select * from members where dtml-sqltest member_id
Steve type=string and dtml-sqltest gender type=string

Steve Then in the SkinScript for maleMemberRack:

Steve WITH QUERY getMemberByGender(member_id=self.id,
Steve gender='male') COMPUTE blah, blah, blah

Steve -steve

 "Dirksen" == Dirksen  [EMAIL PROTECTED] writes:

Dirksen I set up two racks in one specialist, one is
Dirksen maleMemberRack, the other femaleMemberRack.  Both are
Dirksen loaded by accessing attribute id, and have skinscripts to
Dirksen retrieve data from a db. Suppose the femaleMemberRack
Dirksen gets loaded first, it finds out from the db that the 'id'
Dirksen is a male, then how can it pass the process to the
Dirksen maleMemberRack?

Dirksen Dirksen

Dirksen __ Do You
Dirksen Yahoo!?  Yahoo! Shopping - Thousands of Stores. Millions
Dirksen of Products.  http://shopping.yahoo.com/

Dirksen ___ Zope
Dirksen maillist - [EMAIL PROTECTED]
Dirksen http://lists.zope.org/mailman/listinfo/zope ** No cross
Dirksen posts or HTML encoding!  ** (Related lists -
Dirksen http://lists.zope.org/mailman/listinfo/zope-announce
Dirksen http://lists.zope.org/mailman/listinfo/zope-dev )


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )