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?
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 to http://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)

Can this trivial Queue approach do this?

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to