[Zope] Five defaultView and REQUEST.URL0

Maciej Wisniowski maciej.wisniowski at coig.katowice.pl
Tue Feb 21 09:24:25 EST 2006


Hi

I've created simple view that just displays few lines of text (with 
national characters)
and URL of the current page (which is received by call to my product 
method (code below)).
I'm using UTF-8. I've used REQUEST.URL0 to generate url. The problem is 
when
I'm accessing my object via it's name (I'mean when defaultView is used) 
like:

http://localhost:8080/my_problem_object

I get:

'ascii' codec can't decode byte 0xc4 in position 154: ordinal not in 
range(128)

Suprisingly to me when I'm using:
http://localhost:8080/my_problem_object/@@test_uni

everything works correclty.

Without national characters in Page Template it works OK.
When I'm not using self.REQUEST.URL0 it works correctly too.
When I use str(self.REQUEST.URL0) everything is good again.

Can somebody tell me whether I'm doing something in a wrong
way, or maybe it is a bug or feature? I dont understand why there
is such a difference between view and default view?


Below is a part of my code:

---main class---
class GeneralModule(Folder):
    """GeneralModule"""
    (...)

    def get_obj_url(self):
        return self.REQUEST.URL0

    (...)

---view is---
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">
<body>
    <h1> Some unicode characters here: łąka</h1> 
    <span tal:content="python: context.get_obj_url()"></span>
</body>
</html>


---configure.zcml:---

  <five:traversable class=".GeneralModule.GeneralModule" />
  <five:defaultViewable class=".GeneralModule.GeneralModule" />
 
  <browser:page
    for=".GeneralModule.IGeneralModule"
    template="./zpt/test_uni.zpt"
    name="test_uni"
    permission="zope.Public"
  />
 
  <browser:defaultView
    for=".GeneralModule.IGeneralModule"
    name="test_uni"
  />
...


-- 
Maciej Wisniowski




More information about the Zope mailing list