Last week I wrote about a Plone library called collective.trajectory which allows you to do url routing on Plone content type. Back then it was only able to route the context, but I have yet to try develop something on it yet.
A few days ago on geekcamp.my, I gave a talk on it, so naturally, I'll need to test to develop something on it first before doing the talk. Using trajectory, I hacked together a simple app, which fetch a profile page from Facebook, to demonstrate the library capabilities. Here's the howto.
Create a content type which can be added on any part of site, where if user load a subpath of the content, it will load a profile info from graph.facebook.com, and serve it as a context in Plone.
Creating an archetype project
First you'll need ZopeSkel in your buildout. Add this section into buildout.cfg:
recipe = zc.recipe.egg
Execute ./bin/buildout install paster afterwards. Once thats done, you should have paster c…
I think I'll skip the introduction as this is mainly a note for myself
The LDAP Setup
I'm not going to cover how to setup LDAP. The setup that I'm using for this system is organized where all users are under an Organizational Unit called 'people' (ou=people,dc=organization,dc=org) with this schema:
Based on my previous post on WebSocket server using Tornado, I've hacked the code more to be a SocketIO server instead of just WebSocket, so that it can be used on many browsers until everyone support WebSocket. The SocketIO connection is handled by TornadIO, a neat SocketIO library for Tornado.
I've packaged Radiate together with a buildout.cfg, so you can deploy it easily by just using these few lines of commands git clone https://email@example.com/kagesenshi/radiate.git radiate
./bin/buildoutTo start the daemon, just execute: ./bin/radiate-admin fgThe readme file on how to deploy and use Radiate is here: https://github.com/kagesenshi/radiate/blob/master/README.txt.
WebSocket server side documentation/guides around tend to be very node.js oriented. However, I don't fancy rewriting stuff I already have simply to be able to make use of WebSocket. After some research, I figured out a mechanism for a service which will handle push for WebSocket, in a simpler manner which are familiar to everyone - simple POST/GET!
Example server code: (on Tornado 11.0)
from tornado import websocket
print "WebSocket opened"
print "WebSocket closed"
def get(self, *args, **kwargs):
data = self.get_arg…