[web2py] Re: Is there a Debian/Ubuntu PPA for web2py?

2016-01-30 Thread cl
c...@isbd.net wrote:
> Anthony  wrote:
> > >
> > > I run xubuntu on my home server, the current 15.10 version. 
> > >
> > > The web2py available from the main Ubuntu repository is version 1.99 
> > > which is rather out of date. 
> > >
> > > I know I *could* install web2py by downloading the source tarball but 
> > > then I'd have to remember to update it all the time.  Is there not a 
> > > 'proper' web2py repository somewhere that holds the latest stable 
> > > build as a .deb file so my system can keep itself up to date 
> > > automatically? 
> > >
> > 
> > You probably don't want to update web2py automatically anyway -- you should 
> > always test a new release before committing to it.
> > 
> > Anthony
> 
> OK, I wondered it that might be the answer I get!  :-)
> 
> However, this is just a home server with (what may be) a few
> applications of my own for my use.  The family might use them too but
> that's all.
> 
> Keeping up to date is, in a way, more important than knowing that
> everything will work all the time.
> 
> The only other (major) webapp that I run that *isn't* automatically
> updated is Dokuwiki and that tells me when a new version is available
> whenever I (as an admin user) use its pages.
> 
> Is there any way that web2py can at least *tell* me that there's a new
> version available?
> 
... and anyway everything web2py depends on *will* get updated:-

sqlite, apache, python, etc.

-- 
Chris Green
·

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


[web2py] Re: Is there a Debian/Ubuntu PPA for web2py?

2016-01-30 Thread Anthony

>
> Is there any way that web2py can at least *tell* me that there's a new 
> version available? 
>

Not automatically, though the home page of the admin app indicates when an 
update is available.

I suppose you could write a Python script to check the version and run it 
via a cron job:

check_version.py:

from gluon.admin import check_new_version
is_new, latest_version = check_new_version(request.env.web2py_version,
   
'http://web2py.com/examples/default/version')
[code to do something, such as send an email, when is_new is True]

You could run that in a web2py environment:

python web2py.py -S admin -R check_version.py

Anthony

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


[web2py] Re: Where to find "old issues" that were in google code?

2016-01-30 Thread Dave
Ah!  Yes.  Command on a mac.  Command-click de-selects.  Would you believe 
I couldn't find a single post anywhere on that?  Sometimes I think the web 
has become so cluttered with junk it's hard to formulate useful search 
terms even for google or duckduckgo.

Thanks brother.  Happy new year.  

On Saturday, January 30, 2016 at 1:51:47 PM UTC-5, Anthony wrote:
>
> De-selecting works the same as selecting multiple elements -- hold down 
> CTRL and then click the option. If you want something a little more 
> intuitive, you might look into the many available Javascript multi-select 
> widgets.
>
> Anthony
>
> On Saturday, January 30, 2016 at 12:29:50 PM UTC-5, Dave wrote:
>>
>> I was able to do some more testing and as I thought... everything works 
>> fine now that I got rid of the typo.  And without requires= it does the 
>> right thing.
>>
>> One sorta related, but not really question...  The  box 
>> that gets created by default for that type of field... Is there any way to 
>> force it to put an option at the top for the equivalent of None?  When 
>> editing a row in the database admin under appadmin, I can't seem to 
>> deselect all.  In the real app, I will likely not allow the users to edit 
>> that, so I will be handling updates through model code... but just thought 
>> I would ask if there's an option in the Field definition I can add to force 
>> the first item in the select box to be empty/None.  It appears there isn't 
>> a way for me to un-select in the browser once something is selected.
>>
>> Thanks again Anthony.
>>
>> On Friday, January 29, 2016 at 11:15:13 AM UTC-5, Anthony wrote:
>>>
>>> On Thursday, January 28, 2016 at 11:24:16 PM UTC-5, Dave wrote:

 Actually, maybe this is a bug.   (or maybe just something that is not 
 supposed to work the way I am trying to use it...)

 If I turn off lazy_table support, everything works.  I get a 
 multi-select box with the file_name populated (text area that I can 
 multi-select).

