[web2py] Re: grid add/edit form label

2017-06-06 Thread icodk
Sorry in your case it is
form[1][0][2][0]="Som text"

This will replace the text in the DOM element of the serialized form 
returned by the call to SQLFORM.smartgrid
Please note that the indexes (1,0,2,0) I used above can be different in 
your case. To find out start by printing the element to the console, then 
you can change the  indexes to get the button text.
For more info please see:
http://web2py.com/books/default/chapter/29/05/the-views#Server-side-DOM-and-parsing

On Tuesday, June 6, 2017 at 6:20:29 AM UTC+2, T.R.Rajkumar wrote:
>
>
>
>

-- 
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: request.vars list object

2017-06-06 Thread 'Annet' via web2py-users
Hi Kiran and Anthony,

Thanks for your replies.

Indeed I have a form with field 'label' and a var 'label in the URL. 
Changing request.vars to
request.get_vars solved the issue.

Kind regards,

Annet

-- 
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: web2py 2.15.1

2017-06-06 Thread tim . nyborg
Re #3: I highly recommend swapping in Eonasdan's bootstrap-datetimepicker: 
https://github.com/Eonasdan/bootstrap-datetimepicker

I just altered my web2py_ajax.html to swap dependencies and initialize 
datepickers:

# response.files.insert(1,'/inc/css/calendar.css')
# response.files.insert(2,'/inc/js/web2py/calendar.js')

# Replacing web2py calendar with bootstrap datetimepicker
response.files.insert(1, 
"/inc/js/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css")
response.files.insert(2, "/inc/js/moment/moment.js")
response.files.insert(3, 
"/inc/js/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js")


// Initialize bootstrap datetimepicker
$(function (){
$('.date').datetimepicker({
format: '-MM-DD',
keyBinds: null, // Stop keypresses from navigating the widget, 
allowing users to edit date/times normally
}); 
$('.datetime').datetimepicker({
format: '-MM-DD HH:mm',
useCurrent: 'day',  // This pulls out the current day, without 
the current time (00:00 default)
keyBinds: null, // Stop keypresses from navigating the widget, 
allowing users to edit date/times normally
});
});

Enter code here...





On Monday, 5 June 2017 09:39:11 UTC+1, Karoly Kantor wrote:
>
> Dear Massimo,
>
> I saw your question in the developers group where I cannot post, therefore 
> i do it here.
>
> I am currently aware of the following issues to be fixed:
>
> 1. Google 2nd generation SQL is definitely a problem. Please note I made a 
> temporary hack to fix it, described here: 
> https://groups.google.com/forum/?fromgroups=#!topic/web2py/vs39zZpaH7g
>
> 2. We have a long overdue issue with the password reset emails not sending 
> on GAE. I am using a temporary dirty workaround that sends a plain text new 
> password, search for the issue about "lazyT object being passed to GAE".
>
> 3. I am having trouble making the date picker work nicely across all 
> browsers, especially where there is a native solution. Microsoft Edge is 
> the worst case. In general, would be good to have a nicer date picker
>
> 4. General comment: We have "batteries included", however, some of those 
> batteries now have newer versions than included, e.g. bootstrap
>
>
>
>
>

-- 
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: grid add/edit form label

2017-06-06 Thread T.R.Rajkumar
Thanks a lot icodk. Now I am able to change the text of buttons.

-- 
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] "import ssl" impossible in Web2py with python 2.7.9 but "import ssl" working with python 2.7.9

2017-06-06 Thread e27gis

I have sending email problems that I am sure are related to SSL/TLS.

I am running the last Web2py version with Python 2.7.9 and Apache 2.4

When I make a mail script with SMTPLIB, Web2py tells me that SSL is not 
present. When I want to "import ssl" within a Web2py script, no ssl module 
is found.

But when I import ssl in a python script outside Webpy, import ssl is 
working ! 

Any Idea ?

Thierry

-- 
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: web2py 2.15.1

2017-06-06 Thread Anthony
On Tuesday, June 6, 2017 at 5:02:10 AM UTC-4, tim.nyb...@conted.ox.ac.uk 
wrote:
>
> Re #3: I highly recommend swapping in Eonasdan's bootstrap-datetimepicker: 
> https://github.com/Eonasdan/bootstrap-datetimepicker
>

That's nice but is tied to Bootstrap and has a lot of dependencies. 
Something more lightweight, such as https://chmln.github.io/flatpickr/, 
might be more appropriate.

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] Code editor with code completion

2017-06-06 Thread Assela Pathirana
Dear all, 

I have started dabbling with web2py since a few weeks. Created several 
simple apps of my own and quite happy with it as a web framework.   I have 
the following questions, to which I could not find a satisfactory answer 
within the mailing list. I would be very much grateful if someone can help 
me on these. 

