respond_tosupport
You can add a routing ruler.connect('/:controller/:action/:id.:format')at the bottom ofinitRoutes. Then you can userespond_tomethod like this:
self.respond_to(
html=lambda: self.render('<h1>Hello World</h1>'),
js=lambda: self.render(script='alert("hello, world")')
)
If 'http://example.com/foo/bar/12345.html' is requested, the controller will executelambda: self.render('<h1>Hello World</h1>'). While 'http://example.com/foo/bar/12345.js' is request, the client will receive a script content. They are the same action.Tell if a request is XHR
GAEO useX-Requested-Withheader to tell if a request is initiated by XMLHttpRequest object. You can tell that by seeing thatself._is_xhris True or False.rendermethod addscripttype
You can useself.render(script="alert('!')")to send clienttext/javascriptdata.REST methods
Now we route the REST methods to the main dispatcher, and you can useself._request_methodto get the request method (e.g., 'get', 'put', 'head', ...etc).
2008/09/27
GAEO Recent Updates
We had added these features (in 0.2 branch) recently:
2008/09/24
Scaffold in 0.2
Source code is available here.
Scaffold helps you to quickly create pages that play with entities.
Here's an example:
gaeogen.py scaffold GuestBook new edit index show destroy name:StringProperty email:EmailProperty text:TextProperty
It creates a simple guestbook on http://your-host/guestbook/ which can list, add, modify, and delete posts.
The prototype of scaffold is:
gaeogen.py scaffold <scaffold_name> <actions> <data_name:data_types> ...
where actions include index/new/create/edit/update/show/destroy, and data types must be one of the defined types in GAE.
If you want to set some properties to the type, "name:StringProperty(required=True)" works.
I'm still working on it, and any suggestion is welcome.
Scaffold helps you to quickly create pages that play with entities.
Here's an example:
gaeogen.py scaffold GuestBook new edit index show destroy name:StringProperty email:EmailProperty text:TextProperty
It creates a simple guestbook on http://your-host/guestbook/ which can list, add, modify, and delete posts.
The prototype of scaffold is:
gaeogen.py scaffold <scaffold_name> <actions> <data_name:data_types> ...
where actions include index/new/create/edit/update/show/destroy, and data types must be one of the defined types in GAE.
If you want to set some properties to the type, "name:StringProperty(required=True)" works.
I'm still working on it, and any suggestion is welcome.
2008/09/21
Ajax Helpers in 0.2
We will add ajax helpers in version 0.2. You can quickly generate some ajax calls by invoking these helpers. For example
thus, you can put this generated html in your template:
Of course, since the generated content uses jQuery, you shoud include the jQuery first. You can include it from Google's CDN: http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
Is 'ajax helpers' a good idea?
from gaeo.view.helper import ajax
...
# generate a html link and send a request to /foo/bar
self.send_link = ajax.link_to_remote("Click me", "/foo/bar", callback="alert('!');")
...
thus, you can put this generated html in your template:
...
Click this link: {{ send_link }}
...
Of course, since the generated content uses jQuery, you shoud include the jQuery first. You can include it from Google's CDN: http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
Is 'ajax helpers' a good idea?
2008/09/20
GAEO 0.1 Released
Since we don't find any significant bug in the alpha version, we decide to release a stable version.
You can download the GAEO version 0.1 from here. If you need documentations, this site should work for you. And most of all, report bugs here if you encounter anything strange.
Now, we have to start the version 0.2 works.
You can download the GAEO version 0.1 from here. If you need documentations, this site should work for you. And most of all, report bugs here if you encounter anything strange.
Now, we have to start the version 0.2 works.
2008/09/10
GAEO 0.1 alpha and reference guides
We decide to release an alpha version of GAEO 0.1. Please try it and report any bug or suggestion to help the 0.1 stable release.
Besides the 0.1-alpha, we add more articles in GAEO's documentation site. You can refer to the usage of each class through the reference page. If you have written something about GAEO, please let us know, thanks :-)
Besides the 0.1-alpha, we add more articles in GAEO's documentation site. You can refer to the usage of each class through the reference page. If you have written something about GAEO, please let us know, thanks :-)
Tags:
documentation,
release
2008/09/06
The New Documentation Site
![]() |
| From Screenshots |
Now we are using Google Sites to build GAEO's documentation site. You can find useful tutorials and references there. Enjoy it :-)
Tags:
documentation
Subscribe to:
Posts (Atom)
