Hi I am new to Turbogears and trying to learn.

I downloaded the xhtml file from google map api site, and save it in
the googlemap.kid file. Here is the content. The only change I did is
to add xmlns:py="http://purl.org/kid/ns#";

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
xmlns:py="http://purl.org/kid/ns#";>
  <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>

        <title>Google Maps JavaScript API Example: simple</title>
        <script
src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAAEfCuQGsNiSWxRgf_vfNWaRQjskl1-YgiA_BGX2yRrf7htVrbmBTEB0IH-F489GrwP8-dHLib7cKKIQ";
type="text/javascript">
        </script>

        <script type="text/javascript">
        //<![CDATA[

        function onLoad() {
          // The basics.
          //
          // Creates a map and centers it on Palo Alto.

          if (GBrowserIsCompatible()) {
                var map = new GMap(document.getElementById("map"));
                map.centerAndZoom(new GPoint(-122.1419, 37.4419), 4);
          }
        }

        //]]>
        </script>
  </head>
  <body onload="onLoad()">
        <div id="map" style="width: 500px; height: 300px"></div>
  </body>
</html>


Then I added two functions in the Root class.

    @turbogears.expose(html="bmf.templates.googlemap")
    def location(self):
        import time
        return dict()


    @turbogears.expose()
    def location2(self):
        import time
        return googlestring  #googleString has all the content from the
googlemap.kid file



After I running the web server, I can see the map with
http://www.myownsite/location2. But with http://www.myownsite/location,
I got all these errors,

500 Internal error

Server got itself in trouble

Traceback (most recent call last):
  File
"c:\python24\lib\site-packages\CherryPy-2.1.1-py2.4.egg\cherrypy\_cphttptools.py",
line 271, in run
    main()
  File
"c:\python24\lib\site-packages\CherryPy-2.1.1-py2.4.egg\cherrypy\_cphttptools.py",
line 502, in main
    body = page_handler(*args, **cherrypy.request.paramMap)
  File
"c:\python24\lib\site-packages\TurboGears-0.8.9-py2.4.egg\turbogears\controllers.py",
line 125, in newfunc
    return controllers._process_output(tg_format, output, html)
  File
"c:\python24\lib\site-packages\TurboGears-0.8.9-py2.4.egg\turbogears\controllers.py",
line 38, in _process_output
    output = view.render(output, tg_format, template=template)
  File
"c:\python24\lib\site-packages\TurboGears-0.8.9-py2.4.egg\turbogears\view.py",
line 91, in render
    tclass = lookupTemplate(template)
  File
"c:\python24\lib\site-packages\TurboGears-0.8.9-py2.4.egg\turbogears\view.py",
line 67, in lookupTemplate
    mod = kid.load_template(tfile, name=classname)
  File
"c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\__init__.py", line
119, in load_template
    code = template.compile(dump_code=cache,
dump_source=os.environ.get('KID_OUTPUT_PY'))
  File
"c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\compiler.py", line
87, in compile
    code = self.code
  File
"c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\compiler.py", line
101, in code
    self._code = py_compile(self.python, pyfile, 'exec')
  File
"c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\compiler.py", line
108, in python
    py = kid.parser.parse_file(self.kid_file, self.encoding)
  File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\parser.py",
line 56, in parse_file
    return parse(source, encoding, filename=filename)
  File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\parser.py",
line 45, in parse
    return parser.parse()
  File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\parser.py",
line 72, in parse
    self.proc_stream(self.module_code)
  File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\parser.py",
line 127, in proc_stream
    for (ev, item) in self.stream:
  File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\pull.py",
line 164, in _track
    for p in stream:
  File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\pull.py",
line 203, in _coalesce
    for ev, item in stream:
  File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\pull.py",
line 367, in __iter__
    for (ev, stuff) in self._expat_stream():
  File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\pull.py",
line 339, in _expat_stream
    feed(data)
  File "c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\pull.py",
line 407, in feed
    raise e
ExpatError: not well-formed (invalid token): line 8, column 52

Powered by Cherrypy 2.1.1


Seems the kid doesn't like the <script
src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAAEfCuQGsNiSWxRgf_vfNWaRQjskl1-YgiA_BGX2yRrf7htVrbmBTEB0IH-F489GrwP8-dHLib7cKKIQ";
type="text/javascript">
        </script> part. 

What did I do wrong?

Wen


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to