1. I liked very much to have the convenience of an IDE (especially the 
debugger/code-completion features.  However, the way the whole package 
works makes me prefer to work with the online editor/debugger system. The 
Debugger is quite adequate for the purpose. However, what I could not 
figure out is how to get code completion in the online editor. There is a 
discussion about an editor called 'Amy' in this list a few years ago. 
However, I did not find any information about how to get it going in the 
current version of web2py. I tried adding 

editor = Amy

(Also with different capitalization like AMY, amy); but every time my 
editor window is empty! (obviously it does not work this way). 

I also tried adding 

TEXT_EDITOR = 'amy'

at the end of 0.py  file. It has no impact. 

Can you help me how to set the proper editor with code completion on 
web2py. 

2. What is your recommended way of getting web2py auto-completion to work 
with an IDE (I use Wing IDE  - it's web site has some information 
https://wingware.com/doc/howtos/web2py but this is not complete (which 
modules should I import in addition to db to get full web2py system to 
autocomplete?). Again, there are many old threads in this list on this - 
but I could not find a methods that works easily with the current 
version(s) of web2py. 

Thank you very much in advance. 

Assela

-- 
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: possible error in autocomplete code

2017-06-06 Thread Carlos Kitu
Thanks a lot, Anthony.
I use to check the framework code before posting questions, and when I saw 
this in the callback method of the autocomplete widget:
def callback(self): 
if self.keyword in self.request.vars: 
field = self.fields[0] 
if type(field) is Field.Virtual: 
records = [] 
table_rows = self.db(self.db[field.tablename]).select(orderby=
self.orderby)

I guessed wrongly that virtual fields were supported.
Thank you and best regards.

El lunes, 5 de junio de 2017, 17:11:37 (UTC+2), Anthony escribió:
>
> You cannot use autocomplete to search a virtual field. It runs a database 
> query, so the field must exist in the database.
>
> Anthony
>
> On Monday, June 5, 2017 at 9:23:51 AM UTC-4, Carlos Kitu wrote:
>>
>> Good afternoon,
>> I'm trying to create an autocomplete field to search in the table 
>> db.auth_user, but the search must be done with the full name.
>> As db.auth_user has two separate fields (first_name, and last_name), I 
>> created a virtual field to compose both fields:
>>
>> db.auth_user.full_name = Field.Virtual('full_name', lambda row: '%s %s' 
>> %(row.auth_user.first_name, row.auth_user.last_name))
>>
>> Then, I used the autocomplete widget in a field:
>>
>> db.define_table('my_table',
>>  Field('my_user', 'reference auth_user', notnull=True, unique=False, 
>> label='User'),
>>  ...
>> )
>>
>>
>> db.my_table.my_user.widget = SQLFORM.widgets.autocomplete(
>> request, db.auth_user.full_name, id_field=db.auth_user.id, db=db,
>> at_beginning=False, limitby=(0, 10), min_length=2)
>>
>>
>>
>> And I get this error when creating a new form:
>>
>>  'DAL' object has no attribute 'None'
>> Versión
>> web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47Rastreo
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>> 19.
>> 20.
>> 21.
>> 22.
>>
>> Traceback (most recent call last):
>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/restricted.py", 
>> line 227, in restricted
>> exec ccode in environment
>>   File 
>> "/home/clm/Documentos/p/productos/web2py_2.14.6/applications/VREscalas/controllers/default.py"
>>  
>> ,
>>  line 1119, in 
>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/globals.py", 
>> line 417, in 
>> self._caller = lambda f: f()
>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/tools.py", line 
>> 4241, in f
>> return action(*a, **b)
>>   File 
>> "/home/clm/Documentos/p/productos/web2py_2.14.6/applications/VREscalas/controllers/default.py"
>>  
>> ,
>>  line 140, in programas
>> lambda row: A('resumen', _href=URL(
>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/sqlhtml.py", 
>> line 2307, in grid
>> create_form = SQLFORM(table, **sqlformargs)
>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/sqlhtml.py", 
>> line 1288, in __init__
>> inp = field.widget(field, default)
>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/sqlhtml.py", 
>> line 748, in __call__
>> table_rows = 
>> self.db(self.db[self.fields[0].tablename]).select(orderby=self.orderby)
>>   File 
>> "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/packages/dal/pydal/base.py",
>>  line 914, in __getitem__
>> return self.__getattr__(str(key))
>>   File 
>> "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/packages/dal/pydal/base.py",
>>  line 921, in __getattr__
>> return BasicStorage.__getattribute__(self, key)
>> AttributeError: 'DAL' object has no attribute 'None':
>>
>>
>> I printed in console the self.fields[0]:
>> self.fields {'comment': None, 'represent':  at 
>> 0x7f6c907310c8>, 'widget': None, 'name': 'full_name', 'f': >  at 0x7f6c90731050>, 'requires': None, 'readable': True, 'label': 
>> 'Full 
>> name', 'writable': False, 'filter_out': None, 'tablename': None, 
>> 'formatter': , 'type': 'string'}
>>
>> It happens that the db.auth_user.full_name.tablename is None, i.e., the 
>> virtual field have no tablename attibute as the autocomplete code seems to 
>> expect.
>> Should I open a ticket?
>>
>> Thank you and best regards.
>>
>

-- 
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] Migration fails when dropping a column on Postgresql

2017-06-06 Thread Richard Vézina
Just some thought not solution... Maybe you could try to decouple your data
from your table, by doing so you then will be able to flush the entire
model instead of just modify it (ALTER), that way you will avoid the issue
with rname.

You can use this trick to decouple your basic required data :

 if db(db.phone_number).count() == 0:
db.phone_number.insert(phone_number='123-456-7890',
extension='0')
db.phone_number.insert(phone_number='987-654-3210',
extension='0')

To drop and recreate your model you can comment it, hit a page, it gonna
make a request and since models file are all executed at eache request you
db schema should be dropped. Then un comment after fix the field name at
your convenience. It should work, it is not work you may consider dropping
your table in the database directly.

If you have already input your data set into your database I am sure you
can easily extract them and generate a bunch of web2py insert
programmatically.

This could be the besting move you ever done, I mean decouple your data
from you model and keep it out of the way of your database modeling.

You must remove those if and insert statement once you push into production
as it generates a count request for each table on which you set this
fixture, which represent a major slow down.

Richard

On Tue, Jun 6, 2017 at 2:36 AM, Doug Taylor  wrote:

> This is becoming a show-stopper for me now as I cannot ADD fields to an
> exiting table either. I'm pretty sure adding fields worked before when I
> was running on Windows. Made the transition to Linux on my office desktop
> recently and that was when I first encountered the problem. Adding the
> field LocalMountPoint (rname='storage_local_mount'):
>
> self.db.define_table('StorageVolume',
> Field('VolumeName', rname='storage_volume_name',
> type='string', length=32, label='Volume', comment='The name of the Storage
> Volume'),
> Field('FileServerId', rname='storage_volume_server_id',
> type='reference FileServer', ondelete='CASCADE', label='Server',
> comment='The Server on which the Storage Volume resides'),
> Field('StorageUri', rname='storage_uri', type='string',
> length=256, label='Storage URI', comment='The URI of the Storage Volume'),
> Field('LocalMountPoint', rname='storage_local_mount',
> type='string', length=256, label='Local Mount Point', comment='The local
> mount point of the Storage Volume'),
> audit,
> rname='storage_volume',
> format='%(VolumeName)s',
> singular='Volume',
> plural='Volumes',
> migrate=True)
> self.db.commit()
>
> results in:
>
> ALTER TABLE storage_volume ADD localmountpoint VARCHAR(256);
> success!
>
> Aaaargh! Can anyone give feedback on how long this may take to fix? Can
> someone give me some pointers so I can fix it myself? As I said, bit of a
> noob to python and web2py... but how hard can it be? :)
>
> --
> 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: preserve search criteria in sqlform.grid after component reLOAD

2017-06-06 Thread Jonathan Tomm
Thanks, this save me a lot of trouble!

-- 
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: [web2py/web2py] Auth add_membership and del_membership mistakenly alter the logged-in user's session (#1638)

2017-06-06 Thread Richard Vézina
We could continue this conversation here...

When you mention "persist the list of flagged users", it mean that there is
no such thing as persistence in web2py and that at each request web2py is
completely "ignorant" about any given state it may find itself in??

I guess using session as a persistence mean for make this possible would
involve security issue as we would using user centric persistence option
for storing general information which is sensitive as it provide a list of
ID and possibly other information to make this working...

We could use encryption and rely over web2py instance picked password to
hide this information to a potential attacker? Do we already have any way
to encrypt something into the user session or are we doing such thing at
all??

At the same time a simple list of user ID which someone can already guess
the identifier is not that much sensitive.

It may be just not the best place to store such information...

Richard


On Tue, Jun 6, 2017 at 12:12 PM, abastardi  wrote:

> How could we update someone else auth.user_groups?? Could we issue a one
> time reinitialization command by setting a flag on/off when use
> add_/del_membership?? We can then force a give user to reinit the
> auth.user_groups list on his next request...
>
> That's one approach, but then we need a way to persist the list of flagged
> users (preferably that easily scales horizontally), and there would be some
> cost on every request (at least every request that needs to check
> authorization) to check the list.
>
> Another option would be to keep a record of active session identifiers for
> each user, and whenever a role change occurs, update all of that user's
> active sessions (note, this will not work with cookie-based sessions --
> only sessions stored on the server).
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> , or mute
> the thread
> 
> .
>

-- 
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: different default application based on the host header - Python anywhere - Go daddy

2017-06-06 Thread Ron Chatterjee
Seems working now. Sorry Massimo, may be I was getting the cache. 



On Monday, June 5, 2017 at 8:40:10 PM UTC-4, Ron Chatterjee wrote:
>
> Okay, but Massimo, 
>
> What's the logic to route multiple domain to multiple different apps 
> hosted at pythonanywhere? The above don't seem to work (example shown with 
> two domains being routed to two apps - doesn't work).
>
> -Ron
>
>
> On Sunday, June 4, 2017 at 12:14:11 PM UTC-4, Massimo Di Pierro wrote:
>>
>> I recommend this logic be moved to nginx. web3py will no longer support 
>> this.
>>
>> On Sunday, 4 June 2017 04:52:34 UTC-5, Ron Chatterjee wrote:
>>>
>>> Would this be same as the domain mapping? 
>>>
>>>
>>> 
>>>
>>> routers = dict(
>>>   BASE  = dict(
>>>   domains = {
>>>   'domain1.com' : 'app1',
>>>   'domain2.com' : 'app2',
>>>   }
>>>   ),
>>> )
>>>
>>>

-- 
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: Code editor with code completion

2017-06-06 Thread Ron Chatterjee
wing IDE. 

On Tuesday, June 6, 2017 at 9:34:01 AM UTC-4, Assela Pathirana wrote:
>
> Dear all, 
>
> I have started dabbling with web2py since a few weeks. Created several 
> simple apps of my own and quite happy with it as a web framework.   I have 
> the following questions, to which I could not find a satisfactory answer 
> within the mailing list. I would be very much grateful if someone can help 
> me on these. 
>
> 1. I liked very much to have the convenience of an IDE (especially the 
> debugger/code-completion features.  However, the way the whole package 
> works makes me prefer to work with the online editor/debugger system. The 
> Debugger is quite adequate for the purpose. However, what I could not 
> figure out is how to get code completion in the online editor. There is a 
> discussion about an editor called 'Amy' in this list a few years ago. 
> However, I did not find any information about how to get it going in the 
> current version of web2py. I tried adding 
>
> editor = Amy
>
> (Also with different capitalization like AMY, amy); but every time my 
> editor window is empty! (obviously it does not work this way). 
>
> I also tried adding 
>
> TEXT_EDITOR = 'amy'
>
> at the end of 0.py  file. It has no impact. 
>
> Can you help me how to set the proper editor with code completion on 
> web2py. 
>
> 2. What is your recommended way of getting web2py auto-completion to work 
> with an IDE (I use Wing IDE  - it's web site has some information 
> https://wingware.com/doc/howtos/web2py but this is not complete (which 
> modules should I import in addition to db to get full web2py system to 
> autocomplete?). Again, there are many old threads in this list on this - 
> but I could not find a methods that works easily with the current 
> version(s) of web2py. 
>
> Thank you very much in advance. 
>
> Assela
>
>

-- 
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: possible error in autocomplete code

2017-06-06 Thread Anthony
Sorry, I forgot about that -- you can in fact use a virtual field. However, 
for it to work properly, you must specify the table name when defining the 
virtual field:

db.auth_user.full_name = Field.Virtual('full_name', 
   lambda row: '%s %s' %(row.auth_user.
first_name,
 row.auth_user.
last_name),
   table_name='auth_user')

Also, note that when you use a virtual field with autocomplete, it selects 
all records (and all fields) in the table and does the filtering in Python, 
so this could be quite slow for large tables.

Anthony

On Tuesday, June 6, 2017 at 9:51:33 AM UTC-4, Carlos Kitu wrote:
>
> Thanks a lot, Anthony.
> I use to check the framework code before posting questions, and when I saw 
> this in the callback method of the autocomplete widget:
> def callback(self): 
> if self.keyword in self.request.vars: 
> field = self.fields[0] 
> if type(field) is Field.Virtual: 
> records = [] 
> table_rows = self.db(self.db[field.tablename]).select(orderby=
> self.orderby)
>
> I guessed wrongly that virtual fields were supported.
> Thank you and best regards.
>
> El lunes, 5 de junio de 2017, 17:11:37 (UTC+2), Anthony escribió:
>>
>> You cannot use autocomplete to search a virtual field. It runs a database 
>> query, so the field must exist in the database.
>>
>> Anthony
>>
>> On Monday, June 5, 2017 at 9:23:51 AM UTC-4, Carlos Kitu wrote:
>>>
>>> Good afternoon,
>>> I'm trying to create an autocomplete field to search in the table 
>>> db.auth_user, but the search must be done with the full name.
>>> As db.auth_user has two separate fields (first_name, and last_name), I 
>>> created a virtual field to compose both fields:
>>>
>>> db.auth_user.full_name = Field.Virtual('full_name', lambda row: '%s %s' 
>>> %(row.auth_user.first_name, row.auth_user.last_name))
>>>
>>> Then, I used the autocomplete widget in a field:
>>>
>>> db.define_table('my_table',
>>>  Field('my_user', 'reference auth_user', notnull=True, unique=False, 
>>> label='User'),
>>>  ...
>>> )
>>>
>>>
>>> db.my_table.my_user.widget = SQLFORM.widgets.autocomplete(
>>> request, db.auth_user.full_name, id_field=db.auth_user.id, db=db
>>> ,
>>> at_beginning=False, limitby=(0, 10), min_length=2)
>>>
>>>
>>>
>>> And I get this error when creating a new form:
>>>
>>>  'DAL' object has no attribute 'None'
>>> Versión
>>> web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47Rastreo
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>> 12.
>>> 13.
>>> 14.
>>> 15.
>>> 16.
>>> 17.
>>> 18.
>>> 19.
>>> 20.
>>> 21.
>>> 22.
>>>
>>> Traceback (most recent call last):
>>>   File 
>>> "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/restricted.py", line 
>>> 227, in restricted
>>> exec ccode in environment
>>>   File 
>>> "/home/clm/Documentos/p/productos/web2py_2.14.6/applications/VREscalas/controllers/default.py"
>>>  
>>> ,
>>>  line 1119, in 
>>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/globals.py", 
>>> line 417, in 
>>> self._caller = lambda f: f()
>>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/tools.py", 
>>> line 4241, in f
>>> return action(*a, **b)
>>>   File 
>>> "/home/clm/Documentos/p/productos/web2py_2.14.6/applications/VREscalas/controllers/default.py"
>>>  
>>> ,
>>>  line 140, in programas
>>> lambda row: A('resumen', _href=URL(
>>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/sqlhtml.py", 
>>> line 2307, in grid
>>> create_form = SQLFORM(table, **sqlformargs)
>>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/sqlhtml.py", 
>>> line 1288, in __init__
>>> inp = field.widget(field, default)
>>>   File "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/sqlhtml.py", 
>>> line 748, in __call__
>>> table_rows = 
>>> self.db(self.db[self.fields[0].tablename]).select(orderby=self.orderby)
>>>   File 
>>> "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/packages/dal/pydal/base.py",
>>>  line 914, in __getitem__
>>> return self.__getattr__(str(key))
>>>   File 
>>> "/home/clm/Documentos/p/productos/web2py_2.14.6/gluon/packages/dal/pydal/base.py",
>>>  line 921, in __getattr__
>>> return BasicStorage.__getattribute__(self, key)
>>> AttributeError: 'DAL' object has no attribute 'None':
>>>
>>>
>>> I printed in console the self.fields[0]:
>>> self.fields {'comment': None, 'represent':  at 
>>> 0x7f6c907310c8>, 'widget': None, 'name': 'full_name', 'f': >>  at 0x7f6c90731050>, 'requires': None, 'readable': True, 'label'
>>> : 'Full name', 'writable': False, 'filter_out': None, 'tablename': None, 
>>> 'formatter': , 'type': 'string'}
>>>
>>> It happens that the db.auth

Re: [web2py] auth.navbar modification

2017-06-06 Thread Richard Vézina
Hello Pierre,

What are your trying to do exactly which doesn't work as expect??

The config you show us about login_next is not different from the default
behavior of web2py so, I don't understand what you expect other than that...

About registration_requires_verification and registration_requires_approval,
are your users still need to pass trough these step?? I guess no...

I am not sure regarding the talking in the book about the
referrer_actions=None...

I do understand it required in case of using these parameters :

auth.settings.login_next = URL('index')auth.settings.logout_next =
URL('index')auth.settings.profile_next =
URL('index')auth.settings.register_next = URL('user',
args='login')auth.settings.retrieve_username_next =
URL('index')auth.settings.retrieve_password_next =
URL('index')auth.settings.change_password_next =
URL('index')auth.settings.request_reset_password_next = URL('user',
args='login')auth.settings.reset_password_next = URL('user',
args='login')auth.settings.verify_email_next = URL('user',
args='login')



I am confuse by these explanation... I don't seems to be able to control
login_next, neither if I set referrer_actions=None or not though. But I
have a custom login layout.html so it may be come from there...

Please make you intention clearer, what the expected behavior you can't
achieve to do. And maybe if you have more than one layout in your app, try
investigate there.

Richard



On Mon, Jun 5, 2017 at 2:08 PM, Pierre  wrote:

> Hi
>
> I am trying to redirect user after successful login. I do nothing but what
> the book says but i am unable to change default behaviour
> here is the code :
>
> in db.py :
>
> auth.settings.registration_requires_verification = False
> auth.settings.registration_requires_approval = False
> auth.settings.reset_password_requires_verification = True
> auth.settings.login_next = URL('default','index')
>
>
>
> in layout.html :
> {{='auth' in globals() and auth.navbar(mode='dropdown', referrer_actions=
> None)}}
>
>
> book url :
> http://web2py.com/books/default/chapter/29/09/access-control
> #Auth-Settings-and-messages
>
> trying hard to stay calm.GRMBBBLEU   GRRBBBMLEUMBLEU
>
> --
> 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: Code editor with code completion

2017-06-06 Thread Dave S


On Tuesday, June 6, 2017 at 11:11:47 AM UTC-7, Ron Chatterjee wrote:
>
> wing IDE. 
>
>
And do you have an answer to his question about Wing IDE?
 

> On Tuesday, June 6, 2017 at 9:34:01 AM UTC-4, Assela Pathirana wrote:
>>
>> Dear all, 
>>
>> I have started dabbling with web2py since a few weeks. Created several 
>> simple apps of my own and quite happy with it as a web framework.   I have 
>> the following questions, to which I could not find a satisfactory answer 
>> within the mailing list. I would be very much grateful if someone can help 
>> me on these. 
>>
>> 1. I liked very much to have the convenience of an IDE (especially the 
>> debugger/code-completion features.  However, the way the whole package 
>> works makes me prefer to work with the online editor/debugger system. The 
>> Debugger is quite adequate for the purpose. However, what I could not 
>> figure out is how to get code completion in the online editor. There is a 
>> discussion about an editor called 'Amy' in this list a few years ago. 
>> However, I did not find any information about how to get it going in the 
>> current version of web2py. I tried adding 
>>
>> editor = Amy
>>
>> (Also with different capitalization like AMY, amy); but every time my 
>> editor window is empty! (obviously it does not work this way). 
>>
>> I also tried adding 
>>
>> TEXT_EDITOR = 'amy'
>>
>> at the end of 0.py  file. It has no impact. 
>>
>> Can you help me how to set the proper editor with code completion on 
>> web2py. 
>>
>> 2. What is your recommended way of getting web2py auto-completion to work 
>> with an IDE (I use Wing IDE  - it's web site has some information 
>> https://wingware.com/doc/howtos/web2py but this is not complete (which 
>> modules should I import in addition to db to get full web2py system to 
>> autocomplete?). Again, there are many old threads in this list on this - 
>> but I could not find a methods that works easily with the current 
>> version(s) of web2py. 
>>
>> Thank you very much in advance. 
>>
>> Assela
>>
>>

-- 
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: "import ssl" impossible in Web2py with python 2.7.9 but "import ssl" working with python 2.7.9

2017-06-06 Thread Dave S


On Tuesday, June 6, 2017 at 3:32:22 AM UTC-7, e27...@gmail.com wrote:
>
>
> I have sending email problems that I am sure are related to SSL/TLS.
>
> I am running the last Web2py version with Python 2.7.9 and Apache 2.4
>
> When I make a mail script with SMTPLIB, Web2py tells me that SSL is not 
> present. When I want to "import ssl" within a Web2py script, no ssl module 
> is found.
>
> But when I import ssl in a python script outside Webpy, import ssl is 
> working ! 
>
>
Your SSL module is probably in your Python's site packages, and web2py may 
not be looking there 
(it has its own ideas about where packages should be).  Or perhaps you have 
multiple Python installations.

Is this a linux system?

/dps


 

> Any Idea ?
>
> Thierry
>

-- 
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] Migration fails when dropping a column on Postgresql

2017-06-06 Thread Anthony
On Tuesday, June 6, 2017 at 2:36:19 AM UTC-4, Doug Taylor wrote:
>
> This is becoming a show-stopper for me now as I cannot ADD fields to an 
> exiting table either.
>

It shouldn't be a show stopper, as you can always migrate the database via 
other means. Just use an external tool, or simply run a manually 
constructed ADD/DROP SQL statement via db.executesql().
 

> I'm pretty sure adding fields worked before when I was running on Windows. 
> Made the transition to Linux on my office desktop recently and that was 
> when I first encountered the problem.
>

Is it possible you were running a more recent version of PyDal on Windows 
(the issue appears to be fixed in the current master branch of PyDal)? 
Otherwise, I don't think the code would do anything different from one OS 
to another.
 

> Aaaargh! Can anyone give feedback on how long this may take to fix? Can 
> someone give me some pointers so I can fix it myself? As I said, bit of a 
> noob to python and web2py... but how hard can it be? :)
>

As noted, I think it is fixed in the master branch, so maybe you could test 
that and confirm.

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: "import ssl" impossible in Web2py with python 2.7.9 but "import ssl" working with python 2.7.9

2017-06-06 Thread Anthony


> Your SSL module is probably in your Python's site packages, and web2py may 
> not be looking there 
> (it has its own ideas about where packages should be).
>

No, web2py will find modules in the usual Python search path, though it 
will also find modules in the /modules folder of the current application.

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: [web2py/web2py] Auth add_membership and del_membership mistakenly alter the logged-in user's session (#1638)

2017-06-06 Thread Anthony

>
> When you mention "persist the list of flagged users", it mean that there 
> is no such thing as persistence in web2py and that at each request web2py 
> is completely "ignorant" about any given state it may find itself in??
>

Well, each request is executed independently, though there are means of 
persisting state, such as the cache, a database, or the file system.
 

> I guess using session as a persistence mean for make this possible would 
> involve security issue as we would using user centric persistence option 
> for storing general information which is sensitive as it provide a list of 
> ID and possibly other information to make this working...
>

It's not a security issue, as users are not able to inspect the data in 
their sessions (even cookie-based sessions are encrypted), but it wouldn't 
make sense to store a list that needs to be globally accessible across 
users inside the session of a single user. Sessions are for storing data 
specific to a particular user (actually, a particular session of a 
particular user).
 

>
> On Tue, Jun 6, 2017 at 12:12 PM, abastardi  
> wrote:
>
>> How could we update someone else auth.user_groups?? Could we issue a one 
>> time reinitialization command by setting a flag on/off when use 
>> add_/del_membership?? We can then force a give user to reinit the 
>> auth.user_groups list on his next request...
>>
>> That's one approach, but then we need a way to persist the list of 
>> flagged users (preferably that easily scales horizontally), and there would 
>> be some cost on every request (at least every request that needs to check 
>> authorization) to check the list.
>>
>> Another option would be to keep a record of active session identifiers 
>> for each user, and whenever a role change occurs, update all of that user's 
>> active sessions (note, this will not work with cookie-based sessions -- 
>> only sessions stored on the server).
>>
>> —
>> You are receiving this because you were mentioned.
>> Reply to this email directly, view it on GitHub 
>> , 
>> or mute the thread 
>> 
>> .
>>
>
>

-- 
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: "import ssl" impossible in Web2py with python 2.7.9 but "import ssl" working with python 2.7.9

2017-06-06 Thread e27gis
Funny thing :

On the distant server, 

1/ If I launch the mail controller from Web2py.exe (127.0.0.1/admin), it 
does find SSL module (python version 2.7.9) --> the mail is sent

2/ If I launch the mail controller as 'localhost/admin' i.e. through Apache 
2.4, it does not find the SSL module (python 2.7.10, the one that is 
installed) --> the mail is not sent

What is going on there ?

It looks like Apache does something with the Python SSL module.

Very strange.

Any idea ?




Le mardi 6 juin 2017 21:43:19 UTC+2, Anthony a écrit :
>
>
> Your SSL module is probably in your Python's site packages, and web2py may 
>> not be looking there 
>> (it has its own ideas about where packages should be).
>>
>
> No, web2py will find modules in the usual Python search path, though it 
> will also find modules in the /modules folder of the current application.
>
> 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: Login page - Menu bar does not work

2017-06-06 Thread Jordan Ladora
I notice the same problem. 

Using firefox, the js console reveals that web2py-bootstrap3.js is trying 
to call the function "web2py.validate_entropy", which is in web2py.js, but 
cannot find it.

The error is:
* ReferenceError: web2py is not defined. * (line 14, posn 7 of 
web2py-bootstrap3.js). 

I'm not sure how to make web2py-bootstrap3.js see web2py.js. 

Can someone please look into this and post a fix? TY.




On Wednesday, September 21, 2016 at 5:18:11 PM UTC-6, SR wrote:
>
> When I am in the Login page, the menu items does not work.
> Any idea why it is not working?
> 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: 'validate_and_insert' throws error each time on latest version where it was fine before on prev version

2017-06-06 Thread Jordan Ladora
Thank you for checking that.

Yeah, I'm still getting this, even when logged in. As a temp workaround I 
swapped all the instances of "validate_and_insert" in my app for "insert".

I did find a note I made a couple years ago from back before I upgraded to 
the latest version that said validate_and_insert would not work if no 
fields were set, like in the '## no fields-' example I posted on 6/3, so 
maybe this is due to something else I have e.g. in db.py...



On Monday, June 5, 2017 at 10:43:16 AM UTC-6, Anthony wrote:
>
> On Monday, June 5, 2017 at 12:32:09 PM UTC-4, Jordan Ladora wrote:
>>
>> Thanks. It's also throwing the identical error when using the app's web 
>> page as a logged in user.
>>
>
> Are you sure? I tried it as a logged in user and it works fine (using your 
> exact table definition and insert code).
>
> 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] How can javascript reads a SQLFORM field which writable=False

2017-06-06 Thread Rudy
I posted a question a couple days ago asking how I can read a SQLFORM's 
field and update it using javascript when its writable=False (because user 
is not supposed to make change to the subtotal field manually, it should be 
calculated based on the sum of all the items), but I didn't get any reply. 
Now I wonder if anyone can share your insight how i can read a SQLFORM 
field which writable=False, thanks in advance!

-- 
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] how to query json field (with filter in/out) by equality

2017-06-06 Thread Jurgis Pralgauskis
Hi, 
I use json field with following filters

Field('responses', 'json'), 


db.learn.responses.filter_in = lambda obj, dumps=dumps: dumps(obj)
db.learn.responses.filter_out = lambda txt, loads=loads: loads(txt)


but if I want to select based on equality -- nothing is found -- query:

db.learn.responses==['foo', 'bar']  


should I apply filter_in here as well?


-- 
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 use Let's Encrypt with Web2Py on Apache

2017-06-06 Thread Raymond Smith
Dave

That standalone flag saved my life !!! I LOVE YOU :D :D :D 

thankyou a ton !!!


On Wednesday, May 31, 2017 at 7:43:09 AM UTC+12, Dave S wrote:
>
>
>
> On Tuesday, May 30, 2017 at 12:05:01 PM UTC-7, Dave S wrote:
>>
>>
>>
>> On Tuesday, May 30, 2017 at 8:50:50 AM UTC-7, Raymond Smith wrote:
>>>
>>> Please tell me how you did this!! :) IT would be really helpful  :)
>>>
>>>
>> I can't answer for the Apache case (or even for the preferred NginX 
>> case), but I found using CertBot in manual mode was easy (on AWS Linux).  
>> Rocket was running on port 80, so I told CertBot to use port 443.  Whizz 
>> bang, everything done.  I stopped Rocket, restarted it with port 443 and 
>> the -c and -k arguments (pointing to where CertBot deposited the goods), 
>> and Poof!  It worked!
>>
>> I still have a Rocket running on port 80, redirecting to https, but will 
>> probably stop it to run CertBot on port  80 when I need to renew.  If I get 
>> nginx going before then, I'll update this post.
>>
>>
> BTW, docs at
> https://certbot.eff.org/docs/using.html#standalone>
> and
> 
> (consecutive)
>
> /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.


