You're not actually loading myhost/<post_id>/<post_title> right? You're 
loading something like:

myhost/123123/this-is-the-title-slug

?

On Tuesday, January 15, 2013 3:17:50 PM UTC-6, NP wrote:
>
> I'm trying to implement url slugs in my app (python-based). I want the 
> slugged URL to be of the format  myhost/<post_id>/<post_title>
>
> When I try to access the page using the above slugged url format, I get an 
> error and (in Chrome, the error says - unexpected token <). If I delete the 
> '/<post_title>' from the url, the page loads correctly. Specifically, I 
> noticed that once I have a 'forward slash' after the <post_id>, I have 
> issues. Everything works fine without that extra slash (extra directory)
>
> My code is
>
> class mainhandler(webapp.RequestHandler):
>     def get(self):
>         if (self.request.path == '/test'):
>             path = os.path.join (os.path.dirname (__file__), 'test.htm')
>             self.response.headers ['Content-Type'] = 'text/html'
>             self.response.out.write (template.render (path, {}))
>         else:                       
>             path = os.path.join (os.path.dirname (__file__), 'index.htm') 
>            
>             self.response.headers ['Content-Type'] = 'text/html'        
>          
>             self.response.out.write (template.render (path, {}))
>
> application = webapp.WSGIApplication( [('/.*', mainhandler)],  debug=True) 
>
> Basically, I want to load the index.htm file and on that file, I have 
> javascript which is supposed to extract the post-id from the URL and do 
> some stuff with it.
>
> Anybody know what I'm doing wrong here? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/q0W7znocqEoJ.
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/google-appengine?hl=en.

Reply via email to