[web2py] Re: IMPORTANT - WEB2PY CONSULTING

2016-03-29 Thread João Saraiva
Hi!

I noticed that DefineScope appears twice in the list (although the URLs are 
different: one points to the main page, while the other points to the page 
where web2py is mentioned).
I think it is the only duplicate in the list, although I might have missed 
something.

Cheers,
João Saraiva


On Saturday, February 27, 2016 at 5:29:01 AM UTC, Gael Princivalle wrote:
>
> Hello Massimo.
>
> I've saw that some of these website companies are offline:
> http://web2py.com/init/default/support
>
> I suggest to delete these websites from the support list.
>
> Best regards. 
>
> Il giorno venerdì 26 febbraio 2016 14:50:26 UTC+1, Gael Princivalle ha 
> scritto:
>>
>> Hello Massimo.
>>  
>> Can you add us?
>>
>> www.tasko.it
>>
>> 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/d/optout.


Re: [web2py] Re: alternate date/time widgets?

2016-03-29 Thread ..mg..
Is there an easy way to get just the widgets?  I have stupid.css, and 
I should have some time Thursday to play with it.

-mg

On Tue, Mar 29, 2016 at 02:25:11PM -0700, Massimo Di Pierro wrote:
> You do not have to use stupid css to use the tags widget. But you will need 
> to write some CSS to make it look the way you want.
> 
> On Monday, 28 March 2016 23:52:38 UTC-5, Ron Chatterjee wrote:
> >
> > If we dont use stupid css wondering what will b the equivalent 
> > autocomplete with dismissal tags can b (for search). 
> 
> -- 
> 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/d/optout.

-- 
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/d/optout.


[web2py] Re: float argument required, not str

2016-03-29 Thread Leonel Câmara
O erro parece ser que uma dessas tabelas tem lá 'decimal' como tipo mas o 
valor que está na base de dados é uma string. Fizeste alguma mudança às 
tabelas e uma migração recentemente?

Já agora, se possível, fala inglês que este grupo é internacional.

-- 
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/d/optout.


[web2py] Re: Upload file from 'static/images' to database

2016-03-29 Thread Dave S


On Tuesday, March 29, 2016 at 2:28:13 PM UTC-7, Nick Michael wrote:
>
> Hi, I'm having some trouble and was hoping someone could point me in the 
> right direction.
>
> I'm creating an application which has an input form which stores to a 
> database. One entry accepts images, but can also be left empty (by using 
> requires IS_EMPTY_OR). I also have a placeholder image saved under 
> 'static/images'. I want to make it so that if the upload file is left 
> empty, I store the placeholder image from the 'static/images' folder in the 
> database entry, otherwise it'll use the image that was uploaded by the user.
>
>
Do you really need to store the image in the DB?  If the same placeholder 
is used for everyone (until they upload), just having a flag saying "use 
placeholder" might be enough.  Also, a normal upload field is a filename 
(the obfuscated one); you could put the static path in the field.  In 
either case, download() changes from the example code to checking either 
the flag or the path to see where to get the image to stream.

If you are using something other than a "normal upload" field, please show 
your model.

/dps


 

> Here's my current implementation:
>
> if request.vars.image == "":
> ##Enter Code Here##
> else:
> image_file = db.user_items.image.store(request.vars.image.file, 
> request.vars.image.filename)
> addItemToData (request.vars.name, request.vars.collection, 
> request.vars.tag, request.vars.value, request.vars.story, image_file, 
> auth.user.id, request.vars.tradeable)
> redirect(URL('default', 'profile'))
>

-- 
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/d/optout.


[web2py] Re: float argument required, not str

2016-03-29 Thread Dave S


On Tuesday, March 29, 2016 at 2:28:11 PM UTC-7, Ciro Alves wrote:
>
> Salve Pessoal
>
> Estou com um erro que não consigo resolver. Eu faço um select onde só 
> estão envolvidas variáveis inteiras mas, mesmo assim, recebo o erro acima 
> dizendo que uma variável float era requerida.
>
> Segue abaixo a descrição do erro. Não consigo passar do select. E o 
> estranho é que sempre funcionou.
>
> Alguma poderia sugerir onde está o problema?
>
>
I think we're going to need to see where these tables are defined in your 
model.  The error relates to a conversion between types, so perhaps you 
have a mismatch between *db.t_mpconsumida.f_ano_**referencia *and* 
ano_referencia, *or between  *db.t_**mpconsumida.f_codigo_**materiaprima *
and* db.t_materiaprima.f_codigo.*

/dps

 

> Traceback (most recent call last):
>   File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
> 2.13.4\gluon\restricted.py", line 227, in restricted
> exec ccode in environment
>   File "C:/Users/Ciro/Documents/Profissionais/Web2py/Web2py 
> 2.13.4/applications/prods/controllers/default.py" 
> , line 
> 268, in 
>   File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
> 2.13.4\gluon\globals.py", line 412, in 
> self._caller = lambda f: f()
>   File "C:/Users/Ciro/Documents/Profissionais/Web2py/Web2py 
> 2.13.4/applications/prods/controllers/default.py" 
> , line 
> 265, in list_mp
> 
> *recs = db((db.t_mpconsumida.f_ano_referencia == 
> ano_referencia)&(db.t_mpconsumida.f_codigo_materiaprima == 
> db.t_materiaprima.f_codigo)).select(orderby=db.t_produto.f_prodlist)  *File 
> "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
> 2.13.4\gluon\packages\dal\pydal\objects.py", line 2025, in select
> return adapter.select(self.query,fields,attributes)
>   File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
> 2.13.4\gluon\packages\dal\pydal\adapters\sqlite.py", line 124, in select
> return super(SQLiteAdapter, self).select(query, fields, attributes)
>   File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
> 2.13.4\gluon\packages\dal\pydal\adapters\base.py", line 1293, in select
> return self._select_aux(sql,fields,attributes)
>   File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
> 2.13.4\gluon\packages\dal\pydal\adapters\base.py", line 1274, in _select_aux
> return processor(rows,fields,self._colnames,cacheable=cacheable)
>   File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
> 2.13.4\gluon\packages\dal\pydal\adapters\base.py", line 1764, in parse
> for row in rows]
>   File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
> 2.13.4\gluon\packages\dal\pydal\adapters\base.py", line 1674, in _parse
> value = self.parse_value(value, ft, blob_decode)
>   File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
> 2.13.4\gluon\packages\dal\pydal\adapters\base.py", line 1524, in parse_value
> return self.parsemap[key](value,field_type)
>   File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
> 2.13.4\gluon\packages\dal\pydal\adapters\base.py", line 1601, in parse_decimal
> value = ('%.' + str(decimals) + 'f') % value
> TypeError: float argument required, not str
>
>

-- 
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/d/optout.


[web2py] Re: GAE problems

2016-03-29 Thread rif
Oh, you mean the db query... Here is the whole controller that's generating 
the error:

def index():
page = int(request.vars['page']) if request.vars['page'] else 0
items_per_page = 10
limitby = (page*items_per_page,(page+1)*items_per_page+1)
form = crud.update(Facturi, a0, next=URL('index'))
facturi = db(Facturi).select(orderby=~Facturi.numar, limitby=limitby)
today = date.today()
return locals()

and the most important model involved looks like this:
Facturi = db.define_table('factura',
Field('numar', notnull=True),
Field('firma', db.firma, 
requires=IS_IN_DB(db(db.firma.request_tenant==auth.user_id), db.firma.id, 
'%(nume)s')),
Field('cont', 'reference cont', 
requires=IS_EMPTY_OR(IS_IN_DB(db((db.cont.request_tenant==auth.user_id) & 
(db.cont.is_active==True)), db.cont.id, '%(iban)s(%(moneda)s)'))),
Field('client', db.client, 
requires=IS_IN_DB(db(db.client.request_tenant==auth.user_id), db.client.id, 
'%(nume)s')),
Field('platita', 'boolean', default=False),
Field('termen_de_plata', 'date', 
default=datetime.date.today() + datetime.timedelta(15)),
Field('moneda', requires=IS_IN_SET(('RON','EUR','USD')), 
default='RON'),
Field('curs_schimb', 'double', default=1, 
requires=IS_FLOAT_IN_RANGE(0, 99)),
Field('TVA', 'integer', requires = IS_IN_SET([0,24], 
error_message=T('trebuie sa fie un TVA valid'), zero=None), default=0),
Field('reprezentant', db.reprezentant, 
requires=IS_EMPTY_OR(IS_IN_DB(db(db.reprezentant.request_tenant==auth.user_id), 
db.reprezentant.id, '%(nume)s'))),
Field('uuid', length=64, default=lambda:str(uuid.uuid4()), 
readable=False, writable=False),
Field('tva_activ', 'boolean'),
auth.signature,
format='%(numar)s')


