Re: [web2py] Re: Prevent multiple submit buttons from showing Working... on submit

2013-12-08 Thread Martin Weissenboeck
Same problem. It seems, that

input *data-w2p_disable_with=MSSG*** name=submit1 type=submit value=
Back /


has no effect.

By the way, I have found in gluon/html.py that something like

DIV('text', **{'_data-role': 'collapsible'})


could alo be written as

DIV('text', data={'role': 'collapsible'})


Regards, Martin



2013/12/8 Mark Li markruole...@gmail.com

 My web2py.js is the same as the one shipped with the latest web2py.

 I also tried adding a data-w2p_disable_with attribute to the input, but
 it didn't change to the attribute value:

 input data-w2p_disable_with=message type=submit/


 On Fri, Dec 6, 2013 at 11:55 AM, Niphlod niph...@gmail.com wrote:

 can you please check that your web2py.js is the same one shipped with the
 latest web2py ?
 You can fetch it here

 https://raw.github.com/web2py/web2py/master/applications/welcome/static/js/web2py.js


 On Friday, December 6, 2013 12:31:17 AM UTC+1, Mark Li wrote:

 Hey Niphlod,

 The 2 submit buttons have different names, here's the resulting HTML.

 tr id=submit_record__row
 td class=w2p_fl/td
 td class=w2p_fw
 input name=save_progress type=submit value=Save Progress
 /
 input class=btn name=post_playlist type=submit value=Post
 Playlist /
 /td
 td class=w2p_fc/td
 /tr

 However, clicking on either results in both having the working...
 message. Is this not intended behavior?

 One of the form submit buttons is from the SQLFORM (i add a _name
 attribute later), and the other one I insert into the form.

 On Thursday, December 5, 2013 12:50:00 PM UTC-8, Niphlod wrote:

 uhm, you're right. However, usually with different submit buttons you'd
 likely have one of them having a name attribute (and those are excluded
 from being put in the working... state) is this your case ?

 How are you handling different posts based on the fact that the user
 clicks on one instead of the other ?

 BTW2: if any clickable-something has a data-w2p_disable_with
 attribute, that one is used instead of the default Working... message



  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/aT_YWu0Ublo/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.

 For more options, visit https://groups.google.com/groups/opt_out.


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] new feature in trunk: TODO panel in admin editor

2013-12-08 Thread Paolo Valleri
Dear all,
the online editor has got a new TODO panel in which are listed all TODO you 
might have in the current application.
For the time being it highlights only TODO in python files, in the short 
future we will support other file types and special keywords, along with 
the keyword TODO I've seen users using FIXME (please let me know the ones 
you use most). 

It is still in a work in progress feature, given that please let me know 
not only any issue you will find but also all extensions you foresee.

Paolo

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] URL Routing question re: setting persistent arguments for use in controller functions

2013-12-08 Thread Henry Nguyen
Hello,

I have an application in which users can have sub_users. Within the app, a 
user can select a sub_user, at which point, all controls become targeted to 
that selected sub_user. For example, if I select sub_user 1 and then goto 
settings/show_settings.html, I want the show_settings.html to show 
settings only for that sub_user 1. If I navigate to another page, I want 
the controller and function to again refer only to sub_user 1. I want it to 
stay like this until I explicitly navigate to another sub_user 2.

In the case of web2py's URL mapping scheme, I assume this would mean I 
would have to use 1 as the argument after every function in the URL. What's 
the best way to go about ensuring this? Is this even the best way?

I've looked around and I can't find any best-practice advice regarding this 
functionality for web2py. Interestingly enough, though, the admin app does 
exactly what I'm looking for. For example, if I goto appadmin and goto 
manage an app, I am first taken to:

http://127.0.0.1:8000/admin/default/design/myapp

Then, if I goto peek at a model file, I am taken to:

http://127.0.0.1:8000/admin/default/peek/myapp/models/db.py

I am obviously being directed to a different function in the default 
controller of the admin app, but how did the myapp argument stay constant 
throughout that navigation?

Thank you ahead of time for any help. We're starting to rewrite our stack 
at my company and web2py is proving immeasurably invaluable... allowing us 
to develop so refreshingly quickly and confidently. Thank you all for your 
work on this!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to measure conversion rate with google analytics?

2013-12-08 Thread Mika Sjöman
I have

But I get no conversion rates at all. Apparently it needs a special goal 
URL in Google Analytics to set up a goal (Bottom left). 

What I did was to set a new column in auth_user.just_registered with 
default value of True. If they come into the system with a True value, they 
get redirected to a success page which then moves them into the normal 
command central page. Quite smooth, and it could probably not be a part of 
web2py since conversion rate is really specific to each website, because 
you will have to figure out what a success is. 

Since this is mostly a standard thing (anybody using analytics and web2py 
would like to measure conversion rate for signups), maybe web2py should 
send all people to a register success page automatically that then 
redirects people to whatever URL they set as the destination.  

Cheers :)



On Sunday, December 8, 2013 8:34:19 AM UTC+1, Christian Foster Howes wrote:

 can't you just add google analytics to your site.  from there you can see 
 referrers and funnels and conversions etc. with almost no extra work.

 On Friday, December 6, 2013 12:48:31 PM UTC-8, Mika Sjöman wrote:

 Hi

 I was wondering if it is possible to measure the conversion rate of how 
 many people sign up to our service www.dominochinese.com with google 
 analytics? If I understand it correct, I need to set up a goal URL with 
 google analytics, but I then wonder how to redirect new users to that URL? 
 Is there anything built into web2py so the stats become correct? I was just 
 thinking that if I just redirect people who never signed in, I could 
 possibly mess things up. 

 Maybe I could just run a ajax call to the goal URL, if they are missing a 
 database row value with the name has_signed_in_before? But will this give 
 me the correct stats? 

 Also any ideas on how to connect this to an Ad-words campaign?

 I use both email login and Janrain for people to sign up. 

 Cheers!



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] having troubles with scheduler in 2.8.2

2013-12-08 Thread Ivo
I'm trying to get the scheduler up and running but it keeps giving me 
failed and then stops.
-D0 gives me:

DEBUG:web2py.scheduler.mac.linuxmce#16946:   task starting
DEBUG:web2py.scheduler.mac.linuxmce#16946:task started
DEBUG:web2py.scheduler.mac.linuxmce#16946:recording heartbeat 
(RUNNING)
DEBUG:web2py.scheduler.mac.linuxmce#16973:new task report: FAILED
DEBUG:web2py.scheduler.mac.linuxmce#16973:   traceback: Traceback (most 
recent call last):
  File /Applications/web2py 
2/web2py-2.8.2/web2py.app/Contents/Resources/gluon/scheduler.py, line 238, 
in executor
result = dumps(_function(*args, **vars))
  File applications/test_app/models/tasks.py, line 108, in update
db.people.commit()
  File /Applications/web2py 
2/web2py-2.8.2/web2py.app/Contents/Resources/gluon/dal.py, line 8817, in 
__getitem__
return ogetattr(self, str(key))
AttributeError: 'Table' object has no attribute 'commit'

Traceback (most recent call last):
  File 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/queues.py,
 
