Re: [web2py] lock table record

2020-11-25 Thread AGRogers
I use the code below to cleanup some stuff if the user leaves the page
before doing some things i expected:

window.onbeforeunload = function(){
if (UnsavedCards > 0){CleanUpOnPageExit();}
}

You could clear the flag at this point with an ajax call.
___
*www.TenOutOfTen.org* <https://www.TenOutOfTen.org>
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Wed, 25 Nov 2020 at 21:50, Vid Ogris  wrote:

> Yeah I tried to do that... so I have records and there is a fields with 3
> options as T (true),F (false),P(pending)
>
> When the user starts to edit I set status to P and the SQLgrid does not
> list this record for other users (SELECT * From table where filed = 'F').
> The problem is if the user click on the back button I cannot change the
> status back to F, so the record would be listed again.
>
> Any ideas how to do that?
>
> V V sre., 25. nov. 2020 ob 12:39 je oseba AGRogers 
> napisala:
>
>> I am not aware that web2py has anything built in to do that. And it is a
>> tricky task - to do it properly you need all sorts of real time feedback
>> going to every grid that is already opened. It's conceptually not too hard
>> for grids that will be opened in the future - just set a flag when someone
>> starts to edit a record and clear it when they finish. But you would need
>> to do that yourself.
>>
>> One thing that makes this problem worse (ie one user
>> overwriting another user's change) is that web2py writes *every* field in
>> the form to the database even if the user only changed a single field. So
>> even if two users edit two different fields of the same record, the last
>> person to save the record will overwrite all fields with their data - the
>> one they changed (good) and the ones they didnt change (bad)
>>
>> ___
>> *www.TenOutOfTen.org* <https://www.TenOutOfTen.org>
>> rogers...@gmail.com
>> (+95) 09 250018669 (Myanmar)
>>
>>
>>
>> On Wed, 25 Nov 2020 at 19:40, Yebach  wrote:
>>
>>> Hello,
>>>
>>> how can I lock a record in a table (SQLform.grid) when somebody is
>>> editing one record so that other users cannot see it or it is grayed out or
>>> smth.
>>>
>>> Is there already an web2py ways or do I have to create a new filed set
>>> it as temp lock etc...
>>>
>>> thank you
>>>
>>> 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/461d3292-f56d-4773-80c3-2926f3b6f079n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/web2py/461d3292-f56d-4773-80c3-2926f3b6f079n%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/r1Gy87kRcmE/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/CACWMBMNf34RWRJNm407G_O_PWqo1g2TdmcjX_9Ov%2B3_KeiHOuA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/web2py/CACWMBMNf34RWRJNm407G_O_PWqo1g2TdmcjX_9Ov%2B3_KeiHOuA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>
>
> --
> Lep pozdrav
>
> Vid Ogris
>
>
> --
> 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 emai

Re: [web2py] lock table record

2020-11-25 Thread AGRogers
I am not aware that web2py has anything built in to do that. And it is a
tricky task - to do it properly you need all sorts of real time feedback
going to every grid that is already opened. It's conceptually not too hard
for grids that will be opened in the future - just set a flag when someone
starts to edit a record and clear it when they finish. But you would need
to do that yourself.

One thing that makes this problem worse (ie one user
overwriting another user's change) is that web2py writes *every* field in
the form to the database even if the user only changed a single field. So
even if two users edit two different fields of the same record, the last
person to save the record will overwrite all fields with their data - the
one they changed (good) and the ones they didnt change (bad)

___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Wed, 25 Nov 2020 at 19:40, Yebach  wrote:

> Hello,
>
> how can I lock a record in a table (SQLform.grid) when somebody is editing
> one record so that other users cannot see it or it is grayed out or smth.
>
> Is there already an web2py ways or do I have to create a new filed set it
> as temp lock etc...
>
> thank you
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/461d3292-f56d-4773-80c3-2926f3b6f079n%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNf34RWRJNm407G_O_PWqo1g2TdmcjX_9Ov%2B3_KeiHOuA%40mail.gmail.com.


Re: [web2py] Login via an link/URL

2020-11-24 Thread AGRogers
Thanks for the extra info :D

___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Fri, 20 Nov 2020 at 05:39, valq...@gmail.com  wrote:

> login_bare is a normal function, it is intended to login through ajax, but
> it cant be used in this case, since it requires raw password (not hash).
> I would create a table that maps hash of url (!!! Not url itself and  not
> hash-like part of url) to user_id and then use auth.login_user as Carlos
> mentioned.
>
> среда, 18 ноября 2020 г. в 16:19:35 UTC+3, roge...@gmail.com:
>
>> Thanks Carlos
>>
>> I couldnt find the login_user() function in the book but i did find it
>> here:
>> https://web2py.readthedocs.io/en/latest/_modules/gluon/tools.html#Auth.login_user
>>
>>
>> Does  login_user(self, user)  essentially bypass the normal
>> authentication process?
>> And is  login_bare(self, username, password)  the normal login function?
>>
>> Andrew
>>
>>
>> ___
>> *www.TenOutOfTen.org* 
>> roge...@gmail.com
>> (+95) 09 250018669 <+95%209%20250%20018%20669> (Myanmar)
>>
>>
>> On Wed, 18 Nov 2020 at 21:26, Carlos Correia <
>> car...@memoriapersistente.pt> wrote:
>>
>>> On 17/11/20 22:24, Kenneth wrote:
>>>
>>> Hi,
>>>
>>> I tried searching the discussions but could not find anything like this
>>> being discussed.
>>>
>>> I'm looking into having users login into my app via an link/URL they
>>> receive via email. They just get an link no separate username and password.
>>> When the link is accessed they are logged in normally. The link would look
>>> like something like this: my.website.com/longhash4324kljhasdfasd9f87ads
>>>
>>> Does web2py already contain this function?
>>>
>>>
>>> Kenneth
>>>
>>> --
>>> 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/e8102d90-88c8-4a4c-abcb-96ba7aa54cddn%40googlegroups.com
>>> 
>>> .
>>>
>>> Hi,
>>>
>>> I would write the hash somewhere in the filesystem, create a controller
>>> to verify the hash, then use Auth.login_user() to authenticate the user.
>>>
>>> Having said that, please note that it is a (very) bad idea, since a "man
>>> in the middle" could easily intercept the mail and hack the session.
>>>
>>> Regards,
>>>
>>> Carlos Correia
>>> =
>>> MEMÓRIA PERSISTENTE
>>> GSM:  917 157 146 (Signal, WhatsApp)
>>> e-mail: ge...@memoriapersistente.pt
>>> URL: http://www.memoriapersistente.pt
>>> XMPP (Jabber): car...@memoriapersistente.pt
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/00b9aa90-1458-f9c5-ae9b-703e740341d7%40memoriapersistente.pt
>>> 
>>> .
>>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/434776c9-cf49-4fbc-b251-1c49cd8ef32dn%40googlegroups.com
> 
> .
>

-- 
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.
To view this 

Re: [web2py] Re: Update dropdown list in SQLFORM.grid based on selection in another dropdown list

2020-11-24 Thread AGRogers
Glad you got it working.

I send javascript from my controller back to the view for some custom
control widgets. That sounds similar to what you want to do.

I dont know where i found the original code sample to do that - not in the
book I dont think. This page
http://www.web2pyslices.com/slice/show/1446/widget-select-or-add-option you
will see an example of how it can be done. To be honest I dont fully
understand how the wrapper works. But i got some nice custom controls
working nonetheless :)


def widget(self, field, value):
#generate the standard widget for this field
select_widget = OptionsWidget.widget(field, value)

#get the widget's id (need to know later on so can tell
receiving controller what to update)
my_select_id = select_widget.attributes.get('_id', None)
add_args = [my_select_id]
#create a div that will load the specified controller via ajax
form_loader_div = DIV(LOAD(c=self.controller, f=self.function,
args=add_args,ajax=True), _id=my_select_id+"_dialog-form",
_title=self.form_title)
#generate the "add" button that will appear next the options
widget and open our dialog
activator_button = A(T(self.button_text),
_id=my_select_id+"_option_add_trigger")
#create javascript for creating and opening the dialog
js = '$( "#%s_dialog-form" ).dialog({autoOpen: false, show:
"blind", hide: "explode", width: %s});' % (my_select_id,
self.dialog_width)
js += '$( "#%s_option_add_trigger" ).click(function() { $(
"#%s_dialog-form" ).dialog( "open" );return false;}); ' %
(my_select_id, my_select_id)#decorate our activator button for
good measure
js += '$(function() { $( "#%s_option_add_trigger"
).button({text: true, icons: { primary: "ui-icon-circle-plus"} });
});' % (my_select_id)
jq_script=SCRIPT(js, _type="text/javascript")
wrapper = DIV(_id=my_select_id+"_adder_wrapper")
wrapper.components.extend([select_widget, form_loader_div,
activator_button, jq_script])
return wrapper





___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Fri, 20 Nov 2020 at 19:09, Tom Clerckx  wrote:

> OK, I was able to do it with SQLFORM.grid(), using jQuery by:
> * registering a change function on the #shelves_genre field
> * execute an XMLHttpRequest upon a change of #shelves_genre that updates
> the innerHTML of #shelves_shelve_items
>
> It would be nice however if something similar (registering form-events
> onchange/onselect/...) could be achieved when e.g. creating the form, so
> that you can do it in python instead of having to add the javascript
> functions.
>
>
>
> On Friday, November 13, 2020 at 3:53:23 PM UTC+1 Tom Clerckx wrote:
>
>> Hi,
>>
>> Considering the sample code below.
>> I have manually populated the books table with a number of books for
>> different genres.
>> Now I can create an entry in the shelves table, using the SQLFORM.grid
>> The shelve_items will be shown as a dropdown list with the books that
>> I've added
>>
>> What I would like is to update the contents of the shelve_items dropdown
>> list in the form, based on the selected genre in that same form.
>>
>> In the past I did something similar, using a SELECT() box and adding an
>> onchange=ajax(...) call to update a DIV elsewhere in the page.
>>
>> I was wondering however, if there is a better way to do this directly in
>> the SQLFORM.grid()
>>
>>
>> ===
>> index.html
>> ===
>> {{extend 'layout.html'}}
>> {{=form}}
>>
>> ===
>> default.py
>> ===
>>
>> def index():
>> form = SQLFORM.grid(db.shelves, user_signature=False)
>> return dict(form=form)
>>
>> ==
>> db.py
>> ==
>> genres = ['thriller', 'sf', 'roman', 'fantasy']
>> db.define_table('books',
>>   Field('name', 'string'),
>>   Field('author', 'string'),
>>   Field('genre', 'string', requires=IS_IN_SET(genres)),
>>   format='%(name)s'
>>   )
>> db.define_table('shelves',
>>   Field('genre', 'string', requires=IS_IN_SET(genres)),
>>   Field('shelve_items', 'reference books'),
>>   )
>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/61c5b124-cf09-4df5-aa58-dd6589bc63b8n%40googlegroups.com
> 
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- 

Re: [web2py] SQLform.grid request not sending bool valuis

2020-11-24 Thread AGRogers
Are the boolean fields writable? I think unwritable fields are excluded
from request.vars.

___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Tue, 24 Nov 2020 at 22:21, Yebach  wrote:

> Hello
>
> I have a SQLform.grid and when validating fields i have some issues
>
> so to come around i have
>
> if request.args and request.args[0] in ['edit', 'new']:
> if form.update_form:
> if form.update_form.accepts(request.vars):
> print request.vars
> print request.args
> session.flash = T('Diagnoza postavljena')
> redirect(URL())
>
> the problem is that reques.vars is not including fileds that are of type
> boolean
>
> therefore i did a workaround and whn bool field is set as string it does
> but i want to change the text field to be checkbox
>
> any suggeestion? Either on getting the bool value or changing the field to
> be checkbox
>
> Thank you
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/55aa4f8e-7da4-48c6-a526-f074f6aaa9acn%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPGELDe%2BKZ8nVt0dK%3DqLfCbf-mOCKQtEL9BJEU5P%3DzOCg%40mail.gmail.com.


Re: [web2py] Cron instead of Scheduler

2020-11-24 Thread AGRogers
Glad to hear you got it sorted.

___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Tue, 24 Nov 2020 at 18:02, Gaël Princivalle 
wrote:

> Thank you for your reply.
>
> The problem was in the psycop2 library.
> Running these commands now I'm able to run the web2py workers:
>
> mv env env.old2
> virtualenv --python $HOME/opt/bin/python2.7 env
> source env/bin/activate
> pip2 install uwsgi psycopg2-binary http://effbot.org/downloads/
> Imaging-1.1.7.tar.gz
> ./stop
> sleep 3
> ./start
>
> Il giorno martedì 24 novembre 2020 alle 08:04:19 UTC+1 roge...@gmail.com
> ha scritto:
>
>> Have you tried running it as sudo?
>> What does it say in the nohup.out file? Maybe a permissions issue?
>>
>> ___
>> *www.TenOutOfTen.org* 
>> roge...@gmail.com
>> (+95) 09 250018669 <+95%209%20250%20018%20669> (Myanmar)
>>
>>
>>
>> On Sat, 21 Nov 2020 at 05:51, Gaël Princivalle 
>> wrote:
>>
>>> Hi.
>>>
>>> I'm still having troubles to start a worker on Opalstack for my
>>> schedulers.
>>> I've this error:
>>> --
>>> [myuser web2pyfolder]$ nohup env/bin/python web2py/web2py.py -K myapp &
>>> [1] 21916
>>> [ myuser web2pyfolder ]$ nohup: ignoring input and appending output to
>>> ‘nohup.out’
>>>
>>> [1]+  Exit 1  nohup env/bin/python web2py/web2py.py -K
>>> myapp
>>> -
>>>
>>> If I don't put the & at the end it sometimes runs, sometimes not.
>>>
>>> I've tried to use the older Web2py version that I was using on
>>> Webfaction and the error still the same.
>>>
>>> Is there another way to start a worker?
>>>
>>> Or can I run some functions of my application with cron?
>>>
>>> Thanks, 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+un...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/bff7c13e-7766-4d78-973a-1a075352c61cn%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/20ebb757-2434-403f-b3ed-5fe49f93cd85n%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMOsCt8d0kZMxsJAmyDCjQCCf_UKbbUp-xj%2Bk4RQoFpKDA%40mail.gmail.com.


Re: [web2py] Cron instead of Scheduler

2020-11-23 Thread AGRogers
Have you tried running it as sudo?
What does it say in the nohup.out file? Maybe a permissions issue?

___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Sat, 21 Nov 2020 at 05:51, Gaël Princivalle 
wrote:

> Hi.
>
> I'm still having troubles to start a worker on Opalstack for my schedulers.
> I've this error:
> --
> [myuser web2pyfolder]$ nohup env/bin/python web2py/web2py.py -K myapp &
> [1] 21916
> [ myuser web2pyfolder ]$ nohup: ignoring input and appending output to
> ‘nohup.out’
>
> [1]+  Exit 1  nohup env/bin/python web2py/web2py.py -K
> myapp
> -
>
> If I don't put the & at the end it sometimes runs, sometimes not.
>
> I've tried to use the older Web2py version that I was using on Webfaction
> and the error still the same.
>
> Is there another way to start a worker?
>
> Or can I run some functions of my application with cron?
>
> Thanks, 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/bff7c13e-7766-4d78-973a-1a075352c61cn%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMOWx%3DSR4_DXD%2B160CGjEOLEdQqiSCB463t2x-fbfG3uWg%40mail.gmail.com.


Re: [web2py] Re: Dashboard library for Web2py performance/recommendation python vs. js

2020-11-18 Thread AGRogers
Some nice looking pages there. Thanks.

On Wed, 18 Nov 2020, 11:38 pm Alex Beskopilny,  wrote:

> dasjboards for web2py https://github.com/ali96343/facew2p
> dashboards  for py4web https://github.com/ali96343/facep4w
> charts Highcharts.js
> On Tuesday, November 17, 2020 at 11:47:04 AM UTC+3 Jonsubs wrote:
>
>> Hi everyone,
>> I need to implement a dashboard and some charts in my webapp. And
>> honestly I'm a little bit lost and overwhelmed.
>>
>> From a Web2py perspective which is the best approach?
>> a) a python based solution (e.g. plotly)
>> b) a JS based solution
>>
>> My app is hosted in Pythonanywhere.
>>
>> Is there any recommended dashboard and chart library for web2py?
>> Thanks, Jon.
>>
>>
>> 
>>  Libre
>> de virus. www.avast.com
>> 
>> <#m_7200113669684149226_m_-2958339010838646051_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/b33a4e69-68f9-4607-aa3f-99f1f661fb34n%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPv8RL49QpJd3W-sudU0sRXVtC6-oDrEy2wuJZ9PzBbnA%40mail.gmail.com.


Re: [web2py] Login via an link/URL

2020-11-18 Thread AGRogers
Thanks Carlos

I couldnt find the login_user() function in the book but i did find it
here:
https://web2py.readthedocs.io/en/latest/_modules/gluon/tools.html#Auth.login_user


Does  login_user(self, user)  essentially bypass the normal authentication
process?
And is  login_bare(self, username, password)  the normal login function?

Andrew


___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Wed, 18 Nov 2020 at 21:26, Carlos Correia 
wrote:

> On 17/11/20 22:24, Kenneth wrote:
>
> Hi,
>
> I tried searching the discussions but could not find anything like this
> being discussed.
>
> I'm looking into having users login into my app via an link/URL they
> receive via email. They just get an link no separate username and password.
> When the link is accessed they are logged in normally. The link would look
> like something like this: my.website.com/longhash4324kljhasdfasd9f87ads
>
> Does web2py already contain this function?
>
>
> Kenneth
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/e8102d90-88c8-4a4c-abcb-96ba7aa54cddn%40googlegroups.com
> 
> .
>
> Hi,
>
> I would write the hash somewhere in the filesystem, create a controller to
> verify the hash, then use Auth.login_user() to authenticate the user.
>
> Having said that, please note that it is a (very) bad idea, since a "man
> in the middle" could easily intercept the mail and hack the session.
>
> Regards,
>
> Carlos Correia
> =
> MEMÓRIA PERSISTENTE
> GSM:  917 157 146 (Signal, WhatsApp)
> e-mail: ge...@memoriapersistente.pt
> URL: http://www.memoriapersistente.pt
> XMPP (Jabber): car...@memoriapersistente.pt
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/00b9aa90-1458-f9c5-ae9b-703e740341d7%40memoriapersistente.pt
> 
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNZceg2jNsMGym4i0bip1VCAZQjRZ2Yjc0n-XkZMRad7Q%40mail.gmail.com.


Re: [web2py] Where to find Alert/Flash messages

2020-11-17 Thread AGRogers
You can see error tickets from the Admin module (screenshot below). I
believe they are stored on the filesystem, not in a table. I have never
looked.

Re Flash messages, unless they are generated from error tickets, i doubt
they are stored anywhere.

I have a function that logs errors (and anything else I want) in an
EventLog table. You are probably catching all errors and trying to handle
them gracefully so its not hard to grab the error that was raised at that
point. Trying to extract the error from the exception took me a little
looking for. My code for that is below.

Also, there is a logging feature in web2py.
http://web2py.com/books/default/chapter/29/04/the-core?search=logger#Logging


Maybe something there helps?

[image: image.png]

def MyFunction:
try:
#My code

except Exception as e:
Result = Public.LogError(pyFileName, e, I, ReturnJson = False)


Public Module
-
from datetime import datetime
import inspect
import sys
import simplejson as json

def LogError(FileName, e=None, ExtraInfo = "", LogType = 'Error',
ReturnJson=False, FlashError = False):

NOW = datetime.now()
curframe = inspect.currentframe()
ErrFunction = inspect.getouterframes(curframe, 2)
Msg = sys.exc_info()[0]
LogFunction = "%s < %s < %s [%s]" %(ErrFunction[1].function,
ErrFunction[2].function, ErrFunction[3].function, FileName)

if e:
if hasattr(e, 'message'):
Msg = "%s [Sys: %s]" % (e.message, Msg)
#print(e.message)
else:
#print(e)
Msg = "%s [Sys: %s]" % (e, Msg)

if not Msg: Msg=''

print('--- ERROR
---')
print("%s: FUNC: %s. ERR: %s. %s" % (str(NOW)[11:19], LogFunction, Msg,
ExtraInfo))
Common.AddLogEntry(LogType=LogType, LogFunction = LogFunction,
LogMessage = '%s %s' % (Msg, ExtraInfo))


print('-')

result = ("%s: FUNC: %s. ERR: %s. %s" % (str(NOW)[11:19], LogFunction,
Msg, ExtraInfo))

message = result
if 'ERR: UNIQUE constraint failed' in message:
startat = message.find("ERR: UNIQUE")
char1 = ":"
char2 = "["
table_info = message[message.find(char1,startat) + 1:
message.find(char2,startat)]
message = f'There is already a record in the database just like
this one. We cannot add another. ({table_info})'

if FlashError: current.response.flash = XML("Error: " + message +
current.response.flash)

result = dict(Success = False, Message = message)
if ReturnJson:
result = json.dumps(result)

logger = logging.getLogger("web2py.app.myapp")
logger.setLevel(logging.DEBUG)
logger.error(message)

return result


___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)




On Mon, 16 Nov 2020 at 20:49, Brennie Standy 
wrote:

> I have a ticket where our client wishes to see a list of all
> flash/alert/error messages, including anything from "Logged in" to our own
> customized error messages set by the previous developer. Where in the app
> can I find this list? Standard global search is not proving useful. 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/b447d3c3-987d-4d59-a790-2dacf04f2fe6n%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPttp_K25bZR9XNau25TsS9HaOiJOSQoyfXZJdqgN9kpw%40mail.gmail.com.


Re: [web2py] Login via an link/URL

2020-11-17 Thread AGRogers
Hi Kenneth

The following are guesses

1. I have never seen anything that is remotely similar to this in web2py.
But i like the idea.

2. Maybe the 'impersonate' option might work. Someone how log in as a user
whose account details you know and then impersonate the user identified in
the link. Info on that here:
http://web2py.com/books/default/chapter/29/09/access-control#Authentication.
Not sure how you log in as the known user though.

