[web2py] Re: transfer local database to Google App Engine website
any migration mentioned in the book refers to altering the table on the backend (i.e. adding/removing columns, tables, and so on). You instead want to move the data within the local database to what is in appspot.com you need to do that AFTER you moved the application directly on .appspot.com . If the model is not complicated, you can succesfully export all the local data to a csv file and reimport that on appspot.com http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Exporting-and-importing-data On Sunday, October 27, 2013 3:36:24 AM UTC+1, books2be...@gmail.com wrote: > > I am trying to deploy my app on Google App Engine. I have a set of > databases that I've built up locally on my laptop that have been > interfacing just fine with my app when the app is running locally. However, > when I visit the .appspot.com address for my app, none of the databases > are present. Also, when I check my datastore on the GAE dashboard, it says > that I don't have any of those databases present. > I read the deployment recipe for GAE and it talks about migrating > databases. What I gleaned from reading that info was that if migrate was > set to true in the database definition, then the local-to-GAE-server > migration should take place automatically. However, this does not seem to > be working. > > Can someone help me out with this? Is my thought process for migrating > databases from my local computer to the GAE servers completely wrong? If > so, can you step through how exactly I can perform the transfer of the > databases? > -- 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: sqlform.smartgrid not show linked_tables only the archieves
please ignore this report, i'm sorry, my mistake in my previous version, the same apps, i didn't use response.models_to_run, in current stable version i use response.models_to_run and forgot to add the related linked_tables. 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] Named arguments in URL()
Hi All, I have a question about URL(). In the book it was written: "... It is also possible to specify application, controller and function using named argument. URL(a='a', c='c', f='f') ..." but for example when I write this: URL(a='myotherapp') the generated URL comes like this: http://127.0.0.1:8000/init/default/myotherapp but it should be like this: http://127.0.0.1:8000/myotherapp Am I right? Thank you for answering. Regards: Roland -- 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] Conexao POSTGRESQL com PYTHON/WEB2PY - problema
Ola, bom dia.. estou com um problema, nao consigo conectar meu banco de dados postgresql ao meu projeto, iniciei utilizando o SQLLITE, conforme aprendi no curso do bruno rocha, so q agora ja queria utilizar o postgresql, dai veio os problemas... rs veja meu codigo... vi as explicacoes e exemplos.. veja como esta meu codigo ate exibir a grid... *no MODELS - "appsettings.py" ta assim* from gluon.storage import Storage config = Storage( db=Storage(), mail=Storage(), auth=Storage() ) import psycopg2 #conn = psycopg2.connect(host='localhost', user='postgres', password='123',dbname='saude') conn = psycopg2.connect("dbname=saude user=postgres") db = conn.cursor() config.mail.sender = "alu...@blouweb.com" config.mail.server = "smtp.gmail.com:587" # "smtp.:25" config.mail.login = "alu...@blouweb.com:" response.title = "INFO-SAÚDE" response.description = "SAÚDE" # glob response.generic_patterns = ['*'] *no MODELS "database.py" tem isso, no sqllite isso era usado, acho q pro postgresql nao sera usado* #coding: utf-8 # conectar ao banco de dados # setar opcoes da DAL db = DAL(**config.db) *no MODELS "datamodel_objects.py" isso foi usado para criar as tabelas no sqllite, no postgresql ja criei as tabelas* db.define_table("cadcidade", Field("nome", "text", length=128, notnull=True, unique=True), Field("uf", "text", length=2, notnull=True), Field("cep", "text", length=8, notnull=True), Field("cod_ibge", "integer", length=7), auth.signature, format="%(nome)s" ) *no CONTROLLERS "bases.py" tem esse codigo pra gerar a grid* * * def list_cidade(): query = db.cadcidade.id > 0 headers = {'cadcidade.nome': 'NOME', 'cadcidade.uf': 'UF', 'cadcidade.cep': 'CEP', 'cadcidade.cod_ibge': 'IBGE' } grid = SQLFORM.grid(query=query, user_signature=False, paginate=20, searchable=False, csv=False, fields=[db.cadcidade.nome, db.cadcidade.uf, db.cadcidade.cep, db.cadcidade.cod_ibge], orderby=db.cadcidade.nome, headers=headers ) return dict(grid=grid) dai esse *CONTROLLER* é exibido numa *VIEWS - BASES* - "list_cidade.html" o codigo ta assim... {{extend 'layout.html'}} {{block main}} CIDADES {{=grid}} {{end}} --- esse é o caminho q usei, a view ta sendo carregado sem erro, so q ta ligada no banco DUMMY.DB, acho q se nao tem conexao d banco o aplicativo gera esse banco automatico... o postgresql ta instalado correto, pois abro ele pelo PgAdmin e mexo nas tabelas sem problemas ja olhei varios exemplos e codigo, procurei fazer igual aos exemplos, mas mesmo assim algo dá errada...lembrand q no sqllite ta funcionando perfeitamente... alguem pode me ajudar, duvidas basicas de iniciante... mas todo inicio é complicado -- 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: Named arguments in URL()
Perhaps the book should be clarified -- if you use named arguments, you have to specify all three. If you specify only 1 argument, it assumes it should be the function, and if you specify 2, it assumes it should be the controller and function. Anthony On Sunday, October 27, 2013 6:17:26 AM UTC-4, Roland Kainrath wrote: > > Hi All, > > I have a question about URL(). In the book it was written: > > "... It is also possible to specify application, controller and function > using named argument. > URL(a='a', c='c', f='f') ..." > > but for example when I write this: > URL(a='myotherapp') > > the generated URL comes like this: > http://127.0.0.1:8000/init/default/myotherapp > > but it should be like this: > http://127.0.0.1:8000/myotherapp > > Am I right? > > Thank you for answering. > > Regards: > Roland > > > > -- 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] SQLFORM onvalidation not working
Hi all, I have a SQLFORM with an onvalidation on the form.accepts(), but it's not working. It skips the onvalidation function... Here is what i try (or just like it): def my_form_processing(form): c = form.vars.a * form.vars.b if c < 0: form.errors.b = 'a*b cannot be negative' else: form.vars.c = c def insert_numbers(): form = SQLFORM(db.numbers) if form.process(onvalidation=my_form_processing).accepted: session.flash = 'record inserted' redirect(URL()) return dict(form=form) But i'm not getting in the 'function my_form_processing'. When i change the onvalidation to: 'onvalidation=my_form_processing()' and i remove the 'form' in 'def my_form_processing(form)' i do get into the function, but then i don't have the form vars that i need to process. Can this be a bug in Web2py? I'm using version 2.7.4-stable+timestamp.2013.10.14.15.16.29 Thanks in advance! Remco -- 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: SQLFORM onvalidation not working
How are you determining whether my_form_processing is getting called? On Sunday, October 27, 2013 10:05:17 AM UTC-4, Remco K wrote: > > Hi all, > > I have a SQLFORM with an onvalidation on the form.accepts(), but it's not > working. It skips the onvalidation function... > > Here is what i try (or just like it): > > def my_form_processing(form): > c = form.vars.a * form.vars.b > if c < 0: >form.errors.b = 'a*b cannot be negative' > else: >form.vars.c = c > > def insert_numbers(): >form = SQLFORM(db.numbers) >if form.process(onvalidation=my_form_processing).accepted: >session.flash = 'record inserted' >redirect(URL()) >return dict(form=form) > > > But i'm not getting in the 'function my_form_processing'. When i change > the onvalidation to: 'onvalidation=my_form_processing()' and i remove the > 'form' in 'def my_form_processing(form)' i do get into the function, but > then i don't have the form vars that i need to process. > > Can this be a bug in Web2py? I'm using version > 2.7.4-stable+timestamp.2013.10.14.15.16.29 > > Thanks in advance! > Remco > -- 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: SQLFORM onvalidation not working
Hi Anthony, By setting a breakpoint for the debugger and work with print "bla" :) -- 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: Error during populating dummy data
Unfortunately populate has a vocabulary that includes words longer the 16bytes. On Sunday, 27 October 2013 00:47:40 UTC-5, tomasz bandura wrote: > > Hello, > > I noticed an error when I try to populate dummy data (i.e. > populate(db.mytable,100)): > > My table : > > db.define_table('parameters_dict', > Field('name','string',length=16) > ) > > Error: > ('ERROR', '22001', > 'value too long for type character varying(16)') > > > It looks i cannot limit length to 16 because for length=24 it works > correctly. > > > Are there any limitations for 'populate'? > > Best regards > Tomasz > -- 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] Conexao POSTGRESQL vs PYTHON/WEB2PY - problemas
Ola, bom dia... estou tentando conectar meu banco postgresql ao meu projeto, so q nao consigo.. veja meu codigo detalhado abaixo... *no MODELS - "appsettings.py" ta assim* from gluon.storage import Storage config = Storage( db=Storage(), mail=Storage(), auth=Storage() ) import psycopg2 #conn = psycopg2.connect(host='localhost', user='postgres', password='123',dbname='saude') conn = psycopg2.connect("dbname=saude user=postgres") db = conn.cursor() config.mail.sender = "alu...@blouweb.com" config.mail.server = "smtp.gmail.com:587" # "smtp.:25" config.mail.login = "alu...@blouweb.com:" response.title = "INFO-SAÚDE" response.description = "SAÚDE" # glob response.generic_patterns = ['*'] *no MODELS "database.py" tem isso, no sqllite isso era usado, acho q pro postgresql nao sera usado* #coding: utf-8 # conectar ao banco de dados # setar opcoes da DAL db = DAL(**config.db) *no MODELS "datamodel_objects.py" isso foi usado para criar as tabelas no sqllite, no postgresql ja criei as tabelas* db.define_table("cadcidade", Field("nome", "text", length=128, notnull=True, unique=True), Field("uf", "text", length=2, notnull=True), Field("cep", "text", length=8, notnull=True), Field("cod_ibge", "integer", length=7), auth.signature, format="%(nome)s" ) *no CONTROLLERS "bases.py" tem esse codigo pra gerar a grid* * * def list_cidade(): query = db.cadcidade.id > 0 headers = {'cadcidade.nome': 'NOME', 'cadcidade.uf': 'UF', 'cadcidade.cep': 'CEP', 'cadcidade.cod_ibge': 'IBGE' } grid = SQLFORM.grid(query=query, user_signature=False, paginate=20, searchable=False, csv=False, fields=[db.cadcidade.nome, db.cadcidade.uf, db.cadcidade.cep, db.cadcidade.cod_ibge], orderby=db.cadcidade.nome, headers=headers ) return dict(grid=grid) dai esse *CONTROLLER* é exibido numa *VIEWS - BASES* - "list_cidade.html" o codigo ta assim... {{extend 'layout.html'}} {{block main}} CIDADES {{=grid}} {{end}} esse é o caminho q usei, a view ta sendo carregado sem erro, so q ta ligada no banco DUMMY.DB, acho q se nao tem conexao d banco o aplicativo gera esse banco automatico... o postgresql ta instalado correto, pois abro ele pelo PgAdmin e mexo nas tabelas sem problemas lembrando q usando a conexao do sqllite o projeto funciona sem problemas... --- alguem pode me ajudar? -- 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: NDB support for GAE
Hi, Just curious, what's the status of this patch? I'm eagerly waiting for NDB support in web2py. S On Sunday, September 29, 2013 9:49:36 AM UTC-7, Quint wrote: > > Hi, > > I think web2py should support NDB for the Google Datastore. > NDB a newer datastore api which has automatic caching features built in. > > https://developers.google.com/appengine/docs/python/ndb/ > > I think it would be great for GAE users to be able to use NDB because it > potentially has better performance and can reduce the costs of your app > (dependent of the type of app off course). > > In fact, i think it wouldn't be that hard to integrate it. > > I had a go at it and i only had to change a couple of lines in dal.py and > it seems to work. > You can switch between NDB and DB because they both should store exactly > the same data in the datastore. > > I attached a patch i made based on version 2.6.4 > Maybe one of the developers could have a look. > > I'm not a web2py expert so this does need to be reviewed by someone with > more in depth knowledge. > But maybe this could serve as a starting point. > > resources: > > > https://docs.google.com/document/d/1AefylbadN456_Z7BZOpZEXDq8cR8LYu7QgI7bt5V0Iw/mobilebasic > > http://dylanv.org/2012/08/22/a-hitchhikers-guide-to-upgrading-app-engine-models-to-ndb/ > > Thanks! > > > > > -- 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] Named arguments in URL()
On 27 Oct 2013, at 6:48 AM, Anthony wrote: > Perhaps the book should be clarified -- if you use named arguments, you have > to specify all three. If you specify only 1 argument, it assumes it should be > the function, and if you specify 2, it assumes it should be the controller > and function. URL() has a long and complicated history, and this peculiar behavior is a consequence of that history. The original idea was that you'd call it with positional arguments for a,c,f, but as it sprouted more arguments, and became able to automatically reference request, it's become more "natural" to always specify argument names. This particular odd behavior could be fixed, and probably should be fixed. It'd cause backward compatibility problems for someone who actually wrote URL(a='functionname'), but I'd be surprised if that's happening; the intent was that you'd write URL('functionname') in that case. [The fix I have in mind is to make the first three arguments of URL something like (acf1, acf2, acf3, ...) and push (a,c,f) into **kwargs.] > > Anthony > > On Sunday, October 27, 2013 6:17:26 AM UTC-4, Roland Kainrath wrote: > Hi All, > > I have a question about URL(). In the book it was written: > "... It is also possible to specify application, controller and function > using named argument. > URL(a='a', c='c', f='f') ..." > > but for example when I write this: > URL(a='myotherapp') > > the generated URL comes like this: > http://127.0.0.1:8000/init/default/myotherapp > > but it should be like this: > http://127.0.0.1:8000/myotherapp > > Am I right? > > Thank you for answering. > > Regards: > Roland > > -- 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: NDB support for GAE
btw dumb question when db.py says DAL(google:datastore) Is it referring to the DB datastore in GAE https://developers.google.com/appengine/docs/python/datastore/ Asking because there a few options for storage mentioned in the GAE docs. On Sunday, September 29, 2013 9:49:36 AM UTC-7, Quint wrote: > > Hi, > > I think web2py should support NDB for the Google Datastore. > NDB a newer datastore api which has automatic caching features built in. > > https://developers.google.com/appengine/docs/python/ndb/ > > I think it would be great for GAE users to be able to use NDB because it > potentially has better performance and can reduce the costs of your app > (dependent of the type of app off course). > > In fact, i think it wouldn't be that hard to integrate it. > > I had a go at it and i only had to change a couple of lines in dal.py and > it seems to work. > You can switch between NDB and DB because they both should store exactly > the same data in the datastore. > > I attached a patch i made based on version 2.6.4 > Maybe one of the developers could have a look. > > I'm not a web2py expert so this does need to be reviewed by someone with > more in depth knowledge. > But maybe this could serve as a starting point. > > resources: > > > https://docs.google.com/document/d/1AefylbadN456_Z7BZOpZEXDq8cR8LYu7QgI7bt5V0Iw/mobilebasic > > http://dylanv.org/2012/08/22/a-hitchhikers-guide-to-upgrading-app-engine-models-to-ndb/ > > Thanks! > > > > > -- 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: SQLFORM onvalidation not working
I've found that it's probably not a bug in Web2py. Problem is that i use a datetime picker in my view, and the format of it is not valid a datetime format for Web2py to store it in the DB. So Web2y send from the db.py a message '' enter date and time as 1963-08-28 14:30:59". What is used to do is re-format the datetime format in a validator so that it can be stored in the DB, but Web2py processes it's own validators first before the user-defined validator is called. Strange because i used it this way before. Maybe there is something changed in the process flow of 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: auth.messages.verify_email html template
I have replaced the standard verification with my own. The standard authentication is pretty simple as it creates a unique key, which it stores in the database and sends as a link to the registrant. When the link is clicked it will match the registration details with the unique id and stores (accepts the user) them. This way you can customize the template and use email API (json), which is much more powerful than smtp method (I use mailgun). Ykä -- 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] Getting the current record in a custom widget
Hi folks. I have a custom widget that needs to do some advanced formatting based on other field values in the current record (i.e. in an edit form) but I don't see any way to get the current record in a custom widget. Any ideas? def my_custom_widget(field, value, **attrs): #how do I get the current row here? pass Thanks, Nathan -- 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] Named arguments in URL()
> [The fix I have in mind is to make the first three arguments of URL > something like (acf1, acf2, acf3, ...) and push (a,c,f) into **kwargs.] > Clever fix. -- 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: Getting the current record in a custom widget
Neither the form nor the record gets passed to the widget. However, you could independently pull the record before adding the widget to the field: def myform(): record = db.mytable(request.args(0)) db.mytable.myfield.widget = lambda f, v, r=record: my_custom_widget(f, v , record=r) form = SQLFORM(db.mytable, record=record).process() return dict(form=form) Anthony On Sunday, October 27, 2013 2:11:14 PM UTC-4, mr.freeze wrote: > > Hi folks. I have a custom widget that needs to do some advanced > formatting based on other field values in the current record (i.e. in an > edit form) but I don't see any way to get the current record in a custom > widget. Any ideas? > def my_custom_widget(field, value, **attrs): > #how do I get the current row here? > pass > > Thanks, > Nathan > -- 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: Getting the current record in a custom widget
Thanks, Anthony. I am doing something similar by setting a session variable so that it will work in appadmin forms too. I wonder why widgets don't get the record since the represent function does. Seems like an oversight. On Sunday, October 27, 2013 1:41:20 PM UTC-5, Anthony wrote: > > Neither the form nor the record gets passed to the widget. However, you > could independently pull the record before adding the widget to the field: > > def myform(): > record = db.mytable(request.args(0)) > db.mytable.myfield.widget = lambda f, v, r=record: my_custom_widget(f,v > , record=r) > form = SQLFORM(db.mytable, record=record).process() > return dict(form=form) > > Anthony > > On Sunday, October 27, 2013 2:11:14 PM UTC-4, mr.freeze wrote: >> >> Hi folks. I have a custom widget that needs to do some advanced >> formatting based on other field values in the current record (i.e. in an >> edit form) but I don't see any way to get the current record in a custom >> widget. Any ideas? >> def my_custom_widget(field, value, **attrs): >> #how do I get the current row here? >> pass >> >> Thanks, >> Nathan >> > -- 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] Named arguments in URL()
On 27 Oct 2013, at 11:21 AM, Anthony wrote: > [The fix I have in mind is to make the first three arguments of URL something > like (acf1, acf2, acf3, ...) and push (a,c,f) into **kwargs.] > > Clever fix. A minor problem: what if the two methods contradict each other? Raise an exception, I guess, perhaps any time both are used, contradiction or not. -- 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] Python vs Mavericks
Just FYI, in case this bites you. I had installed Python 2.7.2 on my Mac some time back, and had an override of PATH in .bash_profile to cause it to run. Today I noticed some odd crashes of Python (doing simple stuff from a CLI). I removed the PATH override, and got the (I guess) system default 2.7.5, which is working fine, and is the current production version of Python 2. -- 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: Access the server data in javascript
> > Thanks Derek, but I am facing one more problem. An 'L' gets appended to > integer data. When I try to get the dict into a json, I am facing "Uncaught > SyntaxError: Unexpected token ILLEGAL " error. Any help on this? > Many web2py api objects as query results (Rows objects) or forms have an .as_json() method, so you don't need to code your own conversion logic: >>> script = SCRIPT("""var myData = %s;""" % db(...).select().as_json()) Post the code so we can help fixing it. -- 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] App deployed on Fedora/Apache. Problem with Load
Hi all, I've deployed an app on a Linux web server using web2py's '1 step' install for Fedora. For connections from www (Chrome and Firefox) and the localhost:8000, the first couple of static pages in the app work ok, but once any Load(...) commands are required I just get the 'Loading...' text showing. I developed my app on separate windows 7 and Mac-OS machines (using Chrome) and the Load components worked ok for both. Any ideas? Thanks AG -- 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] built-in wiki
Hello, I am new to web programming. I use web2py built-in wiki: auth.wiki(), the simplest form. Why is it that when I click the preview button the style for markmin items like ``this is some code`` looks OK (code is highlighted, break lines are present) and when I click on submit a record I see a page where code text is in a different style (in red color and there is no line breaks). My version of web2py: 2.7.4-stable+timestamp.2013.10.14.15.16.29 Any help will be appreciated. Thanks -- 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] App deployed on Fedora/Apache. Problem with Load
Also, I forgot to add, When running app via localhost:8000 on the server, and going into app admin, I can view all the necessary database tables/rows and DB admin page OK. So I don't think it's a problem with DB connectivity. -- 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] tooltip button in SQLFORM.grid
I am trying to figure out a way customize a button in a SQLFORM.grid so that a tooltip text is shown. Is there a simple way to do that in web2py? Thanks -- 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: Getting the current record in a custom widget
> > Thanks, Anthony. I am doing something similar by setting a session > variable so that it will work in appadmin forms too. I wonder why widgets > don't get the record since the represent function does. Seems like an > oversight. The "represent" attribute is specifically for displaying the values of a given record, whereas the widget is for creating a form input. Although a widget may display a default value (e.g., when editing a record), in most cases you want that to be the actual raw value that goes in the database, not some alternative representation. Sounds like you might have an odd use case. Anthony -- 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: NDB support for GAE
Thank you for the patch. I guess my question is why do we need a new adapter? Is this for backward compatibility because otherwise it would break apps that use Field('...',type='decimal(...)')? On Sunday, 29 September 2013 11:49:36 UTC-5, Quint wrote: > > Hi, > > I think web2py should support NDB for the Google Datastore. > NDB a newer datastore api which has automatic caching features built in. > > https://developers.google.com/appengine/docs/python/ndb/ > > I think it would be great for GAE users to be able to use NDB because it > potentially has better performance and can reduce the costs of your app > (dependent of the type of app off course). > > In fact, i think it wouldn't be that hard to integrate it. > > I had a go at it and i only had to change a couple of lines in dal.py and > it seems to work. > You can switch between NDB and DB because they both should store exactly > the same data in the datastore. > > I attached a patch i made based on version 2.6.4 > Maybe one of the developers could have a look. > > I'm not a web2py expert so this does need to be reviewed by someone with > more in depth knowledge. > But maybe this could serve as a starting point. > > resources: > > > https://docs.google.com/document/d/1AefylbadN456_Z7BZOpZEXDq8cR8LYu7QgI7bt5V0Iw/mobilebasic > > http://dylanv.org/2012/08/22/a-hitchhikers-guide-to-upgrading-app-engine-models-to-ndb/ > > Thanks! > > > > > -- 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: Getting the current record in a custom widget
I wouldn't say the use case is odd but it's definitely complex. Then again, without a context for custom widgets to operate in (i.e. no knowledge of the record or form that they are bound to) only simple use cases are possible. Represent and widget are output/input analogs but for some reason represent has access to the whole row whereas widget only gets the field value. I will propose a patch if it can be done unobtrusively and without coupling Field to SQLFORM any further. On Sunday, October 27, 2013 6:10:22 PM UTC-5, Anthony wrote: > > Thanks, Anthony. I am doing something similar by setting a session >> variable so that it will work in appadmin forms too. I wonder why widgets >> don't get the record since the represent function does. Seems like an >> oversight. > > > The "represent" attribute is specifically for displaying the values of a > given record, whereas the widget is for creating a form input. Although a > widget may display a default value (e.g., when editing a record), in most > cases you want that to be the actual raw value that goes in the database, > not some alternative representation. Sounds like you might have an odd use > case. > > Anthony > -- 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] Ticket ID No module named modules
Hello, This error doesn't occur on my dev. system Windows 7, same version of web2py and python2.7 web2py™Version 2.7.4-stable+timestamp.2013.10.14.15.16.29PythonPython 2.6.6: /usr/languages/python/2.6/bin/python (prefix: /usr/languages/python/2.6)Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. Traceback (most recent call last): File "/home/my_site/web2py/gluon/restricted.py", line 217, in restricted exec ccode in environment File "/home/my_site/web2py/applications/gps/controllers/gprs.py", line 9, in from modules import utils File "/home/my_site/web2py/gluon/custom_import.py", line 86, in custom_importer return base_importer(pname, globals, locals, fromlist, level) ImportError: No module named modules the code which raises this error is as simple as from modules import utils what can I do ? thands and regards, andre -- 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] Scheduler and updating db records
I am trying to create a task where every night the following function is run to decrement the days left on my sticky entries. When I call the function using a controller it does exactly as planned where it grabs the sticky entries and decrements the day by 1. When I use the scheduler it runs, but it doesn't update the database records. Am I doing something wrong? # coding: utf8 def stickies(): sticky_entries = db(db.journal.is_sticky == True).select() for sticky in sticky_entries: days = sticky.days - 1 if days == 0: sticky.is_sticky = False sticky.days = days sticky.update_record() return from gluon.scheduler import Scheduler Scheduler(db, dict(stickies = stickies) ) -- 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] Newbie authentication question
Hi there and thanks for a stellar project - really cool. I am trying to solve an issue that arose and was hoping for a pointer so I can solve it. I am wanting to use the authentication mechanism of web2py pretty much as is, but I need to be able to have one registered user, in some cases, be given the ability to administrate and act as other registered users. My thoughts were along the lines of adding a column parent_of to auth_user and if an id is specified here pointing towards another user, the specified id can administrate as that user. Would this be a proper way to go about it, and how could this be implemented? Any thoughts or ideas would be welcome. Tnx, Mikael -- 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] Ticket ID __init__() got an unexpected keyword argument 'default'
Hello, This is a json error which doesn't occur on my dev. system Windows 7, same version of web2py and python2.7 web2py™Version 2.7.4-stable+timestamp.2013.10.14.15.16.29PythonPython 2.6.6: /usr/languages/python/2.6/bin/python (prefix: /usr/languages/python/2.6)Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. Traceback (most recent call last): File "/home/my_site/web2py/gluon/restricted.py", line 217, in restricted exec ccode in environment File "/home/my_site/web2py/applications/gps_/controllers/gprs.py", line 126, in File "/home/my_site/web2py/gluon/globals.py", line 372, in self._caller = lambda f: f() File "/home/my_site/web2py/applications/gps_/controllers/gprs.py", line 46, in call def call(): return service() File "/home/my_site/web2py/gluon/tools.py", line 4913, in __call__ return self.serve_json(request.args[1:]) File "/home/my_site/web2py/gluon/tools.py", line 4604, in serve_json return response.json(s) File "/home/my_site/web2py/gluon/globals.py", line 598, in json return json(data, default=default or custom_json) File "/home/my_site/web2py/gluon/serializers.py", line 124, in json default=default).replace(ur'\u2028', File "/usr/local/lib/python2.6/site-packages/simplejson/__init__.py", line 216, in dumps **kw).encode(obj) TypeError: __init__() got an unexpected keyword argument 'default' This issue raises when I upgraded from web2py-1.99.4 to 2.7.4 To fix the problem, I modified the import of json in gluon/serializers.ps to what it was in 1.99.4 and it works :-) 2.7.4 try: import simplejson as json_parser# try external module except ImportError: try: import json as json_parser # try stdlib (Python >= 2.6) except: import gluon.contrib.simplejson as json_parser# fallback to pure-Python module 1.99.4 try: import json as json_parser # try stdlib (Python 2.6) except ImportError: try: import simplejson as json_parser# try external module except: import contrib.simplejson as json_parser# fallback to pure-Python module Of course this fix it not satisfactory, because I will have to apply this modification every time I upgrade web2py. Also I'd like to understand why the problem raises. Thanks and regards Andre -- 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: Ticket ID No module named modules
Can you please try the nightly build? http://www.web2py.com/examples/static/nightly/web2py_win.zip On Sunday, 27 October 2013 22:49:30 UTC-5, arutti wrote: > > > Hello, > > This error doesn't occur on my dev. system Windows 7, same version of > web2py and python2.7 > > web2py™Version 2.7.4-stable+timestamp.2013.10.14.15.16.29PythonPython > 2.6.6: /usr/languages/python/2.6/bin/python (prefix: > /usr/languages/python/2.6)Traceback > > 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8. > 9. > > Traceback (most recent call last): > File "/home/my_site/web2py/gluon/restricted.py", line 217, in restricted > exec ccode in environment > File "/home/my_site/web2py/applications/gps/controllers/gprs.py", line 9, > in > from modules import utils > File "/home/my_site/web2py/gluon/custom_import.py", line 86, in > custom_importer > return base_importer(pname, globals, locals, fromlist, level) > ImportError: No module named modules > > > > the code which raises this error is as simple as > > from modules import utils > > what can I do ? > > thands and regards, > andre > -- 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: Python vs Mavericks
thanks! i didn't remember that i had installed python 2.7 myself and had to hack it to run with 10.9! cfh On Sunday, October 27, 2013 1:46:49 PM UTC-7, Jonathan Lundell wrote: > > Just FYI, in case this bites you. > > I had installed Python 2.7.2 on my Mac some time back, and had an override > of PATH in .bash_profile to cause it to run. Today I noticed some odd > crashes of Python (doing simple stuff from a CLI). I removed the PATH > override, and got the (I guess) system default 2.7.5, which is working > fine, and is the current production version of Python 2. > > -- 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: transfer local database to Google App Engine website
Also, keep in mind that there is not really a model on GAE big table (google datastore), so there is nothing to view in the console until you write rows to the database. once you write data, you will be able to see the "schema" of the data that was written. cfh On Sunday, October 27, 2013 3:06:23 AM UTC-7, Niphlod wrote: > > any migration mentioned in the book refers to altering the table on the > backend (i.e. adding/removing columns, tables, and so on). > You instead want to move the data within the local database to what is in > appspot.com you need to do that AFTER you moved the application > directly on .appspot.com . > If the model is not complicated, you can succesfully export all the local > data to a csv file and reimport that on appspot.com > > > http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Exporting-and-importing-data > > On Sunday, October 27, 2013 3:36:24 AM UTC+1, books2be...@gmail.com wrote: >> >> I am trying to deploy my app on Google App Engine. I have a set of >> databases that I've built up locally on my laptop that have been >> interfacing just fine with my app when the app is running locally. However, >> when I visit the .appspot.com address for my app, none of the databases >> are present. Also, when I check my datastore on the GAE dashboard, it says >> that I don't have any of those databases present. >> I read the deployment recipe for GAE and it talks about migrating >> databases. What I gleaned from reading that info was that if migrate was >> set to true in the database definition, then the local-to-GAE-server >> migration should take place automatically. However, this does not seem to >> be working. >> >> Can someone help me out with this? Is my thought process for migrating >> databases from my local computer to the GAE servers completely wrong? If >> so, can you step through how exactly I can perform the transfer of the >> databases? >> > -- 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: NDB support for GAE
interesting i as skim the NDB docs very quickly and the patch above i see that it is *very* similar to the "DB Datastore"/Big Table. if the APIs are the same then we should just use the same DAL adapter with a parameter to use NDB. Though because of the caching nature of NDB there may be a whole set of additional/different methods that need to be supported. Saisha D: yes, the google:datastore in web2py currently is using the type of DB storage that you linked to (the only type of storage supported when web2py first integrated with GAE). cfh On Sunday, October 27, 2013 4:37:07 PM UTC-7, Massimo Di Pierro wrote: > > Thank you for the patch. I guess my question is why do we need a new > adapter? Is this for backward compatibility because otherwise it would > break apps that use Field('...',type='decimal(...)')? > > On Sunday, 29 September 2013 11:49:36 UTC-5, Quint wrote: >> >> Hi, >> >> I think web2py should support NDB for the Google Datastore. >> NDB a newer datastore api which has automatic caching features built in. >> >> https://developers.google.com/appengine/docs/python/ndb/ >> >> I think it would be great for GAE users to be able to use NDB because it >> potentially has better performance and can reduce the costs of your app >> (dependent of the type of app off course). >> >> In fact, i think it wouldn't be that hard to integrate it. >> >> I had a go at it and i only had to change a couple of lines in dal.py and >> it seems to work. >> You can switch between NDB and DB because they both should store exactly >> the same data in the datastore. >> >> I attached a patch i made based on version 2.6.4 >> Maybe one of the developers could have a look. >> >> I'm not a web2py expert so this does need to be reviewed by someone with >> more in depth knowledge. >> But maybe this could serve as a starting point. >> >> resources: >> >> >> https://docs.google.com/document/d/1AefylbadN456_Z7BZOpZEXDq8cR8LYu7QgI7bt5V0Iw/mobilebasic >> >> http://dylanv.org/2012/08/22/a-hitchhikers-guide-to-upgrading-app-engine-models-to-ndb/ >> >> Thanks! >> >> >> >> >> -- 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: NDB support for GAE
Yes, using the same adapter with a parameter is also a possibility i thought of. Don't really know anymore why i choose this. Maybe because initially i wanted to create a plugable thingy without changing the DAL code. -- 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.