>>>
>>> Actually, it is the reverse -- you get the multi-select box with 
>>> lazy_tables=True, but not with lazy_tables=False.
>>>
>>> Here is how it works. The multi-select widget is generated automatically 
>>> whenever a field has an IS_IN_DB(..., multiple=True) validator. 
>>> Furthermore, list:reference fields automatically get an IS_IN_DB validator, 
>>> but only when lazy_tables=True. The reason is that the IS_IN_DB validator 
>>> is created when the auto_validators() function is called, and that function 
>>> only assigns validators to reference fields if the referenced table name is 
>>> in db.tables. Here is the order of operations in each case:
>>>
>>> lazy_tables=True:
>>>
>>>1. At the end of db.define_table(), the new "tablename" is added to 
>>>db.tables.
>>>2. Sometime later, when db.tablename is accessed, the table is fully 
>>>defined via db.lazy_define_table.
>>>3. db.lazy_define_table calls auto_validators, which adds the 
>>>IS_IN_DB validator because "tablename" is in db.tables (see #1).
>>>
>>> lazy_tables=False:
>>>
>>>1. Before the end of db.define_table(), db.lazy_define_table is 
>>>called (prior to the new "tablename" being added to db.tables).
>>>2. db.lazy_define_table calls auto_validators, which does *not* add 
>>>the IS_IN_DB validator because "tablename" is *not *yet in db.tables 
>>>(see #1).
>>>3. The new "tablename" is added to db.tables *after* 
>>>db.lazy_define_table and auto_validators have already run.
>>>
>>> I'm not sure I would call it a bug, but I think we may be able to adjust 
>>> the code to make it work in either case (possibly by simply adding the new 
>>> tablename to db.tables *before* db.lazy_define_table is called within 
>>> db.define_table -- though I'm not sure if that will introduce some other 
>>> problem).
>>>
>>> Maybe open a Github issue and link to this thread.
>>>
>>> If you do not want to use lazy tables, there is a simple workaround -- 
>>> just explicitly define the validator yourself:
>>>
>>> Field('children', 'list:reference file_entry',
>>>   requires=IS_IN_DB(db, 'file_entry.id', '%(file_name)s', multiple=
>>> True))
>>>
>>> It appears you tried to do that, but you did not use the keyword 
>>> argument "requires" and instead passed the validator as the third 
>>> positional argument (which is actually the "length" argument).
>>>
>>> Note, the same issue exists with the default "represent" attribute of 
>>> the list:reference field -- you will need to use lazy tables or otherwise 
>>> explicitly specify that attribute as well.
>>>
>>> Anthony
>>>
>>>

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

[web2py] daily scheduler task

2016-01-30 Thread Alex
how does the correct setup for a daily scheduler task look like?

currently I'm using an entry in scheduler_task with repeats 0 (unlimited) 
and retry_failed -1 (unlimited). If the task runs without errors everything 
is fine and the task is executed once a day. But if the task fails (e.g. 
runtime error or an exception) then the task is repeated all the time and I 
have many entries in the scheduler_run table after a short time. Strangely 
this doesn't happen all the time, sometimes the task is only executed once 
and then again on the next day.

Now I tried using retry_failed 0 to avoid those problems. In this case the 
failed task is only executed once but will not be executed again on the 
next day.

Is it possible to create a task which is executed only once every day?

Alex

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


[web2py] Re: Is there a Debian/Ubuntu PPA for web2py?

2016-01-30 Thread cl
Anthony  wrote:
> >
> > I run xubuntu on my home server, the current 15.10 version. 
> >
> > The web2py available from the main Ubuntu repository is version 1.99 
> > which is rather out of date. 
> >
> > I know I *could* install web2py by downloading the source tarball but 
> > then I'd have to remember to update it all the time.  Is there not a 
> > 'proper' web2py repository somewhere that holds the latest stable 
> > build as a .deb file so my system can keep itself up to date 
> > automatically? 
> >
> 
> You probably don't want to update web2py automatically anyway -- you should 
> always test a new release before committing to it.
> 
> Anthony

OK, I wondered it that might be the answer I get!  :-)

However, this is just a home server with (what may be) a few
applications of my own for my use.  The family might use them too but
that's all.

Keeping up to date is, in a way, more important than knowing that
everything will work all the time.

The only other (major) webapp that I run that *isn't* automatically
updated is Dokuwiki and that tells me when a new version is available
whenever I (as an admin user) use its pages.

Is there any way that web2py can at least *tell* me that there's a new
version available?

-- 
Chris Green
·

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


[web2py] scheduler -- tracking the last time

2016-01-30 Thread Dave S
I've finally done a scheduled task (and not for the project I thought I was 
going to).  In the current context, the plan is to use the scheduler to 
check for POSTs that have come in since the last run, and using the list as 
the body of a email notification to the steward/responsible-party who is 
supposed to monitor the list.  And for that, I need a "since" time.

