Do you in Django how the information is shared if the apps are on a distributed platform (like multiple servers or GAE)?
On Oct 23, 2:07 am, Alex Ruddy <person...@gmail.com> wrote: > >> Are you looking for a publisher-subscriber > > mechanism? > > Yes. It would be really good to have it, Django has it and Web2py > still doesn't, > it could be very nice to have publisher-subscriber especially for > project with several apps/plug-ins. > It allows to add plug-in that will change main app behavior without > the need > to modify the main app or adding ugly hooks. > > On Oct 23, 4:17 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > On Oct 22, 3:27 pm, Alex Ruddy <person...@gmail.com> wrote: > > > > 1) OK, if you need content internationalization in web2py - do and > > > handle it by yourself. > > > Question: is the secondary table (as in provided example) is the best > > > way to do it? > > > I used the same table structure of the Django example. I think it is a > > good idea to implement it. > > > > If it should be done manually, what other good ways to do it can you > > > suggest? > > > (on some project we used one table with all translations and user > > > defined function > > > in db to get localized string) > > > And yes, I referred tohttp://code.google.com/p/django-multilingual-model/ > > > as example > > > of Django integration. > > > > 2) Not sure if Queue is what is needed. As far as I understand Queue > > > should be used > > > to pass something from one app to other app asynchronously. > > > I asked about synchronous way of event and listeners > > > Event fires (event "comment_posted" is fired in "comments" plug-in > > > when comment is posted for example) > > > And many other plug-in like "comment verifier" "admin notified by > > > email", "spam checker", "some comment processor" > > > that have listeners to "comment_posted" event are doing their job in > > > synchronous way. > > > The same effect as you have method > > > > def post_comment(data): > > > verify_comment(data) > > > check_if_spam(data) > > > some_other_comment_processor(data) > > > notify_admin_by_email(data) > > > > but when you just have all those functions in different plug-in, so if > > > plug-in installed - it will do it's job. And the order listeners calls > > > should be also always the same. And until all listeners will not do > > > their work, post_comment() will not be finished (synchronous call) > > > I guess I misunderstood. Are you looking for a publisher-subscriber > > mechanism? If so that could be implemented as an app. Would be nice to > > have it. I will think about it some more and implement it, unless > > somebody beats me on time. > > > > Can this trivial Queue approach do this? > > > Yes but would not allow other apps to subscribe to events, only takes > > action (synchronously or asynchronously) end an event is sent to them. > > > > Thanks. > > > On Oct 22, 5:20 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > Thanks Alex, > > > > > 1) > > > > I supposed you refer to: > > > > http://code.google.com/p/django-multilingual-model/ > > > > Most of what Django does has to do with handling the table in Django > > > > Admin, but it does not do anything special about the actual table > > > > structure. Django needs special API like this because of the way it > > > > handles joins. We tend to be more low level when dealing with > > > > databases. In web2py you could do something like this: > > > > > db.define_table('book', > > > > Field('isbn')) > > > > > db.define_table('book_translation', > > > > Field('book',db.book), > > > > Field('language'), > > > > Field('title'), > > > > Field('description')) > > > > > >>> book = db.book.insert(isbn="1234567890") > > > > >>> db.book.translation.insert( > > > > > book=book, > > > > language='en' > > > > title = "web2py for Dummies", > > > > description = "web2py described in simple words.")>>> > > > > db.book.translation.insert( > > > > > book=book, > > > > language='pl' > > > > title = "web2py opisane w prostych slowach") > > > > > 2) We do not have it but it is trivial to implement. Create a model > > > > file called (for example) events.py > > > > > import xmlrpclib, cPickle > > > > queue=cache.ram('events',lambda:[],10**10) > > > > @service.xmlrpc > > > > def remote_enqueue(data): > > > > session.forget() > > > > session._unlock(response) > > > > queue.append(data) > > > > def enqueue(app,*a): > > > > url = 'http://127.0.0.1:8000'+URL > > > > (app,'default','call',args='xmlrpc') > > > > print url > > > > s=xmlrpclib.ServerProxy(url) > > > > s.remote_enqueue(cPickle.dumps(a)) > > > > def dequeue(): > > > > return cPickle.loads(queue.pop()) if queue else None > > > > > and now anywhere in your code you can call > > > > > enqueue('target_app',....) # to queue something in the other app > > > > info = dequeue() # to dequeue first received messages > > > > > Hope this helps. > > > > > On Oct 22, 2:11 am, Alex <person...@gmail.com> wrote: > > > > > > Hello All, > > > > > > web2py looks very intersting framework, just bought a manual in pdf > > > > > today. > > > > > > But in comparision with Django 2 nice things are missed: > > > > > > 1. Content Internationalization (automatic handling blog-posts in > > > > > several languages) > > > > > > 2. Events framework - that allows cross-apps event notification and > > > > > because of it better decomposition of features in the apps (included > > > > > in django core) > > > > > > How to do it in web2py? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---