Yeah but additionally it wraps the given url with the turbogears url
function and I thought that might change something.
Are you running turbogears using the start script or are you running
it behind apache?
On 1/2/07, Bogdan Hlevca <[EMAIL PROTECTED]> wrote:
I tried with redirect from turbogears, but I get the same problem. I
actually expected that since redirect uses internally
cherrypy.HTTPRedirect.
Bogdan
Bogdan Hlevca wrote:
> 1. Thanks for your suggestions. I will try them.
>
> 2. The template calls Root.addItem which redirects to localhost and
> fails.
> I assume that the cause is common with #1 since it is a redirect in
> both cases.
>
> Bogdan
>
> Ian Wilson wrote:
> > I don't know why its broken but here are two things to try if you have
> > not already:
> >
> > 1.Inherit from the turbogears Controller class(Not RootController).
> >
> > from turbogears.controllers import Controller
> > class Members(Controller):
> > ...
> >
> > 2.Use the turbogears redirect function instead of using cherrpy directly.
> > from turbogears import redirect
> >
> > def addItem(...)
> > ...
> > redirect('/users/%s' % memberID)
> >
> >
> > I don't quite understand the template issue? What is wrong there?
> > You mean posting from the form and going to addItem does not work.. or
> > after addItem is done the redirect goes to localhost, ie. fails ?
> >
> > -Ian
> >
> >
> > On 1/1/07, Bogdan Hlevca <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi,
> > >
> > > I have a problem with my site with some URL redirections:
> > >
> > > 1. For subobjects
> > > 2. From templates
> > >
> > > --------------------------------------------------------------------
> > > For
> > > #1. assume that in contollers.py we have
> > >
> > > class Members:
> > > @turbogears.expose(html="hlevca.templates.users")
> > > def index(self):
> > > users = model.Member.select()
> > > return dict(users=users)
> > >
> > > @turbogears.expose(html="hlevca.templates.user")
> > > def default(self, memberID):
> > > try:
> > > memberID = int(memberID)
> > > member = model.Member.get(memberID)
> > > except (ValueError, model.SQLObjectNotFound):
> > > raise cherrypy.NotFound
> > > else:
> > > return dict(member=member)
> > > ...
> > >
> > > class Root(controllers.RootController):
> > >
> > > users = Members()
> > > ...
> > >
> > > If I type in browser www.mysite.org:8082/users it gets redirected to
> > > localhost:8082/users/ and I get an error since I am not working on the
> > > local machine, but if I type directly www.mysite.org:8082/users/ it
> > > goes to the right page.
> > >
> > > Is this a bug, or is my configuration bad?
> > >
> > > #2. I have a similar issue from templates
> > >
> > > in user.kid I have a form
> > >
> > > <form id="addItem" action="/addItem" method="POST">
> > > <input type="hidden" name="memberID" value="${member.id}"/>
> > > <input type="hidden" id="listID" name="listID"
> > > value="${memberList.id}"/>
> > > <label>Add Item: <input type="text" name="value"/></label>
> > > <input type="submit" value="Add"/>
> > > </form>
> > >
> > > while in the Root class in controllers.py I have:
> > >
> > > @turbogears.expose(template="hlevca.templates.users")
> > > def addItem(self, memberID, listID, value):
> > > try:
> > > listID = int(listID)
> > > l = model.List.get(listID)
> > > except ValueError:
> > > turbogears.flash("Invalid list!")
> > > except model.SQLObjectNotFound:
> > > turbogears.flash("List not found! (Did someone else remove
> > > it?)")
> > > else:
> > > # Remove extra spaces
> > > value = value.strip()
> > > # Remove null bytes (they can seriously screw up the
> > > database)
> > > value = value.replace('\x00', '')
> > > if value:
> > > item = model.Item(listID=listID, value=value)
> > > turbogears.flash("Item added!")
> > > else:
> > > turbogears.flash("Item must be non-empty!")
> > > raise cherrypy.HTTPRedirect('/users/%s' % memberID)
> > >
> > > This again seems a problem with redirection. Can someone tell me
> > > whether this is a misconfiguration on my side, or a bug (perhaps in
> > > Cherrypy redirect)?
> > >
> > > Thanks,
> > > Bogdan
> > >
> > >
> > > >
> > >
>
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---