Hello, I would like to know is it possible to forward request?

For example in Java I can forward request from one servlet (like
webapp.RequestHandler) to another or from servlet to jsp (like Django
template).
self.redirect("/someUrl") clears response and doesn't "transfer"
request object. That is why I need redirect.

The task is:
I have a view (Django template)
Person can perform silmpe crud: Create something, delete something,
update something.

Here is a code:

#prepare view data, show news
class AdminPage(webapp.RequestHandler):
        def get(self):
                message = self.request.get('message')
                if not message:
                        message = 'You are in admin console.'
                logging.debug("Did message came -> " + message);
                offset = self.request.get('offset')
                limit = self.request.get('limit')
                news = get_news(offset, limit, False)
                values = {
                        'page': 'admin',
                        'news': news,
                        'count': get_news_count(),
                        'message': message
                }
                path = os.path.join(os.path.dirname(__file__),'html/admin.html')
                self.response.out.write( template.render(path, values) )

#Hide news from user and send to view preparation
class HideNews(webapp.RequestHandler):
        def get(self):
                key = self.request.get('key')
                logging.debug("hide news with key["+key+"]")
                hide_news( key )
                values = {
                        'message':'News was hidden'
                }
                self.redirect("/admin")

As you can see "HideNews" performs an action and wants to send message
to the news requestHandler.
But it can't do it.

Is there any opportunity to forward request processing in GAE?

P.S
I've tried to do this:
class HideNews(webapp.RequestHandler):
        def get(self):
                key = self.request.get('key')
                logging.debug("hide news with key["+key+"]")
                hide_news( key )
                message = "Some str with russian chars".decode('utf-8')
                url = "/admin?message=".decode('utf-8')+message
                self.redirect(url)

And I get:
self.response.headers['Location'] = str(absolute_url)
UnicodeEncodeError: 'ascii' codec can't encode characters in position
36-42: ordinal not in range(128)

It doesn't accept utf-8 chars?
What to try next?

Thanks in advance.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to