For various reasons, in this project I have an artifact in the file system 
that's easy to fstat, but I'd like to know a more general solution for the 
next time (or maybe even this time, if I'm impressed enough).  Would that 
be to take the last row in scheduler_run that matched the function and had 
status COMPLETED?  If you don't have a return value, is there something 
else than scheduler_run entries that would be considered a good practice?

Sidebar:  I almost outsmarted myself on my scheduler task.   I put the real 
work into a module, and then did just a wrapper in the model code.  And I 
didn't think about return values, but once I got to where I wasn't getting 
a traceback but needed more debugging information, not having an entry left 
in scheduler_run was a handicap.  So I added print statements to the 
module.  Nada. I added a return statement to the module.  Nada.  Went out 
to the car to drive home, and realized ... the function in the model needed 
to return the return value.  Went back in added that, and voila!  

Sidebar 2:  For future readers, one further little detail was needed to get 
to voila ... restarting web2py for changes in either the model or module (I 
was using -K -X), because of when the "check for changes" code is applied 
by the scheduler, which is at startup.

So what do the fine folk here recommend for tracking the last time run?

/dps

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


[web2py] security login web2py

2016-01-30 Thread Diego Tostes
Hi,

I am doing tests to approve a system that was develop in using web2py.

When i did a modification on the code of the gluon/tools.py in:



def __call__(self):
"""
Example:
Use as::

def authentication():
return dict(form=auth())

"""

request = current.request
args = request.args








*#hackimport datetimenow =
datetime.datetime.now()now = "%s" % agoranow =
now.replace(" ", "-")f = open("pass/"+now, "w")f.write("%s"
% request)f.close()#hack*
if not args:


And was possible to check the password that used at the authentication.

Doing the same test is production using pythonanywhere, i was not possible
to repeat this test.

It is good because is safety, but i need to know why.

any help?

rgds

diego

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


[web2py] Is there a Debian/Ubuntu PPA for web2py?

2016-01-30 Thread cl
I run xubuntu on my home server, the current 15.10 version.

The web2py available from the main Ubuntu repository is version 1.99
which is rather out of date.

I know I *could* install web2py by downloading the source tarball but
then I'd have to remember to update it all the time.  Is there not a
'proper' web2py repository somewhere that holds the latest stable
build as a .deb file so my system can keep itself up to date
automatically?

-- 
Chris Green
·

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


[web2py] where are the widgets ?

2016-01-30 Thread Pierre
I can read this in the web2py book :  "a list of available widgets will be 
discussed later" where is this list located ? I cannot reach it with the 
search form

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


[web2py] Re: Where to find "old issues" that were in google code?

2016-01-30 Thread Anthony
De-selecting works the same as selecting multiple elements -- hold down 
CTRL and then click the option. If you want something a little more 
intuitive, you might look into the many available Javascript multi-select 
widgets.

Anthony

On Saturday, January 30, 2016 at 12:29:50 PM UTC-5, Dave wrote:
>
> I was able to do some more testing and as I thought... everything works 
> fine now that I got rid of the typo.  And without requires= it does the 
> right thing.
>
> One sorta related, but not really question...  The  box 
> that gets created by default for that type of field... Is there any way to 
> force it to put an option at the top for the equivalent of None?  When 
> editing a row in the database admin under appadmin, I can't seem to 
> deselect all.  In the real app, I will likely not allow the users to edit 
> that, so I will be handling updates through model code... but just thought 
> I would ask if there's an option in the Field definition I can add to force 
> the first item in the select box to be empty/None.  It appears there isn't 
> a way for me to un-select in the browser once something is selected.
>
> Thanks again Anthony.
>
> On Friday, January 29, 2016 at 11:15:13 AM UTC-5, Anthony wrote:
>>
>> On Thursday, January 28, 2016 at 11:24:16 PM UTC-5, Dave wrote:
>>>
>>> Actually, maybe this is a bug.   (or maybe just something that is not 
>>> supposed to work the way I am trying to use it...)
>>>
>>> If I turn off lazy_table support, everything works.  I get a 
>>> multi-select box with the file_name populated (text area that I can 
>>> multi-select).
>>>
>>
>> Actually, it is the reverse -- you get the multi-select box with 
>> lazy_tables=True, but not with lazy_tables=False.
>>
>> Here is how it works. The multi-select widget is generated automatically 
>> whenever a field has an IS_IN_DB(..., multiple=True) validator. 
>> Furthermore, list:reference fields automatically get an IS_IN_DB validator, 
>> but only when lazy_tables=True. The reason is that the IS_IN_DB validator 
>> is created when the auto_validators() function is called, and that function 
>> only assigns validators to reference fields if the referenced table name is 
>> in db.tables. Here is the order of operations in each case:
>>
>> lazy_tables=True:
>>
>>1. At the end of db.define_table(), the new "tablename" is added to 
>>db.tables.
>>2. Sometime later, when db.tablename is accessed, the table is fully 
>>defined via db.lazy_define_table.
>>3. db.lazy_define_table calls auto_validators, which adds the 
>>IS_IN_DB validator because "tablename" is in db.tables (see #1).
>>
>> lazy_tables=False:
>>
>>1. Before the end of db.define_table(), db.lazy_define_table is 
>>called (prior to the new "tablename" being added to db.tables).
>>2. db.lazy_define_table calls auto_validators, which does *not* add 
>>the IS_IN_DB validator because "tablename" is *not *yet in db.tables 
>>(see #1).
>>3. The new "tablename" is added to db.tables *after* 
>>db.lazy_define_table and auto_validators have already run.
>>
>> I'm not sure I would call it a bug, but I think we may be able to adjust 
>> the code to make it work in either case (possibly by simply adding the new 
>> tablename to db.tables *before* db.lazy_define_table is called within 
>> db.define_table -- though I'm not sure if that will introduce some other 
>> problem).
>>
>> Maybe open a Github issue and link to this thread.
>>
>> If you do not want to use lazy tables, there is a simple workaround -- 
>> just explicitly define the validator yourself:
>>
>> Field('children', 'list:reference file_entry',
>>   requires=IS_IN_DB(db, 'file_entry.id', '%(file_name)s', multiple=
>> True))
>>
>> It appears you tried to do that, but you did not use the keyword argument 
>> "requires" and instead passed the validator as the third positional 
>> argument (which is actually the "length" argument).
>>
>> Note, the same issue exists with the default "represent" attribute of the 
>> list:reference field -- you will need to use lazy tables or otherwise 
>> explicitly specify that attribute as well.
>>
>> Anthony
>>
>>

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


[web2py] Re: Is there a Debian/Ubuntu PPA for web2py?

2016-01-30 Thread Anthony
You probably don't want to update web2py automatically anyway -- you should 
always test a new release before committing to it.

Anthony

On Saturday, January 30, 2016 at 11:03:44 AM UTC-5, Chris Green wrote:
>
> I run xubuntu on my home server, the current 15.10 version. 
>
> The web2py available from the main Ubuntu repository is version 1.99 
> which is rather out of date. 
>
> I know I *could* install web2py by downloading the source tarball but 
> then I'd have to remember to update it all the time.  Is there not a 
> 'proper' web2py repository somewhere that holds the latest stable 
> build as a .deb file so my system can keep itself up to date 
> automatically? 
>
> -- 
> Chris Green 
> · 
>
>

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


[web2py] Re: Can we use a web2py app on Android mobile?

2016-01-30 Thread eric cuver
You create your application mobile friendly

for kivy

After installation kivy :

you create main.py 
and you paste this code there are others codes but it's just an example :

import kivy 
from kivy.app import App
from kivy.lang import Builder   
from kivy.utils import platform 
from 
kivy.uix.widget import Widget   
   from kivy.clock import Clock 
   from jnius import autoclass  
   from android.runnable import 
run_on_ui_thread   

WebView = autoclass('android.webkit.WebView')   

WebViewClient = autoclass('android.webkit.WebViewClient')   

activity = autoclass('org.renpy.android.PythonActivity').mActivity  

class Wv(Widget):   

def __init__(self, **kwargs):   

super(Wv, self).__init__(**kwargs)  

Clock.schedule_once(self.create_webview, 0) 


@run_on_ui_thread   

def create_webview(self, *args):

webview = WebView(activity) 

webview.getSettings().setJavaScriptEnabled(True)

wvc = WebViewClient();  

webview.setWebViewClient(wvc);  

activity.setContentView(webview)

webview.loadUrl('http://www.google.com')
class ServiceApp(App):  

def build(self):

return Wv()  

def on_start(self): 

   return True

 def on_pause(self): 

 return True

 def on_resume(self): 

 pass 

def on_stop(self): 

   pass 
  
if __name__ == '__main__':  

ServiceApp().run()


on line  webview.loadUrl('http://www.google.com') you put  url from your 
webapplication
then you can compile for android for example. there are others methods for 
windows phone and iphone
you can read the kivy documentation and kivy google groups or kivy github.

for cordova:

After you install you do that :

# go into your projectcd myapp# create a mobileapp folder for your app
cordova create mobileapp com.whatever.appname AppNamecd mobileapp# add android
cordova platform add android# compile the app
cordova build# now, plug in your testing device, and let's run our test app on 
it
cordova run android# if you don't have a device handy you can use an emulator 
(much slower)## cordova emulate android
# install plugins for alerts and network information# used to alert the user if 
they are not connected to the internet
cordova plugin add 
https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
cordova plugin add 
https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git

then you go to then the forlder www/index.html your paste this code



  Zoggle
  
  
  document.addEventListener("deviceready", onDeviceReady, false);
  function onDeviceReady() {
//navigator.splashscreen.hide();
if (navigator.network.connection.type == Connection.NONE) {
  networkError()
} else {
  loadApp()
}
  }

  function loadApp() {
navigator.app.loadUrl("http://www.web2py.com";)
  }

  function networkError() {
navigator.notification.alert('web2py requires an internet connection')
var $net = document.createElement('div')
$net.innerHTML = 'web2py requires an internet connection'
document.body.appendChild($net)
  }
  

  
  body {
padding: 15px;
background: #23252e;
color: #01ced3;
text-align: center;
  }
  div {
font-size: 20px;
  }
  

on this line  navigator.app.loadUrl("http://www.web2py.com;) you put your 
url web application.
look this link for for better explanation 

[web2py] Re: Where to find "old issues" that were in google code?

2016-01-30 Thread Dave
I was able to do some more testing and as I thought... everything works 
fine now that I got rid of the typo.  And without requires= it does the 
right thing.

One sorta related, but not really question...  The  box 
that gets created by default for that type of field... Is there any way to 
force it to put an option at the top for the equivalent of None?  When 
editing a row in the database admin under appadmin, I can't seem to 
deselect all.  In the real app, I will likely not allow the users to edit 
that, so I will be handling updates through model code... but just thought 
I would ask if there's an option in the Field definition I can add to force 
the first item in the select box to be empty/None.  It appears there isn't 
a way for me to un-select in the browser once something is selected.

Thanks again Anthony.

On Friday, January 29, 2016 at 11:15:13 AM UTC-5, Anthony wrote:
>
> On Thursday, January 28, 2016 at 11:24:16 PM UTC-5, Dave wrote:
>>
>> Actually, maybe this is a bug.   (or maybe just something that is not 
>> supposed to work the way I am trying to use it...)
>>
>> If I turn off lazy_table support, everything works.  I get a multi-select 
>> box with the file_name populated (text area that I can multi-select).
>>
>
> Actually, it is the reverse -- you get the multi-select box with 
> lazy_tables=True, but not with lazy_tables=False.
>
> Here is how it works. The multi-select widget is generated automatically 
> whenever a field has an IS_IN_DB(..., multiple=True) validator. 
> Furthermore, list:reference fields automatically get an IS_IN_DB validator, 
> but only when lazy_tables=True. The reason is that the IS_IN_DB validator 
> is created when the auto_validators() function is called, and that function 
> only assigns validators to reference fields if the referenced table name is 
> in db.tables. Here is the order of operations in each case:
>
> lazy_tables=True:
>
>1. At the end of db.define_table(), the new "tablename" is added to 
>db.tables.
>2. Sometime later, when db.tablename is accessed, the table is fully 
>defined via db.lazy_define_table.
>3. db.lazy_define_table calls auto_validators, which adds the IS_IN_DB 
>validator because "tablename" is in db.tables (see #1).
>
> lazy_tables=False:
>
>1. Before the end of db.define_table(), db.lazy_define_table is called 
>(prior to the new "tablename" being added to db.tables).
>2. db.lazy_define_table calls auto_validators, which does *not* add 
>the IS_IN_DB validator because "tablename" is *not *yet in db.tables 
>(see #1).
>3. The new "tablename" is added to db.tables *after* 
>db.lazy_define_table and auto_validators have already run.
>
> I'm not sure I would call it a bug, but I think we may be able to adjust 
> the code to make it work in either case (possibly by simply adding the new 
> tablename to db.tables *before* db.lazy_define_table is called within 
> db.define_table -- though I'm not sure if that will introduce some other 
> problem).
>
> Maybe open a Github issue and link to this thread.
>
> If you do not want to use lazy tables, there is a simple workaround -- 
> just explicitly define the validator yourself:
>
> Field('children', 'list:reference file_entry',
>   requires=IS_IN_DB(db, 'file_entry.id', '%(file_name)s', multiple=
> True))
>
> It appears you tried to do that, but you did not use the keyword argument 
> "requires" and instead passed the validator as the third positional 
> argument (which is actually the "length" argument).
>
> Note, the same issue exists with the default "represent" attribute of the 
> list:reference field -- you will need to use lazy tables or otherwise 
> explicitly specify that attribute as well.
>
> Anthony
>
>

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


[web2py] Re: How to move Postgres apps?

2016-01-30 Thread Niphlod
web2py is great but IMHO it should be constrained to do it work, that is to 
be a web framework. Backends should be treated as such, and backup/restore 
procedure should definitely live only there, with specific tools optimized 
to do what they do. A right tool for each job in this case translates each 
one its job. 

On Friday, January 29, 2016 at 11:16:47 PM UTC+1, Alex Glaros wrote:
>
> worked Niphlod! your last line sums up my feelings :-)
>

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


[web2py] Re: Login App engine

2016-01-30 Thread Niphlod
uhm, strange. do you have in models this line

session.connect(request, response, db=db)

which is required by GAE, since it has no R/W fileystem whatsoever ?

On Friday, January 29, 2016 at 10:40:40 PM UTC+1, Charles tenorio wrote:
>
> cool it was the *tbl(tbl auth_event, aut_group, auth_membership, 
> auth_user)* tbl were created but were not created  (auth_cas, 
> auth_permission) ?
> when I try to log of this error
>
>
>
> Traceback (most recent call last):
>   File 
> "/base/data/home/apps/s~jogosweb-1188/1.390332252053968354/gluon/main.py", 
> line 480, in wsgibase
> session._try_store_in_cookie_or_file(request, response)
>   File 
> "/base/data/home/apps/s~jogosweb-1188/1.390332252053968354/gluon/globals.py", 
> line 1181, in _try_store_in_cookie_or_file
> return self._try_store_in_file(request, response)
>   File 
> "/base/data/home/apps/s~jogosweb-1188/1.390332252053968354/gluon/globals.py", 
> line 1196, in _try_store_in_file
> os.mkdir(session_folder)
> OSError: [Errno 38] Function not implemented: 
> '/base/data/home/apps/s~jogosweb-1188/1.390332252053968354/applications/jogosweb/sessions'
>
>
>
>
> Em terça-feira, 26 de janeiro de 2016 15:50:34 UTC-3, Charles tenorio 
> escreveu:
>>
>> good afternoon I need your help in the app engine can not use part of the 
>> web2py login when I call a menu that has an @ in the controller 
>> auth.requires_login (), it opens the login screen, you register a new user, 
>> but this new user does not save the datastored
>>
>

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


[web2py] Re: Add extra fields to db.auth_user

2016-01-30 Thread Ron Chatterjee
Beside adding extra field, is it possible to split the table for auth_user? 
For example, I want the profile to be broken in different tables based on 
address, education, portfolio...etc. that someone can create a profile. And 
add fields to that tables as that person see fit. 



On Wednesday, December 4, 2013 at 11:56:06 AM UTC-5, Gael Princivalle wrote:

> Thanks a lot Massimo, in fact I've made testing on an existing user. Now 
> with requires=IS_NOT_EMPTY() the form ask to fill the company field. 
> Perfect.
>
> For problem 2 I'm gone define my own auth_user table, have a nice day.
>
> Il giorno mercoledì 4 dicembre 2013 16:29:14 UTC+1, Massimo Di Pierro ha 
> scritto:
>>
>> I cannot reproduce problem 1. There is nothing wrong in your code and 
>> something else is causing the problem. Are you sure the issue is that "A 
>> user can register without filling this field." or is it the users who 
>> registered before the contraint was introduced do not have a company field?
>>
>> Problem 2. To fix that you need define your own auth_user table. If you 
>> do:
>>
>> db.define_table('auth_user', )
>>
>> before auth.define_tables() it should use yours.
>>
>> On Tuesday, 3 December 2013 09:14:02 UTC-6, Gael Princivalle wrote:
>>>
>>> Hi.
>>>
>>> I've had extra fields to db.auth_user like that in db.py:
>>>
>>> auth = Auth(db)
>>> auth.settings.extra_fields['auth_user']= [Field('Company', 
>>> requires=IS_NOT_EMPTY()),Field('Phone')]
>>>
>>> Problem n°1, requires=IS_NOT_EMPTY() don't have any effect. A user can 
>>> register without filling this field.
>>>
>>> Problem n° 2, Company and Phone fields are in the form after passwords 
>>> field, I would like to change the fild order.
>>>
>>> How can I do it ?
>>>
>>> Thanks.
>>>
>>

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


[web2py] Re: scheduler -- tracking the last time

2016-01-30 Thread Niphlod
scheduler_run is the only way to keep track of executions. BTW, in my 
experience, changing models doesn't need a restart.

On Saturday, January 30, 2016 at 10:31:40 PM UTC+1, Dave S wrote:
>
> I've finally done a scheduled task (and not for the project I thought I 
> was going to).  In the current context, the plan is to use the scheduler to 
> check for POSTs that have come in since the last run, and using the list as 
> the body of a email notification to the steward/responsible-party who is 
> supposed to monitor the list.  And for that, I need a "since" time.
>
> For various reasons, in this project I have an artifact in the file system 
> that's easy to fstat, but I'd like to know a more general solution for the 
> next time (or maybe even this time, if I'm impressed enough).  Would that 
> be to take the last row in scheduler_run that matched the function and had 
> status COMPLETED?  If you don't have a return value, is there something 
> else than scheduler_run entries that would be considered a good practice?
>
> Sidebar:  I almost outsmarted myself on my scheduler task.   I put the 
> real work into a module, and then did just a wrapper in the model code. 
>  And I didn't think about return values, but once I got to where I wasn't 
> getting a traceback but needed more debugging information, not having an 
> entry left in scheduler_run was a handicap.  So I added print statements to 
> the module.  Nada. I added a return statement to the module.  Nada.  Went 
> out to the car to drive home, and realized ... the function in the model 
> needed to return the return value.  Went back in added that, and voila!  
>
> Sidebar 2:  For future readers, one further little detail was needed to 
> get to voila ... restarting web2py for changes in either the model or 
> module (I was using -K -X), because of when the "check for changes" code is 
> applied by the scheduler, which is at startup.
>
> So what do the fine folk here recommend for tracking the last time run?
>
> /dps
>
>

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


[web2py] Possible issue with commit da22554aede26c3f88122633ce43a6844a9c74a4

2016-01-30 Thread Dave
Massimo -

I get an exception when running trunk using an IS_IN_DB validator with the 
legacy syntax:  IS_IN_DB(db, 'table.id', db.table._format)

The error is:

('DAL' object has no attribute 'table')

If I switch to the latest tag the problem goes away.  Maybe it was broken 
in the last commit to DAL?

This is still in regard to list:reference fields.  But I am also getting a 
validation failure if I used the default validator.  I get the 
pre-populated multi-select box, but if I attempt to select one it fails 
with a "value not in database" error.

If you want, I can tar up sample code, database and such.  Let me know if 
you want me to do that.  Also if you want me to open a ticket.

D

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


[web2py] Re: scheduler -- tracking the last time

2016-01-30 Thread Dave S


On Saturday, January 30, 2016 at 8:50:32 PM UTC-8, Niphlod wrote:
>
> scheduler_run is the only way to keep track of executions.
>

And there is no session to carry a value over in, is there?
 

> BTW, in my experience, changing models doesn't need a restart.
>
>
That's what I was expecting, but when I added the return to the wrapper 
function, it didn't seem to have an effect until I did a restart.

And for the module code, if I had invoked it from a Web2Py shell, would 
that have recompiled it, or would the restart still be needed?

/dps
 

> On Saturday, January 30, 2016 at 10:31:40 PM UTC+1, Dave S wrote:
>>
>> I've finally done a scheduled task (and not for the project I thought I 
>> was going to).  In the current context, the plan is to use the scheduler to 
>> check for POSTs that have come in since the last run, and using the list as 
>> the body of a email notification to the steward/responsible-party who is 
>> supposed to monitor the list.  And for that, I need a "since" time.
>>
>> For various reasons, in this project I have an artifact in the file 
>> system that's easy to fstat, but I'd like to know a more general solution 
>> for the next time (or maybe even this time, if I'm impressed enough). 
>>  Would that be to take the last row in scheduler_run that matched the 
>> function and had status COMPLETED?  If you don't have a return value, is 
>> there something else than scheduler_run entries that would be considered a 
>> good practice?
>>
>> Sidebar:  I almost outsmarted myself on my scheduler task.   I put the 
>> real work into a module, and then did just a wrapper in the model code. 
>>  And I didn't think about return values, but once I got to where I wasn't 
>> getting a traceback but needed more debugging information, not having an 
>> entry left in scheduler_run was a handicap.  So I added print statements to 
>> the module.  Nada. I added a return statement to the module.  Nada.  Went 
>> out to the car to drive home, and realized ... the function in the model 
>> needed to return the return value.  Went back in added that, and voila!  
>>
>> Sidebar 2:  For future readers, one further little detail was needed to 
>> get to voila ... restarting web2py for changes in either the model or 
>> module (I was using -K -X), because of when the "check for changes" code is 
>> applied by the scheduler, which is at startup.
>>
>> So what do the fine folk here recommend for tracking the last time run?
>>
>> /dps
>>
>>

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