line 266, in _feed
send(obj)
PicklingError: Can't pickle class '__restricted__.TaskReport': import of 
module __restricted__ failed
DEBUG:web2py.scheduler.mac.linuxmce#16946:task stopped
DEBUG:web2py.scheduler.mac.linuxmce#16946:new task report: STOPPED
DEBUG:web2py.scheduler.mac.linuxmce#16946:   result: None
DEBUG:web2py.scheduler.mac.linuxmce#16946: recording task report in db 
(STOPPED)
INFO:web2py.scheduler.mac.linuxmce#16946:task completed (STOPPED)



-used db is SQLite
-tasks.py:

def update():
rows=db(db.people.id == 1).select()
row=rows[0]
row.update_record(name = John)
db.people.commit()
return locals()

anyone?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Spatial/GIS: find records within X distance of point?

2013-12-08 Thread User
I'm storing latitude/longitude coordinates in a geometry field (using 
PostgreSQL 
9.1.10):

Field('point', 'geometry()')

I understand there is also the geography type but from my reading geometry 
is faster and is suitable for small distances (
http://workshops.boundlessgeo.com/postgis-intro/geography.html#why-not-use-geography
)

I want users to be able to specify a reference point and search for all 
records within X distance from the reference point.  Using raw SQL I would 
use  ST_DWithin http://postgis.refractions.net/docs/ST_DWithin.html doing 
something like

SELECT name, ST_AsText(point)
FROM mytable
WHERE ST_DWithin(point, ST_GeomFromText('POINT(40.47112 -76.33)',4326), 0.1)

But web2py does not seem to support ST_DWithin only st_within.  So how can 
I achieve a similar result in web2py?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Online classes

2013-12-08 Thread Mika Sjöman
Hi

Supper happy to see this! 

Two questions: 
1. could you cut them down a bit into smaller sections? 2.5 hour videos are 
a little bit too much to take in one time. 20 - 30 minutes max I would say 
is my personal attention span, preferably shorter.
2. is it possible to make it more like coursera or udacity? Watch video (20 
min), Practice with a quiz (write some short code to verify that I know the 
things), Answer a weekly quiz (after finishing 2.5h of video?).

Cheers!

On Tuesday, December 3, 2013 7:34:18 AM UTC+1, Massimo Di Pierro wrote:

 Hello everybody,

 As you know I teach a certification program about web development with 
 Python and I use web2py. 
 I posted my most recent classes online:

 https://vimeo.com/75499986
 https://vimeo.com/76047107
 https://vimeo.com/76608898
 https://vimeo.com/77179700
 https://vimeo.com/77654974

 It is about of 13 hours of web2py lessons and coding.
 Please join me in thanking the students who enrolled in the program and 
 supported these classes.

 Massimo


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] foreign key constraint failed ???

2013-12-08 Thread Ivan Gazzola
I can't resolve this ticket in mhy app. I try to insert from appadmin but 
i've always this error:

class 'sqlite3.IntegrityError' foreign key constraint failed


This is my model:

db.define_table('Nominativi',
Field('nome',notnull=True, represent=lambda nome:nome.title()),
Field('categoria',db.Categorie_Nominativi,default='1'),
Field('sesso',requires=IS_EMPTY_OR(IS_IN_SET(['maschio','femmina']))),
Field('mail',requires=IS_EMPTY_OR(IS_EMAIL(error_message=T('Inserire 
Una Mail Valida',
Field('indirizzo'),
Field('localita', label='Località'),
Field('cap',requires=IS_EMPTY_OR(IS_LENGTH(5,5, 
error_message=T('Inserire Un CAP valido',
Field('provincia',requires=IS_EMPTY_OR(IS_IN_SET(Elenco_Province, 
zero=T('Selezionare una Provincia',
Field('codice_fiscale',length=20),
Field('partita_iva',length=20),
Field('data_di_nascita','date'),
Field('professione'),
Field('padre'),
Field('madre'),
Field('inviato_da'),
Field('id_precendente','integer'),
format=lambda 
r:r.nome.title()+'--'+db.Categorie_Nominativi(r.categoria)['categoria'])

db.Nominativi.nome.filter_in = lambda value : w2p_encrypt(value,key=chiave)
db.Nominativi.nome.filter_out = lambda value : w2p_decrypt(value,key=chiave)
db.Nominativi.mail.filter_in = lambda value : w2p_encrypt(value,key=chiave)
db.Nominativi.mail.filter_out = lambda value : w2p_decrypt(value,key=chiave)
db.Nominativi.indirizzo.filter_in = lambda value : 
w2p_encrypt(value,key=chiave)
db.Nominativi.indirizzo.filter_out = lambda value : 
w2p_decrypt(value,key=chiave)
db.Nominativi.localita.filter_in = lambda value : 
w2p_encrypt(value,key=chiave)
db.Nominativi.localita.filter_out = lambda value : 
w2p_decrypt(value,key=chiave)
db.Nominativi.cap.filter_in = lambda value : w2p_encrypt(value,key=chiave)
db.Nominativi.cap.filter_out = lambda value : w2p_decrypt(value,key=chiave)
db.Nominativi.codice_fiscale.filter_in = lambda value : 
w2p_encrypt(value,key=chiave)
db.Nominativi.codice_fiscale.filter_out = lambda value : 
w2p_decrypt(value,key=chiave)
db.Nominativi.padre.filter_in = lambda value : w2p_encrypt(value,key=chiave)
db.Nominativi.padre.filter_out = lambda value : 
w2p_decrypt(value,key=chiave)
db.Nominativi.madre.filter_in = lambda value : w2p_encrypt(value,key=chiave)
db.Nominativi.madre.filter_out = lambda value : 
w2p_decrypt(value,key=chiave)
db.Nominativi.categoria.requires=IS_IN_DB(db,'Categorie_Nominativi.id','%(categoria)s',zero=None)
db.Nominativi.categoria.represent = lambda id,row: row.categoria
db.Nominativi.nome.represent = lambda nome,row: nome.title()
db.Nominativi.inviato_da.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome)

db.define_table('Relazioni',
Field('nominativo',db.Nominativi,required=True,requires=[IS_IN_DB(db, 
'Nominativi.id')]),
Field('referente',db.Nominativi,required=True,requires=[IS_IN_DB(db, 
'Nominativi.id')]),
Field('tipo_relazione',label='Tipo di relazione'))

db.Relazioni.tipo_relazione.widget = lambda field,value: \
 SQLFORM.widgets.string.widget(field,value,_placeholder=Inserire il 
tipo di relazione)
db.Relazioni.referente.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome,id_field=db.Nominativi.id,limitby=(0,10),
 
min_length=3)


db.define_table(Consulenze,
Field('dentista',db.Nominativi,required=True),
Field('data_inizio_collaborazione','date'),
Field('data_fine_collaborazione','date'),
Field('id_precedente','integer'),
format=lambda r:db.Nominativi(r.dentista)['nome'])
odontoiatri=db(db.Nominativi.categoria==2)
db.Consulenze.dentista.requires=IS_IN_DB(odontoiatri,'Nominativi.id','%(nome)s')

db.define_table(Pazienti_Consulenza,
Field('dentista',db.Consulenze, required=True),
Field('paziente',db.Nominativi,required=True, unique=True))

everything worked fine when I've added the table.
I can't see what is wrong in the last table ...

Thx

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: convert month into roman format

2013-12-08 Thread Massimo Di Pierro
https://pypi.python.org/pypi/rome/0.0.2

On Saturday, 7 December 2013 23:55:17 UTC-6, 黄祥 wrote:

 hi,

 is there any way to convert month into roman format?
 e.g.
 month = datetime.date.today().strftime('%m')

 i want to convert the month variable value into roman format
 what is the best way to achieve that?

 thanks and best regards,
 stifan


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Spatial/GIS: find records within X distance of point?

2013-12-08 Thread Massimo Di Pierro
Added ST_Dwithin support in trunk. Please check it.

On Sunday, 8 December 2013 07:02:06 UTC-6, User wrote:

 I'm storing latitude/longitude coordinates in a geometry field (using 
 PostgreSQL 
 9.1.10):

 Field('point', 'geometry()')

 I understand there is also the geography type but from my reading geometry 
 is faster and is suitable for small distances (
 http://workshops.boundlessgeo.com/postgis-intro/geography.html#why-not-use-geography
 )

 I want users to be able to specify a reference point and search for all 
 records within X distance from the reference point.  Using raw SQL I would 
 use  ST_DWithin http://postgis.refractions.net/docs/ST_DWithin.html doing 
 something like

 SELECT name, ST_AsText(point)
 FROM mytable
 WHERE ST_DWithin(point, ST_GeomFromText('POINT(40.47112 -76.33)',4326), 
 0.1)

 But web2py does not seem to support ST_DWithin only st_within.  So how can 
 I achieve a similar result in web2py?



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Online classes

2013-12-08 Thread Massimo Di Pierro
It would be great if you could edit the text and cut it into smaller parts. 
I am not recording it again. ;-)

On Sunday, 8 December 2013 07:03:10 UTC-6, Mika Sjöman wrote:

 Hi

 Supper happy to see this! 

 Two questions: 
 1. could you cut them down a bit into smaller sections? 2.5 hour videos 
 are a little bit too much to take in one time. 20 - 30 minutes max I would 
 say is my personal attention span, preferably shorter.
 2. is it possible to make it more like coursera or udacity? Watch video 
 (20 min), Practice with a quiz (write some short code to verify that I know 
 the things), Answer a weekly quiz (after finishing 2.5h of video?).

 Cheers!

 On Tuesday, December 3, 2013 7:34:18 AM UTC+1, Massimo Di Pierro wrote:

 Hello everybody,

 As you know I teach a certification program about web development with 
 Python and I use web2py. 
 I posted my most recent classes online:

 https://vimeo.com/75499986
 https://vimeo.com/76047107
 https://vimeo.com/76608898
 https://vimeo.com/77179700
 https://vimeo.com/77654974

 It is about of 13 hours of web2py lessons and coding.
 Please join me in thanking the students who enrolled in the program and 
 supported these classes.

 Massimo



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Online classes

2013-12-08 Thread Teddy Nyambe
Very helpful videos, but too big for download especially for some of us
with slow connections, downloaded two...three go!
On 8 Dec 2013 16:26, Massimo Di Pierro massimo.dipie...@gmail.com wrote:

 It would be great if you could edit the text and cut it into smaller
 parts. I am not recording it again. ;-)

 On Sunday, 8 December 2013 07:03:10 UTC-6, Mika Sjöman wrote:

 Hi

 Supper happy to see this!

 Two questions:
 1. could you cut them down a bit into smaller sections? 2.5 hour videos
 are a little bit too much to take in one time. 20 - 30 minutes max I would
 say is my personal attention span, preferably shorter.
 2. is it possible to make it more like coursera or udacity? Watch video
 (20 min), Practice with a quiz (write some short code to verify that I know
 the things), Answer a weekly quiz (after finishing 2.5h of video?).

 Cheers!

 On Tuesday, December 3, 2013 7:34:18 AM UTC+1, Massimo Di Pierro wrote:

 Hello everybody,

 As you know I teach a certification program about web development with
 Python and I use web2py.
 I posted my most recent classes online:

 https://vimeo.com/75499986
 https://vimeo.com/76047107
 https://vimeo.com/76608898
 https://vimeo.com/77179700
 https://vimeo.com/77654974

 It is about of 13 hours of web2py lessons and coding.
 Please join me in thanking the students who enrolled in the program and
 supported these classes.

 Massimo

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: foreign key constraint failed ???

2013-12-08 Thread Ivo
though it may not be the preferred solution I resolved it by adding:
adapter_args=dict(foreign_keys=False) to db = 
DAL('sqlite://storage.sqlite') in db.py


On Sunday, December 8, 2013 3:16:36 PM UTC+1, Ivan Gazzola wrote:

 I can't resolve this ticket in my app. I try to insert in 
 Pazienti_Consulenza from appadmin but i've always this error:
 
 class 'sqlite3.IntegrityError' foreign key constraint failed
 

 This is my model:

 db.define_table('Nominativi',
 Field('nome',notnull=True, represent=lambda nome:nome.title()),
 Field('categoria',db.Categorie_Nominativi,default='1'),
 Field('sesso',requires=IS_EMPTY_OR(IS_IN_SET(['maschio','femmina']))),
 Field('mail',requires=IS_EMPTY_OR(IS_EMAIL(error_message=T('Inserire 
 Una Mail Valida',
 Field('indirizzo'),
 Field('localita', label='Località'),
 Field('cap',requires=IS_EMPTY_OR(IS_LENGTH(5,5, 
 error_message=T('Inserire Un CAP valido',
 Field('provincia',requires=IS_EMPTY_OR(IS_IN_SET(Elenco_Province, 
 zero=T('Selezionare una Provincia',
 Field('codice_fiscale',length=20),
 Field('partita_iva',length=20),
 Field('data_di_nascita','date'),
 Field('professione'),
 Field('padre'),
 Field('madre'),
 Field('inviato_da'),
 Field('id_precendente','integer'),
 format=lambda 
 r:r.nome.title()+'--'+db.Categorie_Nominativi(r.categoria)['categoria'])

 db.Nominativi.nome.filter_in = lambda value : w2p_encrypt(value,key=chiave)
 db.Nominativi.nome.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)
 db.Nominativi.mail.filter_in = lambda value : w2p_encrypt(value,key=chiave)
 db.Nominativi.mail.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)
 db.Nominativi.indirizzo.filter_in = lambda value : 
 w2p_encrypt(value,key=chiave)
 db.Nominativi.indirizzo.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)
 db.Nominativi.localita.filter_in = lambda value : 
 w2p_encrypt(value,key=chiave)
 db.Nominativi.localita.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)
 db.Nominativi.cap.filter_in = lambda value : w2p_encrypt(value,key=chiave)
 db.Nominativi.cap.filter_out = lambda value : w2p_decrypt(value,key=chiave)
 db.Nominativi.codice_fiscale.filter_in = lambda value : 
 w2p_encrypt(value,key=chiave)
 db.Nominativi.codice_fiscale.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)
 db.Nominativi.padre.filter_in = lambda value : 
 w2p_encrypt(value,key=chiave)
 db.Nominativi.padre.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)
 db.Nominativi.madre.filter_in = lambda value : 
 w2p_encrypt(value,key=chiave)
 db.Nominativi.madre.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)

 db.Nominativi.categoria.requires=IS_IN_DB(db,'Categorie_Nominativi.id','%(categoria)s',zero=None)
 db.Nominativi.categoria.represent = lambda id,row: row.categoria
 db.Nominativi.nome.represent = lambda nome,row: nome.title()

 db.Nominativi.inviato_da.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome)

 db.define_table('Relazioni',
 Field('nominativo',db.Nominativi,required=True,requires=[IS_IN_DB(db, 
 'Nominativi.id')]),
 Field('referente',db.Nominativi,required=True,requires=[IS_IN_DB(db, 
 'Nominativi.id')]),
 Field('tipo_relazione',label='Tipo di relazione'))

 db.Relazioni.tipo_relazione.widget = lambda field,value: \
  SQLFORM.widgets.string.widget(field,value,_placeholder=Inserire il 
 tipo di relazione)

 db.Relazioni.referente.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome,id_field=
 db.Nominativi.id,limitby=(0,10), min_length=3)


 db.define_table(Consulenze,
 Field('dentista',db.Nominativi,required=True),
 Field('data_inizio_collaborazione','date'),
 Field('data_fine_collaborazione','date'),
 Field('id_precedente','integer'),
 format=lambda r:db.Nominativi(r.dentista)['nome'])
 odontoiatri=db(db.Nominativi.categoria==2)

 db.Consulenze.dentista.requires=IS_IN_DB(odontoiatri,'Nominativi.id','%(nome)s')

 db.define_table(Pazienti_Consulenza,
 Field('dentista',db.Consulenze, required=True),
 Field('paziente',db.Nominativi,required=True, unique=True))

 everything worked fine when I've added the table.
 I can't see what is wrong in the last table ...

 Thx


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Table reference field instead of the id

2013-12-08 Thread Gael Princivalle
Hello all.

Well I don't understand really how to manage this problem.

I cannot use web2py id's for referencing my brands, I need to use id's from 
another CRM application called 01. So I have in my brands table a field 
called id_01 and in the products table a field called brand_id_01.
When I modify a products row in the admin interface I can choose the 
brand_id_01 by the brands.name, OK, but when I display the products 
table I see the brand_id_01, KO.
Also when I display a SQLFORM.grid from the products table I don't see 
the brands.name instead of the brand_id_01.
How I can display the brands.name instead of the brand_id_01 in my 
SQLFORM.grid ?

My db:
db.define_table('brands',
Field('id_01', unique = True),
Field('name'),
format='%(names')
db.define_table('products',
Field('code', unique=True),
Field('description'),
Field('brand_id_01', 'reference brands', requires = 
IS_IN_DB(db, db.brands.id_01, '%(name)s')))

My controller:
def products_listing():
query=db.products
fields = 
(db.products.id_01,db.products.code,db.products.description,db.products.brand_id_01)
grid = SQLFORM.grid(query, fields=fields)
return dict(grid=grid)

Thanks a lot for any kind of help.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] get a controller function in default view

2013-12-08 Thread Ivo
I need to get dictionary item which is located in 
default.py in to a view. to be more specific:

default.py:

def my function():
my_result = 'my result' 
return dict(my_result=my_result)

the view is accessed from default/my_function.html, 
but my_result is also needed in a html above that (views/layout_1.html) 
how do I do that?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Table reference field instead of the id

2013-12-08 Thread 黄祥
i think you should refer it to db.brands.id. e.g.
db.define_table('brands',
Field('id_01', unique = True),
Field('name'),
format='%(name)s')
db.define_table('products',
Field('code', unique=True),
Field('description'),
Field('brand_id_01', 'reference brands', requires = 
IS_IN_DB(db, db.brands.id, '%(name)s')))

it requires the table products to refer to brands id field not id_01 in 
table brands. not sure what do you want to achieve in here, i think you can 
make conditional requires.
e.g. (not tested)
if 'crm' in request.function :
db.products.brand_id_01.requires = IS_IN_DB(db, db.brands.id, 
'%(id_01)s')
else:
db.products.brand_id_01.requires = IS_IN_DB(db, db.brands.id, 
'%(name)s')

my point is the reference field in products table is refer to the id field 
on brands, and for the field represented on drop down list is base on the 
function, if it contain 'crm' it will show the brands.id_01, other function 
will show the name.

ref:
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Database-validators
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-representation

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: convert month into roman format

2013-12-08 Thread 黄祥
thank you so much for the reference link, massimo.

best regards,
stifan

On Sunday, December 8, 2013 9:21:41 PM UTC+7, Massimo Di Pierro wrote:

 https://pypi.python.org/pypi/rome/0.0.2

 On Saturday, 7 December 2013 23:55:17 UTC-6, 黄祥 wrote:

 hi,

 is there any way to convert month into roman format?
 e.g.
 month = datetime.date.today().strftime('%m')

 i want to convert the month variable value into roman format
 what is the best way to achieve that?

 thanks and best regards,
 stifan



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: get a controller function in default view

2013-12-08 Thread 黄祥
why not extend the layout_1.html in your view?
e.g.
{{extend 'layout_1.html'}}

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: foreign key constraint failed ???

2013-12-08 Thread 黄祥
had you already try using :
'reference Nominativi' instead of db.Nominativi 
and 
requires is set to db.Nominativi.id instead of 'Nominativi.id'?

e.g. 
db.define_table('Relazioni',
Field('nominativo', 'reference Nominativi', 
required=True,requires=[IS_IN_DB(db, db.Nominativi.id)]),
Field('referente', reference Nominativi', 
required=True,requires=[IS_IN_DB(db, db.Nominativi.id)]),
Field('tipo_relazione',label='Tipo di relazione'))

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: cannot get a multiselect list

2013-12-08 Thread 黄祥


 requires=IS_IN_SET(ngotype]),


are you sure? there is unbalance bracket [] on that
i mean:

requires=IS_IN_SET(ngotype]),

should be

requires=IS_IN_SET(ngotype),


best regards,

stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: foreign key constraint failed ???

2013-12-08 Thread Ivan Gazzola
I changed all fields in 'referece field' format but nothing changes :(
For the validatos IS_IN_DB(db,db.table.field,format) is mistaken and return 
errors, indeed the correct form is IS_IN_DB(db,table.field,format) ...

Regards

Ivan

Il giorno domenica 8 dicembre 2013 17:20:15 UTC+1, 黄祥 ha scritto:

 had you already try using :
 'reference Nominativi' instead of db.Nominativi 
 and 
 requires is set to db.Nominativi.id instead of 'Nominativi.id'?

 e.g. 
 db.define_table('Relazioni',
 Field('nominativo', 'reference Nominativi', 
 required=True,requires=[IS_IN_DB(db, db.Nominativi.id)]),
 Field('referente', reference Nominativi', 
 required=True,requires=[IS_IN_DB(db, db.Nominativi.id)]),
 Field('tipo_relazione',label='Tipo di relazione'))

 best regards,
 stifan


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: get a controller function in default view

2013-12-08 Thread Ivo
I'm not quite sure what you mean or how I should do that.
The layout_1.html serves as the template on how items are displayed. (it's 
not a replacement for layout.html)
Layout_1.html is included in several other views as the basis of how to 
display the items.

It has a table inside which dictates how the items are shown.
I need to add the my_result inside that table.

I'm going to try to copy the function to a model as well. that should make 
it globally available. 
Since I'm new to all of this I'm not sure on how things should be done and 
what's best practice.


On Sunday, December 8, 2013 5:14:19 PM UTC+1, 黄祥 wrote:

 why not extend the layout_1.html in your view?
 e.g.
 {{extend 'layout_1.html'}}

 best regards,
 stifan


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] URL Routing question re: setting persistent arguments for use in controller functions

2013-12-08 Thread Jonathan Lundell
On 8 Dec 2013, at 12:46 AM, Henry Nguyen henrynguy...@gmail.com wrote:

 I have an application in which users can have sub_users. Within the app, a 
 user can select a sub_user, at which point, all controls become targeted to 
 that selected sub_user. For example, if I select sub_user 1 and then goto 
 settings/show_settings.html, I want the show_settings.html to show settings 
 only for that sub_user 1. If I navigate to another page, I want the 
 controller and function to again refer only to sub_user 1. I want it to stay 
 like this until I explicitly navigate to another sub_user 2.
 
 In the case of web2py's URL mapping scheme, I assume this would mean I would 
 have to use 1 as the argument after every function in the URL. What's the 
 best way to go about ensuring this? Is this even the best way?
 

Consider storing the sub_user ID in your session.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: foreign key constraint failed ???

2013-12-08 Thread Ivan Gazzola
If possible I prefer to keep foreign_keys=True for db integrity.

Thx

Ivan

Il giorno domenica 8 dicembre 2013 15:41:03 UTC+1, Ivo ha scritto:

 though it may not be the preferred solution I resolved it by adding:
 adapter_args=dict(foreign_keys=False) to db = 
 DAL('sqlite://storage.sqlite') in db.py


 On Sunday, December 8, 2013 3:16:36 PM UTC+1, Ivan Gazzola wrote:

 I can't resolve this ticket in my app. I try to insert in 
 Pazienti_Consulenza from appadmin but i've always this error:
 
 class 'sqlite3.IntegrityError' foreign key constraint failed
 

 This is my model:

 db.define_table('Nominativi',
 Field('nome',notnull=True, represent=lambda nome:nome.title()),
 Field('categoria',db.Categorie_Nominativi,default='1'),
 Field('sesso',requires=IS_EMPTY_OR(IS_IN_SET(['maschio','femmina']))),
 Field('mail',requires=IS_EMPTY_OR(IS_EMAIL(error_message=T('Inserire 
 Una Mail Valida',
 Field('indirizzo'),
 Field('localita', label='Località'),
 Field('cap',requires=IS_EMPTY_OR(IS_LENGTH(5,5, 
 error_message=T('Inserire Un CAP valido',
 Field('provincia',requires=IS_EMPTY_OR(IS_IN_SET(Elenco_Province, 
 zero=T('Selezionare una Provincia',
 Field('codice_fiscale',length=20),
 Field('partita_iva',length=20),
 Field('data_di_nascita','date'),
 Field('professione'),
 Field('padre'),
 Field('madre'),
 Field('inviato_da'),
 Field('id_precendente','integer'),
 format=lambda 
 r:r.nome.title()+'--'+db.Categorie_Nominativi(r.categoria)['categoria'])

 db.Nominativi.nome.filter_in = lambda value : 
 w2p_encrypt(value,key=chiave)
 db.Nominativi.nome.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)
 db.Nominativi.mail.filter_in = lambda value : 
 w2p_encrypt(value,key=chiave)
 db.Nominativi.mail.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)
 db.Nominativi.indirizzo.filter_in = lambda value : 
 w2p_encrypt(value,key=chiave)
 db.Nominativi.indirizzo.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)
 db.Nominativi.localita.filter_in = lambda value : 
 w2p_encrypt(value,key=chiave)
 db.Nominativi.localita.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)
 db.Nominativi.cap.filter_in = lambda value : w2p_encrypt(value,key=chiave)
 db.Nominativi.cap.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)
 db.Nominativi.codice_fiscale.filter_in = lambda value : 
 w2p_encrypt(value,key=chiave)
 db.Nominativi.codice_fiscale.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)
 db.Nominativi.padre.filter_in = lambda value : 
 w2p_encrypt(value,key=chiave)
 db.Nominativi.padre.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)
 db.Nominativi.madre.filter_in = lambda value : 
 w2p_encrypt(value,key=chiave)
 db.Nominativi.madre.filter_out = lambda value : 
 w2p_decrypt(value,key=chiave)

 db.Nominativi.categoria.requires=IS_IN_DB(db,'Categorie_Nominativi.id','%(categoria)s',zero=None)
 db.Nominativi.categoria.represent = lambda id,row: row.categoria
 db.Nominativi.nome.represent = lambda nome,row: nome.title()

 db.Nominativi.inviato_da.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome)

 db.define_table('Relazioni',
 Field('nominativo',db.Nominativi,required=True,requires=[IS_IN_DB(db, 
 'Nominativi.id')]),
 Field('referente',db.Nominativi,required=True,requires=[IS_IN_DB(db, 
 'Nominativi.id')]),
 Field('tipo_relazione',label='Tipo di relazione'))

 db.Relazioni.tipo_relazione.widget = lambda field,value: \
  SQLFORM.widgets.string.widget(field,value,_placeholder=Inserire il 
 tipo di relazione)

 db.Relazioni.referente.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome,id_field=
 db.Nominativi.id,limitby=(0,10), min_length=3)


 db.define_table(Consulenze,
 Field('dentista',db.Nominativi,required=True),
 Field('data_inizio_collaborazione','date'),
 Field('data_fine_collaborazione','date'),
 Field('id_precedente','integer'),
 format=lambda r:db.Nominativi(r.dentista)['nome'])
 odontoiatri=db(db.Nominativi.categoria==2)

 db.Consulenze.dentista.requires=IS_IN_DB(odontoiatri,'Nominativi.id','%(nome)s')

 db.define_table(Pazienti_Consulenza,
 Field('dentista',db.Consulenze, required=True),
 Field('paziente',db.Nominativi,required=True, unique=True))

 everything worked fine when I've added the table.
 I can't see what is wrong in the last table ...

 Thx



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: foreign key constraint failed ???

2013-12-08 Thread Alan Etkin


 If possible I prefer to keep foreign_keys=True for db integrity.


Another similar thread 

https://groups.google.com/d/msg/web2py/klspqXpha4E/mCwQ6HC5IhAJ

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Table reference field instead of the id

2013-12-08 Thread Gael Princivalle
Thanks Stifan but also with:
db.products.brand_id_01.requires = IS_IN_DB(db, db.brands.id, '%(name)s')
web2py don't display the db.brands.name instead of the 
db.products.brand_id_01..

A solution could be make lambda function, what do you think about something 
like that ?
In the controller:
def products_listing():
query=db.products
links = [dict(header=T('Brand'), body=lambda row: (something that 
return the brands.name of the products.brand_id_01 current row)]
fields = 
(db.products.id_01,db.products.code,db.products.description,db.products.brand_id_01)
grid = SQLFORM.grid(query, fields=fields, links=links)
return dict(grid=grid)

Is it possible ?

Il giorno domenica 8 dicembre 2013 17:10:18 UTC+1, 黄祥 ha scritto:

 i think you should refer it to db.brands.id. e.g.
 db.define_table('brands',
 Field('id_01', unique = True),
 Field('name'),
 format='%(name)s')
 db.define_table('products',
 Field('code', unique=True),
 Field('description'),
 Field('brand_id_01', 'reference brands', requires = 
 IS_IN_DB(db, db.brands.id, '%(name)s')))

 it requires the table products to refer to brands id field not id_01 in 
 table brands. not sure what do you want to achieve in here, i think you can 
 make conditional requires.
 e.g. (not tested)
 if 'crm' in request.function :
 db.products.brand_id_01.requires = IS_IN_DB(db, db.brands.id, 
 '%(id_01)s')
 else:
 db.products.brand_id_01.requires = IS_IN_DB(db, db.brands.id, 
 '%(name)s')

 my point is the reference field in products table is refer to the id field 
 on brands, and for the field represented on drop down list is base on the 
 function, if it contain 'crm' it will show the brands.id_01, other function 
 will show the name.

 ref:

 http://web2py.com/books/default/chapter/29/07/forms-and-validators#Database-validators

 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-representation

 best regards,
 stifan


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] URL Routing question re: setting persistent arguments for use in controller functions

2013-12-08 Thread Jonathan Lundell
On 8 Dec 2013, at 8:43 AM, Jonathan Lundell jlund...@pobox.com wrote:

 On 8 Dec 2013, at 12:46 AM, Henry Nguyen henrynguy...@gmail.com wrote:
 
 I have an application in which users can have sub_users. Within the app, a 
 user can select a sub_user, at which point, all controls become targeted to 
 that selected sub_user. For example, if I select sub_user 1 and then goto 
 settings/show_settings.html, I want the show_settings.html to show 
 settings only for that sub_user 1. If I navigate to another page, I want the 
 controller and function to again refer only to sub_user 1. I want it to stay 
 like this until I explicitly navigate to another sub_user 2.
 
 In the case of web2py's URL mapping scheme, I assume this would mean I would 
 have to use 1 as the argument after every function in the URL. What's the 
 best way to go about ensuring this? Is this even the best way?
 
 
 Consider storing the sub_user ID in your session.

I should point out, though, that there's a downside to this. Suppose a user 
opens multiple tabs, and tries to work with different sub_users in different 
tabs. That will fail, because all the tabs share the same session.

If that's not an issue for you, sessions are the way to go. If it is, try 
putting the sub_user into your forms as a hidden variable, and picking it up 
from vars.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Importng dropbox and scheduler problem

2013-12-08 Thread Peter
When I access dropbox from my web2py app through the browser, the dropbox 
access works fine.

If I do at linux command line 
Python2.6
import dropbox


it imports fine.

If I start the scheduler with

python2.6 /opt/web-apps/web2py web2py.py -K myapp

the sheduler works fine, but if I#

import dropbox

in a function used by the scheduler, it fails with a ImportError: No 
module named dropbox error
any ideas what can be wrong. When i have the same setup on another server 
there is no problem.

Thanks in advance for any help on this puzzling problem.

Peter



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Online classes

2013-12-08 Thread Mika Sjöman
Hmm... ok.

Thinking ... if it would be possible to use vimeo to integrate into a small 
learn web2py website. Just need pause points to hide the video 
temporarily and show them again after the user has input commands into a 
text area field and has gotten them verified as correct. We actually do 
almost the same in our compnay, but with short videos at dominochinese.com 
where we teach Chinese using videos and quizzes. Or is this something you 
are planning to do yourself?

Cheers



On Sunday, December 8, 2013 3:26:40 PM UTC+1, Massimo Di Pierro wrote:

 It would be great if you could edit the text and cut it into smaller 
 parts. I am not recording it again. ;-)

 On Sunday, 8 December 2013 07:03:10 UTC-6, Mika Sjöman wrote:

 Hi

 Supper happy to see this! 

 Two questions: 
 1. could you cut them down a bit into smaller sections? 2.5 hour videos 
 are a little bit too much to take in one time. 20 - 30 minutes max I would 
 say is my personal attention span, preferably shorter.
 2. is it possible to make it more like coursera or udacity? Watch video 
 (20 min), Practice with a quiz (write some short code to verify that I know 
 the things), Answer a weekly quiz (after finishing 2.5h of video?).

 Cheers!

 On Tuesday, December 3, 2013 7:34:18 AM UTC+1, Massimo Di Pierro wrote:

 Hello everybody,

 As you know I teach a certification program about web development with 
 Python and I use web2py. 
 I posted my most recent classes online:

 https://vimeo.com/75499986
 https://vimeo.com/76047107
 https://vimeo.com/76608898
 https://vimeo.com/77179700
 https://vimeo.com/77654974

 It is about of 13 hours of web2py lessons and coding.
 Please join me in thanking the students who enrolled in the program and 
 supported these classes.

 Massimo



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: get a controller function in default view

2013-12-08 Thread Ivo
Any one know how I can do this.
I tried creating a model but still no joy...

On Sunday, December 8, 2013 5:41:01 PM UTC+1, Ivo wrote:

 I'm not quite sure what you mean or how I should do that.
 The layout_1.html serves as the template on how items are displayed. (it's 
 not a replacement for layout.html)
 Layout_1.html is included in several other views as the basis of how to 
 display the items.

 It has a table inside which dictates how the items are shown.
 I need to add the my_result inside that table.

 I'm going to try to copy the function to a model as well. that should make 
 it globally available. 
 Since I'm new to all of this I'm not sure on how things should be done and 
 what's best practice.


 On Sunday, December 8, 2013 5:14:19 PM UTC+1, 黄祥 wrote:

 why not extend the layout_1.html in your view?
 e.g.
 {{extend 'layout_1.html'}}

 best regards,
 stifan



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: get a controller function in default view

2013-12-08 Thread Ovidio Marinho
{{extend 'layout1.html}}

{{=my_result}}




 Ovidio Marinho Falcao Neto
  ITJP.NET.BR
 ovidio...@gmail.com
 Brasil



2013/12/8 Ivo ivo.nijenh...@gmail.com

 Any one know how I can do this.
 I tried creating a model but still no joy...


 On Sunday, December 8, 2013 5:41:01 PM UTC+1, Ivo wrote:

 I'm not quite sure what you mean or how I should do that.
 The layout_1.html serves as the template on how items are displayed.
 (it's not a replacement for layout.html)
 Layout_1.html is included in several other views as the basis of how to
 display the items.

 It has a table inside which dictates how the items are shown.
 I need to add the my_result inside that table.

 I'm going to try to copy the function to a model as well. that should
 make it globally available.
 Since I'm new to all of this I'm not sure on how things should be done
 and what's best practice.


 On Sunday, December 8, 2013 5:14:19 PM UTC+1, 黄祥 wrote:

 why not extend the layout_1.html in your view?
 e.g.
 {{extend 'layout_1.html'}}

 best regards,
 stifan

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Table reference field instead of the id

2013-12-08 Thread Massimo Di Pierro
Try replace

lambda row: (something that return the brands.name of the 
products.brand_id_01 current row)

with

lambda row: 
(db.brandshttp://www.google.com/url?q=http%3A%2F%2Fdb.brands.namesa=Dsntz=1usg=AFQjCNE3jQMLe-HFn1TMWcTiEsecaE2E1w
(row.brand_id_01).name)

On Sunday, 8 December 2013 11:26:34 UTC-6, Gael Princivalle wrote:

 Thanks Stifan but also with:
 db.products.brand_id_01.requires = IS_IN_DB(db, db.brands.id, '%(name)s')
 web2py don't display the 
 db.brands.namehttp://www.google.com/url?q=http%3A%2F%2Fdb.brands.namesa=Dsntz=1usg=AFQjCNE3jQMLe-HFn1TMWcTiEsecaE2E1w
  
 instead of the db.products.brand_id_01..

 A solution could be make lambda function, what do you think about 
 something like that ?
 In the controller:
 def products_listing():
 query=db.products
 links = [dict(header=T('Brand'), body=lambda row: (something that 
 return the brands.name of the products.brand_id_01 current row)]
 fields = 
 (db.products.id_01,db.products.code,db.products.description,db.products.brand_id_01)
 grid = SQLFORM.grid(query, fields=fields, links=links)
 return dict(grid=grid)

 Is it possible ?

 Il giorno domenica 8 dicembre 2013 17:10:18 UTC+1, 黄祥 ha scritto:

 i think you should refer it to db.brands.id. e.g.
 db.define_table('brands',
 Field('id_01', unique = True),
 Field('name'),
 format='%(name)s')
 db.define_table('products',
 Field('code', unique=True),
 Field('description'),
 Field('brand_id_01', 'reference brands', requires = 
 IS_IN_DB(db, db.brands.id, '%(name)s')))

 it requires the table products to refer to brands id field not id_01 in 
 table brands. not sure what do you want to achieve in here, i think you can 
 make conditional requires.
 e.g. (not tested)
 if 'crm' in request.function :
 db.products.brand_id_01.requires = IS_IN_DB(db, db.brands.id, 
 '%(id_01)s')
 else:
 db.products.brand_id_01.requires = IS_IN_DB(db, db.brands.id, 
 '%(name)s')

 my point is the reference field in products table is refer to the id 
 field on brands, and for the field represented on drop down list is base on 
 the function, if it contain 'crm' it will show the brands.id_01, other 
 function will show the name.

 ref:

 http://web2py.com/books/default/chapter/29/07/forms-and-validators#Database-validators

 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-representation

 best regards,
 stifan



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Importng dropbox and scheduler problem

2013-12-08 Thread Peter


 I have made some progress.


The import of dropbox works fine when the scheduler is started from the 
command line

python2.6 /opt/web-apps/web2py web2py.py -K myapp


But it does not work when the scheduler is started as a service. 

So the issue is caused when one starts the scheduler as a service.

In my startup file

DAEMON=python2.6
PARAMETERS=/opt/web-apps/web2pyr/web2py.py -K new_spin2

and 
RUN=RUN=`$DAEMON $PARAMETERS

So it is doing the same thing, so the issue I guess is caused by the order 
of startup of the services.

Does anyone know how this can affect imports into python?

Thanks
Peter


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Question on EMTE and websockets

2013-12-08 Thread John Griffith
Did you get this fixed? 

On Saturday, 8 June 2013 14:52:08 UTC+1, george3825 wrote:

 Hello,

 I have been trying to get the EMTE engine up and running. So far I have 
 gotten the matchingserver, robottrader, and the log parsers to work and 
 even into a MySQL DB. I have been stuck on getting the trading data to 
 display in a browser. When any browser (IE, FF, Chrome) connects to the 
 site I see the matchingserver print a client connected message. Also when 
 using Wireshark I can see the data being sent to my PC. When I run Chrome 
 Dev browser the realtime/ websocket connection just sits on Switching 
 protocol pending. Also the same is if I place an order by clicking on the 
 trading GUI.

 Any ideas?




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: get a controller function in default view

2013-12-08 Thread Anthony
It would help if you show layout_1.html and how it is included in the view, 
but you can refer to a variable returned by the controller in any included 
view:

In myfunction.html:

{{extend 'layout.html'}}

{{include 'layout_1.html'}}

Then in layout_1.html:

{{=myresult}}

Or if you need to check whether myresult exists:

{{=globals().get('myresult', '')}}

Anthony

On Sunday, December 8, 2013 11:41:01 AM UTC-5, Ivo wrote:

 I'm not quite sure what you mean or how I should do that.
 The layout_1.html serves as the template on how items are displayed. (it's 
 not a replacement for layout.html)
 Layout_1.html is included in several other views as the basis of how to 
 display the items.

 It has a table inside which dictates how the items are shown.
 I need to add the my_result inside that table.

 I'm going to try to copy the function to a model as well. that should make 
 it globally available. 
 Since I'm new to all of this I'm not sure on how things should be done and 
 what's best practice.


 On Sunday, December 8, 2013 5:14:19 PM UTC+1, 黄祥 wrote:

 why not extend the layout_1.html in your view?
 e.g.
 {{extend 'layout_1.html'}}

 best regards,
 stifan



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: app not working after install 2.8.2 is_mobile error

2013-12-08 Thread Vinhthuy
Massimo: I feel really scared reading this.  In fact, I haven't upgraded to 
the latest version yet, partly because exactly what you said.  I haven't 
kept up with this reading list, and I am afraid that after the upgrade my 
apps won't work because I fail to do certain things that are discussed in 
the this reading list.

Can you please enforce a policy that all things that we need to do after an 
upgrade would be listed in CHANGES?  Thanks.



On Friday, December 6, 2013 8:38:25 PM UTC-6, Massimo Di Pierro wrote:

 You missed a few threads discussing this. ;-)
 You need to clear/remove the sessions. The format of the session storage 
 has changed.

 On Friday, 6 December 2013 17:55:52 UTC-6, Ivo wrote:

 I tried upgrading the web2py to 2.8.2 that was a bad idea...
 it totally killed the web2py app.
 I redownloaded a clean version and copied over my app now it throws the 
 weirdest error:
 type 'exceptions.NameError''dict' object has no attribute 'is_mobile'
 it traces to user.html, but in reality it's caused by layout.htm
 the welcome app is working so I had a look inside the layout.html basicly 
 the same except for a few mods I made that are unrelated.

 what am I missing? 



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] URL Routing question re: setting persistent arguments for use in controller functions

2013-12-08 Thread Henry Nguyen
Jonathan, 

Thank you for your suggestion. Session variables should work just fine for 
this indeed.

Just for future reference, I had also came up with a somewhat hacky way to 
get my navigation menus to append the sub_user.id as an argument. 
Basically, I have two navigation menus: one on the left to select the 
sub_user and one at the top for various actions pertaining to that 
sub_user. In menu.py, iterate over each sub_user and add a tab for the 
sub_user menu, appending the sub_user.id as an argument to the URL. Then, 
only add the top menu items if the current sub_user.id equals the id in the 
URL arguments. If so, set the arguments for each of those tabs to be that 
sub_user.id. In other words:

for sub_user in db(db.sub_user.auth_user_id==auth.user_id).select():
response.sub_user_menu += [
(str(sub_user.first_name), False, URL('dashboard', 'index', args=str
(sub_user.id)), [])]
if request.args(0) and str(sub_user.id) == str(request.args(0)):
response.dashboard_menu = [
(T('Tab1'), (request.function=='tab1'), URL('dashboard', 'tab1',args
=str(sub_user.id)), []),
(T('Tab2'), (request.function=='tab2'), URL('dashboard', 'tab2',args
=str(sub_user.id)), []),
(T('Tab3'), (request.function=='tab3'), URL('dashboard', 'tab3',args
=str(sub_user.id)), [])]

Not sure how Pythonic this really is but it got the job done. Sessions will 
be much cleaner, though, so I'll go with that. Thank you again.



On Sunday, December 8, 2013 9:28:16 AM UTC-8, Jonathan Lundell wrote:

 On 8 Dec 2013, at 8:43 AM, Jonathan Lundell jlun...@pobox.comjavascript: 
 wrote:

 On 8 Dec 2013, at 12:46 AM, Henry Nguyen henryn...@gmail.comjavascript: 
 wrote:

 I have an application in which users can have sub_users. Within the app, a 
 user can select a sub_user, at which point, all controls become targeted to 
 that selected sub_user. For example, if I select sub_user 1 and then goto 
 settings/show_settings.html, I want the show_settings.html to show 
 settings only for that sub_user 1. If I navigate to another page, I want 
 the controller and function to again refer only to sub_user 1. I want it to 
 stay like this until I explicitly navigate to another sub_user 2.

 In the case of web2py's URL mapping scheme, I assume this would mean I 
 would have to use 1 as the argument after every function in the URL. What's 
 the best way to go about ensuring this? Is this even the best way?


 Consider storing the sub_user ID in your session.


 I should point out, though, that there's a downside to this. Suppose a 
 user opens multiple tabs, and tries to work with different sub_users in 
 different tabs. That will fail, because all the tabs share the same session.

 If that's not an issue for you, sessions are the way to go. If it is, try 
 putting the sub_user into your forms as a hidden variable, and picking it 
 up from vars.



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] how to build field list from string for SQLFORM.grid?

2013-12-08 Thread P T
I am dynamically creating the fields in a table from entries in another 
table. I am using SQLFORM.grid to view/edit the table. 

For the grid, the following field list works fine:
   fields=[db.monthly_projections.employee, db.monthly_projections.id, db.
monthly_projections.costcode,
   db.monthly_projections.Dec_2013, db.monthly_projections.Jan_2014,db
.monthly_projections.Feb_2014]

But, the problem is I don't know the complete field list ahead of time. So, 
I am using this instead:
   fields=[db.monthly_projections.employee, db.monthly_projections.id, db.
monthly_projections.costcode] 
   for row in  db(db.months).select():
   fields.append('db.monthly_projections.'+ row.effort_month.strftime(
'%b_%Y'))

This is giving an error 
type 'exceptions.AttributeError' 'str' object has no attribute 'tablename'

On debugging, I see that the fields is created as three gluon.dal.Fields 
and three strings

 fields
[gluon.dal.Field object at 0x05414470, 
gluon.dal.Field object at 0x046D7A58, 
gluon.dal.Field object at 0x09F15D30, 
'db.monthly_projections.Dec_2013', 
'db.monthly_projections.Jan_2014', 
'db.monthly_projections.Feb_2014']

So, I changed the definition of fields to:
   fields=[db.monthly_projections.employee, db.monthly_projections.id, db.
monthly_projections.costcode] 
   for row in  db(db.months).select():
   fields.append(Field('db.monthly_projections.'+ row.effort_month.strftime(
'%b_%Y')))

and this gives an error:
type 'exceptions.SyntaxError' invalid table or field name: 
db.monthly_projections.Dec_2013 
So, in short, how do I build the field list from string for SQLFORM.grid?

Thanks for your help!
PT

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: app not working after install 2.8.2 is_mobile error

2013-12-08 Thread Ivo
I searched for one as well but just took the risk because I backed up my 
apps.
however I do propose that the upgrade script includes clearing out sessions 
and cache this will save a lot time and questions. Also the impact should 
be mentioned. For example the foreign key error a lot of us are having.

On Monday, December 9, 2013 5:11:40 AM UTC+1, Vinhthuy wrote:

 Massimo: I feel really scared reading this.  In fact, I haven't upgraded 
 to the latest version yet, partly because exactly what you said.  I haven't 
 kept up with this reading list, and I am afraid that after the upgrade my 
 apps won't work because I fail to do certain things that were discussed 
 here.

 Can you please enforce a policy that whatever we need to do after an 
 upgrade would be listed in CHANGES?  Thanks.



 On Friday, December 6, 2013 8:38:25 PM UTC-6, Massimo Di Pierro wrote:

 You missed a few threads discussing this. ;-)
 You need to clear/remove the sessions. The format of the session storage 
 has changed.

 On Friday, 6 December 2013 17:55:52 UTC-6, Ivo wrote:

 I tried upgrading the web2py to 2.8.2 that was a bad idea...
 it totally killed the web2py app.
 I redownloaded a clean version and copied over my app now it throws the 
 weirdest error:
 type 'exceptions.NameError''dict' object has no attribute 'is_mobile'
 it traces to user.html, but in reality it's caused by layout.htm
 the welcome app is working so I had a look inside the layout.html 
 basicly the same except for a few mods I made that are unrelated.

 what am I missing? 



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: having troubles with scheduler in 2.8.2

2013-12-08 Thread Niphlod
commit() can only be called on the DAL instance, not on the table

i.e. 
db.commit()
instead of
db.tablename.commit()


On Sunday, December 8, 2013 1:57:13 PM UTC+1, Ivo wrote:

 I'm trying to get the scheduler up and running but it keeps giving me 
 failed and then stops.
 -D0 gives me:

 DEBUG:web2py.scheduler.mac.linuxmce#16946:   task starting
 DEBUG:web2py.scheduler.mac.linuxmce#16946:task started
 DEBUG:web2py.scheduler.mac.linuxmce#16946:recording heartbeat 
 (RUNNING)
 DEBUG:web2py.scheduler.mac.linuxmce#16973:new task report: FAILED
 DEBUG:web2py.scheduler.mac.linuxmce#16973:   traceback: Traceback (most 
 recent call last):
   File /Applications/web2py 
 2/web2py-2.8.2/web2py.app/Contents/Resources/gluon/scheduler.py, line 238, 
 in executor
 result = dumps(_function(*args, **vars))
   File applications/test_app/models/tasks.py, line 108, in update
 db.people.commit()
   File /Applications/web2py 
 2/web2py-2.8.2/web2py.app/Contents/Resources/gluon/dal.py, line 8817, in 
 __getitem__
 return ogetattr(self, str(key))
 AttributeError: 'Table' object has no attribute 'commit'

 Traceback (most recent call last):
   File 
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/queues.py,
  
 line 266, in _feed
 send(obj)
 PicklingError: Can't pickle class '__restricted__.TaskReport': import of 
 module __restricted__ failed
 DEBUG:web2py.scheduler.mac.linuxmce#16946:task stopped
 DEBUG:web2py.scheduler.mac.linuxmce#16946:new task report: STOPPED
 DEBUG:web2py.scheduler.mac.linuxmce#16946:   result: None
 DEBUG:web2py.scheduler.mac.linuxmce#16946: recording task report in db 
 (STOPPED)
 INFO:web2py.scheduler.mac.linuxmce#16946:task completed (STOPPED)



 -used db is SQLite
 -tasks.py:

 def update():
 rows=db(db.people.id == 1).select()
 row=rows[0]
 row.update_record(name = John)
 db.people.commit()
 return locals()

 anyone?



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.