Re: [Zope] Strange CSS inclusion BUG

2000-09-19 Thread Li Dongfeng


- Original Message - 
From: "Dieter Maurer" <[EMAIL PROTECTED]>
To: "Li Dongfeng" <[EMAIL PROTECTED]>
Cc: "Zope" <[EMAIL PROTECTED]>
Sent: Wednesday, September 20, 2000 3:25 AM
Subject: Re: [Zope] Strange CSS inclusion BUG


> Li Dongfeng writes:
>  > To use CSS file, I put the following line in the head of HTML files:
>  > 
>  > 
>  > "
>  >   rel="stylesheet" type="text/css">
>  > 
>  > 
>  > Where "local_css" is a DTML document containing CSS style sheet.
>  > But the DTML generates the following error message:
>  > 
>  > Error Type: AttributeError
>  > Error Value: 'string' object has no attribute 'absolute_url'
>  > 
>  > If I strip the   > Why is the DTML document local_css changed into a string 
>  > after ?
> That is a dtml-if caveat!
> 
>   The dtml-if documentation says that dtml-if caches its
>   variable value to save time, in case the variable is
>   in fact a function that takes long to call.
> 
>   What happens in your case:
>  looks up "local_css" and because
> it is callable, it gets called (i.e. rendered).
> The result is a string. This string is bound to
> "local_css" inside the 
> Therefore, "local_css.absolute_url" results in
> the error you observed.
> 
> You can replace  by
> .
> 

This really works! Even when the request is from a folder
below where local_css resides. This success sugests that
"_.has_key()" also use aquisition to search for objects.

> This will not be equivalent to "" but
> good enough for your purpose.
> 
> If you want to emulate it more faithfull, you could
> use:
> 
> 
> This is equivalent ot "" with the
> exception of the caching.
> 
> 
> Dieter

___
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] Strange CSS inclusion BUG

2000-09-19 Thread Li Dongfeng

To use CSS file, I put the following line in the head of HTML files:


"
  rel="stylesheet" type="text/css">


Where "local_css" is a DTML document containing CSS style sheet.
But the DTML generates the following error message:

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

If I strip the ?



___
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] Help: PATH_INFO==>object

2000-09-08 Thread Li Dongfeng

Thanks for the correction. Now I see that
PATH_INFO refers to the current page,
not the calling page. I think the hidden input
field solution is OK for me.

What is the *Traversal interface*? Do you
mean the PARENTS enviroment?

- Original Message - 
From: "Martijn Pieters" <[EMAIL PROTECTED]>
To: "Li Dongfeng" <[EMAIL PROTECTED]>
Cc: "Zope" <[EMAIL PROTECTED]>
Sent: Friday, September 08, 2000 5:01 PM
Subject: Re: [Zope] Help: PATH_INFO==>object


> On Fri, Sep 08, 2000 at 11:32:39AM +0800, Li Dongfeng wrote:
> > I am writing a service for other pages to
> > use as form action. How can I reference
> > the caller object in DTML/python?
> > 
> > I can only think of this: First use PARENTS[-1]
> > to get to the root object of the site.
> > Then split the PATH_INFO containing the caller's
> > path, and go down from the root to every subfolder
> > in PATH_INFO and then get to the caller object.
> > But this is not very elegant.
> > 
> > Can anyone give better solution to this?
> 
> PATH_INFO only tells you something about the service object, not about the
> calling page. If you use this as a FORM action target, it's the browser
> that makes the call, not Zope.
> 
> You can, in many cases, determine the browser URL by looking at
> HTTP_REFERER, but many people and companies use proxies and firewalls to
> filter this out nowadays; it is considered sensitive information.
> 
> If this app is targeted at a intranet or other controlled environment, you
> could dictate the presence of HTTP_REFERER, and rely on that, otherwise
> you will have to add a reference as a hidden form field generated by the
> calling object.
> 
> Once you have a URL of the calling object, you can use the Traversal
> interface to turn that URL into an object reference.
> 
> -- 
> Martijn Pieters
> | Software Engineermailto:[EMAIL PROTECTED]
> | Digital Creations  http://www.digicool.com/
> | Creators of Zope   http://www.zope.org/
> | ZopeStudio: http://www.zope.org/Products/ZopeStudio
> -
> 
> ___
> 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 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] Help: PATH_INFO==>object

2000-09-07 Thread Li Dongfeng

I am writing a service for other pages to
use as form action. How can I reference
the caller object in DTML/python?

I can only think of this: First use PARENTS[-1]
to get to the root object of the site.
Then split the PATH_INFO containing the caller's
path, and go down from the root to every subfolder
in PATH_INFO and then get to the caller object.
But this is not very elegant.

Can anyone give better solution to this?


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