[web2py] Field.Virtual: unexpected behaviour

2016-05-09 Thread Val K
Hi! I am angry, I wasted half a day to catch this error: db.define_table('tbl', Field('name'), Field.Virtual('alias_name', lambda row: row.name) # right notation is `row.tbl.name` ) in controller: rows = db(db.tbl).select() #it's OK! I

[web2py] Re: Field.Virtual: unexpected behaviour

2016-05-09 Thread Leonel Câmara
Well the thing is row.*neverhood_will_be_processed_without_any_errors* Doesn't cause any error because row just returns None for values that aren't there so the virtual field will just have None as the value. I do agree it is sort of counter-intuitive that you have to be explicit about the ta

[web2py] Re: How to take HTML tag out out of list string, in set

2016-05-09 Thread rajjmatthur
day_str = ('Sun', 'Mon', 'Tues', 'wed') Field('days', type='list:string',,requires=IS_IN_SET ((day_str), multiple=True),widget=lambda field, value: SQLFORM.widgets.multiple.widget(field, value, size=3, style='divs', label=True)), /view {{=my_table.days}} One example On Monday, May 9, 2016 a

[web2py] Re: Field.Virtual: unexpected behaviour

2016-05-09 Thread Val K
all a little differently: Field.Virtual('alias_name', lambda row: *None*) #- works OK! i.e. row.alias_name *exists* and row.alias_name == *None* *but * Field.Virtual('alias_name', lambda row: row.*bla_bla*) #- causes that row. alias_name *doesn't* *exist at all!* On Monday, May 9, 2016 at 7:05

[web2py] Re: How to take HTML tag out out of list string, in set

2016-05-09 Thread Leonel Câmara
Add a represent to that field and then render the rows before sending them to the view, the represent can be something like this: represent=lambda v, row: '' if not v else ', '.join(v) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2p

[web2py] Re: Computed DAL Values On Insert

2016-05-09 Thread Niphlod
are all of the required fields of "storage_string()" supplied ? On Monday, May 9, 2016 at 5:25:21 PM UTC+2, Mark Billion wrote: > > When I do an insert the computed values dont updatethoughts? > > def storage_form_controller(): > x = request.vars.client > sl_dict = { 'client':request.

[web2py] Re: Computed DAL Values On Insert

2016-05-09 Thread Mark Billion
Yep On Monday, May 9, 2016 at 12:19:13 PM UTC-4, Niphlod wrote: > > are all of the required fields of "storage_string()" supplied ? > > On Monday, May 9, 2016 at 5:25:21 PM UTC+2, Mark Billion wrote: >> >> When I do an insert the computed values dont updatethoughts? >> >> def storage_form_cont

[web2py] Re: Field.Virtual: unexpected behaviour

2016-05-09 Thread Val K
it seems that `try-except` catches key/attribute error while evaluating field.virtual and if it happens - doesn't create field.virtual at all On Monday, May 9, 2016 at 7:17:07 PM UTC+3, Val K wrote: > > all a little differently: > Field.Virtual('alias_name', lambda row: *None*) #- works OK! i.e

[web2py] Re: How to take HTML tag out out of list string, in set

2016-05-09 Thread rajjmatthur
represent doesn't work. On Monday, May 9, 2016 at 12:17:23 PM UTC-4, Leonel Câmara wrote: > > Add a represent to that field and then render the rows before sending them > to the view, the represent can be something like this: > > represent=lambda v, row: '' if not v else ', '.join(v) > > > > > -

[web2py] Re: How to take HTML tag out out of list string, in set

2016-05-09 Thread Leonel Câmara
What do you mean doesn't work? Are you calling render on the rows? -- 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 a

[web2py] Re: SQLFORM.grid links not working

2016-05-09 Thread Simon Carr
Thanks Anthony, I actually got it working using request.args(len(request.args)-1) Your solution is far more elegant. I have not used python for a few years and I forgot about slicing. Thanks Simon On Monday, 9 May 2016 16:37:10 UTC+1, Anthony wrote: > > See my response here: > https://groups.

[web2py] Any script for compiling c++ codes from web2py?

2016-05-09 Thread Emmanuel Dsouza
or any link? -- 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" gro

[web2py] Why is this code for getting variables from view to controller not working?

2016-05-09 Thread Emmanuel Dsouza
in view: *{{extend 'layout.html'}}* ** ** *function myFunction(){* *var value = 22;* *ajax('{{=URL('default', 'my_action', vars=dict(value=str(value)))}}', [], 'target');* *}* ** ** *here* ** ** it says: name 'value' is not defined -- Resources: - http://we

[web2py] Re: Any script for compiling c++ codes from web2py?

2016-05-09 Thread Leonel Câmara
Well you could run the compiler command like you would for any other command (for instance using subprocess), is this what you want? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issue

[web2py] Re: Why is this code for getting variables from view to controller not working?

2016-05-09 Thread Jim S
It is because the ajax call is built at the time the page is rendered and not when the javascript function executes. Instead of building the parameters into the URL string, I've done this: $.ajax({url: "{{=URL('default', 'my_action')}}", async: false, data: {value=String(value

[web2py] Re: Why is this code for getting variables from view to controller not working?

2016-05-09 Thread Val K
Hi! *it seems that the error happens in `str(value)`* *What is your controller like?* On Monday, May 9, 2016 at 8:58:19 PM UTC+3, Emmanuel Dsouza wrote: > > in view: > > *{{extend 'layout.html'}}* > ** > > ** > *function myFunction(){* > *var value = 22;* > *ajax('{{=

[web2py] Re: Computed DAL Values On Insert

2016-05-09 Thread Niphlod
and content_string isn't explicitely passed, and storage_string() returns a non-null value ? On Monday, May 9, 2016 at 6:36:19 PM UTC+2, Mark Billion wrote: > > Yep > > On Monday, May 9, 2016 at 12:19:13 PM UTC-4, Niphlod wrote: >> >> are all of the required fields of "storage_string()" supplied

[web2py] Re: Any script for compiling c++ codes from web2py?

2016-05-09 Thread Emmanuel Dsouza
yeah exactly. thanks On Monday, May 9, 2016 at 11:54:47 PM UTC+5:30, Leonel Câmara wrote: > > Well you could run the compiler command like you would for any other > command (for instance using subprocess), is this what you want? > -- Resources: - http://web2py.com - http://web2py.com/book (Docu

[web2py] Re: Why is this code for getting variables from view to controller not working?

2016-05-09 Thread Anthony
On Monday, May 9, 2016 at 1:58:19 PM UTC-4, Emmanuel Dsouza wrote: > > in view: > > *{{extend 'layout.html'}}* > ** > > *

[web2py] Re: How to take HTML tag out out of list string, in set

2016-05-09 Thread Anthony
This has nothing to do with the IS_IN_SET validator, which simply does validation in your code (typically, it would also generate an HTML select widget in forms, but not in your code, as you have explicitly specified your own form widget). It also has nothing to do with the field's form widget,

[web2py] display only year on a form

2016-05-09 Thread Winter Kryz
Hello, I have created a form where I need to insert the enrolling year of a student that is about to graduate on a particular career in a University. The 'year' field on the form displays an ajax calendar but it shows the complete date DD-MM- and I want it to display just the year without d

[web2py] Re: How to take HTML tag out out of list string, in set

2016-05-09 Thread rajjmatthur
Interesting! So, if I do: a = my_table.render() I get a is > How do I now access individual elements? like Rows[0], Rows[1]..Rows[10].etc? because a[0] doesn't work. On Monday, May 9, 2016 at 3:53:48 PM UTC-4, Anthony wrote: > > This has nothing to do with the IS_IN_SET validator, which

[web2py] Where to add custom validators

2016-05-09 Thread Pierre-Antoine Roiron
Hi ! I am using custom validators that I add to the validators.py file. Unfortunately, It' overwritten at each upgrade of web2py. Is there a file inside my site inside which I could put these custom validators ? Thank you for your help. -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: display only year on a form

2016-05-09 Thread Niphlod
wouldn't it just better to propose an integer field or a selectbox (or an autocomplete) with the next 10 years ?!?!?! On Monday, May 9, 2016 at 10:33:06 PM UTC+2, Winter Kryz wrote: > > Hello, > > I have created a form where I need to insert the enrolling year of a > student that is about to gra

[web2py] Re: How to take HTML tag out out of list string, in set

2016-05-09 Thread Dave S
On Monday, May 9, 2016 at 1:34:31 PM UTC-7, rajjm...@gmail.com wrote: > > Interesting! > > So, if I do: > > a = my_table.render() > > I get > > a is > > > How do I now access individual elements? like Rows[0], > Rows[1]..Rows[10].etc? because a[0] doesn't work. > > It appears that you have an i

[web2py] I would like to know how to redirect the url after login

2016-05-09 Thread crondonb
Hello I am new to web2py and I would like to know how to redirect the url after login, so I forwarded to the same home page. greetings and thanks in advance i found this code in the example app and i dont know what is the needed modification {{extend 'layout.html'}} {{=T('Sign Up') if reques

[web2py] Re: Where to add custom validators

2016-05-09 Thread Leonel Câmara
Put them in a module in your applications modules folder and then import them in your models. -- 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 receive

[web2py] Re: DB2 truncate()

2016-05-09 Thread 'DenesL' via web2py-users
There are different platforms on which DB2 runs and in some the TRUNCATE command is supported, but that is not the case for iSeries DB2. Which version of OS are you running?. The alternative seems to be a DELETE without a WHERE clause which could be set as a TRUNCATE override in another db2 clas

[web2py] Re: create file outside of web2py using IDE

2016-05-09 Thread 'DenesL' via web2py-users
The models are executed in alphabetic order, so check that the newly created model file is not executed before the db is defined. On Wednesday, May 4, 2016 at 11:56:08 AM UTC-4, Vic Ding wrote: > > Hi all, > > I am using Pycharm together with web2py. I created a model file > models/db1.py in ID

[web2py] web2py 2.14.6 is OUT

2016-05-09 Thread Massimo Di Pierro
A few vulnerabilities have been found in admin. One of them was serious and it made admin vulnerable to brute force password attacks under some conditions. They have been been fixed in version 2.14.6. If you expose admin publicly, we recommend you upgrade immediately. Anyway, we remind everybod

[web2py] Re: Understanding the download function

2016-05-09 Thread Andy W
Many thanks for the clear explanation! Andy On Monday, May 9, 2016 at 7:28:49 PM UTC+4, Anthony wrote: > > Assuming you are talking about the standard download() function in the > default.py controller of the scaffolding application, note that it uses > response.download() to retrieve the file,

Re: [web2py] Re: Not Authorized - but I don't know why

2016-05-09 Thread Manuele Pesenti
Il 08/05/16 20:34, Simon Carr ha scritto: > I found the problem, I had to add > > | > user_signature=False > | > > to the SQLFORM.grid i.e. (SQLFORM.grid(.,user_signature=False) > > This sorted out the problem Now I think you can just decorate your controller function to prevent not log

[web2py] Re: How To Select Only The Latest Rows from a Table

2016-05-09 Thread sesenmaister
What does mean "DOES NOT WORK? Are you getting an OperationalError? Use the argument *groupby *instead of *distinct*, and you'll get the desired results. On Sunday, May 8, 2016 at 9:33:44 AM UTC+2, PRACHI VAKHARIA wrote: > > > > *How To Select Only The Latest Rows from a Table* > > For a Table

[web2py] Re: IS_NOT_EMPTY_OR(IS_IN_SET((),multiple=True))

2016-05-09 Thread sesenmaister
When using the validator IS_IN_SET(..) , it will require the values are in the set. So it will require not to be empty. On Sunday, May 8, 2016 at 6:51:23 PM UTC+2, billmac...@gmail.com wrote: > > I would like to have a set that requires to be not empty. But looking at > the documentatio

[web2py] executeSQL returns None (Cassandra)

2016-05-09 Thread MrRedmerlot
Hi, My web2py is connected to Cassandra. I need to use ALLOW FILTERING flag in the command. I don't see how I could include it in DAL, so I tried using raw db.executesql(), but it seems that even simplest command 'select * from ' returns None. Is this a known bug? Any suggestions? Thanks --

[web2py] Re: How To Select Only The Latest Rows from a Table

2016-05-09 Thread Niphlod
in addition to groupby you need to select the aggregate you want. "the latest row for fieldname2" is really the max(some_other_column) for each group. That being said, please show your data and your desired resultset: I'm guessing it'll be a little harder to retrieve what you want. -- Resource

[web2py] Re: executeSQL returns None (Cassandra)

2016-05-09 Thread 'DenesL' via web2py-users
As far as I know web2py does not oficially support Cassandra, however it could be added with some work. On Monday, May 9, 2016 at 5:06:10 AM UTC-4, MrRedmerlot wrote: > > Hi, > > My web2py is connected to Cassandra. > I need to use ALLOW FILTERING flag in the command. > I don't see how I could i

[web2py] non W2p form insert

2016-05-09 Thread Mark Billion
Dumb question and even though I have rtmed I cannot seem to find what I am sure is right in front of me. I have a form that sends back data ordered by table name and I want to do something like validate_and_insert(**request.vars) That being said, this doesnt work Locals: eld : fields :

[web2py] Re: non W2p form insert

2016-05-09 Thread Niphlod
try to prefix yourself with the following situation db.define_table('sometable', Field('somefield1'), Field('somefield2')) and then request.vars as {'somefield1' : 'abcd', 'somefield2' : 'cdef', '*contents*': 'wxyz'} trying to do db.sometable.validate_and_insert(**request.vars) will give you t

[web2py] Understanding the download function

2016-05-09 Thread Andy W
I have a multi-tenant application, where users can upload files. I save these in a different directory for each client (tenant), so I can keep tabs on the overall disk space and number of files uploaded by each. This works fine when the table is defined in a model file - from the view I can dow

[web2py] Re: IS_NOT_EMPTY_OR(IS_IN_SET((),multiple=True))

2016-05-09 Thread Anthony
First, note that IS_IN_SET requires an item in the set, so no need for IS_NOT_EMPTY with it. If you are using IS_IN_SET with multiple=True, then you are allowed to select zero items, but you can instead set multiple=(1, len(the_set)), and it will require at least one selection. Also, even if th

[web2py] Re: IS_NOT_EMPTY_OR(IS_IN_SET((),multiple=True))

2016-05-09 Thread billmackalister
Thank you very much Anthony. Works like you explained! On Monday, May 9, 2016 at 11:03:38 AM UTC-4, Anthony wrote: > > First, note that IS_IN_SET requires an item in the set, so no need for > IS_NOT_EMPTY with it. If you are using IS_IN_SET with multiple=True, then > you are allowed to select z

[web2py] Computed DAL Values On Insert

2016-05-09 Thread Mark Billion
When I do an insert the computed values dont updatethoughts? def storage_form_controller(): x = request.vars.client sl_dict = { 'client':request.vars.client, 'kind': request.vars.kind, 'others_with_access': request.vars.others_with_access,

[web2py] Re: non W2p form insert

2016-05-09 Thread Mark Billion
It does indeed On Monday, May 9, 2016 at 10:08:56 AM UTC-4, Niphlod wrote: > > try to prefix yourself with the following situation > > db.define_table('sometable', Field('somefield1'), Field('somefield2')) > > and then request.vars as > > {'somefield1' : 'abcd', 'somefield2' : 'cdef', '*conten

[web2py] Re: Understanding the download function

2016-05-09 Thread Anthony
Assuming you are talking about the standard download() function in the default.py controller of the scaffolding application, note that it uses response.download() to retrieve the file, and as per the documentation, it looks at only the *last* URL arg to obtain the filename (from which it extrac

[web2py] Re: Not Authorized - but I don't know why

2016-05-09 Thread Anthony
Also, note that there is another problem with your view() function. You are using the first URL arg to identify a record, but the grid doesn't know about this, so when it generates its own internal URLs, it will not preserve the URL arg with the record ID. To tell the grid to preserve existing

[web2py] Re: How to take HTML tag out out of list string, in set

2016-05-09 Thread Anthony
Please show your code. On Sunday, May 8, 2016 at 7:15:22 PM UTC-4, rajjmatt...@gmail.com wrote: > > What would be the most efficient way to take out html tag for IS_IN_SET > (str) which outputs > > ['my string'] > > > Want to display. > > > my string > > > Is re.compile and re.sub are the only o

[web2py] Re: [SOLVED] Custom form not accepted (formkey missing)

2016-05-09 Thread Anthony
Note, this is not limited to SQLFORM.factory -- same issue with a plain SQLFORM. Anthony On Friday, March 11, 2016 at 8:09:50 AM UTC-5, Carlos Kitu wrote: > > Hi guys, I don't show up here too often because all the issues I find use > to be solved here. Good job. > > Today I was going nuts with

[web2py] Re: SQLFORM.grid links not working

2016-05-09 Thread Anthony
See my response here: https://groups.google.com/d/msg/web2py/covZOWYOQ1M/NyZkDW5IBAAJ You need something like SQLFORM.grid(..., args=request.args[:1]). Anthony On Sunday, May 8, 2016 at 4:17:57 PM UTC-4, Simon Carr wrote: > > I think I now know why it's not working, but I don't know how to fix