3. Somewhat related to your question is a challenge i want to address: how
can i enable logging in via pictures? My app is for young kids and a great
way for 5 year olds is to link their profile image with a password image.
I thought that would be easy to make but after thinking about your question
I suspect it wont be. It's kind of the same problem - logging in for
someone else.

Cheers
Andrew
___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Wed, 18 Nov 2020 at 08:24, Kenneth  wrote:

> Hi,
>
> I tried searching the discussions but could not find anything like this
> being discussed.
>
> I'm looking into having users login into my app via an link/URL they
> receive via email. They just get an link no separate username and password.
> When the link is accessed they are logged in normally. The link would look
> like something like this: my.website.com/longhash4324kljhasdfasd9f87ads
>
> Does web2py already contain this function?
>
>
> Kenneth
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/e8102d90-88c8-4a4c-abcb-96ba7aa54cddn%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMOQpQchoc6UXc_i-bz-wyX9LuAOC0Nf_8dmpig86650OA%40mail.gmail.com.


Re: [web2py] Re: Push Notifications

2020-11-16 Thread AGRogers
Thanks for the tip Antonio. The free version could work well for me. I dont
mind reinventing the wheel - I just dont like fixing it when it breaks :)

___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Tue, 17 Nov 2020 at 09:05, António Ramos  wrote:

> Why reiventing the wheel ???
> https://pusher.com/
>
> I use it with web2py and works like a charm
>
>
> Em seg., 16 de nov. de 2020 às 08:44, mostwanted 
> escreveu:
>
>> So far all I have been able achieve is asking the user for permission to
>> send them notifications & if they accept all that happens is that everytime
>> they open the app they get a greetings notification, achieving that was not
>> complicated because it was straight forward, I placed the code in my
>> main.js script & it runs everytime the service worker gets registered.
>>
>> *CODE:*
>> Notification.requestPermission(result => {
>>   if (result === 'granted') {
>> showNotification('Welcome to My App™', 'Everything Services™')
>>   }
>> });
>>
>> function showNotification(title, message) {
>>   if ('Notification' in window) {
>> navigator.serviceWorker.ready.then(registration => {
>>   registration.showNotification(title, {
>> body: message,
>> tag: 'my-app',
>> icon:'/init/static/images/icon_192x192.png',
>> badge:'/init/static/images/icon_128x128.png',
>> vibrate: [200, 100, 200, 100, 200, 100]
>>   });
>> });
>>   }
>> }
>>
>>
>> On Monday, November 16, 2020 at 10:31:10 AM UTC+2 mostwanted wrote:
>>
>>>
>>> Has anyone been able to implement push notifications on their web2py
>>> apps?
>>>
>>> I need a working application with some examples on how to implement this
>>> for one of my applications.
>>>
>>> I've been looking at the "web-push-book (
>>> https://web-push-book.gauntface.com/how-push-works/)" but I cant put it
>>> together in my head.
>>>
>>> What I wanna achieve is relatively basic, I have an applivcation that
>>> offers information on services & products sold in my area, so what I want
>>> is to be able to send notifications everytime a new service or product is
>>> registered.
>>>
>>> If anyone has any idea on how I can easily implement this please help me.
>>>
>>> Regards;
>>>
>>> Mostwanted
>>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/01da1065-f7d3-4394-9014-a424639bef03n%40googlegroups.com
>> 
>> .
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CAEM0BxPX9jKzoBFiVK093YXR912h6ZFb5pzPXU%3DyUkF33yi1hw%40mail.gmail.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPyL3L%2BS0YFwVG93GC6EnQ-wSwR_8eiypvk2JznEcsy9w%40mail.gmail.com.


Re: [web2py] Scheduler on Opalstack

2020-11-12 Thread AGRogers
Regarding Scheduler code in, I understand you can put it in any Model file.

On Fri, 13 Nov 2020, 5:01 am Gaël Princivalle, 
wrote:

> I can see if I create a new app in Webpy 2.20.4 that the db file have this:
> if configuration.get('scheduler.enabled'):
> from gluon.scheduler import Scheduler
> scheduler = Scheduler(db,
> heartbeat=configuration.get('scheduler.heartbeat'))
>
> In my db.py file I don't have that, the scheduler is called at the end of
> the scheduler.py file and that's all.
>
> How can I adapt my db.py file to that?
> In my db.py file I have the connection strin of the db database (main
> tables) and the db_sc database (scheduler database):
> db = DAL('postgres://myuser:mypassword@localhost:5432/postg_db',
> check_reserved=['all'], pool_size=1, entity_quoting=True, bigint_id=True,
> migrate=False, fake_migrate_all=False)
> db_sc = DAL('postgres://myuser:mypassword@localhost:5432/postg_db_sc',
> check_reserved=['all'], pool_size=1, entity_quoting=True, bigint_id=True,
> migrate=False, fake_migrate_all=False)
>
> Thanks in advance for your help.
> Il giorno giovedì 12 novembre 2020 alle 11:52:32 UTC+1 Gaël Princivalle ha
> scritto:
>
>> Sure, here is the complete scheduler.py file:
>> My main DB is db, the DB with the scheduler tables is db_sc.
>> # -*- coding: utf-8 -*-
>>
>> def e_db():
>> today = datetime.datetime.today()
>> file_name = '%s_%s_%s_%s_%s:%s.csv' % (request.application,
>> today.day, today.month, today.year, today.hour, today.minute)
>> file_url = '%s/static/z_backup/csv/%s' % (request.folder, file_name)
>> db.export_to_csv_file(open(file_url, 'wb'))
>> subject = 'Backup CSV %s' % request.application
>> message = 'Il backup CSV di %s è stato salvato in %s.' %
>> (request.application, file_url)
>> '''email_sent = mail.send(
>> to = 'm...@domain.com',
>> subject = subject,
>> reply_to = 'm...@domain.com',
>> message = message)'''
>> db.commit()
>>
>> def sitemap_txt_auto():
>> import os
>> from gluon.myregex import regex_expose
>> # Statics URLs
>> exclusions =
>> ['make_slugs','get_fabbisogno','e_db','get_cart','get_product_cart','test_query','carrellon','ordine_verifican','order_sendn','brands',
>> 'cart_qty', 'cart_weight', 'carrello', 'ordine_verifica',
>> 'ordine_modifica_indirizzo', 'order_send', 'e_deb', 'fuzz',
>> 'googleaf365ee20ab65216', 'insert_product_enquiry',
>> 'insert_service_enquiry', 'prodotto', 'attivita_fattoria_didattica',
>> 'test', 'edit', 'user','unsubscribe','sitemap_txt','download', 'call',
>> 'data', 'upload', 'browse', 'delete']
>> ctldir = os.path.join(request.folder,"controllers")
>> ctls=os.listdir(ctldir)
>> if 'appadmin.py' in ctls: ctls.remove('appadmin.py')
>> if 'manage.py' in ctls: ctls.remove('manage.py')
>> if 'admin.py' in ctls: ctls.remove('admin.py')
>> if 'prod.py' in ctls: ctls.remove('prod.py')
>> if 'default.py.1' in ctls: ctls.remove('default.py.1')
>> sitemap='https://www.sitedomain.com'
>> for ctl in ctls:
>> if ctl.endswith(".bak") == False:
>> filename = os.path.join(ctldir,ctl)
>> data = open(filename, 'r').read()
>> functions = regex_expose.findall(data)
>> for f in functions:
>> if not any(f in s for s in exclusions): # if function is
>> not in exclustions
>> sitemap += '\r\n'
>> sitemap += 'https://www.sitedomain.com/%s' % (f)
>> # Dynamic URLs
>> # News
>> news = db(db.news.on_line == True).select(db.news.ALL)
>> for item in news:
>> sitemap += '\r\n'
>> sitemap += 'https://www.sitedomain.com/news?id=%s' % (str(item.id
>> ))
>> # Products
>> products = db(db.products.on_line == True).select(db.products.ALL)
>> for item in products:
>> sitemap += '\r\n'
>> sitemap += 'https://www.sitedomain.com/prodotti?product_id=' +
>> (str(item.id)) + '_slug=' + item.product_slug
>> # Categories
>> sitemap += '\r\n'
>> sitemap += 'https://www.sitedomain.com /prodotti?category_id=0'
>> categories = db().select(db.products_categories.ALL)
>> for item in categories:
>> sitemap += '\r\n'
>> sitemap += 'https://www. sitedomain.com
>> /prodotti?category_id=%s' % (str(item.id))
>> # Servizi
>> services = db().select(db.services.ALL)
>> for item in services:
>> sitemap += '\r\n'
>> sitemap += '
>> https://www.sitedomain.com/attivita_fattoria_didattica?id=%s' % (str(
>> item.id))
>> file = open('%s/static/sitemap.txt' %request.folder, 'w')
>> file.write(sitemap)
>> file.close()
>> file = open('%s/static/sitemaps/sitemap.txt' %request.folder, 'w')
>> file.write(sitemap)
>> file.close()
>> """email_sent = mail.send(
>> to = 'm...@domain.com',
>> subject = 

Re: [web2py] On Windows I am trying to delete an application that uses logging but the delete fails because the log file is "in use"

2020-11-10 Thread AGRogers
Good tip. Thanks. Seems like something that should end up in the public
version.

___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Tue, 10 Nov 2020 at 23:09, Davidiam  wrote:

> We found that by modifying the gluon\admin.py app_uninstall function, we
> could search for the open log file handles and close them before the actual
> delete of the files is performed.
>
>import logging
>import logging.handlers
>
>for nm, lgr in logging.root.manager.loggerDict.items():
>   if str(nm) == str(app):
>  for h in lgr.handlers:
> h.close()
> On Tuesday, October 27, 2020 at 2:09:51 PM UTC+1 Davidiam wrote:
>
>> It looks like it uses one handler although the logger rotates the actual
>> log files.  I think that I would need to shut down the logger before or at
>> the beginning of the uninstall step, but as the "uninstall application" is
>> run from the admin app, it would be a bit tricky to implement the shutdown
>> for a specific application in the admin application code.  If there was an
>> app.shutdown() method maybe
>>
>> For the moment I am first shutting down the application pool in IIS and
>> then deleting the app but I would prefer a coded solution.  We son't delete
>> applications aften, so the work-around is acceptable for the moment.
>>
>> On Tuesday, October 27, 2020 at 4:23:09 AM UTC+1 roge...@gmail.com wrote:
>>
>>> Ah, i see. Can you temporarily shutdown() the logger and then restart it
>>> when the uninstall is complete? Or does it need to stay running also? I
>>> think it is possible to close a specific handler as well - but i dont know
>>> how the logging works in web2py - maybe there is a single handler for all
>>> the apps (if you can't tell, i have never used it before :)
>>>
>>>
>>> ___
>>> *www.TenOutOfTen.org* 
>>> roge...@gmail.com
>>> (+95) 09 250018669 <+95%209%20250%20018%20669> (Myanmar)
>>>
>>>
>>> On Mon, 26 Oct 2020 at 23:37, Davidiam  wrote:
>>>
 Thank you for your reply,
 Deleting the application folder gives the same error.
 The problem is that the logger holds the log file locked.  If I restart
 the webserver I can delete the file, but our developers can't restart web
 services.
 It is not a big problem but I would like to find a solution (if one
 exists)..

 On Monday, October 26, 2020 at 4:56:30 AM UTC+1 roge...@gmail.com
 wrote:

> Hi David
>
> I am not sure that i have ever used the Uninstall option. I just
> delete the application folder and the application disappears. I am not 
> sure
> if that leaves any residual information in files somewhere. But i have not
> noticed a problem.
>
> Does that work for you?
> Andrew
>
> ___
> *www.TenOutOfTen.org* 
> roge...@gmail.com
> (+95) 09 250018669 <+95%209%20250%20018%20669> (Myanmar)
>
>
>
> On Fri, 23 Oct 2020 at 17:07, Davidiam  wrote:
>
>> When using logging in web2py on Windows, we are unable to delete
>> applications unless we first stop the server.
>>
>> The reason is that the app.log is considered "in use".
>>
>> As the uninstall happens from the admin app, I am not quite sure how
>> best to stop the logger in the application that is being uninstalled when
>> the "Uninstall" option is selected from admin.
>>
>> Anyone have any ideas on how to unistall an app that uses logging.
>> Apparently this is only an issue on Windows because the os.unlink works 
>> on
>> "in use" files on linux systems.
>>
>> Note : We have defined the location of the log files within the
>> application directory structure so that the developers have access to the
>> files.
>>
>> This is the logging code used :
>> def get_configured_logger(name):
>> Test = False
>> logger = logging.getLogger(name)
>> if (len(logger.handlers) == 0):
>> # This logger has no handlers, so we can assume it hasn't yet
>> been configured
>> # (Configure logger)
>>
>> # Create default handler
>> if request.env.web2py_runtime_gae:
>> # Create GAEHandler
>> handler = GAEHandler()
>> else:
>> # Create RotatingFileHandler
>> import os
>> formatter="%(asctime)s %(levelname)s %(process)s %(thread)s
>> %(funcName)s():%   (lineno)d %(message)s"
>> handler =
>> logging.handlers.RotatingFileHandler(os.path.join(request.folder,
>> 'private/app.log'), maxBytes=100,backupCount=2)
>> handler.setFormatter(logging.Formatter(formatter))
>>
>> handler.setLevel(logging.DEBUG)
>>
>> logger.addHandler(handler)
>> logger.setLevel(logging.DEBUG)
>>
>> # Test entry:
>>
>> if Test == 

Re: [web2py] Hosting my web2py application

2020-11-09 Thread AGRogers
I have just set up a Google cloud virtual machine with Debian 9 and Apache
and python 3.7.6. It wasn't easy. Seems to be fast though. If you want a vm
image I can try and work out how to share it with you.

On Sun, 8 Nov 2020, 8:56 am Dave S,  wrote:

>
>
> On Tuesday, October 27, 2020 at 11:21:28 AM UTC-7, Chris wrote:
>>
>> Hi, you can check the install script of waf2py and get the part where the
>> apache server is installed with web2py. you may need to adjust the paths.
>> This is for a debian system
>>
>>
>>
>> https://github.com/ITSec-Chile/Waf2Py/blob/master/installer/waf2py_installer.sh
>>
>>
> There's a more up-to-date script for Nginx, and Mossimo and others don't
> recommend Apache any more, unless you already know it well or have a legacy
> installation.  It's gotten kind of crufty, I'm told, due to the way new
> features were added.
>
> Working with nginx isn't difficult for most uses -- after all, I figured
> out how to use it on my site, and I'm no guru for either web2py or nginx.
> I have not tried the windows version of nginx.  For big sites, you probably
> want the paid version and the add ons for micro APIs, etc, but the free
> version running on AWS linux handles 24x7 at more than 1 request per second.
>
> /dps
>
>
>
>> —
>> Cheers.
>> Chris.
>>
>> On martes, oct. 27, 2020 at 12:44 p. m., mostwanted 
>> wrote:
>> How do I setup a private home server to host my web2py application? What
>> do i need & how do i put it together? If anyone has done it before please
>> share the process or direct me to where I can find the information.
>>
>> Regards;
>>
>> Mostwanted
>>
>> --
>> 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 web...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/6d1e2e29-a423-43d2-b9fe-1e6cae251f26n%40googlegroups.com
>> 
>> .
>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/712d77e0-47c4-46c0-912f-63477afe08b7o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNY8bMB-oOYTdO84a0-uAsyNh9AxHddz-x8%2Br6A4NZgDA%40mail.gmail.com.


Re: [web2py] Displaying content based on the id attribute

2020-11-09 Thread AGRogers
That was a long thread which I didn't read fully. But what I did read made
me think that maybe the original problem was that you needed a slight delay
between when you showed the span and when you made the ajax call. I do that
by putting the ajax call in a setTimeout function. If I don't, the screen
doesn't update until the ajax call is completed.

On Tue, 3 Nov 2020, 7:36 pm mostwanted,  wrote:

> I have a hidden span that i want displayed when a link is clisked while
> waiting for the page to load but this is not working! I dont know where I
> am going wrong but thought I had it right, please assist me.
>
> *CSS:*
> .link_loader
> {
> display: none;
> }
>
> *CONTROLLER*
> *#The yellow line is the hidden span that has the loader I want to display*
> def ajaxlivesearch():
> keywords = request.vars.keywords
> print "Keywords: " + str(keywords)
>
> if keywords:
> query = reduce(lambda
> a,b:a,[db.services.service_name.contains(k) for k in keywords.split()])
> services = db(query).select()
> items = []
>
> if services:
> for c in services:
> items.append(DIV*(SPAN("loading ...", SPAN(_class="fa
> fa-spinner fa-spin"), _class="link_loader",
> data={'id':"res%s"%c.service_name})*, A(c.service_name, _class="service",
> _style="font-weight: bold;", _href=URL('companies', args=c.id),
> _id="res%s"%c.service_name,
> _onclick="updatelivesearch(jQuery('#res%s').html())" % c.service_name)))
>
> *VIEW*
> *#This jQuery script attempts to display the hidden span*
>
> **$(document).ready(function(){
> $('.service').click(function(e) {
> const id = $(this).data('id');
> $('#' + id).fadeIn();
> e.preventDefault();
>
> });
> });
>
> **
>
> Regards;
>
> Mostwanted
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/3b8a175c-ecdc-47e5-a157-45e7fe260f9fn%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMMxq2KBKA-5JocJFjmNtMkB3uNP7kY_wqGAXnA06P5C4g%40mail.gmail.com.


Re: [web2py] music and programming

2020-11-08 Thread AGRogers
It looks great Stifan. Well done. I am not musical but it looks like a
pretty comprehensive research. I like the tabulator control as well.

___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Sun, 8 Nov 2020 at 05:53, 黄祥  wrote:

> developing app for learning music
> https://sugizo.pythonanywhere.com/music
> critic and suggestion welcome both music and programming side
>
> thanks and best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/46b29681-b3e4-4648-84a0-1d2cb7c3bb8bn%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPtMyqR8V7rm9tHByfHg-G4JhOPxs-wk3L-UHPQujzmRQ%40mail.gmail.com.


Re: [web2py] On Windows I am trying to delete an application that uses logging but the delete fails because the log file is "in use"

2020-10-26 Thread AGRogers
Ah, i see. Can you temporarily shutdown() the logger and then restart it
when the uninstall is complete? Or does it need to stay running also? I
think it is possible to close a specific handler as well - but i dont know
how the logging works in web2py - maybe there is a single handler for all
the apps (if you can't tell, i have never used it before :)

___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Mon, 26 Oct 2020 at 23:37, Davidiam  wrote:

> Thank you for your reply,
> Deleting the application folder gives the same error.
> The problem is that the logger holds the log file locked.  If I restart
> the webserver I can delete the file, but our developers can't restart web
> services.
> It is not a big problem but I would like to find a solution (if one
> exists)..
>
> On Monday, October 26, 2020 at 4:56:30 AM UTC+1 roge...@gmail.com wrote:
>
>> Hi David
>>
>> I am not sure that i have ever used the Uninstall option. I just delete
>> the application folder and the application disappears. I am not sure if
>> that leaves any residual information in files somewhere. But i have not
>> noticed a problem.
>>
>> Does that work for you?
>> Andrew
>>
>> ___
>> *www.TenOutOfTen.org* 
>> roge...@gmail.com
>> (+95) 09 250018669 <+95%209%20250%20018%20669> (Myanmar)
>>
>>
>>
>> On Fri, 23 Oct 2020 at 17:07, Davidiam  wrote:
>>
>>> When using logging in web2py on Windows, we are unable to delete
>>> applications unless we first stop the server.
>>>
>>> The reason is that the app.log is considered "in use".
>>>
>>> As the uninstall happens from the admin app, I am not quite sure how
>>> best to stop the logger in the application that is being uninstalled when
>>> the "Uninstall" option is selected from admin.
>>>
>>> Anyone have any ideas on how to unistall an app that uses logging.
>>> Apparently this is only an issue on Windows because the os.unlink works on
>>> "in use" files on linux systems.
>>>
>>> Note : We have defined the location of the log files within the
>>> application directory structure so that the developers have access to the
>>> files.
>>>
>>> This is the logging code used :
>>> def get_configured_logger(name):
>>> Test = False
>>> logger = logging.getLogger(name)
>>> if (len(logger.handlers) == 0):
>>> # This logger has no handlers, so we can assume it hasn't yet been
>>> configured
>>> # (Configure logger)
>>>
>>> # Create default handler
>>> if request.env.web2py_runtime_gae:
>>> # Create GAEHandler
>>> handler = GAEHandler()
>>> else:
>>> # Create RotatingFileHandler
>>> import os
>>> formatter="%(asctime)s %(levelname)s %(process)s %(thread)s
>>> %(funcName)s():%   (lineno)d %(message)s"
>>> handler =
>>> logging.handlers.RotatingFileHandler(os.path.join(request.folder,
>>> 'private/app.log'), maxBytes=100,backupCount=2)
>>> handler.setFormatter(logging.Formatter(formatter))
>>>
>>> handler.setLevel(logging.DEBUG)
>>>
>>> logger.addHandler(handler)
>>> logger.setLevel(logging.DEBUG)
>>>
>>> # Test entry:
>>>
>>> if Test == True:
>>> logger.debug(name + ' logger created')
>>> else:
>>> # Test entry:
>>> if Test == True:
>>> logger.debug(name + ' already exists')
>>>
>>> return logger
>>>
>>> --
>>> 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/c9b3c32c-6cfc-4b5f-9894-a62d16898ea5n%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/4af7b1b3-1161-4252-80fe-0f89e125db82n%40googlegroups.com
> 
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- 

Re: [web2py] On Windows I am trying to delete an application that uses logging but the delete fails because the log file is "in use"

2020-10-25 Thread AGRogers
Hi David

I am not sure that i have ever used the Uninstall option. I just delete the
application folder and the application disappears. I am not sure if that
leaves any residual information in files somewhere. But i have not noticed
a problem.

Does that work for you?
Andrew

___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Fri, 23 Oct 2020 at 17:07, Davidiam  wrote:

> When using logging in web2py on Windows, we are unable to delete
> applications unless we first stop the server.
>
> The reason is that the app.log is considered "in use".
>
> As the uninstall happens from the admin app, I am not quite sure how best
> to stop the logger in the application that is being uninstalled when the
> "Uninstall" option is selected from admin.
>
> Anyone have any ideas on how to unistall an app that uses logging.
> Apparently this is only an issue on Windows because the os.unlink works on
> "in use" files on linux systems.
>
> Note : We have defined the location of the log files within the
> application directory structure so that the developers have access to the
> files.
>
> This is the logging code used :
> def get_configured_logger(name):
> Test = False
> logger = logging.getLogger(name)
> if (len(logger.handlers) == 0):
> # This logger has no handlers, so we can assume it hasn't yet been
> configured
> # (Configure logger)
>
> # Create default handler
> if request.env.web2py_runtime_gae:
> # Create GAEHandler
> handler = GAEHandler()
> else:
> # Create RotatingFileHandler
> import os
> formatter="%(asctime)s %(levelname)s %(process)s %(thread)s
> %(funcName)s():%   (lineno)d %(message)s"
> handler =
> logging.handlers.RotatingFileHandler(os.path.join(request.folder,
> 'private/app.log'), maxBytes=100,backupCount=2)
> handler.setFormatter(logging.Formatter(formatter))
>
> handler.setLevel(logging.DEBUG)
>
> logger.addHandler(handler)
> logger.setLevel(logging.DEBUG)
>
> # Test entry:
>
> if Test == True:
> logger.debug(name + ' logger created')
> else:
> # Test entry:
> if Test == True:
> logger.debug(name + ' already exists')
>
> return logger
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/c9b3c32c-6cfc-4b5f-9894-a62d16898ea5n%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMOsCaPu0P_Z5jtXhByVmfERp5aAHXbBaNfShky8VivVeA%40mail.gmail.com.


Re: [web2py] SQLFLORMGRID

2020-10-04 Thread AGRogers
Hi

I have used the DAL to execute code before or after I make database
changes. Maybe that might work in your situation:
http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#callbacks-on-record-insert-delete-and-update


Cheers
Andrew

___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Fri, 2 Oct 2020 at 00:07, lcham...@gmail.com 
wrote:

>
> Hello,
> i use sqlformgrid and like this :
> controller:
> def art_manage():
> records= SQLFORM.grid(query=db.t_art,maxtextlength =
> 40,deletable=False,create=True, fields=[db.t_art.f_name, db.t_art.f_team,
> db.t_art.f_tit])
> return dict(records=records)
>
> view:
> {{=records}}
>
>
> the records displayed are good and i let the possibility to add records
> (create=True).
> My question is : when i add a record and i submit i would to exectue a
> function , how can i do ?
> Thank you
>
> (i know how to do with form .. if form.process (onvalidation .. and so on)
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/399f0935-40d6-4277-829e-2fe5f7f0784bn%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMMrnhVc0BzjPgh_gZAPz0Sa0b2z3RUK4XG5ks4teuL%2Byw%40mail.gmail.com.


Re: [web2py] OT PollyReports generate PDF using bands from DB

2020-10-04 Thread AGRogers
Thanks Denes. I have often looked for reporting solutions over the years. I
will keep it in mind.

___
*www.TenOutOfTen.org* 
rogers...@gmail.com
(+95) 09 250018669 (Myanmar)



On Fri, 2 Oct 2020 at 00:58, 'DenesL' via web2py-users <
web2py@googlegroups.com> wrote:

>
> While searching for a Python PDF package I found PollyReports and was
> pleasantly surprised by it, and it is also nicely documented.
>
> PollyReports is a small, light module providing a simple way to generate
> reports from databases using Python.
>
> Reference: https://pythonhosted.org/PollyReports/docs.html
> Tutorial: https://pythonhosted.org/PollyReports/tutorial.html
> Other features (subreports): https://opensource.gonnerman.org/?cat=4
>
> I hope you find it as useful as I did.
>
> Regards,
> Denes
>
>
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/53fdf8b1-d571-4e60-a9cc-1d000524043fn%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPbtOBRHREGdA6VP1vOCsm3fH13nj1J6tnF4_z0e_DHrA%40mail.gmail.com.


Re: [web2py] Re: Freshly cloned web2py, grid example says "not authorized"

2020-09-22 Thread AGRogers
Yes, I got bitten by this too. My opinion is that this decorator (and
others like it) should start commented out. These little obstacles can make
those first weeks unnecessarily harder.

On Wed, 23 Sep 2020, 1:18 pm BigBaaadBob,  wrote:

> Yes, thanks. I’m just surprised this doesn’t work In the Welcome
> application out of the box. I’m not writing a new application; I’m just
> clicking on the buttons provided in unchanged freshly cloned code.
>
> On Tuesday, September 22, 2020 at 11:04:00 AM UTC-7 Константин Комков
> wrote:
>
>> Hello! You need to comment decorator #@auth.requires_membership('admin')
>> or add your user in 'admin' group see chapter 9 Access Control in The book.
>> Also set table name, forexample:
>> tablename = 'auth_user'
>>
>>
>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/e9a55652-c0f7-40f9-8e60-6d8c6fed033dn%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPacmUXQiqbuou%2BJrWx3_eBn2CApHD3M_Aq9xh3hY8QhA%40mail.gmail.com.


[web2py] FYI this is a useful website for extra Web2py info and examples

2020-08-26 Thread AGRogers
Hi

I find myself ending up on this site every now and then:
https://web2py.wordpress.com/tag/reference/

There are examples there that have really helped me. Interestingly, after I
see the example i often discover that the same info was available in the
book, i was just not smart enough to work out how to use it!

I hope it helps someone.

Cheers
Andrew

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPxxyHWCCKUKBQAT5xVn9mbQVwoqeU_6K%3DPHLGm2r%2Bamw%40mail.gmail.com.


Re: [web2py] Re: Auto-generate PUT and DELETE methods

2020-08-24 Thread AGRogers
Hi Rahul

I haven't done much at all with the rest api. But I would have assumed that
you would need to decorate it with @requires to control who can access
what. I can't see that in your code.


On Tue, 25 Aug 2020, 3:06 am Rahul,  wrote:

> Hi All,
>Not sure if this is the right thread to put this up --
> I was trying to use this code for rest/json -- however -- with slight
> changes and wrong parameters in the URL my entire table got exposed -- Here
> is the code --
>
> *CONTROLLER :  DEFAULT.PY CODE*
>
> ## API ---
> @request.restful()
> def api():
>
> response.view = 'generic.'+request.extension
>
> def GET(*args,**vars):
> patterns = 'auto'
> parser = db.parse_as_rest(patterns,args,vars)
> if parser.status == 200:
> return dict(content=parser.response)
> else:
> raise HTTP(parser.status,parser.error)
>
> def POST(table_name,**vars):
> return db[table_name].validate_and_insert(**vars)
>
> def PUT(table_name,record_id,**vars):
> return db(db[table_name]._id==record_id).update(**vars)
>
> def DELETE(table_name,record_id):
> return db(db[table_name]._id==record_id).delete()
>
> return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)
>
> When some adds the url like this in the browser --
> http://127.0.0.1:8000/artpic/default/api/mblog?id=%221%22=%222%22  (
> http://127.0.0.1:8000/artpic/default/api/mblog?id="1"="2; )  it poses
> a huge risk as all the data in the table is exposed. All tables are exposed
> and even username and password from my tables get exposed and easily
> accessible
>
> This works properly -- but above url exposes a huge security risk --
> http://127.0.0.1:8000/artpic/default/api/mblog/id/37.json
>
> Am I doing this properly ?? Is there something I am missing -- The above
> code in controller is the only code I am using --  Please see the image
> attached -- It looks like a huge security risk.
>
> Regards,
>
> *Rahul*
>
> On Friday, June 22, 2012 at 7:55:19 PM UTC+5:30 Massimo Di Pierro wrote:
>
>> wow. done that.
>>
>> On Thursday, 21 June 2012 18:04:04 UTC-5, Anthony wrote:
>>>
>>> Using my new Google Groups super powers
>>> , I
>>> have edited your original post, so if you'd like, you can delete this
>>> correction and we can pretend this never happened. ;-)
>>>
>>> Anthony
>>>
>>> On Thursday, June 21, 2012 6:40:37 PM UTC-4, Massimo Di Pierro wrote:

 Silly me. This

 def PUT(table_name,record_id):

 return db(db[table_name]._id==record_id).delete()


 was supposed to be


 def DELETE(table_name,record_id):

 return db(db[table_name]._id==record_id).delete()


 On Thursday, 21 June 2012 13:38:01 UTC-5, Derek wrote:
>
> Looks like you have Get, Post, and PUT and PUT. Where's Delete?
>
> On Wednesday, June 20, 2012 4:39:33 PM UTC-7, Massimo Di Pierro wrote:
>>
>> You can do
>>
>> @request.restful()
>> def api():
>> response.view = 'generic.'+request.extension
>> def GET(*args,**vars):
>> patterns = 'auto'
>> parser = db.parse_as_rest(patterns,args,vars)
>> if parser.status == 200:
>> return dict(content=parser.response)
>> else:
>> raise HTTP(parser.status,parser.error)
>> def POST(table_name,**vars):
>> return db[table_name].validate_and_insert(**vars)
>>
>> def PUT(table_name,record_id,**vars):
>>
>> return db(db[table_name]._id==record_id).update(**vars)
>>
>> def PUT(table_name,record_id):
>>
>> return db(db[table_name]._id==record_id).delete()
>>
>> return locals()
>>
>>
>> On Wednesday, 20 June 2012 11:30:26 UTC-5, Osama Hussain wrote:
>>>
>>> Using the following code web2py generated all possible patterns for
>>> all my tables for GET and POST methods:
>>>
>>> @request.restful()
>>> def api():
>>> response.view = 'generic.'+request.extension
>>> def GET(*args,**vars):
>>> patterns = 'auto'
>>> parser = db.parse_as_rest(patterns,args,vars)
>>> if parser.status == 200:
>>> return dict(content=parser.response)
>>> else:
>>> raise HTTP(parser.status,parser.error)
>>> def POST(table_name,**vars):
>>> return db[table_name].validate_and_insert(**vars)
>>> return locals()
>>>
>>>
>>> Is it possible to have patterns generated for PUT and DELETE methods?
>>>
>>> --
> 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" 

Re: [web2py] Re: count() with left join

2020-08-20 Thread AGRogers
I have just resorted to pure SQL using db.executesql (I know that doesnt
help you). Can't get much faster than that though. I like how the results
can be returned as a simple dictionary. But i realised i need to be careful
if i ever target a different DB provider. And permissions and common
filters etc.

I find the DAL really great to work with for inner joins on any number of
tables . Especially when i have particular query parts that i want to
reuse. But for outer joins I struggle and prefer to go back to SQL if i can.

On Fri, 21 Aug 2020 at 10:39, valq...@gmail.com  wrote:

> len(db(query).select())  - is bad solution, since it loads all records
> into memory  + parsing/transforming into pydal records
>
> пятница, 21 августа 2020 г. в 03:35:33 UTC+3, Jim S:
>
>> Thanks, I'll check that out too.  Might be more efficient than the other
>> alternative.
>>
>> -Jim
>>
>>
>> On Thursday, August 20, 2020 at 7:28:26 PM UTC-5, valq...@gmail.com
>> wrote:
>>>
>>> u_cnt = db.auth_user.id.count().with_alias('user_count')
>>> user_count = db(db.auth_user).select(u_cnt,  left =
>>> ...).first().user_count
>>>
>>> or just passing raw SQL as field:
>>> user_count = db(db.auth_user).select('count(id) AS user_count',  left =
>>> ...).first().user_count
>>>
>>>
>>>
>>>
>>> четверг, 20 августа 2020 г. в 22:27:04 UTC+3, Jim S:
>>>
 Clemens

 Thanks so much, that worked perfect.  I guess I was a little concerned
 about the performance, doing the whole select, but then realized that this
 should cut down on result set size, so shouldn't matter that much.

 Again, thank you

 -Jim


 On Thursday, August 20, 2020 at 2:14:26 PM UTC-5, Clemens wrote:
>
> Hi Jim,
>
> I had this issue some time ago and I solved it by the workaround of
> using len(db(query).select()). The count()-method is a little more
> performant, but in my case it didn't matter. If you need the rows object 
> of
> the select for further processing anyway, you can have the len() on the
> rows object.
>
> It's not perfect, but it works :-)
>
> Best regards
> Clemens
>
> On Thursday, August 20, 2020 at 8:52:15 PM UTC+2 Jim S wrote:
>
>> Hi
>>
>> I'm trying to get the count of records to be returned in a query
>> using:
>>
>> db(query).count()
>>
>> Adding complexity to the situation is that query may sometimes be
>> over multiple tables with need a left clause added.  When selecting 
>> records
>> you do this by passing the left= parameter inside the .select().
>>
>> But, you can't pass anything into the .count() method.
>>
>> Has anyone found an efficient way to get a .count() when a left join
>> is in use?
>>
>> -Jim
>>
>> (cross-posting to py4web 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/ac06edd8-4ccf-4866-b327-3277abb6ec42n%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMN%2BddrNeKEiY_w6%3Db4i%2Bena1H%2Br5-7k8bVciGV1nT%3De_Q%40mail.gmail.com.


Re: [web2py] Re: modules: NameError("name 'reload' is not defined",)

2020-08-18 Thread AGRogers
I am completely out of my depth re this issue. But I just read the
following on the py4web group and wondered whether it might be related.

Proper use of modules
Q from Richard: Where do modules go?
A I think proper modules should be installed with pip but if you want to
distribute the source of
your own pure python module with an app I say place it under a new folder
apps/yourapp/modules and make sure there is an "__init__.py" in there. Do
not install it in
the path otherwise may interfere with modules with similar names used by
other apps in the
same apps. Related Q: So "__init__.py" lives in apps/yourapp/modules? A:
Not any module
will work this way. files in the module must use the "from . xyz import"
notation and not
"from thismodule import" notation
Any subfolder of an app that contains python code should have an __init__.py
empty one


On Wed, 19 Aug 2020, 12:05 am Kevin Keller,  wrote:

> I see there is an open issue on git from 8 days ago:
>
> https://github.com/web2py/web2py/issues/2341
>
> So just FYI it is already reported.
>
> Its a strange error.
>
> Must be somewhere in the module save function and after save it should
> trigger the compile which obviously does not work anymore either.
>
> Should be a small thing
>
> Am Di., 18. Aug. 2020 um 15:56 Uhr schrieb xgp.l...@gmail.com <
> xgp.lat...@gmail.com>:
>
>> Hi,
>>
>> I already open a conversation about this but no complete answers were
>> given.
>> I ran from source and experience the same error.
>>
>>
>> Cheers,
>>
>> El Tuesday, August 18, 2020 a la(s) 8:52:43 AM UTC-5, kell...@gmail.com
>> escribió:
>>
>>> Same issue here with newest web2py
>>>
>>> Am Di., 18. Aug. 2020 um 07:08 Uhr schrieb 'Annet' via web2py-users <
>>> web...@googlegroups.com>:
>>>
 I reported the same problem some time ago.

 When I edit a module and save it I get this nameError. Since I am
 importing the modules into other applications I have to restart web2py
 everytime I edit a module.

 Further more the module are no longer compiled on first use, which
 I also find very annoying.

 Annet

 Op zondag 16 augustus 2020 om 12:09:28 UTC+2 schreef Vlad:

> same error, though with a lot more than 3 lines
>
> On Wednesday, June 24, 2020 at 5:36:36 AM UTC-5 serge.bo...@gmail.com
> wrote:
>
>>
>> I have an issue saving my modues with the last version of web2py.
>> Is there something I do wrong?
>>
>> Context: Ubuntu 18.04 / web2py version 2.20.4 / python 3.6.9
>>
>> How to reproduce this issue (a bug??) with a simple example:
>>
>> In the applications examples, create a module (for instance empty.py)
>>
>> Then open it,
>> => url:
>> 127.0.0.1:8000/admin/default/edit/examples/modules/empty.py?id=modules__empty__py
>> The file contains 3 lines:
>> #!/usr/bin/env python
>> # -*- coding: utf-8 -*-
>> from gluon import *
>>
>> do not change anything and save it (ctrl + S)...
>>
>> => Since the last version, I get the following message:
>>
>>  Impossible de recharger le module car:
>>  NameError("name 'reload' is not defined",)
>>
>> Thanks for any advise...
>>
> --
 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.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/web2py/56370ed0-27a0-4b3d-a984-2fd6ac7bb964n%40googlegroups.com
 
 .

>>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/df07ae0b-2ffa-453d-a481-363567f9b6f6n%40googlegroups.com
>> 
>> .
>>
> --
> 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
> 

Re: [web2py] Re: Server SQL non existent or access denied

2020-08-18 Thread AGRogers
Hi Andrea

According to
https://docs.microsoft.com/en-us/sql/connect/python/pyodbc/step-3-proof-of-concept-connecting-to-sql-using-pyodbc?view=sql-server-ver15

*pyODBC uses* the *Microsoft ODBC* driver for SQL Server. If your version
of the *ODBC* driver *is* 17.1 or later, you *can use* the Azure Active
Directory interactive mode of the *ODBC* driver through *pyODBC*.

The numbers might not match yours but the concept should be the same -
pyodbc goes through Microsoft odbc.

It's been a while since I have done something with any odbc driver. But my
first step would be ensuring Microsoft ODBC is working fine. Maybe you have
done that already. I used to just create a connection from, say, MS Office
or Access and verify that I could read the data I needed. Then I would move
onto whatever app it was that I was trying to set up with odbc.




On Sun, 16 Aug 2020, 7:46 pm Andrea Fae',  wrote:

> Hello Villas, first thanks so much. You are gently.
> I will have possibility tomorrow to test. I just installed ODBC driver 17
> in my client, so tomorrow I will test first of all if with a windows DSN
> connection it's possible to connect to SQL server 2016. After it I will try
> using web2py...But I don't know the implication about windows ODBC driver,
> pyodbc (it's another odbc driver...so independent from windows ODBC driver
> I think), and I don't know exactly if my DAL syntax is correct or not,
> because I found different syntax in the web.
> If there will be anyone who could help me I will be very grateful.
> Thank you so much Villas!!
>
> Il giorno sabato 15 agosto 2020 17:27:41 UTC+2, villas ha scritto:
>>
>> >> Do I have to install any ODBC SQL Server Driver on my client?
>>
>> Hi Andrea
>> I feel your frustration and, although I do not use mssql,  I believe you
>> will certainly require a suitable ODBC driver installed so you can then
>> connect to that datasource using pyobc.
>> Maybe this will help  https://github.com/mkleehammer/pyodbc/wiki
>> Note that you should be able to use the pyodbc library independently from
>> web2py.
>> I hope that other mssql users can give better advice.
>> All the best
>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/a3fd7654-838e-416b-b7f6-8c531388979ao%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPttU-_pmRy3Upsi7ZaZNEeueg41g0ORD_PfEyX%2BZtxbA%40mail.gmail.com.


Re: [web2py] Re: Nested menu item

2020-08-18 Thread AGRogers
I'm pretty sure that bootstrap doesn't allow nesting menus more than a
single level. If you need more you need to use a custom menu system.

I'm not sure how that applies to web2py's menu system. But I suspect it too
only accommodates a single level by design.

On Wed, 19 Aug 2020, 7:24 am Vlad,  wrote:

> I may be missing something, but it seems to me that by design MENU helper
> produces regular, simple menu code, as it's not bootstrap-enabled by
> itself. I mean, this was my assumption to begin with; that's why I haven't
> even tried it - rather setting up menu as a list  of items  (i.e. data
> structure to be used in menu, which by default belongs to menu.py) and in
> layout.html I create an explicit bootstrap menu, iterating over the list,
> using appropriate html code, and this is how I use it.
>
> On Tuesday, August 18, 2020 at 4:55:06 AM UTC-4 Annet wrote:
>
>> Hi,
>>
>> I've got a two level menu, however, calling
>>
>> {{=MENU(response.app_menu)}}
>>
>> doesn't render a Bootstrap 4 menu like your resulting html code. It
>> renders something pretty ugly:
>>
>> 
>>   
>> > class="fas fa-home">
>> 
>> 
>>   Our network
>>   Networks we joined
>>  
>>
>>   
>>  
>>
>>
>> Do you have any idea how to solve this issue?
>>
>> Kind regards,
>>
>> Annet
>>
>> Op vrijdag 17 juli 2020 om 16:33:16 UTC+2 schreef Vlad:
>>
>>> Missing something basic, but seems to me that the following code should
>>> result in nested menu:
>>>
>>> response.menu = [['One', False, 'link1',
>>>   [
>>> ['Two', False, None,
>>>['Three', False, 'link3']
>>> ]
>>>   ]
>>>  ]
>>> ]
>>>
>>> "One" menu items contains "two", as it should, but "two" comes out to be
>>> a simple menu item, not containing "three" in it. What's missing?? How do I
>>> make nested sub-menu items?
>>>
>>> Here is the resulting html, where "three" sub-item is not even present:
>>>
>>> 
>>>  >> >One
>>>  
>>>   Two
>>>  
>>> 
>>>
>>>
>>>
>>>
>>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/ac140d58-8f06-4455-b4e0-b9dd9fd028a0n%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMMtf_P0KpggAXXn2kvvT5DCZniofakB3ZSnYU9eKSQ9ww%40mail.gmail.com.


[web2py] How to improve a widget select list that allows new options to be added?

2020-08-18 Thread AGRogers
Hi

I want a drop down list that shows all the values from existing records AND
allows the user to add a new value if they want.

I have got something working using https://select2.org/ . But my approach
is questionable.

The problem i have is that when a new value is added and the form is
submitted, the widget code is called *before* the new value is persisted to
the database. So when the form reloads after successfully being processed,
the dropdown doesn't have the new item and so can't be displayed.

If i then reload the page the new item is included and all is well.

I got around this by delaying the creation of the Select2 dropdown. Instead
of the widget immediately building the Select2 it executes an AJAX call
which grabs the dropdown data and then builds it. Of course this is done
after the form has been accepted so it has the new entry and all works well.

Is this the best way to do it?

Or can i somehow set the widget **after** the form has been created?

Thanks
Andrew

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNVeBd_cU5NSKRBSnyGVxcqDrDRf%2BLnC%3DOqmxshqG7Byg%40mail.gmail.com.


Re: [web2py] Re: pyDAL looks abandoned?

2020-08-17 Thread AGRogers
That's good news.

On Mon, 17 Aug 2020 at 17:08, Massimo Di Pierro 
wrote:

> yes Peewee is more actcie but I would not say pydal is abandoned. pydal is
> more mature and there were commits as recent as last week. In my opinion it
> needs very little work and I am reluctant to change things. Many of the
> issues are requests for new features, some are how to, or support for
> exhotic features. There are also many issue that have been fixed but the
> issue has not been closed. When I have time I will take a pass and close a
> bunch.
>
> I do not think there are many bugs in pydal that need fixing excecpt for
> the need to support google cloud storage in py3.
>
>
> On Monday, 11 May 2020 13:27:14 UTC-7, Val K wrote:
>>
>>
>> There are 131 issues on pyDAL-GitHub, but the problem is not in the
>> amount but in that more than half of them without any response. Look at
>> peewee that has 7.5k stars and only 2 open issues!... yes, this is impolite
>> comparision - sorry.
>> I've just need to implement CTE + WITH RECURSIVE (like this
>> http://docs.peewee-orm.com/en/latest/peewee/querying.html#recursive-ctes
>> )
>> and I wasted 2 days to figure out how I can do very simple thing like  '1
>> AS foo'  in right way that is (as I suppose):
>> Expression(db, '1', type='integer').with_alias('foo')
>>
>> So, the question is: why is there nothing about that in the book?
>> Why does pyDAL have no that very simple but very necessary method  which
>> allows to do cool things like:
>>  db(...).select(
>> ...,
>> db.exp(
>>'max(product.price) OVER(PARTITION BY product.category)',
>>type = 'decimal(n, m)' # the same as Field(..., type = 'decimal(n,
>> m)')
>> ).with_alias('most_expensive_in_category')
>> )
>>
>> here is used WINDOW-function that allows to get products list with
>> 'most_expensive_in_category' in *one* plain query
>> *without using subquery* with GRUOP BY product.category + join
>>
>> Also there is my PR on web2py book
>> https://github.com/web2py/web2py-book/pull/424
>> it hangs for almost a year - it is just a book, not code
>> I'm sad
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/8a858190-e078-44f8-bcff-c88c13dae0b6o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNT4SbbjjKeWNT015pWMm44%3Di77mYgWEBYWpwppxK7LVQ%40mail.gmail.com.


Re: [web2py] Re: Altering reference table format in SQLFORM

2020-08-11 Thread AGRogers
I just tried the format option change to the table to see if it worked for
me... but it didn't. Thanks Villas for the 'requires' tip. I am sure i will
need that knowledge at some point..

On Wed, 12 Aug 2020 at 01:30, David Orme  wrote:

> Thanks! I had played with the represent attribute, with no success, but
> using that first option within the controller works. Changing the validator
> seems a bit over the top just to change the format, but it works!
>
> On Tuesday, 11 August 2020 16:07:36 UTC+1, villas wrote:
>>
>> Off the top of my head, maybe these ideas would put you on a better
>> track...  :)
>>
>> 1.  The reference field has a default validator, try changing it to
>> something like this:
>>
>> db.assignments.marker.requires = IS_IN_DB(db, 'markers.id', '%(last_name)s, 
>> %(first_name)s (%(email)s)')
>>
>> 2. Check out the .represent attribute
>>
>>
>>
>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/dc15ee08-5608-43b2-97fe-2c998aec5a9do%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMOzOnMFfHU0nRY84srzNFtaaeQsNH4dMrm%3D9xrxdua3fQ%40mail.gmail.com.


Re: [web2py] Re: Has anybody had experience with Visual Studio Code Remote Development?

2020-08-10 Thread AGRogers
Thanks Villas. That's encouraging.

On Tue, 11 Aug 2020, 2:17 am villas,  wrote:

> In the absence of other replies...
>
> Massimo has mentioned (in the py4web group)
> <https://groups.google.com/d/msg/py4web/gnPCfFldKwM/MZTuQ5gLAgAJ> that he
> knows generally that many developers are using Visual Studio remotely and
> it is a very good set up, so he strongly recommends it.
> This seems consistent with your experience so I suggest you should
> continue to go with it.
> I use VS locally with web2py and like it,  so I'm thinking to do the same.
>
>
>
> On Friday, 7 August 2020 06:45:16 UTC+1, AGRogers wrote:
>>
>> Hi
>>
>> Has anyone used this sort of config before with web2py? That is, VSC
>> connecting via SSH to a remote server (Google Cloud Debian VM for me) and
>> then being able to debug an app on the remote system.
>>
>> I am getting ready to deploy my app for the first time and have been
>> somewhat fearful that if there is some weird bug I will never be able to
>> track it down without being able to debug on that system.
>>
>> So i stumbled onto this
>> https://code.visualstudio.com/docs/remote/remote-overview which seems
>> really cool - you can run python apps on a remote server and debug it like
>> it was on the localhost.
>>
>> So i got a Google Cloud server installed and got VSC talking to it fine
>> and debugged a one line python 'app'. So that was neat.
>>
>> But I am not sure where to start with web2py in this environment. I
>> havent tried very hard yet though.
>>
>> Can anyone tell me i am wasting my time or that it works great?
>>
>> Thanks
>> Andrew
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/68a5b9a0-368c-4d3c-990f-491190f98fbeo%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/68a5b9a0-368c-4d3c-990f-491190f98fbeo%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMM-7HsMEP9g854%2BoCuu8jfCZWvFo_rifSoTzXghY6ZNLg%40mail.gmail.com.


Re: [web2py] Re: Has anybody had experience with Visual Studio Code Remote Development?

2020-08-10 Thread AGRogers
Thanks Kevin. I didn't need to do anything in my app to be able to debug.
My app was literally only two lines of code. Maybe things have changed? I
will keep you posted with my progress.

On Tue, 11 Aug 2020, 5:15 am Kevin Keller,  wrote:

> I tried to use it once remotely, not even web2py related, but there were
> quite some hoops to jump through, as far I as remembered.
>
> You have to add some custom code to your app to make communicate etc. and
> I could not be bothered.
>
> Anyways, I went back to just use vim with several plugins that make it a
> nice VS Code type experience.
>
> Happy to share the .vimrc file.
>
> Am Mo., 10. Aug. 2020 um 18:17 Uhr schrieb villas :
>
>> In the absence of other replies...
>>
>> Massimo has mentioned (in the py4web group)
>> <https://groups.google.com/d/msg/py4web/gnPCfFldKwM/MZTuQ5gLAgAJ> that
>> he knows generally that many developers are using Visual Studio remotely
>> and it is a very good set up, so he strongly recommends it.
>> This seems consistent with your experience so I suggest you should
>> continue to go with it.
>> I use VS locally with web2py and like it,  so I'm thinking to do the same.
>>
>>
>>
>> On Friday, 7 August 2020 06:45:16 UTC+1, AGRogers wrote:
>>>
>>> Hi
>>>
>>> Has anyone used this sort of config before with web2py? That is, VSC
>>> connecting via SSH to a remote server (Google Cloud Debian VM for me) and
>>> then being able to debug an app on the remote system.
>>>
>>> I am getting ready to deploy my app for the first time and have been
>>> somewhat fearful that if there is some weird bug I will never be able to
>>> track it down without being able to debug on that system.
>>>
>>> So i stumbled onto this
>>> https://code.visualstudio.com/docs/remote/remote-overview which seems
>>> really cool - you can run python apps on a remote server and debug it like
>>> it was on the localhost.
>>>
>>> So i got a Google Cloud server installed and got VSC talking to it fine
>>> and debugged a one line python 'app'. So that was neat.
>>>
>>> But I am not sure where to start with web2py in this environment. I
>>> havent tried very hard yet though.
>>>
>>> Can anyone tell me i am wasting my time or that it works great?
>>>
>>> Thanks
>>> Andrew
>>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/68a5b9a0-368c-4d3c-990f-491190f98fbeo%40googlegroups.com
>> <https://groups.google.com/d/msgid/web2py/68a5b9a0-368c-4d3c-990f-491190f98fbeo%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CADHCKLRh8Rd9vi2q9DRAudf9C5iPaa-pzzUhWLu83rsQ%3DHW%3DNg%40mail.gmail.com
> <https://groups.google.com/d/msgid/web2py/CADHCKLRh8Rd9vi2q9DRAudf9C5iPaa-pzzUhWLu83rsQ%3DHW%3DNg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNPq2FA7ToLrpAp%3D%2B3TaQJkPfCpwW51zNj-CqqMyJn8zQ%40mail.gmail.com.


[web2py] Has anybody had experience with Visual Studio Code Remote Development?

2020-08-06 Thread AGRogers
Hi

Has anyone used this sort of config before with web2py? That is, VSC
connecting via SSH to a remote server (Google Cloud Debian VM for me) and
then being able to debug an app on the remote system.

I am getting ready to deploy my app for the first time and have been
somewhat fearful that if there is some weird bug I will never be able to
track it down without being able to debug on that system.

So i stumbled onto this
https://code.visualstudio.com/docs/remote/remote-overview which seems
really cool - you can run python apps on a remote server and debug it like
it was on the localhost.

So i got a Google Cloud server installed and got VSC talking to it fine and
debugged a one line python 'app'. So that was neat.

But I am not sure where to start with web2py in this environment. I havent
tried very hard yet though.

Can anyone tell me i am wasting my time or that it works great?

Thanks
Andrew

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNyM8Op2MmusQyCLnE_4BcXtfSN063GFxNFxHdc6Un-EQ%40mail.gmail.com.


Re: [web2py] Re: How to send contenteditable to web2py AJAX call

2020-08-03 Thread AGRogers
Thanks for update.

On Sun, 2 Aug 2020, 6:38 am Rob Paire,  wrote:

> So I stepped through the Web2py AJAX call in the debugger and found that
> the hang-up was due to jquery serialize method. That method wants a form
> variable name as input. The easiest solution is to wrap the table in a set
> of form tags and then modify the TD so that it contains a form input object
> like this:
>
>   
>
> now the ajax call works as expected. A dash of CSS to hide the field
> borders and the end results look acceptable!
>
> Thank you for all  your help
>
> On Friday, July 31, 2020 at 6:34:45 PM UTC-4, Rob Paire wrote:
>>
>> Hi All,
>> I am trying to send data entered into the contenteditable feature of a
>> row object using a Web2py AJAX call, and it's not working.
>>
>> The problem is illustrated below in a sample View file with two Ajax
>> calls. The first call, from the manual, uses an input form variable and it
>> works fine. In second call I tried passing the Name of the editable content
>> object to the AJAX call, but it does not work. In short, I want to send
>> document.getElementById('q').innerHTML as the data parameter of the ajax
>> function - how is this done?  I tried various combinations of dict strings
>> {'key':'value'} as the data parameter but nothing seemed to work.
>>
>> Note: the controller data function looks for both r and q request.vars
>>
>> {{extend 'layout.html'}}
>> 
>> Ajax call example from the manual works perfectly.. the data appears
>> in the target Above.
>> 
>> 
>> >onclick="ajax('{{=URL('data')}}',['r'],'target');"/>
>> 
>> 
>>
>> > align="center">
>> 
>>   
>>
>> This AJAX call does not work:  > onfocusout="ajax('{{=URL('data')}}',['q'],'target');"
>>  contenteditable="true" id="q" name="q" COLSPAN="1" > ajaxdata 
>>
>>  how do I pass the contenteditable data M to the AJAX
>> function? 
>> 
>> 
>>
>> Thank you kindly
>> -Rob
>>
>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/6b8bc494-d26d-4136-bb02-2cbc4b498f14o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNJABQGN8tCxXy0ghuvuH8-K75rse0np65LwQhzSY%3D4Pw%40mail.gmail.com.


Re: [web2py] WAF2PY 1.0

2020-08-03 Thread AGRogers
Looks cool. Thanks for sharing.

On Mon, 3 Aug 2020, 4:25 pm Christian Varas,  wrote:

> Hello all.
> I'm glad to announce  WAF2PY 1.0 
>
> *What is this?*
>
> WAF2PY is a Web Application Firewall using NGINX and ModSecurity. WAF2PY
> provides a nice and easy to use web interface *powered by* *WEB2PY* that
> controls modsecurity and nginx configuration in an easy way, allowing you
> to configure protection for any web application in just minutes.
>
>
>
> *Features*
>
>- Protect a site in just minutes
>- Create global or local exclusions for any rule
>- Add virtual interfaces
>- Create static routes for the desired app
>- Analyze debug, access, error and audit logs
>- Download logs
>- Check the stats for every application
>- Disable/Enable protection with just 1 click
>- Enable/Disable rules
>- Modify rules
>- Restrict paths or files
>- Insert headers
>- Start/Stop/Reload/Check Syntax of NGINX
>- CAPTCHA on login (Google Recaptcha2)
>- Two-step Login Authentication (Email code)
>- Written on Python3
>
>
> *Images*
>
> https://photos.app.goo.gl/kXrsQTPPMuAXi8Tr5
>
> *Download*
>
> You can download WAF2PY from github: https://github.com/ITSec-Chile/Waf2Py
> 
>
> *About this bundle*
>
> Tested in Debian 10 (No docker).
>
> *Components for this build:*
>
>- Waf2Py 1.0 App
>- Web2Py 2.20.2
>- Nginx version: openresty 1.17.6.2
>- ModSecurity v3 - libmodsecurity3
>- Modsecurity Nginx connector OWASP ModSecurity Core Rule Set (CRS) 3.3
>
>
>
> I know this can be off topic in this list, but web2py users may want to
> have a look at it :)
>
>
> Cheers.
> Chris.
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CA%2Bs%2BuJvbsBAkMPnVTqjGYaMYL_AqGbJ5M9NqUyC5m-AEBZLjSQ%40mail.gmail.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPpMEVk%2BNOvuQxoumC8yxW-pSpPj%3DahfrX%2BLT%3DEYRmEeg%40mail.gmail.com.


Re: [web2py] Re: How to send contenteditable to web2py AJAX call

2020-08-01 Thread AGRogers
Is there a reason you can't use the standard js or jquery ajax calls? Then
you can build your own data structures easily and see exactly what is going
where. I found things easier to debug that way.

The only time I use the web2py one is when I want to send a web2py form
back to the controller. It handles that elegantly.

But you are not using a web2py form I don't think.



On Sat, 1 Aug 2020, 11:33 pm Rob Paire,  wrote:

> Hi Clemens
> Appreciate your comments. Both calls have the same target - it's the first
> tag in the HTML.
>
> The property of contenteditable has been applied to the TD so it is no
> longer static, but in fact the user can edit it.
>
> In the finished product there will be a large HTML table or grid that the
> user can edit and the goal is to use an AJAX call to send the data back to
> the server one cell at a time, or maybe I will loop the table object once
> looking for changes. The table will be fixed length of around 150 rows.
>
> I know all this can be done with the form generator in Web2py but I
> inherited the HTML and it looks good, only problem is how to save the input
> data.
>
> My backup plan is to put a hidden form with one input and use that form
> variable as a proxy to make the AJAX call. This kind of hacky solution goes
> against the grain and it's seems like there has to be a better way.
>
> -Rob
>
> On Sat, Aug 1, 2020, 4:50 AM Clemens 
> wrote:
>
>> Hi,
>>
>> currently I'm in hurry. Thus, only a quick help by hint:
>>
>> In your second, non-working example, I can't find a the target which is
>> addressed by your call (first example from documentation it's > id="target">)
>>
>> And why do you want a ajax action for the , because it's static. What
>> do you want to archive by this? Maybe there is an easier way for that.
>>
>> Best regards
>> Clemens
>>
>>
>> On Saturday, August 1, 2020 at 12:34:45 AM UTC+2, Rob Paire wrote:
>>>
>>> Hi All,
>>> I am trying to send data entered into the contenteditable feature of a
>>> row object using a Web2py AJAX call, and it's not working.
>>>
>>> The problem is illustrated below in a sample View file with two Ajax
>>> calls. The first call, from the manual, uses an input form variable and it
>>> works fine. In second call I tried passing the Name of the editable content
>>> object to the AJAX call, but it does not work. In short, I want to send
>>> document.getElementById('q').innerHTML as the data parameter of the ajax
>>> function - how is this done?  I tried various combinations of dict strings
>>> {'key':'value'} as the data parameter but nothing seemed to work.
>>>
>>> Note: the controller data function looks for both r and q request.vars
>>>
>>> {{extend 'layout.html'}}
>>> 
>>> Ajax call example from the manual works perfectly.. the data appears
>>> in the target Above.
>>> 
>>> 
>>> >>onclick="ajax('{{=URL('data')}}',['r'],'target');"/>
>>> 
>>> 
>>>
>>> >> align="center">
>>> 
>>>   
>>>
>>> This AJAX call does not work:  >> onfocusout="ajax('{{=URL('data')}}',['q'],'target');"
>>>  contenteditable="true" id="q" name="q" COLSPAN="1" > ajaxdata 
>>>
>>>  how do I pass the contenteditable data M to the AJAX
>>> function? 
>>> 
>>> 
>>>
>>> Thank you kindly
>>> -Rob
>>>
>>>
>>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/JbVMYAjnFsw/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/f2c060de-1017-41c5-bf6f-08356433ba71o%40googlegroups.com
>> 
>> .
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CACSwhqGUo57SzoUHPhPn8Ne3dMoAoPWxTe8hpVLL%3Ddx%3D5f4a0A%40mail.gmail.com
> 
> .
>

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

Re: [web2py] Use cron

2020-07-23 Thread AGRogers
Sorry, can't help there. I have just started to use the Scheduler which is
part of web2py. It was easy to setup and seems to work well. Is there a
reason you can't use it?

On Thu, 23 Jul 2020, 1:53 pm Martin Weissenboeck, 
wrote:

> I use web2py with nginx.Now I need cron . I have read, that habe to use
> "-Y" to activate it. But where is the place for this option, which
> configuration file?
>
> Regards, Martin
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CAMcwXCexnSYtV7X5VyW%3DGF6h8gcc1GPX%2BJBiZXBssK3H4C5PzA%40mail.gmail.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMN4PihiG72_4-AOAOD6Oy-12fzfrR84NesodgBoiJPfdQ%40mail.gmail.com.


Re: [web2py] Starting 2 web2py standalone applications at the same time

2020-07-23 Thread AGRogers
I think you just need to run each on a different port.

On Thu, 23 Jul 2020, 3:57 pm mostwanted,  wrote:

> Hi Guys, how can i install 2 web2py binary standalone applications in one
> computer & start them at the same time without them interfering with one
> another?
>
> I am asking this because everytime i try to start 2 web2py standalone
> applications they interfere with one another, its like they get bumbled up
> together the computer cant differentiate between the two.
>
> Regrads;
>
> Mostwanted
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/5f86cbe6-fd88-463a-9d2c-54bb5aa9aaa5o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMOcYOS1zmraTNfARHZYobz-5mjkNAXZDRSQnkWTj%2B%2BT%2Bg%40mail.gmail.com.


Re: [web2py] Re: How to define constraints DAL Beginner

2020-07-22 Thread AGRogers
Maybe Ivan was just thinking of the Reference fields?
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-types


If so try:

 db.define_table('jogador',
Field('nome', 'reference equipe'),
Field('posicao','string'),
Field('altura','double'),
Field('peso','double'),
Field('equipe')
)

On Wed, 22 Jul 2020 at 16:53, Dave S  wrote:

>
>
> On Tuesday, July 21, 2020 at 5:59:20 PM UTC-7, Ivan Luis wrote:
>>
>> db.define_table('jogador',
>> Field('nome', 'string'),
>> Field('posicao','string'),
>> Field('altura','double'),
>> Field('peso','double'),
>> Field('equipe')
>> )
>>
>> db.define_table('equipe',
>> Field('nome', 'string')
>>)
>>
>> I'm trying do reference the field " Equipe " at Jogador with "Name" at
>> Equipe but i don't know how to do this, i'm beginner in web2py and beginner
>> on Developer Life too
>> Can someone help me understand how this thing works ?
>>
>
> I don't understand what you are asking.
>
> If you have a field "nome" in the two tables that match up, you can do a
> join between the tables, and from the join results select the fields you
> want to display or manipulate.  Rows in the tables that have the value
> "Todo" in the field "nome" would be combined to make a larger row.
>
> But your sample code seems to have nothing in the "Equipe" table except
> "nome"., so I'm not sure what you want that table for.
>
> BTW, you seem to have applied a color option to your sample code that
> makes it almost impossible to read ... white on white, it looks like.  I've
> changed the color in my reply.  If this is a result of pasting from your
> editing tools (IDE, perhaps), be warned ... and maybe check the color
> yourself.
>
> /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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/1bd9b206-eaad-41de-a0f8-0467e27d9c45o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMMCu2oW2yvss%3DoJkAmhvY%3DV9M_8J1tQw%2BAGErf6OzyHOw%40mail.gmail.com.


Re: [web2py] No module named error

2020-07-22 Thread AGRogers
I think I'm on the latest versions of web2py and python. And i have
problems getting modules to recompile (not sure how related that is to this
topic). I gave up and just put all my modules in the Models folder. That
always works for me. I'm going to need to sort that out though at some
point.  But to be clear, i am not saying there is anything wrong with
web2py. My general knowledge is scant so it could well be me doing
something wrong.

On Wed, 22 Jul 2020 at 16:28, Dave S  wrote:

>
>
> On Saturday, July 18, 2020 at 2:15:13 PM UTC-7, xgp.l...@gmail.com wrote:
>>
>> Hi,
>>
>> Im replicating the example from the book for better testing:
>>
>> ./modules/mytest.py
>>
>> from gluon import current
>>
>> def ip():
>>   return current.request.client
>>
>> ./controllers/test.py
>>
>> from applications.mdplenus.modules.mytest import ip
>>
>
> I have a function restuff() in  dot/modules/restuff.py
>
> I use "import restuff"
>
> I admit that for those files  I'm on python 2.7.something and several
> bumps back  on web2py versions (I've tried newer ones, just haven't needed
> to go all in for them yet).  So it's possible that something changed that
> broke things, but I expect the regression tests Massimo has would have
> caught it.
>
> web2py, unlike the newer py4web, uses a custom importer.
>
>
>> def index():
>> return "Your ip is " + mytest.ip()
>>
>>
>> * Same error: ImportError('No module named apptest.modules.mytest',)
>>
>>
> /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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/c1e19587-9ad9-40d0-9718-fb7200da3f64o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNUEOGXV8DYtRbB%2BQeFU8kjxRTjcuMTxc-azDsFEA2ccQ%40mail.gmail.com.


Re: [web2py] Any alternative to installing web2py on laptop

2020-07-19 Thread AGRogers
Sure. pythonanywhere.com is where I started.

Maybe it can run from a USB stick? I think it is pretty portable - but i
have never done that and you would be better listening to someone else.

On Mon, 20 Jul 2020 at 15:24, Nishant Bansal  wrote:

> Hi,
> I have a company provided laptop and I cannot install any external
> software on it. Is there any way to being able to work using web2py without
> installing it,  for e.g - there are online versions of Jupyter notebook
> available for writing python code.
>
> Thanks,
> Nishant
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/1b736e62-05e7-4382-a71f-5c936bd96a3eo%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNCupHAjxiuAL3d8xbX5BwVUFc6%2BWqS%2BCrKPVXf6vAG6A%40mail.gmail.com.


Re: [web2py] display items only entered by a logged in user in a dropdown menu of a reference table

2020-07-19 Thread AGRogers
I'm not sure that is possible Sanka. At least I have not read it in the
book nor seen it referenced by anyone.

I expect you have to write a custom form and handle it manually. But web2py
can still help with those tasks.

On Mon, 20 Jul 2020, 12:45 pm Sanka kanaka krupakar, 
wrote:

> Dear group members
>
> Please advise how to create multiple rows insert by usung SQL form .
>
> On Mon 20 Jul, 2020, 05:37 AGRogers,  wrote:
>
>> Great. It's a cool feature.
>>
>> You would have read that you can turn it off in code temporarily just by
>> setting common_filter =none.
>>
>> That has caught me a few times.
>>
>> On Sun, 19 Jul 2020, 11:06 pm mostwanted,  wrote:
>>
>>> Hey AGRogers, thanks for that suggestion, I added the highlited lines to
>>> my model code & it gave results, thank you very much:
>>>
>>>
>>> db.define_table('lecturer',
>>> Field('surname'),
>>> Field('name'),
>>> Field('title'),
>>> Field('posted_by', 'reference auth_user', default=auth.
>>> user_id, readable=False, writable=False),
>>> *common_filter = lambda query: db.lecturer.posted_by ==
>>> auth.user_id,*
>>> format="%(surname)s %(name)s %(title)s")
>>> def lecturer(details): return '%(surname)s %(name)s' % details
>>>
>>> db.define_table('subject',
>>> Field('subject_name'),
>>> Field('posted_by', 'reference auth_user', default=auth.
>>> user_id, readable=False, writable=False),
>>> *common_filter = lambda query: db.subject.posted_by ==
>>> auth.user_id,*
>>> format="%(subject_name)s"
>>>)
>>> db.define_table('departments',
>>> Field('department_name'),
>>> Field('posted_by', 'reference auth_user', default=auth.
>>> user_id, readable=False, writable=False),
>>> *common_filter = lambda query: db.departments.posted_by
>>> == auth.user_id,*
>>> format="%(department_name)s")
>>>
>>> db.define_table('lecture',
>>>
>>> *Field('subject_name', 'reference subject'),
>>> Field('department', 'reference departments'),* #HERE
>>> Field('theLevels', label=SPAN('Levels'), requires=
>>> IS_IN_SET(['1.1', '1.2', '2.1', '2.2', '3.1', '3.2', '4.1', '4.2'], zero
>>> ='---Select A Level---')), #HERE
>>> *Field('lecturer', 'reference lecturer'),*
>>> Field('class_session', requires=IS_IN_SET(['single
>>> session', 'double session', 'evening single session', 'evening double
>>> session'], zero='Select A Session Period')),
>>>     Field('the_time2', readable=False, writable=False),
>>> Field('class_room', requires=IS_IN_SET(['500', '501',
>>> '502', '503', '504', '505', '506'], zero='---Select A Class Room---')),
>>> Field('controller', readable=False, writable=False),
>>> Field('posted_by', 'reference auth_user', default=auth.
>>> user_id, readable=False, writable=False))
>>>
>>> Regards;
>>>
>>> Mostwanted
>>>
>>> On Sunday, July 19, 2020 at 1:13:06 PM UTC+2, AGRogers wrote:
>>>>
>>>> I would try using a common_filter on the drop down list table. Could
>>>> that work?
>>>>
>>>> On Sun, 19 Jul 2020, 6:10 pm mostwanted,  wrote:
>>>>
>>>>> In my application I have 4 tables, 3 of them referenced in the fourth
>>>>> table but every user should be able to view only what they have entered
>>>>> into the database. Is there a way that in a dropdown list of a referenced
>>>>> table in an SQLFORM users can only view & select from items they have
>>>>> entered?
>>>>>
>>>>> *MODELS CODE:*
>>>>> db.define_table('lecturer',
>>>>> Field('surname'),
>>>>> Field('name'),
>>>>> Field('title'),
>>>>> Field('posted_by', 'reference auth_user', default=auth
>>>>> .user_id, readable=False, writable=False), #HERE
>>>>> format="%(surname)s %(name)s %(title)s")
>>>>> def lecturer(details): return '%(surname)s %(name)s' % details
>>>>>
>>>>

Re: [web2py] display items only entered by a logged in user in a dropdown menu of a reference table

2020-07-19 Thread AGRogers
Great. It's a cool feature.

You would have read that you can turn it off in code temporarily just by
setting common_filter =none.

That has caught me a few times.

On Sun, 19 Jul 2020, 11:06 pm mostwanted,  wrote:

> Hey AGRogers, thanks for that suggestion, I added the highlited lines to
> my model code & it gave results, thank you very much:
>
>
> db.define_table('lecturer',
> Field('surname'),
> Field('name'),
> Field('title'),
> Field('posted_by', 'reference auth_user', default=auth.
> user_id, readable=False, writable=False),
> *common_filter = lambda query: db.lecturer.posted_by ==
> auth.user_id,*
> format="%(surname)s %(name)s %(title)s")
> def lecturer(details): return '%(surname)s %(name)s' % details
>
> db.define_table('subject',
> Field('subject_name'),
> Field('posted_by', 'reference auth_user', default=auth.
> user_id, readable=False, writable=False),
> *common_filter = lambda query: db.subject.posted_by ==
> auth.user_id,*
> format="%(subject_name)s"
>)
> db.define_table('departments',
> Field('department_name'),
> Field('posted_by', 'reference auth_user', default=auth.
> user_id, readable=False, writable=False),
> *common_filter = lambda query: db.departments.posted_by ==
> auth.user_id,*
> format="%(department_name)s")
>
> db.define_table('lecture',
>
> *Field('subject_name', 'reference subject'),
> Field('department', 'reference departments'),* #HERE
> Field('theLevels', label=SPAN('Levels'), requires=
> IS_IN_SET(['1.1', '1.2', '2.1', '2.2', '3.1', '3.2', '4.1', '4.2'], 
> zero='---Select
> A Level---')), #HERE
> *Field('lecturer', 'reference lecturer'),*
> Field('class_session', requires=IS_IN_SET(['single
> session', 'double session', 'evening single session', 'evening double
> session'], zero='Select A Session Period')),
> Field('the_time2', readable=False, writable=False),
> Field('class_room', requires=IS_IN_SET(['500', '501',
> '502', '503', '504', '505', '506'], zero='---Select A Class Room---')),
> Field('controller', readable=False, writable=False),
> Field('posted_by', 'reference auth_user', default=auth.
> user_id, readable=False, writable=False))
>
> Regards;
>
> Mostwanted
>
> On Sunday, July 19, 2020 at 1:13:06 PM UTC+2, AGRogers wrote:
>>
>> I would try using a common_filter on the drop down list table. Could that
>> work?
>>
>> On Sun, 19 Jul 2020, 6:10 pm mostwanted,  wrote:
>>
>>> In my application I have 4 tables, 3 of them referenced in the fourth
>>> table but every user should be able to view only what they have entered
>>> into the database. Is there a way that in a dropdown list of a referenced
>>> table in an SQLFORM users can only view & select from items they have
>>> entered?
>>>
>>> *MODELS CODE:*
>>> db.define_table('lecturer',
>>> Field('surname'),
>>> Field('name'),
>>> Field('title'),
>>> Field('posted_by', 'reference auth_user', default=auth.
>>> user_id, readable=False, writable=False), #HERE
>>> format="%(surname)s %(name)s %(title)s")
>>> def lecturer(details): return '%(surname)s %(name)s' % details
>>>
>>> db.define_table('subject',
>>> Field('subject_name'),
>>> Field('posted_by', 'reference auth_user', default=auth.
>>> user_id, readable=False, writable=False), #HERE
>>> format="%(subject_name)s"
>>>)
>>> db.define_table('departments',
>>> Field('department_name'),
>>> Field('posted_by', 'reference auth_user', default=auth.
>>> user_id, readable=False, writable=False), #HERE
>>> format="%(department_name)s")
>>>
>>> db.define_table('lecture',
>>>
>>> *Field('subject_name', 'reference subject'),
>>> Field('department', 'reference departments'),* #HERE
>>> Field('theLevels', label=SPAN('Levels'), requires=
>>> IS_IN_SET(['1.1', '1.2', '2.1', '2.2', '3.1', '3.2', '4.1', '4.2'], zero
>>> ='---Select A Level---')), #HERE
>>> *Field('lecturer', 'reference lecturer'),*
>>>   

Re: [web2py] display items only entered by a logged in user in a dropdown menu of a reference table

2020-07-19 Thread AGRogers
I would try using a common_filter on the drop down list table. Could that
work?

On Sun, 19 Jul 2020, 6:10 pm mostwanted,  wrote:

> In my application I have 4 tables, 3 of them referenced in the fourth
> table but every user should be able to view only what they have entered
> into the database. Is there a way that in a dropdown list of a referenced
> table in an SQLFORM users can only view & select from items they have
> entered?
>
> *MODELS CODE:*
> db.define_table('lecturer',
> Field('surname'),
> Field('name'),
> Field('title'),
> Field('posted_by', 'reference auth_user', default=auth.
> user_id, readable=False, writable=False), #HERE
> format="%(surname)s %(name)s %(title)s")
> def lecturer(details): return '%(surname)s %(name)s' % details
>
> db.define_table('subject',
> Field('subject_name'),
> Field('posted_by', 'reference auth_user', default=auth.
> user_id, readable=False, writable=False), #HERE
> format="%(subject_name)s"
>)
> db.define_table('departments',
> Field('department_name'),
> Field('posted_by', 'reference auth_user', default=auth.
> user_id, readable=False, writable=False), #HERE
> format="%(department_name)s")
>
> db.define_table('lecture',
>
> *Field('subject_name', 'reference subject'),
> Field('department', 'reference departments'),* #HERE
> Field('theLevels', label=SPAN('Levels'), requires=
> IS_IN_SET(['1.1', '1.2', '2.1', '2.2', '3.1', '3.2', '4.1', '4.2'], 
> zero='---Select
> A Level---')), #HERE
> *Field('lecturer', 'reference lecturer'),*
> Field('class_session', requires=IS_IN_SET(['single
> session', 'double session', 'evening single session', 'evening double
> session'], zero='Select A Session Period')),
> Field('the_time2', readable=False, writable=False),
> Field('class_room', requires=IS_IN_SET(['500', '501',
> '502', '503', '504', '505', '506'], zero='---Select A Class Room---')),
> Field('controller', readable=False, writable=False),
> Field('posted_by', 'reference auth_user', default=auth.
> user_id, readable=False, writable=False))
>
>
>
> *CONTROLLER CODE:*
> I tried the highlighted part but it didnt work, I felt it wouldnt work but
> tried it anyway & it didnt work (shocker!)
> Please help me figure this out.
> def index():
>
>
> *user=db.auth_user(auth.user_id)if not user or
> not(user.id==auth.user_id): redirect(URL('index'))
> form=SQLFORM(db.lecture.posted_by==user.id)*
> if form.process(onvalidation=my_form_processing).accepted:
> response.flash=T('Lecture Entered')
> return locals()
>
>
> Regards;
>
> Mostwanted
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/e98d4e6a-69a2-4c1c-9028-3d98579a0f59o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMP2fFWv9HjEjKD2rN1LrEWw6%3DGfppLu3GE-_cNrDPp%3Dow%40mail.gmail.com.


Re: [web2py] Re: smart grid

2020-07-18 Thread AGRogers
Great

On Sat, 18 Jul 2020 at 22:35, T.R.Rajkumar  wrote:

> Thank you AGRogers. It works.
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/027b2e4a-5225-4232-a4c9-a2a10e5e532do%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/027b2e4a-5225-4232-a4c9-a2a10e5e532do%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMOyRqtSnP9_hSOMpmknD976xtW%3DtTttTauOnMwf0fW%2B5g%40mail.gmail.com.


Re: [web2py] Re: smart grid

2020-07-18 Thread AGRogers
This is how i do something similar in one of my tables:

db.define_table('OrganisationUser',
Field(.),
format = lambda r: ("%s [%s]") % (db.auth_user(r.UserID).DisplayName,
db.Organisation(r.OrganisationID).ShortName)
)

For you maybe:

db.define_table('pm_equip',
  Field(.) .
  format = lambda r: ("%s [$s]") % (r.equipment_detail,
db.pm_location(r.location_id).location_name)
)



On Sat, 18 Jul 2020 at 15:33, T.R.Rajkumar  wrote:

> Thank you AGRogers
> As you said the equipment record format to include the location, that
> would do for me.
> Can you please tell how to do that.
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/c25d0e90-0524-4a63-95f5-85fa475b2b45o%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/c25d0e90-0524-4a63-95f5-85fa475b2b45o%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPpgK21YecGimOyYLQgzma%3DUAYGp_R4tKE01NEnw7VjrA%40mail.gmail.com.


Re: [web2py] Nested menu item

2020-07-17 Thread AGRogers
I don't think bootstrap (which is what web2py utilises I think) allows for
the second nested level. So to do it you would need to implement your own
custom menu structure.

On Sat, 18 Jul 2020, 12:33 am Vlad,  wrote:

> Missing something basic, but seems to me that the following code should
> result in nested menu:
>
> response.menu = [['One', False, 'link1',
>   [
> ['Two', False, None,
>['Three', False, 'link3']
> ]
>   ]
>  ]
> ]
>
> "One" menu items contains "two", as it should, but "two" comes out to be a
> simple menu item, not containing "three" in it. What's missing?? How do I
> make nested sub-menu items?
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/8e2371ef-4b20-4369-86e0-1d1ebf911952o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPH458V35O1Jh%2BKto_Ed2HznYwOsL9wW1qh%2BRe-BP093Q%40mail.gmail.com.


Re: [web2py] smart grid

2020-07-17 Thread AGRogers
One option would be to set the Format of the Equipment record to also
include the location - eg 'My Equipment (It's Location)'

Then your selection drop down list should include the location.

On Fri, 17 Jul 2020, 9:49 pm T.R.Rajkumar,  wrote:

> db.define_table('pm_events',
> Field('eqp_id', 'reference pm_equip'),
> Field('lc_no', 'reference
> dblc.lc_vw_lc_master.lc_no'),
> Field('pending_work', type='string'),
> Field('remarks', type='string'),
> Field('completed', type='string',
> length=1,required='True',notnull='True'),
>
> Field('update_uid','string',length=6,required='True',notnull='True',default
> = session.uname),
>
> Field('update_dt','datetime',required='True',notnull='True',default=request.now)
> )
>
>
> dblc.define_table('lc_vw_lc_master',
> Field('lc_no',
> type='string',length=11,required='True',notnull='True'),
> Field('unit_descr',type='string'),
> Field('btg_descr',type='string'),
> Field('sys_descr',type='string'),
> Field('eqp_descr',type='string'),
> Field('lc_from',type='datetime'),
> Field('lc_to',type='datetime'),
> Field('work_descr',type='string'),
> Field('lc_req_uname',type='string', length=11),
> Field('lc_statue',type='string'),
> Field('lc_req_dt',type='datetime'),
> Field('lc_issue_uname',type='string', length=11),
> Field('lc_issue_dt',type='datetime'),
> primarykey=['lc_no'],
> migrate=False)
>
> db.define_table('pm_equip',
> Field('equipment_id', 'integer'),
> Field('equipment_no', 'string', length = 25),
> Field('equipment_detail','string'),
> Field('division_id', 'integer'),
> Field('location_id', 'reference pm_location'),
> Field('subdivision_id', 'integer'),
> Field('divn', 'string',length = 10),
> Field('rep_code', 'string', length = 10)
>)
> db.define_table('pm_location',
> Field('location_id', 'integer'),
> Field('location_name', 'string')
> )
>
> I have the above tables in db.py
> Now in controller pm_events.py I want to have a form for pm_events which
> has reference to pm_equip which in turn has reference to pm_location.
> In the create form for pm_events on the selection of equipment it should
> show the location of the equipment and user enters other details and
> submits the form.
> How to achieve this functionality, may be in a smart grid.
> Thank you for the time.
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/2f1ae9c8-a967-443f-b0f4-197ab4f869e3o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNPJBpOAeWDZy_LjG1895od_o1V32UtxP5CvDVZmcA6YQ%40mail.gmail.com.


Re: [web2py] Re: Under what circumstances would db.define_table() return None

2020-07-17 Thread AGRogers
That's for sure! His stack exchange posts really helped me get around some
problems early on... and now :-) I should pray for a special blessing for
him tomorrow 

On Fri, 17 Jul 2020, 9:05 pm villas,  wrote:

> That's great Andrew.
> BTW great to see that Anthony is helping - he is someone who really knows
> the nuts and bolts of web2py!
>
>
>
> On Friday, 17 July 2020 08:05:40 UTC+1, Andrew Rogers wrote:
>>
>> Thanks for your response Villas. My reason for this approach is that i
>> have a lot of code that expects a table object and i am trying to avoid
>> having to modify it to handle the a different format.
>>
>> Anthony on Stack Exchange found my error. He said:
>> "You probably also set DAL(..., lazy_tables=True), in which
>> case, db.define_table() returns None rather than a Table object, as the
>> table is not actually created until first accessed via db.tablename.
>>
>> Given your code, there is no benefit to setting lazy_tables=True, as all
>> tables are accessed (and therefore created) immediately after definition
>> anyway."
>>
>> On Thursday, 16 July 2020 at 03:43:40 UTC+10 villas wrote:
>>
>>> You don't mention...
>>>
>>>- Which DB adapter you are using
>>>- Why just one of your tables is expected to be an in-memory table
>>>and the others not
>>>- Why you don't simply maintain the list of tables in a list(), or
>>>dict() or some other in-memory structure
>>>
>>> In any case, maybe this idea might help...
>>>
>>> db = DAL("sqlite://storage.sqlite") # or whichever DB you are using
>>> dbmemo = DAL("sqlite:memory")
>>>
>>> dbmemo.define_table('DatabaseModel', Field('TableName'))
>>>
>>> for t in db.tables:
>>> dbmemo.DatabaseModel.update_or_insert(TableName=t)
>>>
>>>
>>> On Wednesday, 15 July 2020 07:45:36 UTC+1, Andrew Rogers wrote:

 This code working fine but now it fails because the db.define_table()
 returns None.

 table = db.define_table('DatabaseModel', Field('TableName'))  # This
 is not working now
 for t in db.tables:
 table.update_or_insert(TableName=t)

 The only thing that I think I have changed that might have affected it
 was setting migrate = false in appconfig.ini. I have changed it back
 but to no avail.

 What could stop db.define_table from returning a table?

 (I am using this to create an in-memory table which I populate with a
 list of actual tables.)

 Thanks.

 PS:
 https://stackoverflow.com/questions/62908908/under-what-circumstances-would-db-define-table-return-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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/b3dcebaa-7aee-4e25-ab8f-fea7b28b86c5o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMN7Ld%3DvNKM2T4WSfr3%2BPsepPyh5PB19DRB_x%3DGSDfyJcA%40mail.gmail.com.


Re: [web2py] Re: web2py online debugger under python3

2020-07-16 Thread AGRogers
Hi Seth

I have no idea sorry. I would like to know the answer to this question
though.

Andrew

On Fri, 17 Jul 2020, 7:28 am Seth J,  wrote:

> So, what would you recommend for "remote debugging" situation?  I have
> web2py running on internal firewalled Windows 2016 Server and have been
> struggling to adopt anything for debugging purposes.
>
> On Tuesday, May 5, 2020 at 9:11:00 PM UTC-4 roge...@gmail.com wrote:
>
>> Hi Clemens
>>
>> I think a standalone debugger is much better. The online debugger could
>> be great to debug applications in production  though.
>>
>> Where are you doing your development? On your local machine or Python
>> Anywhere or somewhere else?  I don't think it's possible to debug using
>> Visual Studio Code or PyCharm if web2py is not running on your local
>> machine. The debugger needs to connect to the python process.
>>
>> Anyhow, it's not hard to do once you know where to look. I managed to get
>> PyCharm debugging in about 15 minutes - most of that was spent downloading
>> the app for the first time.
>>
>> Cheers
>> Andrew
>>
>> On Wed, 6 May 2020 at 07:04, Clemens 
>> wrote:
>>
>>> Hi Andrew,
>>>
>>> well, I would say, it's because I ever used it and it's okay for me. But
>>> which one would you recommend? And how to connect your favorite debugger
>>> with web2py? Never used another debugger for web2py.
>>>
>>> Regards
>>> Clemens
>>>
>>>
>>> On Tuesday, May 5, 2020 at 1:56:25 AM UTC+2, AGRogers wrote:
>>>>
>>>> Hi Clemens
>>>>
>>>> I definitely can't help you with this problem. Sorry. But I am
>>>> interested in why you use the online debugger and not something else?
>>>>
>>>> Thanks
>>>> Andrew
>>>>
>>>> On Mon, 4 May 2020 at 23:50, Clemens 
>>>> wrote:
>>>>
>>>>> Hello Massimo,
>>>>>
>>>>> I hoped the latest web2py version would fix the problem. My current
>>>>> configuration is now:
>>>>> web2py version 2.20.4-stable+timestamp.2020.05.03.05.18.50, Running on
>>>>> Rocket 1.2.6, Python 3.6.9, Ubuntu 18.04., Firefox 75.0 (64-bit)
>>>>>
>>>>> But the online debugger still doesn't work. The debugger doesn't catch
>>>>> the breakpoint, set in my code. Instead, after waiting a few minutes I got
>>>>> the following new situation:
>>>>>
>>>>> [image: Screenshot_2020-05-04 interact.png]
>>>>>
>>>>> [image: Screenshot_2020-05-04 interact-02.png]
>>>>> Do you have any idea, how I can fix this?
>>>>>
>>>>> Best regards
>>>>> Clemens
>>>>>
>>>>>
>>>>> On Sunday, April 26, 2020 at 8:46:00 AM UTC+2, Massimo Di Pierro wrote:
>>>>>>
>>>>>> what browser?
>>>>>>
>>>>>> On Monday, 30 March 2020 13:23:57 UTC-7, Clemens wrote:
>>>>>>>
>>>>>>> Hello everybody!
>>>>>>>
>>>>>>> I've switched my web2py app from python2 to python3. The app itself
>>>>>>> works fine, but the web2py online debugger doesn't work anymore and is
>>>>>>> mostly freezing. Sometimes a get the following error message:
>>>>>>>
>>>>>>> Exception timeout: timeout('timed out',)
>>>>>>>
>>>>>>> Traceback (most recent call last): File
>>>>>>> "/usr/lib/python3.6/socket.py", line 586, in readinto return
>>>>>>> self._sock.recv_into(b) socket.timeout: timed out
>>>>>>>
>>>>>>> My configuration is as follows:
>>>>>>>
>>>>>>> web2py 2.19.1-stable+timestamp.2020.03.21.21.49.28 (Running on
>>>>>>> Rocket 1.2.6, Python 3.6.9), Ubuntu 18.04 LTS
>>>>>>>
>>>>>>> What do I have to change additionally that the online debugger is
>>>>>>> working under python3?
>>>>>>>
>>>>>>>
>>>>>>> Thanks a lot for any support!
>>>>>>>
>>>>>>>
>>>>>>> Best regards Clemens
>>>>>>>
>>>>>> --
>>>>> Resources:
>>>>> - http://web2py.com
>>>>> - http://w

Re: [web2py] Re: how to update a database field with a random value selected from a list using random.choice()

2020-07-15 Thread AGRogers
>>>My motto is:  get something working and move on!

Haha. A modified version I need to remember: Get something working and
don't go back and break it!

On Thu, 16 Jul 2020, 7:20 am villas,  wrote:

> We all have our styles of programming.  I would probably create a dict of
> times.
> But any idea which works is fine. Everyone looks at their old code and
> sees a better way.
> My motto is:  get something working and move on!
>
>
>
> On Wednesday, 15 July 2020 19:26:33 UTC+1, mostwanted wrote:
>>
>> Thank you Villas, i updated my controller like this & its giving results.
>> I a sure there is a better way to do this, a ore cleaner way & if anyone
>> cares to improve my code please dont hesitate so i could update mine &
>> learn more:
>>
>> def my_form_processing(form):
>> if form.vars.class_session=='single session':
>> single_session_times=['0830-0930hrs', '0930-1030hrs', '1100-1200'
>> ,'1200-1300', '1400-1500', '1500-1600', '1600-1700']
>> the_time=random.choice(single_session_times)
>> form.vars.the_time2=the_time
>>
>> if form.vars.class_session=='evening single session':
>> evening_single_session_times=['1730-1830', '1830-1930']
>> the_time=random.choice(evening_single_session_times)
>> form.vars.the_time2=the_time
>>
>> if form.vars.class_session=='double session':
>> double_session_times=['0830-1030', '1100-1300', '1400-1700']
>> the_time2=random.choice(double_session_times)
>> form.vars.the_time2=the_time2
>>
>> if form.vars.class_session=='evening double session':
>> evening_double_session_times=['1730-1930']
>> the_time=random.choice(evening_double_session_times)
>> form.vars.the_time2=the_time
>>
>> @auth.requires_login()
>> def index():
>> form=SQLFORM(db.lecture)
>> if form.process(onvalidation=my_form_processing).accepted:
>> response.flash=T('Lecture Entered')
>> return locals()
>> Regards;
>>
>> Mostwanted
>>
>> On Wednesday, July 15, 2020 at 5:47:18 PM UTC+2, villas wrote:
>>>
>>> Before submission of form, use JS.
>>> or
>>> After submission,  allocate the time in the controller using
>>> *onvalidation*.  See
>>> http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#onvalidation
>>>
>>> On Wednesday, 15 July 2020 13:58:28 UTC+1, mostwanted wrote:

 I thought it would be easy but its not, wrong values are being selected
 from wrong lists! After submitting a form I wanna check to see if the
 session field is either a single_session, double_session,
 evening_single_session or evening_double_session, depending on what it is I
 want time to be selected randomly from an appropriate list and inputted
 into the session_time field but wrong values from wrong lists are entered,
 information gets mixed up!

 model code:
 db.define_table('lecture',
 Field('subject_name', 'reference subject'),
 Field('department', 'reference departments'), #HERE
 Field('theLevels', label=SPAN('Levels'), requires=
 IS_IN_SET(['1.1', '1.2', '2.1', '2.2', '3.1', '3.2', '4.1', '4.2'],
 zero='---Select A Level---')), #HERE
 Field('lecturer', 'reference lecturer'),
 Field('class_session', requires=IS_IN_SET(['single
 session', 'double session', 'evening single session', 'evening double
 session'], zero='Select A Session Period')),
 Field('session_time', readable=False, writable=False),
 Field('class_room', readable=False, writable=False),
 Field('controller', readable=False, writable=False)
)

 single_session_times=['0830-0930hrs', '0930-1030hrs', '1100-1200',
 '1200-1300', '1400-1500', '1500-1600', '1600-1700']
 double_session_times=['0830-1030', '1100-1300', '1400-1700']

 evening_single_session_times=['1730-1830', '1830-1930']
 evening_double_session_times=['1730-1930']
 '''
 After submitting the form, have system scheck the session, if the
 session is any of whats defined give it a proper time
 '''
 if db.lecture.class_session=='single session':
 the_time=random.choice(single_session_times)
 db.lecture.session_time.default=the_time


 elif db.lecture.class_session=='evening single session':
 the_time=random.choice(evening_single_session_times)
 db.lecture.session_time.default=the_time


 elif db.lecture.class_session=='double session':
 the_time=random.choice(double_session_times)
 db.lecture.session_time.default=the_time


 elif db.lecture.class_session=='evening double session':
 the_time=random.choice(evening_double_session_times)
 db.lecture.session_time.default=the_time



 How can i achieve this with proper results from the intended list

 Mostwanted


Re: [web2py] count() as a field in sqlform.grid

2020-07-14 Thread AGRogers
Can you add a virtual field to the Cart table to do the counting for you?

On Tue, 14 Jul 2020, 4:34 pm Vlad,  wrote:

> The following doesn't work:
>
> fields = [db.cart.id, db.cart.id.count()]
>
>
> grid = SQLFORM.grid(db.cart,
> fields=fields,
> left = [db.cart_content.on(db.cart.id==db.
> cart_content.cart)],
> groupby=db.cart.id)
>
> what's the best way to accomplish this?
> I simply wan to count how many items in each cart.
> logically db.car.id.count() should really work here, but it doesn't.
>
> greatly appreciate any suggestions on how to do this properly.
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/b49bb71f-2cfc-48eb-b1a4-84d8e828b1beo%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMOUVKNdeZ0VVtGfRrOk%3DP5fhiZV%2BPQDUscnC_HM%2BiuzqQ%40mail.gmail.com.


Re: [web2py] Setting options in IS_IN_SET() as links to pages with more links

2020-07-10 Thread AGRogers
I solved the challenge of having too many options  by using the multiselect
option recommended in the book.
http://web2py.com/books/default/chapter/29/07#IS_IN_SET-and-Tagging (
http://loudev.com/)
"We strongly suggest using the jQuery multiselect plugin to render multiple
fields."

It's designed for multiselect obviously but i don't see why it  couldn't be
adjusted to be used as a nice way of searching for and selecting a single
option.


On Thu, 9 Jul 2020 at 20:24, mostwanted  wrote:

> Hi guys, is it possible to set options in the IS_IN_SET() validator as
> links to pages with more links related to the ones in the validator?
> I have a table that registers students, the requirements for the app are
> that all progams should be available for selection in the form field of
> *Program_of_Study* in a dropdown format, the problem is that they are too
> many, waaay too many to be listed in a dropdown, so I was wondering if i
> could have levels* (Certificate, Diploma, Degeree, Masters, PhD) *in the
> IS_IN_SET() validator but as links & when someone selects Diploma it
> re-directs them to a page of Diploma programs allowing them to select the
> program they want by clicking on it & then getting redirected back again to
> the form to complete the form, something like below
>
> *Code Example in the MODEL*
>
> *db.define_table('links',Field('name',
> requires=IS_IN_SET([('certificate', _href=URL('default',
> 'certificate_programs')), ('diploma', _href=URL('default',
> 'diploma_programs')), ('degree', _href=URL('default', 'degree_programs'))],
> zero='---Select Level of Study---')))*
>
> If the above is not possible at all whats an alternative to solving my
> challenge (With exaples please )
> Regards;
>
> Mostwanted
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/0562362a-2de5-44eb-8718-efdbd43436e1o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMMhb-iR09Te3HjcSTN03jTqJv7%2B%3DJGv7LjfjokpOXtB1g%40mail.gmail.com.


Re: [web2py] In a custom html form of SQLFORM in web2py, how to copy the request argument of the url into a form field input?

2020-07-08 Thread AGRogers
>>>  db.category.name.default = request.args(0)
 That's a good idea. I forgot that you can just change that before building
the form.
Thanks


On Wed, 8 Jul 2020 at 23:33, Jim S  wrote:

> Here is how I'd do it:
>
> Controller:
> def category():
> db.category.name.default = request.args(0)
> form=SQLFORM(db.category)
> return dict(form=form)
>
> Template:
> {{extend 'layout.html'}}
> {{=form}}
>
> There are a couple of issues in your example
>
> 1.  You're using SQLFORM to create a form, but then you aren't doing
> anything with it.  You need to pass it to your template for it to be useful.
> 2.  The else portion of the if form.process().accepted is executed anytime
> you call the controller and haven't submitted the form.  Therefore, on your
> initial display of the form, your error message will display.
>
> I hope this helps.
>
> -Jim
>
> On Tuesday, July 7, 2020 at 7:33:30 PM UTC-5, AGRogers wrote:
>>
>> OK. After you declare the form but before you process it you can set the
>> form.vars.FieldName property. I think that might help.
>>
>> On Wed, 8 Jul 2020, 4:36 am Anusha Narayan,  wrote:
>>
>>> Yeah! The first question, is what I am talking about.
>>>
>>> On Mon, 6 Jul 2020, 8:56 pm AGRogers,  wrote:
>>>
>>>> Do you mean you want to set the EVENT_ID so that it's already selected
>>>> when the form opens?
>>>>
>>>> Or are you saying that after you select the Event and submit the form
>>>> you get an error?
>>>>
>>>> On Sat, 4 Jul 2020, 3:27 pm Anusha Narayan, 
>>>> wrote:
>>>>
>>>>> *The code of my model db.py is:*
>>>>>
>>>>> db.define_table(
>>>>> 'event_table',
>>>>> Field('event_name'),
>>>>> Field('organizer_name'),
>>>>> )
>>>>>
>>>>> db.define_table('category',
>>>>> Field('Category_name',requires=IS_NOT_EMPTY()),
>>>>> Field('Event_id',db.event_table)
>>>>> )
>>>>>
>>>>> *The controller looks like:*
>>>>>
>>>>> def category():
>>>>>
>>>>> form=SQLFORM(db.category)
>>>>> if form.process().accepted:
>>>>> response.flash='form has accepted'
>>>>> else:
>>>>> response.flash='form has errors'
>>>>> return dict()
>>>>>
>>>>>
>>>>> *The code for the view (default/category.html) is:*
>>>>>
>>>>> {{extend 'layout.html'}}
>>>>>
>>>>>
>>>>>
>>>>>   
>>>>>
>>>>>   category name: >>>> value="{{=request.args(0)}}"/>
>>>>>   event_id type: 
>>>>> 
>>>>>  
>>>>>
>>>>>
>>>>> *(Here I am trying to pass the event id through the request argument of 
>>>>> the URL. But when I submit the form, it says "form has errors". Why is 
>>>>> that happening? I am not able to understand.?*
>>>>>
>>>>> --
>>>>> 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 web...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/web2py/38a3a4ba-7887-415a-8409-f5f28170d178o%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/web2py/38a3a4ba-7887-415a-8409-f5f28170d178o%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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 receiv

Re: [web2py] In a custom html form of SQLFORM in web2py, how to copy the request argument of the url into a form field input?

2020-07-07 Thread AGRogers
OK. After you declare the form but before you process it you can set the
form.vars.FieldName property. I think that might help.

On Wed, 8 Jul 2020, 4:36 am Anusha Narayan,  wrote:

> Yeah! The first question, is what I am talking about.
>
> On Mon, 6 Jul 2020, 8:56 pm AGRogers,  wrote:
>
>> Do you mean you want to set the EVENT_ID so that it's already selected
>> when the form opens?
>>
>> Or are you saying that after you select the Event and submit the form you
>> get an error?
>>
>> On Sat, 4 Jul 2020, 3:27 pm Anusha Narayan, 
>> wrote:
>>
>>> *The code of my model db.py is:*
>>>
>>> db.define_table(
>>> 'event_table',
>>> Field('event_name'),
>>> Field('organizer_name'),
>>> )
>>>
>>> db.define_table('category',
>>> Field('Category_name',requires=IS_NOT_EMPTY()),
>>> Field('Event_id',db.event_table)
>>> )
>>>
>>> *The controller looks like:*
>>>
>>> def category():
>>>
>>> form=SQLFORM(db.category)
>>> if form.process().accepted:
>>> response.flash='form has accepted'
>>> else:
>>> response.flash='form has errors'
>>> return dict()
>>>
>>>
>>> *The code for the view (default/category.html) is:*
>>>
>>> {{extend 'layout.html'}}
>>>
>>>
>>>
>>>   
>>>
>>>   category name: >> value="{{=request.args(0)}}"/>
>>>   event_id type: 
>>> 
>>>  
>>>
>>>
>>> *(Here I am trying to pass the event id through the request argument of the 
>>> URL. But when I submit the form, it says "form has errors". Why is that 
>>> happening? I am not able to understand.?*
>>>
>>> --
>>> 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/38a3a4ba-7887-415a-8409-f5f28170d178o%40googlegroups.com
>>> <https://groups.google.com/d/msgid/web2py/38a3a4ba-7887-415a-8409-f5f28170d178o%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/CACWMBMNsEm9rXYFhd7e8Bh6jK9wix%2ByUdZ5BunMT%3Dnef92mGPg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/web2py/CACWMBMNsEm9rXYFhd7e8Bh6jK9wix%2ByUdZ5BunMT%3Dnef92mGPg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CAPf%3DStg%3DQEP%2B5VCTBpuohbSVEjY%3DueYvjzBRsJzseQ4nKTBWWA%40mail.gmail.com
> <https://groups.google.com/d/msgid/web2py/CAPf%3DStg%3DQEP%2B5VCTBpuohbSVEjY%3DueYvjzBRsJzseQ4nKTBWWA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMONiteBodmSUNt2j-HWUwt%2BN_bcQDjkbFqPsR4_XHeGgw%40mail.gmail.com.


Re: [web2py] In a custom html form of SQLFORM in web2py, how to copy the request argument of the url into a form field input?

2020-07-06 Thread AGRogers
Do you mean you want to set the EVENT_ID so that it's already selected when
the form opens?

Or are you saying that after you select the Event and submit the form you
get an error?

On Sat, 4 Jul 2020, 3:27 pm Anusha Narayan,  wrote:

> *The code of my model db.py is:*
>
> db.define_table(
> 'event_table',
> Field('event_name'),
> Field('organizer_name'),
> )
>
> db.define_table('category',
> Field('Category_name',requires=IS_NOT_EMPTY()),
> Field('Event_id',db.event_table)
> )
>
> *The controller looks like:*
>
> def category():
>
> form=SQLFORM(db.category)
> if form.process().accepted:
> response.flash='form has accepted'
> else:
> response.flash='form has errors'
> return dict()
>
>
> *The code for the view (default/category.html) is:*
>
> {{extend 'layout.html'}}
>
>
>
>   
>
>   category name:  value="{{=request.args(0)}}"/>
>   event_id type: 
> 
>  
>
>
> *(Here I am trying to pass the event id through the request argument of the 
> URL. But when I submit the form, it says "form has errors". Why is that 
> happening? I am not able to understand.?*
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/38a3a4ba-7887-415a-8409-f5f28170d178o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNsEm9rXYFhd7e8Bh6jK9wix%2ByUdZ5BunMT%3Dnef92mGPg%40mail.gmail.com.


Re: [web2py] Re: scheduler gives and error about datetime

2020-06-29 Thread AGRogers
Thanks for the update. Hopefully I won't need it 

On Tue, 30 Jun 2020, 2:12 am Pierre,  wrote:

> For a temporary solution, i made an external python prg and used cron on
> my pi to sync the databases everynight and works find with sqlite syntax.
> It's way more extensive work but seems to be reliable for many days now.
> I have read again the doc, and cannot figure out at all my mistake.
> At this time i scheduled manualy the task via the admin interface to do
> tests, so i can follow the stage, queued, running, etc.
> thanks
>
> Le mercredi 24 juin 2020 23:01:27 UTC-4, Dave S a écrit :
>>
>>
>>
>> On Wednesday, June 17, 2020 at 6:41:32 AM UTC-7, Pierre wrote:
>>>
>>> Gooday,
>>> In the controler the function works correctly.  But as a task, it gives
>>> an error about Json not beeing able to deal with datetime.
>>> any suggestion would be appreciated :)
>>>
>>> here is the error :  TypeError: datetime.datetime(2020, 6, 16, 5, 17,
>>> 49) is not JSON serializable
>>>
>>>
>> This does not look right:
>>
>>
>>> from gluon.scheduler import Scheduler
>>>
>>> Scheduler(db,dict(sync_data=pump_most_recent,sync_dates=acue_src_dst_update))
>>>
>>>
>> In a models file called scheduler.py, I have:
>>
>>
>> from gluon.scheduler import Scheduler
>>
>> scheduler = Scheduler(db)
>>
>>
>> def taskfunc(arg1, arg2):
>>   var1 = do_something(arg1)
>>   if var1 in arg2:
>>return "success"
>>
>>
>> In a controller, I kick off the task with
>>
>> chunk1 = dostuff(request.args[0])
>> string1 =  targets[rand()]
>> tid = scheduler.queue_task('taskfunc', pvars={'arg1': chunk1, 'arg2':
>> string2}, timeout=1200)
>>
>> (the controller knows scheduler from the models)
>>
>> Sending a date as an argument would be done by using a pvars dictionary
>> in the same way.   For one of my tasks, I send a datetime via pvars.   The
>> task also has a request.now.  (It has the whole request, but you can tell
>> it's a scheduler request).
>>
>> Do you find the documentation on Scheduler unclear?
>>
>> /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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/38baa4e9-9942-4faf-bc57-4e12d59051beo%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPgx2dQ1tGYaqNyE29QDXrAgnPY9nHzuaJSJ2SFQsmxnQ%40mail.gmail.com.


Re: [web2py] scheduler gives and error about datetime

2020-06-23 Thread AGRogers
I haven't done anything in the scheduler yet. It's on my to do list though.
I will come back here if I have any good suggestions.

On Tue, 23 Jun 2020, 10:22 pm Pierre,  wrote:

> I advance like you by trying tons of things :)
> I did the most simple thing with the task  just putting a =
> datetime.datetime.now()  and it gives the exact same error.
> Tasks doesn't like datetime period :)
> Not yet figured out how to jsonify the task yet based on your suggestion,
> but still bumping my head on it :)
>
>
> Le lundi 22 juin 2020 23:56:07 UTC-4, AGRogers a écrit :
>>
>> Yeah, i dont really understand how web2py sends locals() etc back to the
>> view and how that differs from JSON data. I just keep trying random things
>> until it works :)
>>
>> On Tue, 23 Jun 2020 at 12:15, Pierre  wrote:
>>
>>> thanks AG  I will look into your suggestion.
>>> Fiddling with the error, found out that it's when reading back from
>>> sqlite that the error arise.  It's like something from web2py doesn't like
>>> the format of my date in the field of the table.
>>> But at this time, i do not know how to tell "web2py" that the string
>>> representing the datetime in the field is formated like this  '%Y-%m-%d :
>>> %H:%M:%S'
>>> wonder if the datetime format used in my sqlite table field is the
>>> problem.   So curius that everything works fine in the controler but not as
>>> a task.
>>>
>>> Le lundi 22 juin 2020 20:54:34 UTC-4, AGRogers a écrit :
>>>>
>>>> Hi
>>>>
>>>> I use this code to solve this problem:
>>>>
>>>> result = json.dumps(result, indent=4, sort_keys=True, default=str)
>>>>
>>>> Don't know what it does but it solves my problem.
>>>>
>>>> I found it here:
>>>>
>>>> https://stackoverflow.com/questions/11875770/how-to-overcome-datetime-datetime-not-json-serializable
>>>>
>>>>
>>>>
>>>>
>>>> On Wed, 17 Jun 2020 at 23:41, Pierre  wrote:
>>>>
>>>>> Gooday,
>>>>> In the controler the function works correctly.  But as a task, it
>>>>> gives an error about Json not beeing able to deal with datetime.
>>>>> any suggestion would be appreciated :)
>>>>>
>>>>> here is the error :  TypeError: datetime.datetime(2020, 6, 16, 5, 17,
>>>>> 49) is not JSON serializable
>>>>>
>>>>> here is the code:
>>>>>
>>>>> #reload(sys)
>>>>> #sys.setdefaultencoding('utf-8')
>>>>> import sys
>>>>> import os
>>>>> import time
>>>>> import datetime
>>>>> import sqlite3
>>>>> #
>>>>>
>>>>> #--
>>>>> def pump_most_recent():
>>>>> state = 'unknown'
>>>>> try:
>>>>> conn=sqlite3.connect('z:/alarm.sqlite')
>>>>> except sqlite3.Error as err:
>>>>> state = err # ='connexion impossible'
>>>>> else:
>>>>> state = 'connection ok'
>>>>> #   last entry in the local storage is kept in the acue table,
>>>>> have to get this in order to query the prod databases
>>>>> k = db(db.acue).select(db.acue.dstd2) # get the row
>>>>> l = k[0].dstd2# get the date of
>>>>> interest
>>>>> curs=conn.cursor()
>>>>> rows = curs.execute("select * from log_txt where date > ?",
>>>>> (l,)).fetchall()
>>>>> curs.close()
>>>>> conn.close()
>>>>> #
>>>>> for row in rows:
>>>>> a = datetime.datetime.strptime(row[1],'%Y-%m-%d :
>>>>> %H:%M:%S') # date avec le temps
>>>>> b = row[2]
>>>>> c = row[3]
>>>>> d = row[4]
>>>>> e = row[5]
>>>>> f = row[6]
>>>>> g = row[7]
>>>>> h = row[8]
>>>>> i = row[9]
>>>>> j = row[10]
>>>>> #
>>>>>
>>>>> db.alogs.insert(quand=a,etat=b,zone1=c,zone2=d,zone3=e,zone4=f,zone5=g,zone6=h,zone7=i,note=j)
&g

Re: [web2py] scheduler gives and error about datetime

2020-06-22 Thread AGRogers
Yeah, i dont really understand how web2py sends locals() etc back to the
view and how that differs from JSON data. I just keep trying random things
until it works :)

On Tue, 23 Jun 2020 at 12:15, Pierre  wrote:

> thanks AG  I will look into your suggestion.
> Fiddling with the error, found out that it's when reading back from sqlite
> that the error arise.  It's like something from web2py doesn't like the
> format of my date in the field of the table.
> But at this time, i do not know how to tell "web2py" that the string
> representing the datetime in the field is formated like this  '%Y-%m-%d :
> %H:%M:%S'
> wonder if the datetime format used in my sqlite table field is the
> problem.   So curius that everything works fine in the controler but not as
> a task.
>
> Le lundi 22 juin 2020 20:54:34 UTC-4, AGRogers a écrit :
>>
>> Hi
>>
>> I use this code to solve this problem:
>>
>> result = json.dumps(result, indent=4, sort_keys=True, default=str)
>>
>> Don't know what it does but it solves my problem.
>>
>> I found it here:
>>
>> https://stackoverflow.com/questions/11875770/how-to-overcome-datetime-datetime-not-json-serializable
>>
>>
>>
>>
>> On Wed, 17 Jun 2020 at 23:41, Pierre  wrote:
>>
>>> Gooday,
>>> In the controler the function works correctly.  But as a task, it gives
>>> an error about Json not beeing able to deal with datetime.
>>> any suggestion would be appreciated :)
>>>
>>> here is the error :  TypeError: datetime.datetime(2020, 6, 16, 5, 17,
>>> 49) is not JSON serializable
>>>
>>> here is the code:
>>>
>>> #reload(sys)
>>> #sys.setdefaultencoding('utf-8')
>>> import sys
>>> import os
>>> import time
>>> import datetime
>>> import sqlite3
>>> #
>>>
>>> #--
>>> def pump_most_recent():
>>> state = 'unknown'
>>> try:
>>> conn=sqlite3.connect('z:/alarm.sqlite')
>>> except sqlite3.Error as err:
>>> state = err # ='connexion impossible'
>>> else:
>>> state = 'connection ok'
>>> #   last entry in the local storage is kept in the acue table, have
>>> to get this in order to query the prod databases
>>> k = db(db.acue).select(db.acue.dstd2) # get the row
>>> l = k[0].dstd2# get the date of interest
>>> curs=conn.cursor()
>>> rows = curs.execute("select * from log_txt where date > ?",
>>> (l,)).fetchall()
>>> curs.close()
>>> conn.close()
>>> #
>>> for row in rows:
>>> a = datetime.datetime.strptime(row[1],'%Y-%m-%d : %H:%M:%S')
>>> # date avec le temps
>>> b = row[2]
>>> c = row[3]
>>> d = row[4]
>>> e = row[5]
>>> f = row[6]
>>> g = row[7]
>>> h = row[8]
>>> i = row[9]
>>> j = row[10]
>>> #
>>>
>>> db.alogs.insert(quand=a,etat=b,zone1=c,zone2=d,zone3=e,zone4=f,zone5=g,zone6=h,zone7=i,note=j)
>>> finally:
>>> return locals()
>>> #
>>>
>>> #---
>>> #
>>> def acue_src_dst_update():
>>> #
>>> z = acue_src_dst_show()
>>> a = z.get('a')
>>> b = z.get('b')
>>> c = z.get('c')
>>> d = z.get('d')
>>> #
>>> db.acue.truncate()
>>> db.acue.insert(srcd1=a,srcd2=b,dstd1=c, dstd2=d)
>>> acue_after_update = db(db.acue).select()
>>> #
>>> return locals()
>>>
>>> #--
>>> from gluon.scheduler import Scheduler
>>>
>>> Scheduler(db,dict(sync_data=pump_most_recent,sync_dates=acue_src_dst_update))
>>>
>>> --
>>> 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.

Re: [web2py] scheduler gives and error about datetime

2020-06-22 Thread AGRogers
Hi

I use this code to solve this problem:

result = json.dumps(result, indent=4, sort_keys=True, default=str)

Don't know what it does but it solves my problem.

I found it here:
https://stackoverflow.com/questions/11875770/how-to-overcome-datetime-datetime-not-json-serializable




On Wed, 17 Jun 2020 at 23:41, Pierre  wrote:

> Gooday,
> In the controler the function works correctly.  But as a task, it gives an
> error about Json not beeing able to deal with datetime.
> any suggestion would be appreciated :)
>
> here is the error :  TypeError: datetime.datetime(2020, 6, 16, 5, 17, 49)
> is not JSON serializable
>
> here is the code:
>
> #reload(sys)
> #sys.setdefaultencoding('utf-8')
> import sys
> import os
> import time
> import datetime
> import sqlite3
> #
>
> #--
> def pump_most_recent():
> state = 'unknown'
> try:
> conn=sqlite3.connect('z:/alarm.sqlite')
> except sqlite3.Error as err:
> state = err # ='connexion impossible'
> else:
> state = 'connection ok'
> #   last entry in the local storage is kept in the acue table, have to
> get this in order to query the prod databases
> k = db(db.acue).select(db.acue.dstd2) # get the row
> l = k[0].dstd2# get the date of interest
> curs=conn.cursor()
> rows = curs.execute("select * from log_txt where date > ?",
> (l,)).fetchall()
> curs.close()
> conn.close()
> #
> for row in rows:
> a = datetime.datetime.strptime(row[1],'%Y-%m-%d : %H:%M:%S') #
> date avec le temps
> b = row[2]
> c = row[3]
> d = row[4]
> e = row[5]
> f = row[6]
> g = row[7]
> h = row[8]
> i = row[9]
> j = row[10]
> #
>
> db.alogs.insert(quand=a,etat=b,zone1=c,zone2=d,zone3=e,zone4=f,zone5=g,zone6=h,zone7=i,note=j)
> finally:
> return locals()
> #
>
> #---
> #
> def acue_src_dst_update():
> #
> z = acue_src_dst_show()
> a = z.get('a')
> b = z.get('b')
> c = z.get('c')
> d = z.get('d')
> #
> db.acue.truncate()
> db.acue.insert(srcd1=a,srcd2=b,dstd1=c, dstd2=d)
> acue_after_update = db(db.acue).select()
> #
> return locals()
>
> #--
> from gluon.scheduler import Scheduler
>
> Scheduler(db,dict(sync_data=pump_most_recent,sync_dates=acue_src_dst_update))
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/ba7a30ef-1e82-430e-8295-8fd4be74c806o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMOyiV-rV2%3DbdHMB3JUht03yagZLT%2BuXtw_Z0yB%3D4gkztA%40mail.gmail.com.


Re: [web2py] How to sort a smartgrid with your own custom sorted id list

2020-06-22 Thread AGRogers
The only thing that comes to mind is to put your sort data into the
database so you have something to sort on. If it is a single user app then
it's easy - add a new column called sortid and put your custom sort order
their.

Multi user needs a second table to join on which might mess with smart
grid.

If you are not trying to display a lot of data you could make a copy of the
table in memory using your order and give that to smart grid.

You can also modify (for that one call) the actual table. I am not sure how
that works for adding fields though. Perhaps you could add a field and put
your data in. It might magically disappear after the function closes. Or
you could drop the field manually if it didn't.

On Fri, 19 Jun 2020, 1:38 am rāma,  wrote:

> Hi all,
>
> How to sort a smartgrid with your own custom sorted id list?
>
> Say I have a id list of the query and I have a sorting functions that
> returns a sorted id list, how would I make smartgrid to commit to the
> ordering instead of sorting by ids by default?
>
> Thanks,
> rama
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/a078772b-0d41-4993-8df7-b9e5c223e9d0o%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNfsc09AH%2Br2YbXe6%3DL86C7TTiKxyzaRx41153En7hy%3Dw%40mail.gmail.com.


Re: [web2py] Re: List | Create | Modify and Delete Users directly from Python controller without using HMI

2020-06-07 Thread AGRogers
Yes, thank you too. I will need that.

On Fri, 5 Jun 2020 at 06:50, Nicolas Hiblot  wrote:

> Thanks Dave and Val
> It's perfect !!
> Web2py forever
>
> Le mardi 2 juin 2020 23:57:31 UTC+2, Nicolas Hiblot a écrit :
>>
>> Hello All,
>>
>> I have read a lot of cases and uses cases about web2py users.
>> But my case is a little différent ;
>> I would like to
>>
>> *List | Create  | Modify and Delete Users directly from Python controller
>> without using HMI*
>>
>> My user db is always the same
>> login 1 is user0
>> login 2 is user1
>> and I can have a lot of users but user0 and user1 are always here
>>
>> 1) List all users by id and username *without* user0 and user1
>>
>>
>>
>>
>>
>> *try :listusers = db(db.auth.if
>> len(listusers) == 0:except Exception as e:listusers = []*
>>
>> 2) Create a user *with a mail / login / and Password* directly using
>> python method in the controller with the db (without the GUI)
>>
>>
>> 3) *Modify a password of an already created user* directly using python
>> method in the controller with the db (without the gui)
>> Note : I have already the id and/or the username of the user
>>
>> 4) *Delete an already created user* directly using python method  in the
>> controller with the db (without the gui)
>> Note : I have already the id and/or the username of the user
>>
>>
>> Thanks in advance
>> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/23b5c0d8-6366-41c8-ad58-85504a4efe8do%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMP4dqfGatrpKHPi0JycUV8JOiR_7wstQfydzXA-qkiDmg%40mail.gmail.com.


Re: [web2py] Re: web2py online debugger under python3

2020-06-07 Thread AGRogers
Great. I have had weird problems with Visual Studio Code debugger. It seems
to get confused sometimes about which line of code it is running and shows
that I am executing a line different to what it is really executing. When i
have that problem i switch to PyCharm and debug there. Then i head back to
Visual Studio Code :)


On Fri, 5 Jun 2020 at 05:48, Clemens 
wrote:

> Hi Andrew,
>
> I've switched over to PyCharm and really like it. Thanks a lot for the
> push!
>
> Best regards
> Clemens
>
>
> On Wednesday, May 6, 2020 at 3:11:00 AM UTC+2, AGRogers wrote:
>>
>> Hi Clemens
>>
>> I think a standalone debugger is much better. The online debugger could
>> be great to debug applications in production  though.
>>
>> Where are you doing your development? On your local machine or Python
>> Anywhere or somewhere else?  I don't think it's possible to debug using
>> Visual Studio Code or PyCharm if web2py is not running on your local
>> machine. The debugger needs to connect to the python process.
>>
>> Anyhow, it's not hard to do once you know where to look. I managed to get
>> PyCharm debugging in about 15 minutes - most of that was spent downloading
>> the app for the first time.
>>
>> Cheers
>> Andrew
>>
>> On Wed, 6 May 2020 at 07:04, Clemens  wrote:
>>
>>> Hi Andrew,
>>>
>>> well, I would say, it's because I ever used it and it's okay for me. But
>>> which one would you recommend? And how to connect your favorite debugger
>>> with web2py? Never used another debugger for web2py.
>>>
>>> Regards
>>> Clemens
>>>
>>>
>>> On Tuesday, May 5, 2020 at 1:56:25 AM UTC+2, AGRogers wrote:
>>>>
>>>> Hi Clemens
>>>>
>>>> I definitely can't help you with this problem. Sorry. But I am
>>>> interested in why you use the online debugger and not something else?
>>>>
>>>> Thanks
>>>> Andrew
>>>>
>>>> On Mon, 4 May 2020 at 23:50, Clemens 
>>>> wrote:
>>>>
>>>>> Hello Massimo,
>>>>>
>>>>> I hoped the latest web2py version would fix the problem. My current
>>>>> configuration is now:
>>>>> web2py version 2.20.4-stable+timestamp.2020.05.03.05.18.50, Running on
>>>>> Rocket 1.2.6, Python 3.6.9, Ubuntu 18.04., Firefox 75.0 (64-bit)
>>>>>
>>>>> But the online debugger still doesn't work. The debugger doesn't catch
>>>>> the breakpoint, set in my code. Instead, after waiting a few minutes I got
>>>>> the following new situation:
>>>>>
>>>>> [image: Screenshot_2020-05-04 interact.png]
>>>>>
>>>>> [image: Screenshot_2020-05-04 interact-02.png]
>>>>> Do you have any idea, how I can fix this?
>>>>>
>>>>> Best regards
>>>>> Clemens
>>>>>
>>>>>
>>>>> On Sunday, April 26, 2020 at 8:46:00 AM UTC+2, Massimo Di Pierro wrote:
>>>>>>
>>>>>> what browser?
>>>>>>
>>>>>> On Monday, 30 March 2020 13:23:57 UTC-7, Clemens wrote:
>>>>>>>
>>>>>>> Hello everybody!
>>>>>>>
>>>>>>> I've switched my web2py app from python2 to python3. The app itself
>>>>>>> works fine, but the web2py online debugger doesn't work anymore and is
>>>>>>> mostly freezing. Sometimes a get the following error message:
>>>>>>>
>>>>>>> Exception timeout: timeout('timed out',)
>>>>>>>
>>>>>>> Traceback (most recent call last): File
>>>>>>> "/usr/lib/python3.6/socket.py", line 586, in readinto return
>>>>>>> self._sock.recv_into(b) socket.timeout: timed out
>>>>>>>
>>>>>>> My configuration is as follows:
>>>>>>>
>>>>>>> web2py 2.19.1-stable+timestamp.2020.03.21.21.49.28 (Running on
>>>>>>> Rocket 1.2.6, Python 3.6.9), Ubuntu 18.04 LTS
>>>>>>>
>>>>>>> What do I have to change additionally that the online debugger is
>>>>>>> working under python3?
>>>>>>>
>>>>>>>
>>>>>>> Thanks a lot for any support!
>>>>>>>
>>>>>>>
>>>>>>> Best regards Clemens
>>>>>>>

Re: [web2py] Tip - Using multiple web2py templates

2020-06-07 Thread AGRogers
Thanks for sharing this. I might need it soon.

On Tue, 2 Jun 2020 at 07:44, Rodrigo Attique 
wrote:

> After a lot of brainstorming I found a way to allow web2py to use multiple
> templates. Perhaps for the elderly it is not a novelty, but for the
> youngest ... This will be a hand in the wheel.
>
> Link:
>
> https://web2pymania.blogspot.com/2020/06/using-multiple-web2py-templates.html
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/6bc7a9fe-43f6-4c9b-8950-8952a0611b8c%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMOvbPZRX6ZkXAiK10LLMBOU6Q4%3DRcampCn%3Dyp%3Dgqx3JVQ%40mail.gmail.com.


Re: [web2py] web2py python3

2020-05-13 Thread AGRogers
Does this help?
https://stackoverflow.com/questions/39146039/pickle-typeerror-a-bytes-like-object-is-required-not-str


On Wed, 13 May 2020 at 04:43, patito feo  wrote:

> Hi,
>
> Having this error when using python3.
>
>  File "//web2py/applications/admin/controllers/default.py" 
> , 
> line 1627, in errors
> error = pickle.load(fullpath_file)
>   File "/ 
> /web2py/gluon/html.py",
>  line 692, in XML_unpickle
> return XML(marshal.loads(data))
> TypeError: a bytes-like object is required, not 'str'
>
> Any ideas?
>
> Cheers,
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/da00b94c-bd5b-42cb-a669-12103c434c14%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMORwUH4f3b1%3Dqj5JogbV9W%2BibZ51TAm2LDyygA5USxwVg%40mail.gmail.com.


Re: [web2py] Re: pyDAL looks abandoned?

2020-05-11 Thread AGRogers
Hi Val. I can't add anything useful to this sorry... except to say that i
have really enjoyed using the DAL in my current project. I have no
experience with others and have not done anything tricky like I have had to
do in SQL server procs and what not. But it has made development easy for
me.

So i hope it hasnt been abandoned :-)

And i have spent a LOT of time in the book - extra examples and keeping
that book up to date would be really helpful.

On Tue, 12 May 2020 at 09:37, Val K  wrote:

> BTW:
> if anyone is interested about WITH RECURSIVE here is my implementation:
> https://github.com/web2py/pydal/issues/627
>
>
>
>
> On Monday, May 11, 2020 at 11:27:14 PM UTC+3, Val K wrote:
>>
>>
>> There are 131 issues on pyDAL-GitHub, but the problem is not in the
>> amount but in that more than half of them without any response. Look at
>> peewee that has 7.5k stars and only 2 open issues!... yes, this is impolite
>> comparision - sorry.
>> I've just need to implement CTE + WITH RECURSIVE (like this
>> http://docs.peewee-orm.com/en/latest/peewee/querying.html#recursive-ctes
>> )
>> and I wasted 2 days to figure out how I can do very simple thing like  '1
>> AS foo'  in right way that is (as I suppose):
>> Expression(db, '1', type='integer').with_alias('foo')
>>
>> So, the question is: why is there nothing about that in the book?
>> Why does pyDAL have no that very simple but very necessary method  which
>> allows to do cool things like:
>>  db(...).select(
>> ...,
>> db.exp(
>>'max(product.price) OVER(PARTITION BY product.category)',
>>type = 'decimal(n, m)' # the same as Field(..., type = 'decimal(n,
>> m)')
>> ).with_alias('most_expensive_in_category')
>> )
>>
>> here is used WINDOW-function that allows to get products list with
>> 'most_expensive_in_category' in *one* plain query
>> *without using subquery* with GRUOP BY product.category + join
>>
>> Also there is my PR on web2py book
>> https://github.com/web2py/web2py-book/pull/424
>> it hangs for almost a year - it is just a book, not code
>> I'm sad
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/12e8a9c3-c855-419d-82e5-6bbe5e2c2e44%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMM1pROd_z%2Bz1X19V7Pw-u3m3-snTe4cVs0kDpQMZRddXg%40mail.gmail.com.


Re: [web2py] Re: web2py online debugger under python3

2020-05-05 Thread AGRogers
Hi Clemens

I think a standalone debugger is much better. The online debugger could be
great to debug applications in production  though.

Where are you doing your development? On your local machine or Python
Anywhere or somewhere else?  I don't think it's possible to debug using
Visual Studio Code or PyCharm if web2py is not running on your local
machine. The debugger needs to connect to the python process.

Anyhow, it's not hard to do once you know where to look. I managed to get
PyCharm debugging in about 15 minutes - most of that was spent downloading
the app for the first time.

Cheers
Andrew

On Wed, 6 May 2020 at 07:04, Clemens 
wrote:

> Hi Andrew,
>
> well, I would say, it's because I ever used it and it's okay for me. But
> which one would you recommend? And how to connect your favorite debugger
> with web2py? Never used another debugger for web2py.
>
> Regards
> Clemens
>
>
> On Tuesday, May 5, 2020 at 1:56:25 AM UTC+2, AGRogers wrote:
>>
>> Hi Clemens
>>
>> I definitely can't help you with this problem. Sorry. But I am interested
>> in why you use the online debugger and not something else?
>>
>> Thanks
>> Andrew
>>
>> On Mon, 4 May 2020 at 23:50, Clemens  wrote:
>>
>>> Hello Massimo,
>>>
>>> I hoped the latest web2py version would fix the problem. My current
>>> configuration is now:
>>> web2py version 2.20.4-stable+timestamp.2020.05.03.05.18.50, Running on
>>> Rocket 1.2.6, Python 3.6.9, Ubuntu 18.04., Firefox 75.0 (64-bit)
>>>
>>> But the online debugger still doesn't work. The debugger doesn't catch
>>> the breakpoint, set in my code. Instead, after waiting a few minutes I got
>>> the following new situation:
>>>
>>> [image: Screenshot_2020-05-04 interact.png]
>>>
>>> [image: Screenshot_2020-05-04 interact-02.png]
>>> Do you have any idea, how I can fix this?
>>>
>>> Best regards
>>> Clemens
>>>
>>>
>>> On Sunday, April 26, 2020 at 8:46:00 AM UTC+2, Massimo Di Pierro wrote:
>>>>
>>>> what browser?
>>>>
>>>> On Monday, 30 March 2020 13:23:57 UTC-7, Clemens wrote:
>>>>>
>>>>> Hello everybody!
>>>>>
>>>>> I've switched my web2py app from python2 to python3. The app itself
>>>>> works fine, but the web2py online debugger doesn't work anymore and is
>>>>> mostly freezing. Sometimes a get the following error message:
>>>>>
>>>>> Exception timeout: timeout('timed out',)
>>>>>
>>>>> Traceback (most recent call last): File
>>>>> "/usr/lib/python3.6/socket.py", line 586, in readinto return
>>>>> self._sock.recv_into(b) socket.timeout: timed out
>>>>>
>>>>> My configuration is as follows:
>>>>>
>>>>> web2py 2.19.1-stable+timestamp.2020.03.21.21.49.28 (Running on Rocket
>>>>> 1.2.6, Python 3.6.9), Ubuntu 18.04 LTS
>>>>>
>>>>> What do I have to change additionally that the online debugger is
>>>>> working under python3?
>>>>>
>>>>>
>>>>> Thanks a lot for any support!
>>>>>
>>>>>
>>>>> Best regards Clemens
>>>>>
>>>> --
>>> 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 web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/ccc32a55-4a15-4f88-9b0f-69326542b6f0%40googlegroups.com
>>> <https://groups.google.com/d/msgid/web2py/ccc32a55-4a15-4f88-9b0f-69326542b6f0%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/73792fd3-310e-43e6-89d6-5f615e12546d%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/73792fd3-310e-43e6-89d6-5f615e12546d%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMOut2-NUb_fJvSme2QPHjGhy61TQjKRzsZPTecS%2BVUF4g%40mail.gmail.com.


Re: [web2py] Re: web2py online debugger under python3

2020-05-04 Thread AGRogers
Hi Clemens

I definitely can't help you with this problem. Sorry. But I am interested
in why you use the online debugger and not something else?

Thanks
Andrew

On Mon, 4 May 2020 at 23:50, Clemens 
wrote:

> Hello Massimo,
>
> I hoped the latest web2py version would fix the problem. My current
> configuration is now:
> web2py version 2.20.4-stable+timestamp.2020.05.03.05.18.50, Running on
> Rocket 1.2.6, Python 3.6.9, Ubuntu 18.04., Firefox 75.0 (64-bit)
>
> But the online debugger still doesn't work. The debugger doesn't catch the
> breakpoint, set in my code. Instead, after waiting a few minutes I got the
> following new situation:
>
> [image: Screenshot_2020-05-04 interact.png]
>
> [image: Screenshot_2020-05-04 interact-02.png]
> Do you have any idea, how I can fix this?
>
> Best regards
> Clemens
>
>
> On Sunday, April 26, 2020 at 8:46:00 AM UTC+2, Massimo Di Pierro wrote:
>>
>> what browser?
>>
>> On Monday, 30 March 2020 13:23:57 UTC-7, Clemens wrote:
>>>
>>> Hello everybody!
>>>
>>> I've switched my web2py app from python2 to python3. The app itself
>>> works fine, but the web2py online debugger doesn't work anymore and is
>>> mostly freezing. Sometimes a get the following error message:
>>>
>>> Exception timeout: timeout('timed out',)
>>>
>>> Traceback (most recent call last): File "/usr/lib/python3.6/socket.py",
>>> line 586, in readinto return self._sock.recv_into(b) socket.timeout: timed
>>> out
>>>
>>> My configuration is as follows:
>>>
>>> web2py 2.19.1-stable+timestamp.2020.03.21.21.49.28 (Running on Rocket
>>> 1.2.6, Python 3.6.9), Ubuntu 18.04 LTS
>>>
>>> What do I have to change additionally that the online debugger is
>>> working under python3?
>>>
>>>
>>> Thanks a lot for any support!
>>>
>>>
>>> Best regards Clemens
>>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/ccc32a55-4a15-4f88-9b0f-69326542b6f0%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNqxCspnOYXk0ryaBC8zL%3D%3DPCGOdBMs5ki5got7gWqBVw%40mail.gmail.com.


Re: [web2py] Re: Importing a CSV file from the Database form fails

2020-05-03 Thread AGRogers
Thanks for the tips. I wrote an import to get in what i needed. But i will
try this out when i need to do my next simple import.
Cheers
Andrew

On Mon, 4 May 2020 at 00:54, Clemens 
wrote:

> Have a look on how you open the file to be imported:
>
> python2:
> open(filename, 'rb')
>
> python3:
> open(str(filename), 'r', encoding='utf-8'))
>
> Hope, it helps!
>
> Regards
> Clemens
>
> On Thursday, March 5, 2020 at 10:07:27 AM UTC+1, Andrew Rogers wrote:
>>
>> Hi
>>
>> I exported a CSV file using the Import/Export > 'export as csv file'
>> button found in the Database interface of web2py. That worked fine.
>>
>> I then modified the exported file slightly - just changed the IDs.
>>
>> I then tried to import the modified file back into the table using the
>> 'import' button in the same area. But it fails with:
>>
>> unable to parse csv fileiterator should return strings, not
>> bytes (did you open the file in text mode?) ×
>>
>> What am i doing wrong?
>>
>> Thanks
>> Andrew
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/cd078f5a-6053-40ff-a1ff-c6241c3518d7%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMM9ujHy%2B_vbYn_siw_QbwwoUDcHq_hzKnZqbOV_0RMXmQ%40mail.gmail.com.


Re: [web2py] Re: How do I hide automatically generated child columns in web2py's SmartGrid?

2020-04-28 Thread AGRogers
Many thanks Jim. Good idea. That should work for me fine.
Cheers

On Fri, 24 Apr 2020 at 22:51, Jim S  wrote:

> This is pretty ugly, but I think it should work if you're interested in
> fixing this with jquery in your template.
>
> I use this technique to hide columns based on other things going on with
> the page, but should work in your situation too.  I haven't tested the
> re-labeling the column heading so the 10th line may need some tweaking...
> {{extend 'layout.html'}}
> 
> $(document).ready(function() {
> {{if not request.args or not request.args[0] in ('new', 'edit',
> 'view'):}}
> var rows = $('.web2py_htmltable > table > tbody > tr');
> rows.each(function(index) {
> $('td:nth-child(4)', this).hide();
> })
> $('th:nth-child(4)', this).hide();
> $('th:nth-child(4)', this).val('Column Heading');
> {{pass}}
> });
> 
>
>
>
>
>
>
> On Friday, April 24, 2020 at 1:38:21 AM UTC-5, Andrew Rogers wrote:
>>
>> (I also asked this question here
>> https://stackoverflow.com/questions/61402508/how-do-i-hide-child-columns-in-web2pys-smartgrid
>> )
>>
>> I love the way web2py smartgrid creates automatic child links to
>> referenced tables. But i can't find how to customise them.
>>
>> I want to show only some of the child table links (see below). I know i
>> can eliminate referenced tables by specifying the `linked_tables` option.
>> And I can make my own links  using the option to make new `links`. And I
>> can use `fields` to hide columns for the main table.
>>
>> But how do I hide one or more of the automatically generated child
>> columns for the tables that *are* included in `linked_tables`?
>>
>> And is it possible to change the link text?
>>
>>
>>
>> [image: child_links.png]
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/aa3d812e-2a1a-4907-b11e-f0c8f3a35179%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPVv7UidAR5GKBTQ9F4-nqGMxhRT5jc%3DM1ZaYC3XdDHng%40mail.gmail.com.


Re: [web2py] Which 4 or 2?

2020-04-18 Thread AGRogers
Hi David

I have spent that last month and a half trying to learn web2py and python
and javascript (and css and sqlite and html). I reckon the official web2py
book has everything in it that you need. However my trouble was that my
knowledge about everything was so minimal that i often couldn't connect the
dots. So i found other resources, especially Anthony's many posts on
stackoverflow, invaluable.

Anyhow, i started collecting links to helpful web2py posts and sites and
noted them in this document:
https://docs.google.com/document/d/1H6oqWAE6jv0R1HuOEamJkP91f8dPfYURLiMHhuiQTWQ/edit?usp=sharing

The document is ugly but it might be a good place to start when you are
looking for more info.

I think the thing the official book lacks is sufficient examples. The
information in it is great and quite complete. But i wasnt smart enough to
work through my problems without more explicit examples.  For example, i
found this site recently and it has a pile of really helpful query
examples: https://web2py.wordpress.com/tag/subquery/

Apart from this group, most of the stuff online for web2py is pretty old.
But dont be put off by that, it almost always works perfectly.

On Sat, 18 Apr 2020 at 15:13, David Swarbrick  wrote:

> Thank you. I will persist.
>
> I used to tell my staff that the only daft question was the one unasked.
> I may be providing a constant supply of evidence to the contrary.
>
> On Friday, 17 April 2020 21:52:24 UTC+1, Christian Varas wrote:
>>
>> Hi,
>>
>> I think is better to start with *web2py*, is easy to learn and I believe
>> that fit better to your site, py4web is really good and more faster, but in
>> web2py you have more tools to do things.
>> The transition after from web2py to py4web is not difficult.
>>
>> Cheers.
>> Chris.
>>
>> El vie., 17 abr. 2020 a las 16:02, David Swarbrick ()
>> escribió:
>>
>>> I have a UK case law database presently viewable at swarb.co.uk. The
>>> output is via WordPress. In better times we have had over 30k page views in
>>> a day. Presently I maintain it entirely using an ancient MS Access
>>> database.
>>> I need to move to a point where I have a sustainable and up to date
>>> editing. All that is local at the moment, and SQLite seems an appropriate
>>> starting point. W2P and P4W seem to offer ideal ways forward. I am a
>>> retired lawyer with some historic programming skills, not a developer. I
>>> tend to find modern programming documentation dense, and most of my time
>>> and attention has to go on content.
>>>
>>> Is P4W ready yet for a dumbo?  Is there an obvious transition from W2P
>>> to p4W?
>>>
>>> Where do I start?
>>>
>>> In any event, congratulations and thank yu.
>>>
>>>
>>>
>>> --
>>> 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 web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/702249ab-643c-496c-8a91-2db2ae775ab6%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/2b81d34b-0038-4165-bcd8-4e458fcf16e6%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNF50DJVn3AVNJtmCjw_4Q%3D9cR3YUJdBm5hFSPoskVn%3DQ%40mail.gmail.com.


Re: [web2py] Web2py, react, typescript, visual studio code setup

2020-03-11 Thread AGRogers
Great. Thanks Larry. I hadn't asked but I wanted to. I'll check it out.

On Thu, 12 Mar 2020, 01:59 Larry Weinberg,  wrote:

> Several people have asked about how to set up web2py to work with React
> (and Typescript) on the front end. Others have asked how to use an IDE like
> Visual Studio Code with web2py. I have a setup that I've posted to github
> that has the basics in place for doing this with a pre-configured Visual
> Studio Code workspace and instructions on how to get it up and running.
>  Web2py running inside VSCode is really easy to work with and debug!
>
> https://github.com/larrywberg/web2py-react-ts-vscode
>
> I am not an expert on Visual Studio Code, or React, or Typescript, or
> web2py so I would be happy to get feedback to improve it.  I hope this is
> useful for others.  It is using React with React Hooks for state
> management.  There is a sample REST call set up.
>
> I hooked in a webpack dev server in addition to the web2py server so that
> the react sample code can be iterated on quickly if you so choose.  You can
> debug the python server and the Typescript client at the same time in
> VSCode if you launch them both from the preconfigured launch tasks. You can
> also use the Web2py admin interface to edit files in parallel with editing
> them in VS Code when running locally.  There are other preconfigured
> scripts set up and you can also trigger the compile of the react code from
> a menu item in the sample code.
>
>
>
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/0dc1a393-0bee-4e49-bf4d-8cd252c0dea7%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMNqcyXJivcd4R6wHBYnZniC%3DZiMQXGCrZ4ZG_hS8Qo1iw%40mail.gmail.com.


Re: [web2py] pyweb login

2020-03-07 Thread AGRogers
 Maybe reinstall python as well?

On Sat, 7 Mar 2020, 22:26 Maurice Waka,  wrote:

> See attached, nothing shows that is installed yet.
> Regards
>
> On Sat, Mar 7, 2020 at 3:23 PM Maurice Waka  wrote:
>
>> Hello, any help out there
>>
>> This is all I get at the terminal, see below.
>> I still can't login
>> Choose a one-time dashboard password:
>> Storing the hashed password in file "password.txt"
>> Dashboard is at: http://127.0.0.1:8000/_dashboard
>> [X] loaded _scaffold
>> [X] loaded myfeed
>> [X] loaded _dashboard
>> [X] loaded _default
>> [X] loaded _documentation
>> [X] loaded examples
>> [X] loaded todo
>> [X] loaded _minimal
>> Bottle v0.12.18 server starting up (using TornadoServer())...
>> Listening on http://127.0.0.1:8000/
>> Hit Ctrl-C to quit.
>>
>> WARNING:tornado.access:403 GET /_dashboard/info (127.0.0.1) 14.35ms
>> WARNING:tornado.access:403 GET /_dashboard/apps (127.0.0.1) 1.72ms
>> WARNING:tornado.access:403 GET /_dashboard/tickets (127.0.0.1) 1.31ms
>> WARNING:tornado.access:403 GET /_dashboard/routes (127.0.0.1) 1.32ms
>>
>>
>> On Thu, Mar 5, 2020 at 4:57 AM Maurice Waka 
>> wrote:
>>
>>> Hello
>>> I recently logged out of py4web app. Upon login again, I  can't get in.
>>> Tried to login to all apps installed in vain.
>>> I downloaded another py4web and reinstalled it but still after
>>> registration I cant login.
>>> No error messages shown at all. It behaves as if its going to refresh
>>> but returns back to the sign in page.
>>> Help here
>>> 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/web2py/pBFfw8y9Bic/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/72062b43-d6b9-4c20-9187-7cf76d37b883%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CALkNK56qbgvN4Jb1pa-KrTm%2B-ffcKSi3Ua1pFTkdJ0T%2BkQef1w%40mail.gmail.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMOy%3D46vvVOYmceoLo%2Be_Fq6QCyV_MhuiYM-NBtMLT_4ig%40mail.gmail.com.


Re: [web2py] Re: Why would new code be ignored and old code be executed?

2020-03-06 Thread AGRogers
>>>  Code in the modules folder are compiled automatically when the python
file is first invoked. So, after you change any file in modules, you should
remove the correspondent .pyc file.

Ah, i see, Thanks for the tip.

On Fri, 6 Mar 2020 at 19:48, Carlos Correia 
wrote:

> Às 09:38 de 06/03/20, Andrew Rogers escreveu:
>
> Thanks for your advice Val. I will try your suggestion... and google
> search a little to see what it does
>
> I dont think i had two servers running but i will look out  for that in
> the future.
>
> It seems that the Module i added was the main problem. I moved all the
> code into the Controller and didnt have any more issues. I dont know what
> best practice is but from a few things i read it seemed to discourage using
> Modules.
>
> Code in the modules folder are compiled automatically when the python file
> is first invoked. So, after you change any file in modules, you should
> remove the correspondent .pyc file.
>
> In controllers and models, however the files are not compiled by default,
> so, most likely, there are no compiled files in those folders and the code
> is interpreted at every request.
>
>
> On Friday, 6 March 2020 07:05:27 UTC+10, Val K wrote:
>>
>> To track module changes try this
>>
>>
>> from gluon.custom_import import track_changes; track_changes(True)
>>
>> Also, your problem looks like you have more then one web2py server running
>>
>
> Regards,
>
> Carlos Correia
> =
> MEMÓRIA PERSISTENTE
> GSM:  917 157 146
> e-mail: ge...@memoriapersistente.pt
> URL: http://www.memoriapersistente.pt
> XMPP (Jabber): car...@memoriapersistente.pt
> GnuPG: wwwkeys.eu.pgp.net
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/2972294b-9cfb-cc26-356d-ea9ec97c99fa%40memoriapersistente.pt
> 
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMOFxRWHQZpGJ%2BkyQgKmhuMOCPUFixcZDn7eU20b_vM51Q%40mail.gmail.com.


Re: [web2py] Re: LOAD in py4web

2020-02-27 Thread AGRogers
https://unpoly.com/

On Fri, 28 Feb 2020 at 16:22, Massimo Di Pierro 
wrote:

> never heard of unpolly.js and cannot find it. Have a link?
>
>
> On Wednesday, 26 February 2020 19:32:20 UTC-8, Carlos Costa wrote:
>>
>> LOAD is a very cool thing! And beginners just say WOW when they can
>> create ajax-like experience so easy.
>> But, IMO, it lacks some important features for modern apps, like error
>> handling and history handling.
>>
>> I have written some simple functions to help cover these things...
>>
>> Another way I found very useful was to use unpolly.js. It's magic but
>> makes me a little lazyer about getting things done with vue.js.
>> (BTW they created unpolly to avoid using things like vue, react, etc,
>> really!)
>>
>> I would like very much to use vue.js but I am still noob regarding how to
>> use it with py4web.
>> Maybe we should really encourage vue.js and stuff alike... but an initial
>> pattern would be cool.
>> And IMO it should be simple and very cleared stated in the docs.
>> So no one will miss LOAD.
>>
>> Em domingo, 23 de fevereiro de 2020 15:18:51 UTC-3, RHC escreveu:
>>>
>>> HI,
>>>
>>> I am beginning to experiment with py4web, I like the sound of it and I
>>> am looking to convert a web2py project to py4web to see how they compare.
>>>
>>> It appears that the LOAD (helper?) that was available in web2py
>>> templates is not available in py4web. I was using this to populate part of
>>> a web page, I liked the way you had the option to use LOAD to call a
>>> separate URL (within the same app) and insert the result into your page
>>> before returning the page to the client.
>>>
>>> What is the reason for the absence of LOAD in py4web? is there a
>>> recommended alternative method of achieving the same effect? I have used a
>>> mixture of ajax=True and ajax=False options for this feature.
>>>
>>> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/22d8b9cf-9ce2-464b-809e-32d4dd84fd02%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPXoWfp9iZ7yQtbCw_YU6yh-9M2_xAQ%3Dzj4ocyWTzxuXw%40mail.gmail.com.


Re: [web2py] Re: Setting a default reference value as that of a specific group the logging in user is a member of

2020-02-26 Thread AGRogers
Thanks for the extra info. In my scenario I have schools, teachers,
subjects, classes and students. At the Classes level there will be hundreds
eventually (new ones each term). Your school limits what subjects you can
see. The teacher limits what classes she can see etc.

If I understood you correctly you are suggesting to use the auth
functionality built into web2py. Do you think that is still appropriate
when there are potentially hundreds of groups?

And second, I think I read that py4web uses a different approach with
tags(?) Is that correct?

Thanks

On Wed, 26 Feb 2020, 15:43 'Annet' via web2py-users, <
web2py@googlegroups.com> wrote:

> I don't understand the use of field 'groups' and function 'get_groups()
>
> I think you should use web2py's built in auth_ functionality: drop field
> 'groups' in both tables, link users and groups (each hotel its own group)
> in the auth_membership table, and use this table to create a list of
> options
> for the drop-down.
>
> I hope this points you in the right direction to solve your problem
>
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/bd2e0505-00f8-4403-9e3d-f89372e2f027%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMP6v_o%2B9Fev_z6yq9XT5agyVc-Y5E1tQcm5mu6MWgUFXA%40mail.gmail.com.


Re: [web2py] Setting a default reference value as that of a specific group the logging in user is a member of

2020-02-25 Thread AGRogers
I am interested in the best practice way to do this as well.

On Tue, 25 Feb 2020, 13:58 mostwanted,  wrote:

> I have 2 tables about a hotel, one table registers the hotel itself & the
> other is about meals that are offered at the hotel but the idea is that
> only group members of each hotel have to & can only register meals for
> their hotels. So to avoid mistakes & prevent malicious intentions I was
> wondering if its possible to have the referencing field in the meals table
> pre-selected appropriately for the logged in user with their correct hotel
> name as per the group they belong to. I hope I make sense:
>
> *MODEL CODE*
> db.define_table('hotel_profile',
> Field('hotel_name'),
> Field('logo', 'upload'),
> Field('tel1'),
> Field('email_address'),
> Field('directions', 'text', requires=IS_LENGTH(500)),
> Field('google_directions'),
> Field('posted_by', 'reference auth_user', default=auth.
> user_id, readable=False, writable=False),
> Field('groups', 'reference auth_group', default=get_group
> (), readable=False, writable=False),
> format='%(hotel_name)s'
>)
>
>
> db.define_table('meals',
> Field('hotel', 'reference hotel_profile'),
> Field('supper_price'),
> Field('supper_details', 'text', requires=IS_LENGTH(200)),
> Field('lunch_price'),
> Field('lunch_details', 'text', requires=IS_LENGTH(200)),
> Field('breakfast_price'),
> Field('breakfast_details', 'text', requires=IS_LENGTH(200
> )),
> Field('posted_by', 'reference auth_user', default=auth.
> user_id, readable=False, writable=False),
> Field('groups', 'reference auth_group', default=get_group
> (), readable=False, writable=False)
>)
>
> Regards;
>
> Mostwanted
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/be138b98-8d67-4a8d-bb77-b4410434f882%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPeHbckGMOpHKYnBwgSiyG3iuH-Xrdhk7YonWaMO7%2BsGg%40mail.gmail.com.


Re: [web2py] Re: Web2py or py4web for a brand new project

2020-01-22 Thread AGRogers
OK, thanks. Re reporting errors, I suspect most errors will be due to my
ignorance. But thanks for the encouragement.

On Tue, Jan 21, 2020, 1:26 PM Massimo Di Pierro 
wrote:

> You should use the py4web documentation. Also please report any error you
> find.
>
>
> On Tuesday, 14 January 2020 22:03:59 UTC-8, Andrew Rogers wrote:
>>
>> Hi
>>
>> Is  the documentation for web2py still mostly relevant for py4web?
>>
>> Thanks
>> Andrew
>>
>> On Thursday, 12 December 2019 20:47:05 UTC+6:30, icodk wrote:
>>>
>>> Should I use Web2py or py4web for a brand new project ?
>>> What is still missing from py4web  ?
>>> Can I debug with pycharm ?
>>> I need all the great authentication I got with web2py :
>>> Registration,pass change, groups mail, etc.
>>> smartgreed will be very nice to have or similar.
>>> Stability ?
>>> Can it be deployed with nginx  and pg ?
>>> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/d6c0a99a-42c9-4b04-91ab-56c8ac72b8c4%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPjhvWrL3%2B0CtjSCFN_fc-246wAbGbBkWKi84Xfixn3Kg%40mail.gmail.com.