miercuri, 30 martie 2016, 00:25:58 UTC+3, Massimo Di Pierro a scris:
>
> I cannot tell what the query is.
>
> On Tuesday, 29 March 2016 02:06:43 UTC-5, rif wrote:
>>
>> The gae query is this:  http://11.firmoasa.appspot.com/facturi
>>
>> I have this route:
>> routers = dict(
>>
>> # base router
>> BASE=dict(
>> default_application='firmoasa',
>> ),
>> )
>>
>> And the full log is this:
>>
>> /facturi 500 952ms 0kb Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 
>> (KHTML, like Gecko) Chrome/49.0.2623.108 Safari/537.36 module=default 
>> version=11
>> 78.96.81.220 - - [29/Mar/2016:00:02:55 -0700] "GET /facturi HTTP/1.1" 500 
>> 378 "http://11.firmoasa.appspot.com/; "Mozilla/5.0 (X11; Linux x86_64) 
>> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.108 Safari/537.36" "
>> 11.firmoasa.appspot.com" ms=952 cpu_ms=555 cpm_usd=0.42 
>> app_engine_release=1.9.35 instance=00c61b117c1212e7c568f7bfc458f105facfec28
>> D 2016-03-29 10:02:54.330
>> select application=firmoasa
>> D 2016-03-29 10:02:54.330
>> route: controller=facturi
>> D 2016-03-29 10:02:54.330
>> route: function.ext=index.html
>> E 2016-03-29 10:02:55.228
>>  Unable to store in FILE: 
>> /base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/controllers/facturi.py
>>
>> Traceback (most recent call last):
>>   File 
>> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/restricted.py", 
>> line 227, in restricted
>> exec ccode in environment
>>   File 
>> "/base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/controllers/facturi.py",
>>  
>> line 128, in 
>>   File 
>> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/globals.py", 
>> line 417, in 
>> self._caller = lambda f: f()
>>   File 
>> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/tools.py", 
>> line 4250, in f
>> return action(*a, **b)
>>   File 
>> "/base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/controllers/facturi.py",
>>  
>> line 9, in index
>> form = crud.update(Facturi, a0, next=URL('index'))
>>   File 
>> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/tools.py", 
>> line 4899, in update
>> **attributes  # contains hidden
>>   File 
>> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/sqlhtml.py", 
>> line 1295, in __init__
>> inp = self.widgets.options.widget(field, default)
>>   File 
>> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/sqlhtml.py", 
>> line 313, in widget
>> options = requires[0].options()
>>   File 
>> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/validators.py", 
>> line 600, in options
>> self.build_set()
>>   File 
>> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/validators.py", 
>> line 586, in build_set
>> records = self.dbset(table).select(*fields, **dd)
>>   File 
>> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/objects.py",
>>  
>> line 2020, in select
>> return adapter.select(self.query, fields, 

[web2py] Re: Using DAL

2016-03-29 Thread Anthony
Or as Leonel, suggests, DAL(..., migrate=False), which simply sets the 
default value of the "migrate" argument to db.define_table to False (rather 
than completely disabling all migrations). In that case, you can simply 
override that default when needed via db.define_table(..., migrate=True).

Anthony

On Tuesday, March 29, 2016 at 5:49:30 PM UTC-4, Anthony wrote:
>
> If all the tables you define in the shell will be pre-existing, use 
> DAL(..., migrate_enabled=False), which will prevent all migrations. If you 
> only need to prevent migrations on a per table basis, then do 
> db.define_table(..., migrate=False).
>
> Anthony
>
> On Tuesday, March 29, 2016 at 5:28:14 PM UTC-4, Aman Bindal wrote:
>>
>> Hi,
>>   I need to access web2py sqlite database from python.
>> So, I wrote a python code like this
>>
>> >> from pydal import DAL, Field
>> >> db = DAL('sqlite://storage.sqlite')
>> >> print db.tables
>> []
>> >> db.define_table(... Already existing table,)
>> it is showing an error of sqlite3.OperationalError: table Account_Details 
>> already exists
>>
>> Please don't print this e-mail unless you really need to.
>>
>> Disclaimer:
>> "This communication (including any accompanying documents) is intended 
>> only for the use of the addressee(s) and contains PRIVATE AND CONFIDENTIAL 
>> information. Unauthorized reading, dissemination, distribution or copying 
>> of this communication is prohibited. If you have received this 
>> communication in error, please return the email to the sender promptly and 
>> delete the original communication. 
>> Please be informed that any review, dissemination, distribution, or 
>> copying of this message is strictly prohibited, unless stated.The sender 
>> confirms that Creditas Solutions shall not be responsible if this email 
>> message is used for any indecent, unsolicited or illegal purposes, which 
>> are in violation of any existing laws and the same shall solely be the 
>> responsibility of the sender and that Creditas Solutions shall at all times 
>> be indemnified of any civil and/ or criminal liabilities or consequences 
>> thereof. 
>> To the contrary, any opinions or comments are personal to the writer and 
>> do not represent the official view of the company. In case where it 
>> represents our official view, it needs to be re-validated and is subject to 
>> the terms of our engagement. Thank you for your co-operation.”
>>
>

-- 
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/d/optout.


[web2py] Re: Using DAL

2016-03-29 Thread Anthony
If all the tables you define in the shell will be pre-existing, use 
DAL(..., migrate_enabled=False), which will prevent all migrations. If you 
only need to prevent migrations on a per table basis, then do 
db.define_table(..., migrate=False).

Anthony

On Tuesday, March 29, 2016 at 5:28:14 PM UTC-4, Aman Bindal wrote:
>
> Hi,
>   I need to access web2py sqlite database from python.
> So, I wrote a python code like this
>
> >> from pydal import DAL, Field
> >> db = DAL('sqlite://storage.sqlite')
> >> print db.tables
> []
> >> db.define_table(... Already existing table,)
> it is showing an error of sqlite3.OperationalError: table Account_Details 
> already exists
>
> Please don't print this e-mail unless you really need to.
>
> Disclaimer:
> "This communication (including any accompanying documents) is intended 
> only for the use of the addressee(s) and contains PRIVATE AND CONFIDENTIAL 
> information. Unauthorized reading, dissemination, distribution or copying 
> of this communication is prohibited. If you have received this 
> communication in error, please return the email to the sender promptly and 
> delete the original communication. 
> Please be informed that any review, dissemination, distribution, or 
> copying of this message is strictly prohibited, unless stated.The sender 
> confirms that Creditas Solutions shall not be responsible if this email 
> message is used for any indecent, unsolicited or illegal purposes, which 
> are in violation of any existing laws and the same shall solely be the 
> responsibility of the sender and that Creditas Solutions shall at all times 
> be indemnified of any civil and/ or criminal liabilities or consequences 
> thereof. 
> To the contrary, any opinions or comments are personal to the writer and 
> do not represent the official view of the company. In case where it 
> represents our official view, it needs to be re-validated and is subject to 
> the terms of our engagement. Thank you for your co-operation.”
>

-- 
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/d/optout.


[web2py] Re: Using DAL

2016-03-29 Thread Leonel Câmara
Add a migrate=False

db = DAL('sqlite://storage.sqlite', migrate=False)

-- 
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/d/optout.


[web2py] Re: IS_NOT_IN_DB validation different than IS_IN_DB

2016-03-29 Thread Anthony
tablename is a variable, but you are using it in a string literal (i.e., 
'[tablename].name') and expecting Python to still somehow figure out you 
are referring to a variable. You should instead use db[tablename].name 
there.

Anthony

On Tuesday, March 29, 2016 at 5:28:11 PM UTC-4, Norm Rajala wrote:
>
> Just started with web2py... great framework.
>
> I tried and failed however to find an answer to why two validators seem to 
> validate differently in terms of checking the syntax of parameters.
>
> I do the following:
>
> tableNames = ['taxaTS', 'taxaPF']
>
> for tableName in tableNames:
> # Create the taxa table
> db.define_table(tableName,
> Field('name' , unique=True, length=512, 
> comment='*Required'),
> Field('root_Path','list:string', default=['root'], 
> length=5200, compute=computers.calcRootPath()),
> Field('is_Leaf','boolean',default=False),
> Field('parent',length=512,default='root', 
> comment='*Required'),
> Field('note','text'),
> Field('link_Paths','list:string',default=[]),
> auth.signature)
>
> ## Field and Table Form Rules
> # name
> db[tableName].name.requires = IS_NOT_EMPTY()
> line 40db[tableName].name.requires = IS_NOT_IN_DB(db, '[tableName].name') 
># Name is unique
>
> # parent
> db[tableName].parent.requires = IS_NOT_EMPTY()
> line 44db[tableName].parent.requires = IS_IN_DB(db, '[tableName].name')   
># Parent name must exist in table already
>
>
>
>
> When the above code executes, I get the following error:
>
>  'DAL' object has no attribute 
> '[tableName]'Version
> web2py™ Version 2.14.3-stable+timestamp.2016.03.26.23.02.02
> Python Python 2.7.3: C:\Python27\python.exe (prefix: C:\Python27)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
>
> Traceback (most recent call last):
>   File "C:\Users\User\PycharmProjects\bladeCloud\web2py\gluon\restricted.py", 
> line 227, in restricted
> exec ccode in environment
>   File 
> "C:/Users/User/PycharmProjects/bladeCloud/web2py/applications/bc/models/db_bc_kb.py"
>  , line 44, 
> in 
> db[tableName].parent.requires = IS_IN_DB(db, '[tableName].name')  # 
> Parent name must exist in table already
>   File "C:\Users\User\PycharmProjects\bladeCloud\web2py\gluon\validators.py", 
> line 529, in __init__
> field = self.dbset.db[items[0]][items[1]]
>   File 
> "C:\Users\User\PycharmProjects\bladeCloud\web2py\gluon\packages\dal\pydal\base.py",
>  line 914, in __getitem__
> return self.__getattr__(str(key))
>   File 
> "C:\Users\User\PycharmProjects\bladeCloud\web2py\gluon\packages\dal\pydal\base.py",
>  line 921, in __getattr__
> return BasicStorage.__getattribute__(self, key)
> AttributeError: 'DAL' object has no attribute '[tableName]'
>
>
> It doesn't like line 44 but is ok with line 40.   
>
> Can someone help?
> Thanks...Norm(really new at 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/d/optout.


[web2py] Re: I want to make a query this way but unfortunately this ain't working. How to fix?

2016-03-29 Thread Anthony
On Tuesday, March 29, 2016 at 4:43:20 PM UTC-4, Jacob Devin wrote:
>
> I want to make a 'search'. For example if I search Jack, it should return 
> all those people's datas from the db which have either first_name or 
> last_name with substring 'jack'. What's wrong here?
>

What's wrong is that you are using .find, which appears nowhere in the 
documentation. You probably want .contains.

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/d/optout.


[web2py] Re: Rawsql to DAL Rows

2016-03-29 Thread Alfonso Serra
Ive found a Niplhod's answer that solves this. 

1.-Create a dummy table:
#create a dummy table with the same structure as the results
db.define_table("results", 
   Field("field1", "string")
   , Field("field2", "string")
   , migrate = False
)

2.- Execute any custom sql with that structure:
rows = db.executesql("SELECT field1, field2 FROM anytable", fields=[db.
results.field1, db.results.field2])
print rows


So with any random sql you can get all the Rows features. This is so cool. 
I love 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/d/optout.


[web2py] Using DAL

2016-03-29 Thread Aman Bindal
Hi,
  I need to access web2py sqlite database from python.
So, I wrote a python code like this

>> from pydal import DAL, Field
>> db = DAL('sqlite://storage.sqlite')
>> print db.tables
[]
>> db.define_table(... Already existing table,)
it is showing an error of sqlite3.OperationalError: table Account_Details 
already exists

-- 
Please don't print this e-mail unless you really need to.

Disclaimer:
"This communication (including any accompanying documents) is intended only 
for the use of the addressee(s) and contains PRIVATE AND CONFIDENTIAL 
information. Unauthorized reading, dissemination, distribution or copying 
of this communication is prohibited. If you have received this 
communication in error, please return the email to the sender promptly and 
delete the original communication. 
Please be informed that any review, dissemination, distribution, or copying 
of this message is strictly prohibited, unless stated.The sender confirms 
that Creditas Solutions shall not be responsible if this email message is 
used for any indecent, unsolicited or illegal purposes, which are in 
violation of any existing laws and the same shall solely be the 
responsibility of the sender and that Creditas Solutions shall at all times 
be indemnified of any civil and/ or criminal liabilities or consequences 
thereof. 
To the contrary, any opinions or comments are personal to the writer and do 
not represent the official view of the company. In case where it represents 
our official view, it needs to be re-validated and is subject to the terms 
of our engagement. Thank you for your co-operation.”

-- 
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/d/optout.


[web2py] IS_NOT_IN_DB validation different than IS_IN_DB

2016-03-29 Thread Norm Rajala
Just started with web2py... great framework.

I tried and failed however to find an answer to why two validators seem to 
validate differently in terms of checking the syntax of parameters.

I do the following:

tableNames = ['taxaTS', 'taxaPF']

for tableName in tableNames:
# Create the taxa table
db.define_table(tableName,
Field('name' , unique=True, length=512, 
comment='*Required'),
Field('root_Path','list:string', default=['root'], 
length=5200, compute=computers.calcRootPath()),
Field('is_Leaf','boolean',default=False),
Field('parent',length=512,default='root', 
comment='*Required'),
Field('note','text'),
Field('link_Paths','list:string',default=[]),
auth.signature)

## Field and Table Form Rules
# name
db[tableName].name.requires = IS_NOT_EMPTY()
line 40db[tableName].name.requires = IS_NOT_IN_DB(db, '[tableName].name')   
 # Name is unique

# parent
db[tableName].parent.requires = IS_NOT_EMPTY()
line 44db[tableName].parent.requires = IS_IN_DB(db, '[tableName].name') 
 # Parent name must exist in table already




When the above code executes, I get the following error:

 'DAL' object has no attribute 
'[tableName]'Version
web2py™ Version 2.14.3-stable+timestamp.2016.03.26.23.02.02
Python Python 2.7.3: C:\Python27\python.exe (prefix: C:\Python27)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.

Traceback (most recent call last):
  File "C:\Users\User\PycharmProjects\bladeCloud\web2py\gluon\restricted.py", 
line 227, in restricted
exec ccode in environment
  File 
"C:/Users/User/PycharmProjects/bladeCloud/web2py/applications/bc/models/db_bc_kb.py"
 , line 44, in 

db[tableName].parent.requires = IS_IN_DB(db, '[tableName].name')  # 
Parent name must exist in table already
  File "C:\Users\User\PycharmProjects\bladeCloud\web2py\gluon\validators.py", 
line 529, in __init__
field = self.dbset.db[items[0]][items[1]]
  File 
"C:\Users\User\PycharmProjects\bladeCloud\web2py\gluon\packages\dal\pydal\base.py",
 line 914, in __getitem__
return self.__getattr__(str(key))
  File 
"C:\Users\User\PycharmProjects\bladeCloud\web2py\gluon\packages\dal\pydal\base.py",
 line 921, in __getattr__
return BasicStorage.__getattribute__(self, key)
AttributeError: 'DAL' object has no attribute '[tableName]'


It doesn't like line 44 but is ok with line 40.   

Can someone help?
Thanks...Norm(really new at 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/d/optout.


[web2py] float argument required, not str

2016-03-29 Thread Ciro Alves
Salve Pessoal

Estou com um erro que não consigo resolver. Eu faço um select onde só estão 
envolvidas variáveis inteiras mas, mesmo assim, recebo o erro acima dizendo 
que uma variável float era requerida.

Segue abaixo a descrição do erro. Não consigo passar do select. E o 
estranho é que sempre funcionou.

Alguma poderia sugerir onde está o problema?

Traceback (most recent call last):
  File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
2.13.4\gluon\restricted.py", line 227, in restricted
exec ccode in environment
  File "C:/Users/Ciro/Documents/Profissionais/Web2py/Web2py 
2.13.4/applications/prods/controllers/default.py" 
, line 
268, in 
  File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
2.13.4\gluon\globals.py", line 412, in 
self._caller = lambda f: f()
  File "C:/Users/Ciro/Documents/Profissionais/Web2py/Web2py 
2.13.4/applications/prods/controllers/default.py" 
, line 
265, in list_mp

*recs = db((db.t_mpconsumida.f_ano_referencia == 
ano_referencia)&(db.t_mpconsumida.f_codigo_materiaprima == 
db.t_materiaprima.f_codigo)).select(orderby=db.t_produto.f_prodlist)  *File 
"C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
2.13.4\gluon\packages\dal\pydal\objects.py", line 2025, in select
return adapter.select(self.query,fields,attributes)
  File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
2.13.4\gluon\packages\dal\pydal\adapters\sqlite.py", line 124, in select
return super(SQLiteAdapter, self).select(query, fields, attributes)
  File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
2.13.4\gluon\packages\dal\pydal\adapters\base.py", line 1293, in select
return self._select_aux(sql,fields,attributes)
  File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
2.13.4\gluon\packages\dal\pydal\adapters\base.py", line 1274, in _select_aux
return processor(rows,fields,self._colnames,cacheable=cacheable)
  File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
2.13.4\gluon\packages\dal\pydal\adapters\base.py", line 1764, in parse
for row in rows]
  File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
2.13.4\gluon\packages\dal\pydal\adapters\base.py", line 1674, in _parse
value = self.parse_value(value, ft, blob_decode)
  File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
2.13.4\gluon\packages\dal\pydal\adapters\base.py", line 1524, in parse_value
return self.parsemap[key](value,field_type)
  File "C:\Users\Ciro\Documents\Profissionais\Web2py\Web2py 
2.13.4\gluon\packages\dal\pydal\adapters\base.py", line 1601, in parse_decimal
value = ('%.' + str(decimals) + 'f') % value
TypeError: float argument required, not str

-- 
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/d/optout.


[web2py] Upload file from 'static/images' to database

2016-03-29 Thread Nick Michael
Hi, I'm having some trouble and was hoping someone could point me in the 
right direction.

I'm creating an application which has an input form which stores to a 
database. One entry accepts images, but can also be left empty (by using 
requires IS_EMPTY_OR). I also have a placeholder image saved under 
'static/images'. I want to make it so that if the upload file is left 
empty, I store the placeholder image from the 'static/images' folder in the 
database entry, otherwise it'll use the image that was uploaded by the user.

Here's my current implementation:

if request.vars.image == "":
##Enter Code Here##
else:
image_file = db.user_items.image.store(request.vars.image.file, 
request.vars.image.filename)
addItemToData (request.vars.name, request.vars.collection, 
request.vars.tag, request.vars.value, request.vars.story, image_file, 
auth.user.id, request.vars.tradeable)
redirect(URL('default', 'profile'))

-- 
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/d/optout.


[web2py] Re: Date picker format

2016-03-29 Thread Massimo Di Pierro
LOL. I think it is not easy enough in fact. In web3py I think all date 
conversions should be done client side and not in validator. There is no 
reason for the server to even know what the client representation of dates 
is.

On Tuesday, 29 March 2016 12:44:54 UTC-5, Jeff Riley wrote:
>
> Mr. Pierro.  I am embarrassed that was so easy.
>
> On Monday, March 28, 2016 at 11:09:32 PM UTC-5, Massimo Di Pierro wrote:
>>
>> look into views/web2py_ajax.html
>>
>> On Monday, 28 March 2016 16:09:39 UTC-5, Jeff Riley wrote:
>>>
>>> Hello everyone.  I have the following field defined.
>>>
>>> Field('due_date', 'date', requires = IS_DATE(format=T('%m-%d-%Y'))),
>>>
>>> The date picker that comes up with this field is setting the date to 
>>> -MM-DD which is conflicting with the format I have defined above when I 
>>> his submit.  How to I get the date picker to return the correct format.
>>>
>>> Thank you all so much for all your help with everything I have asked.
>>>
>>

-- 
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/d/optout.


[web2py] Re: GAE problems

2016-03-29 Thread Massimo Di Pierro
I cannot tell what the query is.

On Tuesday, 29 March 2016 02:06:43 UTC-5, rif wrote:
>
> The gae query is this:  http://11.firmoasa.appspot.com/facturi
>
> I have this route:
> routers = dict(
>
> # base router
> BASE=dict(
> default_application='firmoasa',
> ),
> )
>
> And the full log is this:
>
> /facturi 500 952ms 0kb Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 
> (KHTML, like Gecko) Chrome/49.0.2623.108 Safari/537.36 module=default 
> version=11
> 78.96.81.220 - - [29/Mar/2016:00:02:55 -0700] "GET /facturi HTTP/1.1" 500 
> 378 "http://11.firmoasa.appspot.com/; "Mozilla/5.0 (X11; Linux x86_64) 
> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.108 Safari/537.36" "
> 11.firmoasa.appspot.com" ms=952 cpu_ms=555 cpm_usd=0.42 
> app_engine_release=1.9.35 instance=00c61b117c1212e7c568f7bfc458f105facfec28
> D 2016-03-29 10:02:54.330
> select application=firmoasa
> D 2016-03-29 10:02:54.330
> route: controller=facturi
> D 2016-03-29 10:02:54.330
> route: function.ext=index.html
> E 2016-03-29 10:02:55.228
>  Unable to store in FILE: 
> /base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/controllers/facturi.py
>
> Traceback (most recent call last):
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/restricted.py", 
> line 227, in restricted
> exec ccode in environment
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/controllers/facturi.py",
>  
> line 128, in 
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/globals.py", 
> line 417, in 
> self._caller = lambda f: f()
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/tools.py", 
> line 4250, in f
> return action(*a, **b)
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/controllers/facturi.py",
>  
> line 9, in index
> form = crud.update(Facturi, a0, next=URL('index'))
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/tools.py", 
> line 4899, in update
> **attributes  # contains hidden
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/sqlhtml.py", 
> line 1295, in __init__
> inp = self.widgets.options.widget(field, default)
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/sqlhtml.py", 
> line 313, in widget
> options = requires[0].options()
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/validators.py", 
> line 600, in options
> self.build_set()
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/validators.py", 
> line 586, in build_set
> records = self.dbset(table).select(*fields, **dd)
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/objects.py",
>  
> line 2020, in select
> return adapter.select(self.query, fields, attributes)
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/adapters/google_adapters.py",
>  
> line 500, in select
> (items, tablename, fields) = self.select_raw(query,fields,attributes)
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/adapters/google_adapters.py",
>  
> line 390, in select_raw
> filters = self.expand(query)
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/adapters/google_adapters.py",
>  
> line 246, in expand
> return expression.op(expression.first, expression.second)
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/adapters/google_adapters.py",
>  
> line 262, in AND
> first = self.expand(first)
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/adapters/google_adapters.py",
>  
> line 246, in expand
> return expression.op(expression.first, expression.second)
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/adapters/google_adapters.py",
>  
> line 266, in AND
> return ndb.AND(first, second)
>   File 
> "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/query.py",
>  
> line 574, in __new__
> ' received a non-Node instance %r' % node)
> TypeError: ConjunctionNode() expects Node instances as arguments; received 
> a non-Node instance None
>

-- 
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/d/optout.


Re: [web2py] Re: alternate date/time widgets?

2016-03-29 Thread Massimo Di Pierro
You do not have to use stupid css to use the tags widget. But you will need 
to write some CSS to make it look the way you want.

On Monday, 28 March 2016 23:52:38 UTC-5, Ron Chatterjee wrote:
>
> If we dont use stupid css wondering what will b the equivalent 
> autocomplete with dismissal tags can b (for search). 

-- 
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/d/optout.


[web2py] Re: How did you implement chat system in your app? How's my idea?

2016-03-29 Thread Emmanuel Dsouza
any other idea besides websocket?

On Tuesday, March 29, 2016 at 12:07:00 AM UTC+5:30, Ron Chatterjee wrote:
>
>
> https://www.toptal.com/tornado/simple-python-websocket-server?utm_campaign=blog_post_simple_python_websocket_server_medium=email_source=blog_subscribers
>
> Interesting article.
>

-- 
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/d/optout.


[web2py] Re: Why do I get a never ending 'working' on trying to update my pic in the form in default/screen.html

2016-03-29 Thread Emmanuel Dsouza
So any another idea, how to do it?

On Wednesday, March 30, 2016 at 1:16:43 AM UTC+5:30, Leonel Câmara wrote:
>
> You're trying to upload an image using ajax which is a little bit more 
> complicated and requires you to use something to help you like 
> jquery.form.js otherwise it won't work.
>

-- 
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/d/optout.


[web2py] Re: I want to make a query this way but unfortunately this ain't working. How to fix?

2016-03-29 Thread Jacob Devin
I want to make a 'search'. For example if I search Jack, it should return 
all those people's datas from the db which have either first_name or 
last_name with substring 'jack'. What's wrong here?
On Tuesday, March 29, 2016 at 11:36:18 PM UTC+5:30, Anthony wrote:
>
> Did you read the documentation? What are you trying to do?

-- 
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/d/optout.


[web2py] bug? menu v2.14.3

2016-03-29 Thread lucas
hello one and all,

so i upgraded from v2.12.3 to v2.14.3.  i had trouble with the menu going 
deeper then the level past the first drop down.

so i started a new app and only added the bold below under menu.py:

response.menu += [
(T('My Sites'), False, URL('admin', 'default', 'site')),
  (T('This App'), False, '#', [
  *(T('test1'), False, '', [('test12', False, URL(f='test12')), 
('test13', False, URL(f='test13'))]),*
  (T('Design'), False, URL('admin', 'default', 'design/%s' % 
app)),
  LI(_class="divider"),
...

when i run this app, it does show that test1 is further branched with the 
little arrow and test12 and test13 don't show in its submenu.

now in my main app, the branching is fine.  so i don't think it is a 
problem on the server/web2py part, but probably in the static/css or 
static/js files probably.  i'm not exactly sure how those menu work, but i 
love when they do.

so, just informing, let me know.  thanx in advance, lucas

-- 
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/d/optout.


[web2py] Re: Why do I get a never ending 'working' on trying to update my pic in the form in default/screen.html

2016-03-29 Thread Leonel Câmara
You're trying to upload an image using ajax which is a little bit more 
complicated and requires you to use something to help you like 
jquery.form.js otherwise it won't work.

-- 
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/d/optout.


[web2py] setup-web2py-nginx-uwsgi-ubuntu.sh

2016-03-29 Thread Richard
Hello,

I was happy when I try setup-web2py-nginx-uwsgi-ubuntu.sh with Ubuntu 16.04 
beta 2... It worked flawlessly, thanks...

Richard

-- 
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/d/optout.


[web2py] I want to make a query this way but unfortunately this ain't working. How to fix?

2016-03-29 Thread Anthony
Did you read the documentation? What are you trying to do?

-- 
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/d/optout.


[web2py] Rawsql to DAL Rows

2016-03-29 Thread Alfonso Serra

Im trying to adapt an executesql query to a dal object to make use of 
features like export to csv.

So ive tried something like:

#create a dummy table with the same structure as the results
db.define_table("results", 
   Field("field1", "string")
   , Field("field2", "string")
   , migrate = False
)

#a result from a db.executesql
data = [{"field1": "asd1", "field2": "qwe1"}, {"field1": "asd2", "field2": 
"qwe2"}]

#insert data into the table
db.results.insert(**data[0])

#get the rows object
rows = db(db.results).select()

At some point i get "table results doesnt exists" which is true but, 

Is there any way to get a Rows objects out of a rawsql? Is it required that 
the table exists?

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/d/optout.


[web2py] Re: Date picker format

2016-03-29 Thread Jeff Riley
Mr. Pierro.  I am embarrassed that was so easy.

On Monday, March 28, 2016 at 11:09:32 PM UTC-5, Massimo Di Pierro wrote:
>
> look into views/web2py_ajax.html
>
> On Monday, 28 March 2016 16:09:39 UTC-5, Jeff Riley wrote:
>>
>> Hello everyone.  I have the following field defined.
>>
>> Field('due_date', 'date', requires = IS_DATE(format=T('%m-%d-%Y'))),
>>
>> The date picker that comes up with this field is setting the date to 
>> -MM-DD which is conflicting with the format I have defined above when I 
>> his submit.  How to I get the date picker to return the correct format.
>>
>> Thank you all so much for all your help with everything I have asked.
>>
>

-- 
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/d/optout.


[web2py] Why do I get a never ending 'working' on trying to update my pic in the form in default/screen.html

2016-03-29 Thread Emmanuel Dsouza
in model:
db.define_table('info',
Field('info_id', default=auth.user_id, writable=False, 
readable=False),
Field('dp','upload',label='Update your profile pic'),

Field('first_name',requires=IS_NOT_EMPTY(error_message="Please fill it")),

Field('last_name',requires=IS_NOT_EMPTY(error_message="Please fill it")),
Field('dob','date', 
default=request.now,requires=IS_NOT_EMPTY(error_message="Please fill it"), 
label='Date of Birth'),

Field('sex',requires=IS_IN_SET(['Male','Female','Other'],error_message="Please 
fill it")),

Field('hometown',requires=IS_NOT_EMPTY(error_message="Please fill it")),
Field('highschool', label='High School'),
Field('university'),
Field('oneself', 'text', label='Write about yourself'),
)


in controller:

@auth.requires_login()
def screen():
row=db(db.info.info_id==auth.user_id).select().first()
return locals()


def delformforscreen():
row=db(db.info.info_id==auth.user_id).select().first()
form=SQLFORM(db.info,row.id).process()
submit=form.element("input",_type="submit")
submit["_onclick"]="return confirm('Are you sure');"
return locals()

My views:

in default/screen.html:

{{extend 'layout.html'}}
Hi {{=row.first_name}}!



   {{=LOAD('default', 'delformforscreen.load', ajax=True)}}


in delformforscreen.load:


jQuery(document).ready(function(){
  jQuery('#info_id__row').hide();
});

{{=form}}


-- 
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/d/optout.


[web2py] I want to make a query this way but unfortunately this ain't working. How to fix?

2016-03-29 Thread Jacob Devin
 rows=db((db.info.last_name.lower().find(request.args(0).lower())) | 
(db.info.first_name.lower().find(request.args(0).lower(.select()

-- 
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/d/optout.


Re: [web2py] Re: Google App Engine Launcher 1.9.34 breaks web2py?

2016-03-29 Thread Richard Vézina
Git 2.8 will solve that...

On Tue, Mar 29, 2016 at 1:53 AM, Tommi Lahtonen  wrote:

>
>
> On Thursday, March 24, 2016 at 1:41:42 AM UTC+2, Massimo Di Pierro wrote:
>>
>> Which version of web2py? Did you use git clone? Did you do what it is
>> asking?
>>
>> git submodule update --init --recursive
>>
>> I used the src-version from here:
> http://www.web2py.com/examples/static/web2py_src.zip
>
> I now tried the latest version and it still breaks with app engine
> launcher 1.9.34. With 1.9.32 it works just fine. My much older application
> with older version of web2py works just as badly. Both of them work just
> fine when deployded to appengine.com so it seems that this is a problem
> with App Engine Launcher.
>
>
>
> 2016-03-29 08:47:39 Running command: "['C:\\Python27\\pythonw.exe',
> 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py',
> '--skip_sdk_update_check=yes', '--port=13080', '--admin_port=8005',
> u'K:\\temp\\web2py_src_new\\web2py']"
> INFO 2016-03-29 08:47:48,173 devappserver2.py:769] Skipping SDK update
> check.
> WARNING  2016-03-29 08:47:48,513 simple_search_stub.py:1126] Could not
> read search indexes from
> c:\users\tjlahton\appdata\local\temp\appengine.tiea218-malli\search_indexes
> INFO 2016-03-29 08:47:48,523 api_server.py:205] Starting API server
> at: http://localhost:40963
> INFO 2016-03-29 08:47:48,532 dispatcher.py:197] Starting module
> "default" running at: http://localhost:13080
> INFO 2016-03-29 08:47:48,532 admin_server.py:116] Starting admin
> server at: http://localhost:8005
> ERROR2016-03-29 05:48:06,344 wsgi.py:263]
>
> Traceback (most recent call last):
>
>   File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 240,
> in Handle
>
> handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
>
>   File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 299,
> in _LoadHandler
>
> handler, path, err = LoadObject(self._handler)
>
>   File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 85,
> in LoadObject
>
> obj = __import__(path[0])
>
>   File "K:\temp\web2py_src_new\web2py\gaehandler.py", line 47, in 
>
> from gluon.settings import global_settings
>
>   File "K:\temp\web2py_src_new\web2py\gluon\__init__.py", line 29, in
> 
>
> "You can also download a complete copy from http://www.web2py.com.;
>
> RuntimeError: web2py depends on pydal, which apparently you have not
> installed.
>
> Probably you cloned the repository using git without '--recursive'
>
> To fix this, please run (from inside your web2py folder):
>
>
>
>  git submodule update --init --recursive
>
>
>
> You can also download a complete copy from http://www.web2py.com.
>
> INFO 2016-03-29 08:48:06,354 module.py:787] default: "GET / HTTP/1.1"
> 500 -
> INFO 2016-03-29 08:48:06,983 module.py:787] default: "GET /favicon.ico
> HTTP/1.1" 404 -
> INFO 2016-03-29 08:48:07,013 module.py:787] default: "GET /favicon.ico
> HTTP/1.1" 404 -
> INFO 2016-03-29 08:48:09,523 module.py:787] default: "GET /favicon.ico
> HTTP/1.1" 404 -
>
>
> --
> 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/d/optout.
>

-- 
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/d/optout.


Re: [web2py] Re: web2py 2.14.2

2016-03-29 Thread Richard Vézina
@Sukrut
Maybe here :
http://stackoverflow.com/questions/18351553/regular-expression-validation-for-indian-phone-number-and-mobile-number

On Tue, Mar 29, 2016 at 4:07 AM, Sukrut Joshi  wrote:

> please help for regex of mobile numbers of india i dont want use country
> code ..number must start with digit and end with digit and length of mobile
> no=10
>   requires = IS_MATCH('^1?((-)\d{3}-?|\(\d{3}\))\d{3}-?\d{4}$',
>
>  error_message='not a phone number')
>
> this is for us..and need for india ? eg.91 952 733 2303
>
>
>
> On Tue, Mar 29, 2016 at 9:38 AM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> Please use a different thread for this. On the other thread, can you show
>> the query that cases this traceback?
>>
>>
>> On Monday, 28 March 2016 13:50:46 UTC-5, rif wrote:
>>>
>>> Unfortunately __init__ is present in my case. Moreover when I start the
>>> app using local development server I get another stacktrace (pasted below).
>>>
>>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/restricted.py",
>>> line 227, in restricted
>>> exec ccode in environment
>>>   File
>>> "/home/rif/Documents/webframeworks/firmoasa/applications/firmoasa/controllers/default.py",
>>> line 87, in 
>>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/globals.py",
>>> line 417, in 
>>> self._caller = lambda f: f()
>>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/tools.py", line
>>> 4250, in f
>>> return action(*a, **b)
>>>   File
>>> "/home/rif/Documents/webframeworks/firmoasa/applications/firmoasa/controllers/default.py",
>>> line 8, in firme
>>> form = crud.update(db.firma, a0, next=URL('firme'))
>>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/tools.py", line
>>> 4899, in update
>>> **attributes  # contains hidden
>>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/sqlhtml.py",
>>> line 1295, in __init__
>>> inp = self.widgets.options.widget(field, default)
>>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/sqlhtml.py",
>>> line 313, in widget
>>> options = requires[0].options()
>>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/validators.py",
>>> line 2645, in _options
>>> options = self.other.options(*args, **kwargs)
>>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/validators.py",
>>> line 600, in options
>>> self.build_set()
>>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/validators.py",
>>> line 586, in build_set
>>> records = self.dbset(table).select(*fields, **dd)
>>>   File
>>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/objects.py",
>>> line 2020, in select
>>> return adapter.select(self.query, fields, attributes)
>>>   File
>>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
>>> line 500, in select
>>> (items, tablename, fields) = self.select_raw(query,fields,attributes)
>>>   File
>>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
>>> line 390, in select_raw
>>> filters = self.expand(query)
>>>   File
>>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
>>> line 246, in expand
>>> return expression.op(expression.first, expression.second)
>>>   File
>>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
>>> line 262, in AND
>>> first = self.expand(first)
>>>   File
>>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
>>> line 246, in expand
>>> return expression.op(expression.first, expression.second)
>>>   File
>>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
>>> line 266, in AND
>>> return ndb.AND(first, second)
>>>   File "/opt/google_appengine/google/appengine/ext/ndb/query.py", line
>>> 574, in __new__
>>> ' received a non-Node instance %r' % node)
>>> TypeError: ConjunctionNode() expects Node instances as arguments;
>>> received a non-Node instance None
>>>
>>>
>>> luni, 28 martie 2016, 21:28:52 UTC+3, Dave S a scris:



 On Monday, March 28, 2016 at 2:52:02 AM UTC-7, rif wrote:
>
> After a long while of not updating one app running on gae I
> tried 2.14.3 and I have the error below. Can anyone suggest a fix?
>
> Thanks,
> -rif
>
>  Unable to store in FILE: 
> /base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/models/db.py
>
> Traceback (most recent call last):
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/restricted.py",
>  line 227, in restricted
> exec ccode in environment
>   File 
> "/base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/models/db.py",
>  line 15, in 
> session.connect(request, 

Re: [web2py] Re: web2py 2.14.2

2016-03-29 Thread Richard Vézina
Or second answer here :
http://stackoverflow.com/questions/3813195/regular-expression-for-indian-mobile-numbers

On Tue, Mar 29, 2016 at 11:24 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> @Sukrut
> Maybe here :
> http://stackoverflow.com/questions/18351553/regular-expression-validation-for-indian-phone-number-and-mobile-number
>
> On Tue, Mar 29, 2016 at 4:07 AM, Sukrut Joshi  wrote:
>
>> please help for regex of mobile numbers of india i dont want use country
>> code ..number must start with digit and end with digit and length of mobile
>> no=10
>>   requires = IS_MATCH('^1?((-)\d{3}-?|\(\d{3}\))\d{3}-?\d{4}$',
>>
>>  error_message='not a phone number')
>>
>> this is for us..and need for india ? eg.91 952 733 2303
>>
>>
>>
>> On Tue, Mar 29, 2016 at 9:38 AM, Massimo Di Pierro <
>> massimo.dipie...@gmail.com> wrote:
>>
>>> Please use a different thread for this. On the other thread, can you
>>> show the query that cases this traceback?
>>>
>>>
>>> On Monday, 28 March 2016 13:50:46 UTC-5, rif wrote:

 Unfortunately __init__ is present in my case. Moreover when I start the
 app using local development server I get another stacktrace (pasted below).

   File
 "/home/rif/Documents/webframeworks/firmoasa/gluon/restricted.py", line 227,
 in restricted
 exec ccode in environment
   File
 "/home/rif/Documents/webframeworks/firmoasa/applications/firmoasa/controllers/default.py",
 line 87, in 
   File "/home/rif/Documents/webframeworks/firmoasa/gluon/globals.py",
 line 417, in 
 self._caller = lambda f: f()
   File "/home/rif/Documents/webframeworks/firmoasa/gluon/tools.py",
 line 4250, in f
 return action(*a, **b)
   File
 "/home/rif/Documents/webframeworks/firmoasa/applications/firmoasa/controllers/default.py",
 line 8, in firme
 form = crud.update(db.firma, a0, next=URL('firme'))
   File "/home/rif/Documents/webframeworks/firmoasa/gluon/tools.py",
 line 4899, in update
 **attributes  # contains hidden
   File "/home/rif/Documents/webframeworks/firmoasa/gluon/sqlhtml.py",
 line 1295, in __init__
 inp = self.widgets.options.widget(field, default)
   File "/home/rif/Documents/webframeworks/firmoasa/gluon/sqlhtml.py",
 line 313, in widget
 options = requires[0].options()
   File
 "/home/rif/Documents/webframeworks/firmoasa/gluon/validators.py", line
 2645, in _options
 options = self.other.options(*args, **kwargs)
   File
 "/home/rif/Documents/webframeworks/firmoasa/gluon/validators.py", line 600,
 in options
 self.build_set()
   File
 "/home/rif/Documents/webframeworks/firmoasa/gluon/validators.py", line 586,
 in build_set
 records = self.dbset(table).select(*fields, **dd)
   File
 "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/objects.py",
 line 2020, in select
 return adapter.select(self.query, fields, attributes)
   File
 "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
 line 500, in select
 (items, tablename, fields) =
 self.select_raw(query,fields,attributes)
   File
 "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
 line 390, in select_raw
 filters = self.expand(query)
   File
 "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
 line 246, in expand
 return expression.op(expression.first, expression.second)
   File
 "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
 line 262, in AND
 first = self.expand(first)
   File
 "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
 line 246, in expand
 return expression.op(expression.first, expression.second)
   File
 "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
 line 266, in AND
 return ndb.AND(first, second)
   File "/opt/google_appengine/google/appengine/ext/ndb/query.py", line
 574, in __new__
 ' received a non-Node instance %r' % node)
 TypeError: ConjunctionNode() expects Node instances as arguments;
 received a non-Node instance None


 luni, 28 martie 2016, 21:28:52 UTC+3, Dave S a scris:
>
>
>
> On Monday, March 28, 2016 at 2:52:02 AM UTC-7, rif wrote:
>>
>> After a long while of not updating one app running on gae I
>> tried 2.14.3 and I have the error below. Can anyone suggest a fix?
>>
>> Thanks,
>> -rif
>>
>>  Unable to store in FILE: 
>> /base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/models/db.py
>>
>> Traceback (most recent call 

Re: [web2py] Re: Trying to reach a routes behavior

2016-03-29 Thread Carlos Cesar Caballero Díaz

Many thanks Anthony and Richard, I'll use your suggestion.

Greetings.

El 29/03/16 a las 10:27, Richard Vézina escribió:
I agree with Anthony... Do you have any constraint that prevent you 
from doing that... I would definetly stay away from router as much as 
I can...


Richard

On Tue, Mar 29, 2016 at 9:37 AM, Anthony > wrote:


Right now the url to reach the index function of the country
controller is something like www.myapp.com/country/cuba
 because index is set as
the default function using the parametric router
(www.myapp.com/country/index/cuba
 without set index()
as default).


Now I need to find a way to map

www.myapp.com/country/index/cuba
 from
www.myapp.com/cuba 
www.myapp.com/state/index/cuba/cienfuegos
 from
www.myapp.com/cuba/cienfuegos

www.myapp.com/city/index/cuba/cienfuegos/cienfuegos

from www.myapp.com/cuba/cienfuegos/cienfuegos



I don't think you want to use URL rewrite rules to achieve this,
as it will be very complex to set up and maintain. Given the above
requirements, I think my earlier proposal makes much more sense --
just have a single controller with a single function:

|
defindex():
country,state,city
=request.args(0),request.args(1),request.args(2)
ifcity:
data =get_city_data(country,state,city)
response.view ='default/city_view.html'
elifstate:
data =get_state_data(country,state)
response.view ='default/state_view.html'
elifcountry:
data =get_country_data(country)
response.view ='default/country_view.html'
...
|

Of course, the details of you implement the internal logic will
depend on exactly how different the code is for country vs. state
vs. city.

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/d/optout.


--
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/d/optout.




--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
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/d/optout.


Re: [web2py] Re: Trying to reach a routes behavior

2016-03-29 Thread Richard Vézina
I agree with Anthony... Do you have any constraint that prevent you from
doing that... I would definetly stay away from router as much as I can...

Richard

On Tue, Mar 29, 2016 at 9:37 AM, Anthony  wrote:

> Right now the url to reach the index function of the country controller is
>> something like www.myapp.com/country/cuba because index is set as the
>> default function using the parametric router (
>> www.myapp.com/country/index/cuba without set index() as default).
>>
>
>> Now I need to find a way to map
>>
>> www.myapp.com/country/index/cuba from www.myapp.com/cuba
>> www.myapp.com/state/index/cuba/cienfuegos from
>> www.myapp.com/cuba/cienfuegos
>> www.myapp.com/city/index/cuba/cienfuegos/cienfuegos from
>> www.myapp.com/cuba/cienfuegos/cienfuegos
>>
>
> I don't think you want to use URL rewrite rules to achieve this, as it
> will be very complex to set up and maintain. Given the above requirements,
> I think my earlier proposal makes much more sense -- just have a single
> controller with a single function:
>
> def index():
> country, state, city = request.args(0), request.args(1), request.args(
> 2)
> if city:
> data = get_city_data(country, state, city)
> response.view = 'default/city_view.html'
> elif state:
> data = get_state_data(country, state)
> response.view = 'default/state_view.html'
> elif country:
> data = get_country_data(country)
> response.view = 'default/country_view.html'
> ...
>
> Of course, the details of you implement the internal logic will depend on
> exactly how different the code is for country vs. state vs. city.
>
> 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/d/optout.
>

-- 
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/d/optout.


[web2py] Re: Why is this ajax function not working fine?

2016-03-29 Thread Jacob Devin
Thank you Anthony. It worked flawlessly!

On Tuesday, March 29, 2016 at 6:50:24 PM UTC+5:30, Anthony wrote:
>
> On Tuesday, March 29, 2016 at 6:09:57 AM UTC-4, Jacob Devin wrote:
>>
>> view:
>>
>> {{extend 'layout.html'}}
>> {{for row in rows:}}
>> 
>> {{=row.name}}
>> 
>> 
>> check 
>> 'about'
>>
>
> Please review the documentation. The second argument to the ajax() 
> function is a list of "name" attributes of form input elements -- it cannot 
> simply be a list of raw data values you want to pass to the server (and you 
> certainly shouldn't expect the Python identifiers used in the template to 
> appear in request.vars -- the Javascript code never even sees those 
> identifiers). In this case, because you are not extracting values from form 
> input elements but simply want to pass existing data values, you should 
> instead add those values to the URL itself:
>
> ajax('{{=URL('default', 'about_group', args=row.id)}}', [], '{{=row.id}}')
>
> With the above, in the controller you can get the value of row.id via 
> request.args(0). Also, note the change of the "target" argument to the 
> row.id value -- this will ensure that each target element gets its own 
> unique ID (you cannot give the same CSS id to multiple elements on the 
> page). Of course, you will also need to do:
>
>  
>
>
> 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/d/optout.


Re: [web2py] Re: Trying to reach a routes behavior

2016-03-29 Thread Anthony

>
> Right now the url to reach the index function of the country controller is 
> something like www.myapp.com/country/cuba because index is set as the 
> default function using the parametric router (
> www.myapp.com/country/index/cuba without set index() as default).
>

> Now I need to find a way to map
>
> www.myapp.com/country/index/cuba from www.myapp.com/cuba
> www.myapp.com/state/index/cuba/cienfuegos from 
> www.myapp.com/cuba/cienfuegos
> www.myapp.com/city/index/cuba/cienfuegos/cienfuegos from 
> www.myapp.com/cuba/cienfuegos/cienfuegos
>

I don't think you want to use URL rewrite rules to achieve this, as it will 
be very complex to set up and maintain. Given the above requirements, I 
think my earlier proposal makes much more sense -- just have a single 
controller with a single function:

def index():
country, state, city = request.args(0), request.args(1), request.args(2)
if city:
data = get_city_data(country, state, city)
response.view = 'default/city_view.html'
elif state:
data = get_state_data(country, state)
response.view = 'default/state_view.html'
elif country:
data = get_country_data(country)
response.view = 'default/country_view.html'
...

Of course, the details of you implement the internal logic will depend on 
exactly how different the code is for country vs. state vs. city.

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/d/optout.


[web2py] Re: Why is this ajax function not working fine?

2016-03-29 Thread Anthony
On Tuesday, March 29, 2016 at 6:09:57 AM UTC-4, Jacob Devin wrote:
>
> view:
>
> {{extend 'layout.html'}}
> {{for row in rows:}}
> 
> {{=row.name}}
> 
> 
> check 
> 'about'
>

Please review the documentation. The second argument to the ajax() function 
is a list of "name" attributes of form input elements -- it cannot simply 
be a list of raw data values you want to pass to the server (and you 
certainly shouldn't expect the Python identifiers used in the template to 
appear in request.vars -- the Javascript code never even sees those 
identifiers). In this case, because you are not extracting values from form 
input elements but simply want to pass existing data values, you should 
instead add those values to the URL itself:

ajax('{{=URL('default', 'about_group', args=row.id)}}', [], '{{=row.id}}')

With the above, in the controller you can get the value of row.id via 
request.args(0). Also, note the change of the "target" argument to the 
row.id value -- this will ensure that each target element gets its own 
unique ID (you cannot give the same CSS id to multiple elements on the 
page).

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/d/optout.


Re: [web2py] Re: Why is this ajax function not working fine?

2016-03-29 Thread Niphlod
a taddle bit of recap, seems that you're loosing the bigger picture 

ANYTHING (or, the 99%) of things in views contained in a {{=blabla}} are 
properly escaped.

Back to the "problem":
- first of all, you shouldn't generate  multiple times. 
Every element with an id attribute should be the only instance in the page
- second: you'd really check into what leonel suggested, it cuts the 
complexity
- third, for completeness sake and for that only: in cases like this I like 
to take a step back and iterate over small changes, to see where everything 
is falling apart...
a) let's start with check about
b) let's get "something" become  "ajax('url', ['parameter'], 'target');"
- check about
c) let's get "url" become a proper url
   - check about
d) let's get "parameter" become the row.id 
   - check about

voilà, no syntax errors.

On Tuesday, March 29, 2016 at 12:56:20 PM UTC+2, Jacob Devin wrote:
>
> now it says:
>  unexpected character after line 
> continuation character (default/index.html, line 83)
>
> earlier it was giving no response on clicking as i expected it to work as 
> per its onclick function.
>
> On Tuesday, March 29, 2016 at 4:10:02 PM UTC+5:30, Kiran Subbaraman wrote:
>>
>> Escaping the inner-quotes: > onclick="ajax('{{=URL(\'default\',\'about_group\')}}',[row.id
>> ],'target');">
>> Also will be a good idea to see what sort of errors appear on your 
>> browser's console, and if the generated page contains the callback url that 
>> you expect.
>>
>> 
>> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>>
>> On Tue, 29-03-2016 3:59 PM, Jacob Devin wrote:
>>
>>
>> {{extend 'layout.html'}}
>> {{for row in rows:}}
>> 
>> {{=row.name}}
>> 
>> 
>> > onclick="ajax('{{=URL('default','about_group')}}',[row.id],'target');">check 
>> 'about'
>> 
>>  
>> {{pass}}
>>
>>
>>
>> def index():
>> rows=db(db.groups.id>0).select()
>> return locals()
>> def about_group():
>> row=db(db.groups.id 
>> 
>> ==request.vars.row.id).select().first()
>> return row.about
>> It ain't working with div onclick too. What's the problem now?
>>
>> On Tuesday, March 29, 2016 at 3:48:50 PM UTC+5:30, Leonel Câmara wrote: 
>>>
>>> It shouldn't be on href it should be on onclick. 
>>>
>>> Consider using a trapped link for that instead.
>>>
>>> http://web2py.com/books/default/chapter/29/12/components-and-plugins#Trapped-Ajax-links-and-the-A-Helper
>>>
>> -- 
>> 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+un...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>

-- 
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/d/optout.


Re: [web2py] Re: Trying to reach a routes behavior

2016-03-29 Thread Carlos Cesar Caballero Díaz
Hi Anthony and Richard, these are the functions of my country controller 
(state and city controllers are similar):


def index()
def edit()

In the future the controller will have more functions (we have planned 
new features that will be built as components)


There is no a cuba() function, in index() I have something like:

country = request.args[0]

In the index() functions of the other controllers I get the extra args.

Right now the url to reach the index function of the country controller 
is something like www.myapp.com/country/cuba because index is set as the 
default function using the parametric router 
(www.myapp.com/country/index/cuba without set index() as default).


Now I need to find a way to map

www.myapp.com/country/index/cuba from www.myapp.com/cuba
www.myapp.com/state/index/cuba/cienfuegos from www.myapp.com/cuba/cienfuegos
www.myapp.com/city/index/cuba/cienfuegos/cienfuegos from 
www.myapp.com/cuba/cienfuegos/cienfuegos


Sorry, I was not so clear before...

Greetings.


El 28/03/16 a las 15:15, Anthony escribió:
On Monday, March 28, 2016 at 1:20:59 PM UTC-4, Carlos Cesar Caballero 
wrote:


They provide related but different information with a different
structure (country show main country info, an basic States and
Cities info and so on), The separate country, city, and state
controller files are not strictly needed, but I prefer to maintain
the code structure for extensibility and maintainability. The
controllers have other functions that can be accessed in the
classical way.


Still not sure I follow. What exactly is in your country.py 
controller? Do you literally have a cuba() function? Are there 
functions for other countries, and if so, how do they differ from the 
cuba() function? What is in the city.py controller? Is there a 
function for each city?


I'm guessing it would make more sense to have the /default/index 
function accept up to three URL args specifying the country and 
(optionally) the state and city. Then you would have logic in that 
function to call the appropriate functions, which can reside in 
modules and be imported. But it's hard to say without knowing what you 
are really trying to do.


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/d/optout.




--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
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/d/optout.


[web2py] Re: Progress bars and session

2016-03-29 Thread chenlevy
So, I spend the best part of the day playing with your example but wasn't 
able to make it work.

The best I have is that I see that before the form is submitted 
*getprogress* is called and return the expected value, but while progress 
is running it blocks the invocation of *getprogress* and the prints in 
*getprogress* are executed all at once after the sleep loop of *progress* 
is complete. It looks like a limitation of web2py. I didn't try to create a 
new thread for the update of 
*cache.ram('progress_data', ...)*
Am I doing something wrong?

Here is what I got, after making some minor modification to your code to 
make it work for me:

In my *controller/playground.py*

# Progress bar example:
# See: https://groups.google.com/d/msg/web2py/zgSLxeg7avw/JvPidEBMAQAJ
import time

def progress():
some_form = SQLFORM.factory(Field('a_field'))

if request.post_vars:
n = 20 #simulate 20 iterations
for i in range(n):
msg = "Working"
percent = 100*(i+1) / n
progress_data = cache.ram('progress_data',
  lambda: dict(percent=percent, msg=msg
),
  time_expire=0)   
print "progress:", progress_data
time.sleep(1)
#we are calling this controller through ajax so return a string 
when done
return "done"
else:
progress_data = cache.ram('progress_data',
  lambda: dict(percent=(-1), msg='Ready'),
  time_expire=0)
return locals()

def getprogress():
progress_data = cache.ram('progress_data', lambda: None, None)
print "getprogress:", progress_data
return progress_data

And in my *view/playground/progress.html* I have:

{{extend 'layout.html'}}

{{=a_form}}





Ready...



0%







 function ProgressBar (selector) {

 self = this
 
 self.el = $(selector)
 self.text = self.el.find("#pbar_status");
 self.progress = self.el.find(".progress-bar");
 self.btnstart = self.el.find("#start");
 self.btnabort = self.el.find("#abort");
 
 self.value = 0;
 self.min = 0;
 self.max = 100;
 self.interval = 5000;
 self.running = false;
 self.timer = null;
 self.offset = 0;

 self.set_progress = function (value) {
 value = value || 0;
 var done = false;
 if (value >= self.max) {
 value = self.max
 done = true;
 };
 value = parseInt(value) + "%";
 self.progress.css("width", value);
 self.progress.text(value);
 if (done) {
 self.done();
 };
 };

 self.done = function (msg) {
 var msg = msg || "Process Completed"
 self.text.text(msg)
 console.log("done", self.timer);
 clearInterval(self.timer);
 self.running = false;
 };

 self.abort = function (e) {
 if (self.running) {

 self.value = 0;
 self.set_progress(0);
 self.text.text("Aborted");
 if (self.timer) {
 clearInterval(self.timer);
 };
 self.running = false;
 };
 }

 // ask the server for the progress
 self.ask = function () {
 var ask = $.ajax({
 type: "GET",
 url: window.location.origin + "{{=URL('getprogress.json')}}",
 dataType: "json",
 });
 
 ask.done(function (json) {
 console.log(json);
 var percent = parseInt(json.percent);
 var msg = json.msg;
 if (percent == -1) {
 console.log(msg);
 return;
 };
 self.text.text("Processing...");
 self.text.text(msg);
 self.value = percent + self.offset;
 self.set_progress(self.value);
 });

 ask.fail(function (xhr, status, error) {
 var resp = xhr.responseText;
 self.done("Error (see browser's console for details)");
 if (console) {
 console.log(resp);
 };
 });
 };

 self.start = function (e) {
 if (self.running) {
 console.log("already runing");
 } else {
 console.log("running");
 
 self.value = 0;
 self.set_progress();
 self.ask();
 self.timer = setInterval(self.ask, self.interval);
 self.running = true
 };
 };

 self.set_progress(self.value);
 }

 // start here
 $(function() {
 var pbar = new ProgressBar("#pbar");
 pbar.start();
 })



Thank you very much.

Cheers,
Chen.


On Tuesday, February 16, 2016 at 11:15:06 PM UTC+2, Alfonso Serra wrote:
>
> Im trying 

Re: [web2py] Re: Why is this ajax function not working fine?

2016-03-29 Thread Jacob Devin
now it says:
 unexpected character after line 
continuation character (default/index.html, line 83)

earlier it was giving no response on clicking as i expected it to work as 
per its onclick function.

On Tuesday, March 29, 2016 at 4:10:02 PM UTC+5:30, Kiran Subbaraman wrote:
>
> Escaping the inner-quotes:  onclick="ajax('{{=URL(\'default\',\'about_group\')}}',[row.id
> ],'target');">
> Also will be a good idea to see what sort of errors appear on your 
> browser's console, and if the generated page contains the callback url that 
> you expect.
>
> 
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On Tue, 29-03-2016 3:59 PM, Jacob Devin wrote:
>
>
> {{extend 'layout.html'}}
> {{for row in rows:}}
> 
> {{=row.name}}
> 
> 
>  onclick="ajax('{{=URL('default','about_group')}}',[row.id],'target');">check 
> 'about'
> 
>  
> {{pass}}
>
>
>
> def index():
> rows=db(db.groups.id>0).select()
> return locals()
> def about_group():
> row=db(db.groups.id 
> 
> ==request.vars.row.id).select().first()
> return row.about
> It ain't working with div onclick too. What's the problem now?
>
> On Tuesday, March 29, 2016 at 3:48:50 PM UTC+5:30, Leonel Câmara wrote: 
>>
>> It shouldn't be on href it should be on onclick. 
>>
>> Consider using a trapped link for that instead.
>>
>> http://web2py.com/books/default/chapter/29/12/components-and-plugins#Trapped-Ajax-links-and-the-A-Helper
>>
> -- 
> 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+un...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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/d/optout.


[web2py] Re: How to modify a scheduled task?

2016-03-29 Thread Niphlod
same warning applies. in that case, I think the culprit is that 
next_run_time needs to be updated too.

On Monday, March 28, 2016 at 9:47:19 PM UTC+2, Dave S wrote:
>
>
>
> On Monday, March 28, 2016 at 12:38:03 PM UTC-7, Niphlod wrote:
>>
>> The specific issue with this case is that the scheduler tracks how many 
>> times a task has been executed and prevents your "repeats=1" task to be 
>> executed again because times_run is probably exceeding the value. 
>> That being said (i.e. you'd need to reset times_run too) be aware that 
>> modifying scheduler_task records is not supported: if the underlying tables 
>> will change (thing that can totally happen in a future release) your code 
>> won't work.
>>
>>
> Better to unqueue the task, and requeue, I would think.
>
> But as I read the original post, I thought Arun was trying to run the task 
> at an earlier time than he had originally scheduled, so I wouldn't expect 
> times_run to have been in play.
>
> /dps
>
>
>
>  
>
>> On Saturday, March 26, 2016 at 2:40:50 AM UTC+1, Dave S wrote:
>>>
>>>
>>>
>>> On Friday, March 25, 2016 at 4:46:22 PM UTC-7, Arun Kumar wrote:

 Hi,
I'm using scheduler to run different jobs everyday. To create a new 
 job I simply insert into scheduler_task table like below,

 db.scheduler_task.insert(function_name = "run_job", task_name = "job1", 
 repeats = 1, period = 86400, start_time = start_time, stop_time = 
 end_time, 
 prevent_drift = True)

 The scheduled jobs are running as expected. Say if I want to modify my 
 job1 which I inserted above how can I do? If I open the appadmin db and 
 modify the start_time to a current time + few secs/mins the next schedule 
 not triggered. How can I achieve this? 

>>>
>>>
>>> Works for me, but I have a repeating task and I'm changing 
>>> next_run_time.  Is your status field "QUEUED"?
>>>
>>> /dps
>>>  
>>>
>>

-- 
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/d/optout.


Re: [web2py] Re: Why is this ajax function not working fine?

2016-03-29 Thread Kiran Subbaraman
Escaping the inner-quotes: onclick="ajax('{{=URL(\'default\',\'about_group\')}}',[row.id 
],'target');">
Also will be a good idea to see what sort of errors appear on your 
browser's console, and if the generated page contains the callback url 
that you expect.



Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Tue, 29-03-2016 3:59 PM, Jacob Devin wrote:


{{extend 'layout.html'}}
{{for row in rows:}}

{{=row.name }}


http://row.id/>],'target');">check 'about'


 
{{pass}}



def index():
rows=db(db.groups.id >0).select()
return locals()
def about_group():
row=db(db.groups.id 
==request.vars.row.id 
).select().first()

return row.about
It ain't working with div onclick too. What's the problem now?

On Tuesday, March 29, 2016 at 3:48:50 PM UTC+5:30, Leonel Câmara wrote:

It shouldn't be on href it should be on onclick.

Consider using a trapped link for that instead.

http://web2py.com/books/default/chapter/29/12/components-and-plugins#Trapped-Ajax-links-and-the-A-Helper



--
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/d/optout.


--
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/d/optout.


[web2py] Re: Why is this ajax function not working fine?

2016-03-29 Thread Jacob Devin

{{extend 'layout.html'}}
{{for row in rows:}}

{{=row.name}}


check 
'about'

 
{{pass}}



def index():
rows=db(db.groups.id>0).select()
return locals()
def about_group():
row=db(db.groups.id 

==request.vars.row.id).select().first()
return row.about
It ain't working with div onclick too. What's the problem now?

On Tuesday, March 29, 2016 at 3:48:50 PM UTC+5:30, Leonel Câmara wrote:
>
> It shouldn't be on href it should be on onclick.
>
> Consider using a trapped link for that instead.
>
> http://web2py.com/books/default/chapter/29/12/components-and-plugins#Trapped-Ajax-links-and-the-A-Helper
>

-- 
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/d/optout.


[web2py] Re: Why is this ajax function not working fine?

2016-03-29 Thread Leonel Câmara
It shouldn't be on href it should be on onclick.

Consider using a trapped link for that instead.
http://web2py.com/books/default/chapter/29/12/components-and-plugins#Trapped-Ajax-links-and-the-A-Helper

-- 
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/d/optout.


[web2py] Why is this ajax function not working fine?

2016-03-29 Thread Jacob Devin
view:

{{extend 'layout.html'}}
{{for row in rows:}}

{{=row.name}}


check 
'about'

 
{{pass}}


in controller:

def index():
rows=db(db.groups.id>0).select()
return locals()
def about_group():
row=db(db.groups.id==request.vars.row.id).select().first()
return row.about

-- 
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/d/optout.


Re: [web2py] Re: web2py 2.14.2

2016-03-29 Thread Sukrut Joshi
please help for regex of mobile numbers of india i dont want use country
code ..number must start with digit and end with digit and length of mobile
no=10
  requires = IS_MATCH('^1?((-)\d{3}-?|\(\d{3}\))\d{3}-?\d{4}$',

 error_message='not a phone number')

this is for us..and need for india ? eg.91 952 733 2303



On Tue, Mar 29, 2016 at 9:38 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Please use a different thread for this. On the other thread, can you show
> the query that cases this traceback?
>
>
> On Monday, 28 March 2016 13:50:46 UTC-5, rif wrote:
>>
>> Unfortunately __init__ is present in my case. Moreover when I start the
>> app using local development server I get another stacktrace (pasted below).
>>
>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/restricted.py",
>> line 227, in restricted
>> exec ccode in environment
>>   File
>> "/home/rif/Documents/webframeworks/firmoasa/applications/firmoasa/controllers/default.py",
>> line 87, in 
>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/globals.py",
>> line 417, in 
>> self._caller = lambda f: f()
>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/tools.py", line
>> 4250, in f
>> return action(*a, **b)
>>   File
>> "/home/rif/Documents/webframeworks/firmoasa/applications/firmoasa/controllers/default.py",
>> line 8, in firme
>> form = crud.update(db.firma, a0, next=URL('firme'))
>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/tools.py", line
>> 4899, in update
>> **attributes  # contains hidden
>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/sqlhtml.py",
>> line 1295, in __init__
>> inp = self.widgets.options.widget(field, default)
>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/sqlhtml.py",
>> line 313, in widget
>> options = requires[0].options()
>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/validators.py",
>> line 2645, in _options
>> options = self.other.options(*args, **kwargs)
>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/validators.py",
>> line 600, in options
>> self.build_set()
>>   File "/home/rif/Documents/webframeworks/firmoasa/gluon/validators.py",
>> line 586, in build_set
>> records = self.dbset(table).select(*fields, **dd)
>>   File
>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/objects.py",
>> line 2020, in select
>> return adapter.select(self.query, fields, attributes)
>>   File
>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
>> line 500, in select
>> (items, tablename, fields) = self.select_raw(query,fields,attributes)
>>   File
>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
>> line 390, in select_raw
>> filters = self.expand(query)
>>   File
>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
>> line 246, in expand
>> return expression.op(expression.first, expression.second)
>>   File
>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
>> line 262, in AND
>> first = self.expand(first)
>>   File
>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
>> line 246, in expand
>> return expression.op(expression.first, expression.second)
>>   File
>> "/home/rif/Documents/webframeworks/firmoasa/gluon/packages/dal/pydal/adapters/google_adapters.py",
>> line 266, in AND
>> return ndb.AND(first, second)
>>   File "/opt/google_appengine/google/appengine/ext/ndb/query.py", line
>> 574, in __new__
>> ' received a non-Node instance %r' % node)
>> TypeError: ConjunctionNode() expects Node instances as arguments;
>> received a non-Node instance None
>>
>>
>> luni, 28 martie 2016, 21:28:52 UTC+3, Dave S a scris:
>>>
>>>
>>>
>>> On Monday, March 28, 2016 at 2:52:02 AM UTC-7, rif wrote:

 After a long while of not updating one app running on gae I
 tried 2.14.3 and I have the error below. Can anyone suggest a fix?

 Thanks,
 -rif

  Unable to store in FILE: 
 /base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/models/db.py

 Traceback (most recent call last):
   File 
 "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/restricted.py",
  line 227, in restricted
 exec ccode in environment
   File 
 "/base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/models/db.py",
  line 15, in 
 session.connect(request, response, db = db)
   File 
 "/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/globals.py", 
 line 935, in connect
 session_data = pickle.loads(row.session_data)
   File 
 "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
 line 1382, in loads
 return 

[web2py] GAE problems

2016-03-29 Thread rif
The gae query is this:  http://11.firmoasa.appspot.com/facturi

I have this route:
routers = dict(

# base router
BASE=dict(
default_application='firmoasa',
),
)

And the full log is this:

/facturi 500 952ms 0kb Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 
(KHTML, like Gecko) Chrome/49.0.2623.108 Safari/537.36 module=default 
version=11
78.96.81.220 - - [29/Mar/2016:00:02:55 -0700] "GET /facturi HTTP/1.1" 500 
378 "http://11.firmoasa.appspot.com/; "Mozilla/5.0 (X11; Linux x86_64) 
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.108 Safari/537.36" 
"11.firmoasa.appspot.com" ms=952 cpu_ms=555 cpm_usd=0.42 
app_engine_release=1.9.35 instance=00c61b117c1212e7c568f7bfc458f105facfec28
D 2016-03-29 10:02:54.330
select application=firmoasa
D 2016-03-29 10:02:54.330
route: controller=facturi
D 2016-03-29 10:02:54.330
route: function.ext=index.html
E 2016-03-29 10:02:55.228
 Unable to store in FILE: 
/base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/controllers/facturi.py

Traceback (most recent call last):
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/restricted.py", 
line 227, in restricted
exec ccode in environment
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/controllers/facturi.py",
 
line 128, in 
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/globals.py", 
line 417, in 
self._caller = lambda f: f()
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/tools.py", 
line 4250, in f
return action(*a, **b)
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/applications/firmoasa/controllers/facturi.py",
 
line 9, in index
form = crud.update(Facturi, a0, next=URL('index'))
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/tools.py", 
line 4899, in update
**attributes  # contains hidden
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/sqlhtml.py", 
line 1295, in __init__
inp = self.widgets.options.widget(field, default)
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/sqlhtml.py", 
line 313, in widget
options = requires[0].options()
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/validators.py", 
line 600, in options
self.build_set()
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/validators.py", 
line 586, in build_set
records = self.dbset(table).select(*fields, **dd)
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/objects.py",
 
line 2020, in select
return adapter.select(self.query, fields, attributes)
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/adapters/google_adapters.py",
 
line 500, in select
(items, tablename, fields) = self.select_raw(query,fields,attributes)
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/adapters/google_adapters.py",
 
line 390, in select_raw
filters = self.expand(query)
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/adapters/google_adapters.py",
 
line 246, in expand
return expression.op(expression.first, expression.second)
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/adapters/google_adapters.py",
 
line 262, in AND
first = self.expand(first)
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/adapters/google_adapters.py",
 
line 246, in expand
return expression.op(expression.first, expression.second)
  File 
"/base/data/home/apps/s~firmoasa/11.391689743844727003/gluon/packages/dal/pydal/adapters/google_adapters.py",
 
line 266, in AND
return ndb.AND(first, second)
  File 
"/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/query.py",
 
line 574, in __new__
' received a non-Node instance %r' % node)
TypeError: ConjunctionNode() expects Node instances as arguments; received 
a non-Node instance None

-- 
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/d/optout.