Re: [Zope] Acquisition question

2006-08-29 Thread Ferhat Ayaz
wow. Thanks. This is exactly that what I need. :)

--- Dieter Maurer <[EMAIL PROTECTED]> wrote:

> Ferhat Ayaz wrote at 2006-8-28 11:06 -0700:
> >Here my question:
> >
> >You can do acquisition on URL like
> >
>
>http://localhost:8080/employee_by_id/emp_id/2/viewEmployee
> >
> >here the result of employee_by_id (param is
> emp_id=2)
> >is used by viewEmployee.
> >
> >But I want to use it in a page template like
> >
> > >   "structure mployee_by_id/emp_id/2/viewEmployee">
> >
> >
> >Unfortunatly this will not work like the above
> >example.
> 
> The reason for this different behaviour is that a
> ZSQL method uses a traversal hook to implement the
> "/" feature.
> This traversal hook is only activated during URL
> traversal
> but not for path expression evaluation.
> 
> Fortunately, you do not need this hook in TALES.
> You can instead use a Python expression to call
> the ZSQL Method explicitely:
> 
> 
> 
> This will work only (reliably) when "viewEmployee"
> is
> a PageTemplate (not a DTML object).
> 
> For a DTML object "viewEmployee" you could use:
> 
>  tal:content="employee/viewEmployee"
>  />
> 
> You find the reason for this strange DTML object
> behaviour
> in the "Calling DTML objects" section of
> 
>  
>

> 
> 
> 
> -- 
> Dieter
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Acquisition question

2006-08-29 Thread Dieter Maurer
Ferhat Ayaz wrote at 2006-8-28 11:06 -0700:
>Here my question:
>
>You can do acquisition on URL like
>
>http://localhost:8080/employee_by_id/emp_id/2/viewEmployee
>
>here the result of employee_by_id (param is emp_id=2)
>is used by viewEmployee.
>
>But I want to use it in a page template like
>
>   "structure mployee_by_id/emp_id/2/viewEmployee">
>
>
>Unfortunatly this will not work like the above
>example.

The reason for this different behaviour is that a
ZSQL method uses a traversal hook to implement the
"/" feature.
This traversal hook is only activated during URL traversal
but not for path expression evaluation.

Fortunately, you do not need this hook in TALES.
You can instead use a Python expression to call
the ZSQL Method explicitely:



This will work only (reliably) when "viewEmployee" is
a PageTemplate (not a DTML object).

For a DTML object "viewEmployee" you could use:

   

You find the reason for this strange DTML object behaviour
in the "Calling DTML objects" section of

  



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Acquisition question

2006-08-29 Thread Ferhat Ayaz
Thanks for the answers.
The example was from the Zope Book.

employee_by_id -> Z SQL Method
emp_id -> Parameter key for employee_by_id
2 -> Parameter value for emp_id

The result of employee_by_id(emp_id=2) is a SQL
result. 

viewEmployee -> DTML Method

viewEmployee will use the result of the above
employee_by_id Z SQL Method and render the variables
first,last and salary to HTML, if I call the URL from
a browser.

But, giving the same URL
employee_by_id/emp_id/2/viewEmployee as a tal
expression like

tal:content="structure
employee_by_id/emp_id/2/viewEmployee"

will render nothing. There is also no error messages. 
Do you know what happens?

Thanks,
Ferhat


--- Garito <[EMAIL PROTECTED]> wrote:

> Ferhat Ayaz escribió:
> > Hi list,
> >
> > I'm a newby to zope. Sorry if the question is to
> > dummy.
> > Here my question:
> >
> > You can do acquisition on URL like
> >
> >
>
http://localhost:8080/employee_by_id/emp_id/2/viewEmployee
> >
> > here the result of employee_by_id (param is
> emp_id=2)
> > is used by viewEmployee.
> >
> > But I want to use it in a page template like
> >
> >  >"structure
> mployee_by_id/emp_id/2/viewEmployee">
> > 
> >
> > Unfortunatly this will not work like the above
> > example.
> >
> > Is it possible to do acquisition in this way, or
> is
> > there a way to this?
> >
> > Thanks,
> > Ferhat
> >
> >
> >
> >
> > __
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> > http://mail.yahoo.com 
> > ___
> > Zope maillist  -  Zope@zope.org
> > http://mail.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists - 
> > 
> http://mail.zope.org/mailman/listinfo/zope-announce
> >  http://mail.zope.org/mailman/listinfo/zope-dev )
> >   
> At this point if employee_by_id is the first param
> then all are on 
> traverse_subpath list like:
> 
> ['employee_by_id', 'emp_id', 2, 'viewEmployee']
> 
> then you could use this list to know what your user
> is asking for
> 
> Sorry for my poor english
> 
> -- 
> Mis Cosas
> http://blogs.sistes.net/Garito
> 
> 
> ___
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Acquisition question

2006-08-29 Thread Garito

Ferhat Ayaz escribió:

Hi list,

I'm a newby to zope. Sorry if the question is to
dummy.
Here my question:

You can do acquisition on URL like

http://localhost:8080/employee_by_id/emp_id/2/viewEmployee

here the result of employee_by_id (param is emp_id=2)
is used by viewEmployee.

But I want to use it in a page template like




Unfortunatly this will not work like the above
example.

Is it possible to do acquisition in this way, or is
there a way to this?

Thanks,
Ferhat




__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___

Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce

 http://mail.zope.org/mailman/listinfo/zope-dev )
  
At this point if employee_by_id is the first param then all are on 
traverse_subpath list like:


['employee_by_id', 'emp_id', 2, 'viewEmployee']

then you could use this list to know what your user is asking for

Sorry for my poor english

--
Mis Cosas
http://blogs.sistes.net/Garito


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Acquisition question

2006-08-29 Thread Chris Withers

Ferhat Ayaz wrote:

http://localhost:8080/employee_by_id/emp_id/2/viewEmployee

here the result of employee_by_id (param is emp_id=2)
is used by viewEmployee.

But I want to use it in a page template like




Unfortunatly this will not work like the above
example.


You need to provide us with the traceback you got if you want us to be 
able to help ;-)


Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )