Thanks. Will do so.
On Feb 7, 6:44 am, lkcl <[email protected]> wrote:
> On Feb 6, 10:22 pm, dhmorgan <[email protected]> wrote:
>
> > web2py creator Massimo Di Pierro just posted a request for help on
> > drafting a brief tutorial on using Pyjamas with web2py (web2py
> > disscussion group
> > --http://groups.google.com/group/web2py/browse_thread/thread/9bb107c2fb...
> > )
>
> GREAT! (hi massimo, it's fantastic to see this happening).
>
> > the _draft_ is here --http://mdp.cti.depaul.edu/AlterEgo/default/show/203
>
> > I plan to help with that and would appreciate any feedback, comments,
> > suggestions
>
> looks _great_. absolutely delighted to see it.
>
> first thing i'd recommend doing is to test the jsonrpc service, stand-
> alone - nothing to do with pyjamas:
>
> 1)http://lkcl.net/jsonrpclib.tar.gz(it's a copy of someone else's
> stand-alone jsonrpc client, really good code, really useful, can't
> remember who wrote it! many apologies to the original author! )
>
> 2) create a quick test testweb2pyjsonservice.py, and run it as
> python ./testweb2pyjsonservice.py:
>
> import jsonrpclib
>
> s = jsonrpclib.ServerProxy("http://localhost:8000/todoApp/service/") #
> check this!
>
> # show list of tasks
> tasks = s.get_tasks()
> print tasks
>
> # add one
> tasks = s.add_task("debug pyjamas webpy service")
> print tasks
>
> # how do i get the task id of the one just added? err...
> task_id = 1
>
> # bug in design of todo service - how do i identify the task just
> added?
> tasks = s.delete_task(task_id)
> print tasks
>
> so immediately you can see there's a little bit of work needed.
> controllers/default.py's add_task() should be something like this:
>
> @pyjamas
> def add_task(request,taskFromJson):
> t = db.todo.insert(task= taskFromJson)
> return t.id # TODO: look up web2py db api, check this is right.
>
> also, from a code-style perspective, i would call that @jsonservice
> not @pyjamas, because what's actually being done here - so far - has
> absolutely nothing to do with pyjamas, and everything to do with
> jsonrpc.
>
> so i'd rename the file models/pyjamas.py to models/jsonrpc.py and put
> "jsonservice = JSONRPCService()" instead.
>
> otherwise people will think pyjamas equals jsonrpc and get very
> confused.
>
> _then_, once the above test code works as expected, _then_ you can
> move on to compiling the front-end pyjamas (which unfortunately looks
> like it got corrupted in the cut-paste).
>
> l.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---