[web2py] Re: how to query json field (with filter in/out) by equality

2017-06-06 Thread Anthony
Why have you defined custom filter_in and filter_out functions to convert 
to/from JSON -- that is handled automatically by the DAL when you specify 
the "json" field type?

On Tuesday, June 6, 2017 at 8:54:27 PM UTC-4, Jurgis Pralgauskis wrote:
>
> Hi, 
> I use json field with following filters
>
> Field('responses', 'json'), 
>
>
> db.learn.responses.filter_in = lambda obj, dumps=dumps: dumps(obj)
> db.learn.responses.filter_out = lambda txt, loads=loads: loads(txt)
>
>
> but if I want to select based on equality -- nothing is found -- query:
>
> db.learn.responses==['foo', 'bar']  
>
>
> should I apply filter_in here as well?
>
>
>

-- 
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] How to access selected fields/objects in SQLFORM.grid as opposed to grid row ids

2017-06-06 Thread Peter

Good morning all,

I am using SQLFORM.grid for the first time and I'm baffled (not for the 
first time).
Related posts don't illuminate my issue and at least one seems to 
contradict what I'm seeing.

This is the controller - with some dross removed...

tasks = (db.task.person == person.id)

fields = (db.task.id, db.task.charge, db.task.start_time, db.task.person, 
db.task.title, db.task.task_status)

