Due to Python3 support, TG 2.3 is not based on Pylons anymore.
Pure TurboGears application work out of the box, but apps the use Pylons
might need some minor changes.
If you have pylons installed a backward compatibility layer is
automatically enabled that makes most of pylons code work out of the box,
but some functions might need changes to work.
In your case it is probably enough to add, inside RootController.xmlrpc
before calling forward:
tg.request.environ['pylons.controller'] = self
Otherwise you can try to mount the MyXML controller as a subcontroller
inside RootController using:
from tg.controllers import WSGIAppController
class RootController(BaseController):
xmlrpc = WSGIAppController(XMLRpcTestController())
This should achieve the same behaviour as using forward as the controller
will be served under /xmlrpc.
On Wed, Dec 11, 2013 at 2:51 PM, solab solab <[email protected]> wrote:
> Hi all
>
> I am trying to re-implement an xml rpc interface with turboears, but what
> was working
> with tg 2 is not working with In [8]: tg.version Out[8]: '2.3.1' .
>
> root.py
> ==========
>
> from pylons.controllers import XMLRPCController
> from pylons.controllers.util import forward
> ......
>
> class MyXML(XMLRPCController):
> def userstatus(self):
> return 'basic string'
> userstatus.signature = [ ['string'] ]
>
> def userinfo(self, username, age=None):
> user = LookUpUser(username)
> response = {'username':user.name}
> if age and age > 10:
> response['age'] = age
> return response
> #userinfo.signature = [['struct', 'string'],
>
> class RootController(BaseController):
> @expose()
> def xmlrpc(self, *args, **kw):
> return forward(MyXML())
>
> RUN TIME Error
> ===========
> RuntimeError: Unable to forward: environ['pylons.controller'] is not a
> valid Pylons controller
>
> Doing something wrong or is a tg 2.3.1 Bug
> Some hints ?
>
> Cheers Giovanni
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/turbogears.
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/groups/opt_out.