That's just some (incomplete) example code. You have to define 
'read_only_actions' yourself. In that example, it would be a list functions 
that only need to read (but not write) the database and can therefore be 
given access to one of the slave databases.
 
Actually, it looks like the code has an error -- it should say 
request.function, not request.action -- I'll make the change.
 
Anthony

On Thursday, July 21, 2011 3:54:20 PM UTC-4, Nils Olofsson wrote:

> Hi, 
>
> I did this but i got : 
>
> Traceback (most recent call last): 
>   File "/var/www/web2py/gluon/restricted.py", line 192, in restricted 
>     exec ccode in environment 
>   File "/var/www/web2py/applications/Event/models/db.py", line 18, in 
> <module> 
>     if request.action in read_only_actions: 
> NameError: name 'read_only_actions' is not defined 
>
> <type 'exceptions.NameError'>(name 'read_only_actions' is not defined) 
>
> This error is the reason i asked where it should go. 
>
> Maybe some one could shed some light on it ? 
>
> Regards, 
> Nils 
>
>
> On Jul 21, 7:44 pm, Anthony <abas...@gmail.com> wrote: 
> > It would go in your model file -- the same place where you would normally 
>
> > define the db connection. 
> > 
> > Anthony 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Thursday, July 21, 2011 2:29:45 PM UTC-4, Nils Olofsson wrote: 
> > > Hi Massimo, 
> > 
> > > I'm testing amazon's RDS and EC2 , 1 master many slaves. 
> > 
> > > I could not find out where exactly I am suppose to be putting this 
> > > code. 
> > 
> > > Regards, 
> > 
> > > Nils 
> > 
> > > On Jul 21, 6:48 pm, Massimo Di Pierro <massi...@gmail.com> 
> > > wrote: 
> > > > You would only use this if you have a replicated database. I.e. you 
> > > > are running many database servers synced with each other. For 
> example: 
> > >http://en.wikipedia.org/wiki/Multi-master_replication 
> > 
> > > > On Jul 21, 12:44 pm, Nils Olofsson <nils...@gmail.com> wrote: 
> > 
> > > > > Hi, 
> > 
> > > > > I see this in the Documentation: 
> > 
> > > > > if request.action in read_only_actions: 
> > > > >    db = 
> DAL(shuffle(['mysql://...1','mysql://...2','mysql://...3'])) 
> > > > > else: 
> > > > >    db = 
> DAL(shuffle(['mysql://...3','mysql://...4','mysql://...5'])) 
> > 
> > > > > I'm not sure where exactly I should be using this ? 
> > 
> > > > > And does anyone have some sample code as to how it should be used ? 
>
> > 
> > > > > Nils

Reply via email to