selectable = [('Allocate Payment',  lambda ids: 
redirect(URL('new_payment_allocation', vars=dict(ids=ids]

grid = SQLFORM.grid(db(billable_tasks),
orderby=myorder, all
fields=fields,
selectable=selectable,
deletable=False,
editable=True,
searchable=False,
create=False,
sortable=True,
maxtextlength=150,
paginate=task_count,
details=True,
csv=False)



When I list the selected ids (returned by the lambda)  in my 
new_payment_allocation view I can see a list of ids. 
One post indicated this was a list of the task ids but not from what I can 
see, instead it appears to me to be returning 
the grid row ids for checked items.

My problem is that I can't see how to convert/relate this list of selected 
grid row ids to the required task objects or db.task.id field?

As always any help would be appreciated.

Regards
Peter




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


[web2py] Re: How to access selected fields/objects in SQLFORM.grid as opposed to grid row ids

2017-06-06 Thread Peter
STOP PRESS!

As has happened more than once - documenting the problem opened my mind to 
other possibilities.

I was wrong in saying...  "One post indicated this was a list of the task 
ids but not from what I can see, instead it appears to me to be returning 
the grid row ids for checked items."

IT IS RETURNING THE task.id

There was a one to one mapping of row position to actual task.ids and for 
reasons too long to go into at this hour
I wasn't expecting the tasks to be in their natural .id order - reversing 
the sort order highlighted that it is in fact the task ids)
 
Peter
 

> Regards
> Peter
>
>
>
>
>

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


[web2py] Re: Login page - Menu bar does not work

2017-06-06 Thread Anthony
On Tuesday, June 6, 2017 at 4:13:26 PM UTC-4, Jordan Ladora wrote:
>
> I notice the same problem. 
>
> Using firefox, the js console reveals that web2py-bootstrap3.js is trying 
> to call the function "web2py.validate_entropy", which is in web2py.js, but 
> cannot find it.
>

web2py.validate_entropy in web2py.js is inside a closure, so cannot be 
accessed in web2py-bootstrap3.js. This is a bug -- the ajax_fields function 
was copied from web2py.js, and the reference to web2py.validate_entropy was 
left as is, even though the variable "web2py" is not defined in 
web2py-bootstrap3.js. You can fix it by changing:

  web2py.validate_entropy($(this));

to:

  $.web2py.validate_entropy($(this));

Note, this problem only arises if you add the IS_STRONG validator to 
db.auth_user.password.requires (which is not the default). In that case, 
the PasswordWidget in sqlhtml.py adds a "data-web2py_entropy", which 
triggers the call to the above line. The reason the menus don't work 
properly is because the above line breaks the Javascript code.

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: Login page - Menu bar does not work

2017-06-06 Thread Anthony
Note, this has already been fixed in the master branch, so should be fine 
in the next release.

Anthony

On Tuesday, June 6, 2017 at 11:11:26 PM UTC-4, Anthony wrote:
>
> On Tuesday, June 6, 2017 at 4:13:26 PM UTC-4, Jordan Ladora wrote:
>>
>> I notice the same problem. 
>>
>> Using firefox, the js console reveals that web2py-bootstrap3.js is trying 
>> to call the function "web2py.validate_entropy", which is in web2py.js, but 
>> cannot find it.
>>
>
> web2py.validate_entropy in web2py.js is inside a closure, so cannot be 
> accessed in web2py-bootstrap3.js. This is a bug -- the ajax_fields function 
> was copied from web2py.js, and the reference to web2py.validate_entropy was 
> left as is, even though the variable "web2py" is not defined in 
> web2py-bootstrap3.js. You can fix it by changing:
>
>   web2py.validate_entropy($(this));
>
> to:
>
>   $.web2py.validate_entropy($(this));
>
> Note, this problem only arises if you add the IS_STRONG validator to 
> db.auth_user.password.requires (which is not the default). In that case, 
> the PasswordWidget in sqlhtml.py adds a "data-web2py_entropy", which 
> triggers the call to the above line. The reason the menus don't work 
> properly is because the above line breaks the Javascript code.
>
> 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: How can javascript reads a SQLFORM field which writable=False

2017-06-06 Thread Rudy


I just used the firefox inspector to see the source and spot the id and tag 
I need to get the non-writable field value, something like below:
var quote_id =  jQuery('#quotation_id__row').children("p")[0].innerHTML;

Apologize for any bother, I am still learning a lot of stuffs eg. web2py, 
javascript, even python. Often times I see other experience coders here to 
leverage the API http://web2py.readthedocs.io/en/latest/index.html. For 
this particular question, i thought I could find something from web2py to 
toggle, so that i could read the value of an non-writable field, i went to 
this above API link and did a search for FORM writable, but i didn't see 
where it's building the HTML from web2py engine. Any basic guideline or 
instruction how i can leverage this APIs. Sorry if it sounds dumb.

Now I can read the non-writable field from a FORM, I want javascript to 
make a callback and return a json to update a few fields (non-writable) 
fields in the FORM. Wonder what's the best way to do it, since they are 
non-writable I can see from the firefox inspector that non-writable and 
writable fields are structured like below with HTML elements. BTW, i could 
retrieve the right data from jason and print them out using alert, but I 
couldn't update the non-writable fields. Do I need to alter the HTML 
elements for those non-writable fields to writable HTML element structure, 
and reverse them back right after I update them? Any suggestion is 
appreciated.



 









On Wednesday, June 7, 2017 at 7:49:39 AM UTC+8, Rudy wrote:
>
> I posted a question a couple days ago asking how I can read a SQLFORM's 
> field and update it using javascript when its writable=False (because user 
> is not supposed to make change to the subtotal field manually, it should be 
> calculated based on the sum of all the items), but I didn't get any reply. 
> Now I wonder if anyone can share your insight how i can read a SQLFORM 
> field which writable=False, thanks in advance!
>

-- 
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.