Re: [web2py] Re: Web2py with ngix

2016-12-09 Thread J Boggy
thz i have been solved. 
Now other error is i cannot import some module althougn i have been installed 
and tested on python. But in web2py controller i can't import module

-- 
Resources:
- http://web2py.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] substantial increase in page load time after upgrade to web2py 2.14.6 (only for grid pages)

2016-12-09 Thread Gaurav Vichare
I did following steps to upgrade:

1. From admin panel, I cleaned, caches, sessions and errors using "clean". 
(also cleaned my browser cache and cookies)
2. Then created w2p package using "pack all"
3. Downloaded latest web2py 2.14.6 from 
http://web2py.com/init/default/download
4. Then installed w2p package on web2py 2.14.6 using admin panel
5. Copied web2py.js, appadmin.py, appadmin.html, jquery.js, 
web2py_ajax.html, web2py.css from welcome app and pasted in newly installed 
app
6. Made few css changes to match old UI
Now my complete app is running without any python or js errors.

Now when I visit application page containing web2py grid (SQLFORM.grid()) 
on web2py 2.14.6, it takes *34.775* *seconds* and on version 2.3.2 same 
page with same number of records it takes *0.686* *seconds*. Grid has 
around 4600 records. Pages that doesn't have grid, took approx same time to 
load on both versions.


I did time profiling and found that gluon/html.py is taking most of the 
time.

Time profiling results

2.3.2 : https://paste.ubuntu.com/23602259/

2.14.6 : https://paste.ubuntu.com/23602261/


Also I added print statement before and after grid definition, It took 18 
seconds on 2.14.6 and 10 *miliseconds* on 2.3.2.

SQLFORM.grid() definition is similar to following:

grid = SQLFORM.grid(query,
create=True,
csv=False, deletable=False, searchable=search_query,
showbuttontext=False, links=links, links_placement='left',
maxtextlengths=textlengths, upload=URL('download'),
fields=[db.notice.UIN, db.notice.classname, db.notice.title,
db.notice.type,
db.notice.description,
db.notice.due_date, db.notice.status,
db.notice.risk, db.notice.consequence,
db.notice.document,
db.notice.other])


sample query in above grid-

user_notice.notice = notice.id) AND (user_notice.auth_user = 19)) AND
  (notice.status IN ('Closed','Open','New'))) AND
 (notice.due_date IS NOT NULL))


I tested this on my local computer- Ubuntu 14.04, Python 2.7.6, 
development server and mysql db.

Why newer version takes more time to load grid? Anything I missed while 
doing upgrade?

Please help me to solve this issue.


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.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Scheduler task every first day of every month ?

2016-12-09 Thread António Ramos
start_time=next_run_time???

2016-12-09 21:50 GMT+00:00 黄祥 :

> just an idea why not set default value?
> e.g.
> from gluon.scheduler import Scheduler
> scheduler = Scheduler(db)
>
> start_bom = '%s-%s-01 00:00:00' % (request.now.year, request.now.month)
> db.scheduler_task.start_time = start_bom
> db.scheduler_task. next_run_time = start_bom
>
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Scheduler and Serial Port Problems

2016-12-09 Thread Richard Brown
Hi José,

Thank you for your post. You are correct that it is a feature of the 
Arduino architecture that a transition on RTS resets the target 
microcontroller to enable automatic programming, and it is possible to 
disable this feature, either as you describe or by removing the capacitor 
which couples RTS to Reset. However, as I intend to make my Web2py 
application available to others in the future, and they may choose to use 
standard Arduino products to implement the radio transmitter then I was 
keen to avoid any hardware modifications, especially as these will 
inevitably lead to support questions! Also my USB radio dongle is enclosed 
in a plastic case which would have to be opened to reprogram the code.

I also agree that it is not strictly a Web2py 'problem', except that I am 
using Web2py and the problem is as a result of using the serial port in a 
background process running under its Scheduler - and the observation that 
when Web2py saves and parses files it does something to the serial port 
which overcomes the problem and I was hoping to find out what that was and 
make use of it. However, I have since found a solution using a script, 
installed during the boot sequence which holds the serial port open. I 
created a file 'OpenPort.py' which contains the following code:

import serial

import time

ser=serial.Serial('/dev/ttyUSB0', 57600, timeout=1, xonxoff=0, rtscts=0)

ser.rts=True

while 1:

time.sleep(0.0001)

This is called from a bash script installed using 'sudo update-rc.d 
scheduler-openport defaults' which contains the lines:

dir="/home/www-data/web2py"

user="www-data"

cmd="sudo nohup python 
applications/Heating_Controller/utilities/OpenPort.py &"

I put the file in a new 'utilities' directory under my application as I 
wanted it to be part of the application's files but it cannot be in 
a directory that Web2py recognises (such as Models or Modules) because 
OpenPort.py remains open which prevents the Admin interface from working.

This has solved my problem and doesn't have any hardware implications.

Richard

On Tuesday, December 6, 2016 at 5:25:55 PM UTC, José L. wrote:

> Hi Richard, maybe I'm wrong, but I think this is  not related to web2py at 
> all.
> Arduino boards are build to make a reset whenever the port is open/reopen 
> so they change to "programming" state.
> This is made on purpose, but it's trivial to avoid it. If using an Arduino 
> UNO board, just connecting a 10μF capacitor between RESET and GND will 
> avoid those resets. Just remember to remove the capacitor if you need to 
> re-program your board.
>
> Hope this was the issue.
> José L.
>
> 2016-11-26 16:58 GMT+01:00 Richard Brown :
>
>> I've now had chance to do some more investigation and research since my 
>> last posting and found the following. The reason that saving files in 
>> Web2py causes RTS to be asserted and makes my application work is that my 
>> file 'control.py', which contains all my serial functions, includes the 
>> lines:
>>
>> import serial 
>>
>> ser=serial.Serial('/dev/ttyUSB0', 57600, timeout=1, xonxoff=0, rtscts=0)
>>
>>
>> If I remove/comment out the line 'ser=serial.Serial... ' then the file 
>> save has no effect. Presumably Wb2py must be executing this line somehow as 
>> part of it's parsing process, and saving my other file 'utilities.py' has 
>> the same effect because it contains 'import * from control.py'.
>>
>> I have also been playing with the Pyserial functions ser.setRTS() and 
>> ser.rts, which should force the state of RTS. I have been running these 
>> from Python scripts in my user account and found that if reboot the 
>> Pi, save one of the files in Web2py to force RTS low, then execute ser.rts 
>> or ser.setRTS using my scripts, I can set RTS high or low and that state 
>> persists. However, if I reboot the Pi and run my script *without* saving 
>> the files in Web2py then run my scripts it only cause RTS to pulse low 
>> momentarily, presumably while the script is running. I've tried including a 
>> similar script within the Web2py 'modules' area, I've tried including the 
>> set.rts commands within my serial functions, I've tried a separate function 
>> just to include that command but nothing has done anything other than pulse 
>> RTS until the script/function ends. I haven't tried running a routine once 
>> at startup yet, but I'm not sure how this will be different from running 
>> scripts 'by hand', except as far as I am aware I cannot run scripts as 
>> the 'www-data' user as there is no login/password for that account, and I 
>> have a strange feeling that there must be some sort of ownership issue 
>> here. I have written/hacked scripts to run at startup to start the Web2py 
>> Scheduler and GPIOSever but this is all a bit close to the limits of my 
>> knowledge and ability!
>>
>> In summary, I am further forward in the sense that I understand why, if 
>> not how, Web2py file saves make my application work, although not why 
>> RTS 

Re: [web2py] Re: Scheduler task every first day of every month ?

2016-12-09 Thread Dave S


On Friday, December 9, 2016 at 5:44:34 AM UTC-8, Ramos wrote:
>
> how do i define first day of every month ?
>
> [image: Imagem inline 1]
>
> 2016-12-09 12:18 GMT+00:00 Marlysson Silva  >:
>
>> The problem it with make the sheduler or with date?
>>
>> To try using some_year/some_month/1 dont't work?
>>
>>
>> Em sexta-feira, 9 de dezembro de 2016 07:17:14 UTC-3, Ramos escreveu:
>>>
>>> Hello all,
>>>  i dont know how to define a task to run every 1st day of every month.
>>>
>>> Thank you
>>> Antonio
>>>
>>
There's this post I made in August.  I'm trying to figure out where I made 
the other post I mention-in-passing.



/dps
 

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


Re: [web2py] Re: Scheduler task every first day of every month ?

2016-12-09 Thread 黄祥
just an idea why not set default value?
e.g.
from gluon.scheduler import Scheduler
scheduler = Scheduler(db)

start_bom = '%s-%s-01 00:00:00' % (request.now.year, request.now.month)
db.scheduler_task.start_time = start_bom
db.scheduler_task. next_run_time = start_bom

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.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Removing need for first and last name in auth

2016-12-09 Thread 黄祥
pls try
*models/db.py*
custom_auth_table = db[auth.settings.table_user_name] # get the 
custom_auth_table

custom_auth_table.first_name.notnull = False
custom_auth_table.last_name.notnull = False
custom_auth_table.first_name.required = False
custom_auth_table.last_name.requires = False

auth.settings.table_user = custom_auth_table

*ref:*
http://web2py.com/books/default/chapter/29/09/access-control#Customizing-Auth

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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Difference of two date field in years

2016-12-09 Thread Dave S


On Friday, December 9, 2016 at 8:31:37 AM UTC-8, Amit Kumar Modak wrote:
>
> How to get the difference of two date field in years.
> dateutil.relativedelta.relativedelta is not working as it is not able to 
> recognise date fields as date.
>
>
>
datetime.timedelta ?



If you subtract 2 datetime.datetime objectss or 2 datetime.date objects, 
you get a datetime.timedelta which will tell you the number of days, and 
then you divide by 365, or 365.25 if you expect leap years to be important 
(it will be a while before the skip rules apply; we're 16 years past the 
last one).

datetime has several ways of making date objects, and web2py uses some of 
them.  If you just have a time from the usual epoch, then the python time 
module might help.
.

/dps
 

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


Re: [web2py] improving DAL for normalized DB

2016-12-09 Thread Richard Vézina
Note you can do such query :

db(db.table.id > 0).select("sql_field_name AS new_sql_field_name") but I
don't recall how you access value of a field query like that (plain sql
passed into select...) You can experiment... There is a presentation from
Anthony Bastardi about these undocumented feature from deplaul web2py con
from 2015 I think... Or maybe Anthony can jump in here to clarify my
explanations.

There is also .with_alias('field alias'), but I am not sure exactly what
need you try to fill with them...

About db.executesql(), I think you can use it for DDL purpose, but I prefer
drop into pdAdmin for such type of work... And to be frank there is not
much value added to do it in db.executesql(), I think that having "view
definition" in DAL could be greate it would have to create the view if it
is not already create in the backend... I would avoid me to use the hacky
road that I had used and detailed above by defining them as web2py table
after havnig created them in the backend...

For many-to-many, it would be greate, but I guess it get complicated
rapidly when you start to allow such thing as every you don't have anymore
a one to one relation between DAL methodes and a table... You start to have
code that need to be specific for many-to-many relation which involve 3
table at least, other part of web2py need to support that, like sqlform...
How such table get defined?? Do you have to define these tables all
together or one at a time as now... If there still exist as a single piece,
do you have to make further check at each request to know if the reference
is a many-to-many "real" type... I never try to evaluate the impact over
DAL actual code of such things, I guess Massimo's did such assessment. His
input would enlighten us...

Richard

On Fri, Dec 9, 2016 at 3:37 PM, Val K  wrote:

> Thank you for your reply, Richard!
> " a normalized way to represent web2py list:reference field with a proper
> many-to-many relation table " - yes! this is what I meant, 'alias_name' -
> just very bad example of field name  - it isn't about aliasing  - sorry for
> the mess
>
> About views
> I think I found the acceptable way (for me at least) that is:
> 1. Get query string by   _select()
> 2. Search string  and add aliases to  fields  (if required)
> 3. Wrap string in  "CREATE VIEW ... AS ..." and  create view at db level
> by  db.executesql(  )
> 4. Define corresponding table for created view using
>  db.some_table.any_field.clone(name = alias_for_some_table_any_field)
>
> all  could be wrapped in the  function( view_query, alias_map)
> Parsing sql string (item 2) is not a better way,  but DAL doesn't support
> aliases for fields :(
>
> P.S. db.table.field.clone() - very useful function, but still undocumented
>
>
>
>
>
>
> On Friday, December 9, 2016 at 4:31:48 AM UTC+3, Richard wrote:
>>
>> Hello Val K,
>>
>> I am not sure I understand fully what your are talking about. On one
>> hand, I do understand that you would like a proper way to define SQL VIEW
>> in web2py and you propose to add a switch/flag/argument to define_table()
>> to do so, which would result in a select only table or something like
>> that... It could make sens, but I am not sure it would be accept base on my
>> experience it wouldn't pass as it seems a bit hacky and Massimo would not
>> implement it that way in DAL... Actually, I think there is no proper way to
>> implement view in DAL, and it a shame (we could have care more and answer
>> this need) that we don't have it... But you can define a view as a table in
>> web2py and use all the available feature regarding selection with this
>> "false" table (except create/read/update/delete obviously). You can also,
>> write a plain SQL SELECT and embeded it into a db.executesql() function.
>> Disavantage of the later method is that you can't access field with dot
>> notation db.table_name.field_name as web2py doesn't know about field and
>> even table name in this case, as db.executesql() return rows...
>>
>> On the other hand, I heard you talk about "storedin" field and aliasing
>> but I don't really understand to which common pratice you refer there...
>> Are you talking of a normalized way to represent web2py list:reference
>> field with a proper many-to-many relation table or are you talking about
>> something else? Which level of normalization are you trying to achieve with
>> aliasing and storedin... I don't understand what you refering to here.
>>
>>
>> Thanks
>>
>> Richard
>>
>> On Thu, Dec 8, 2016 at 5:49 PM, Val K  wrote:
>>
>>> It doesn't differ from reference fields. it is about automation
>>> distributed transaction.
>>> Table 'person' hasn't Field('alias_name' ) at db level, it's fake Field
>>> with reverse reference declaration ( 'storedin alias_opt.alias_name' ) that
>>> defines table.field that would be really involved in CRUD-process of table
>>> 'person'
>>>
>>> On Wednesday, December 7, 2016 at 5:29:28 AM UTC+3, Dave S wrote:


 

Re: [web2py] improving DAL for normalized DB

2016-12-09 Thread Val K
Thank you for your reply, Richard!
" a normalized way to represent web2py list:reference field with a proper 
many-to-many relation table " - yes! this is what I meant, 'alias_name' - 
just very bad example of field name  - it isn't about aliasing  - sorry for 
the mess

About views
I think I found the acceptable way (for me at least) that is:
1. Get query string by   _select()
2. Search string  and add aliases to  fields  (if required) 
3. Wrap string in  "CREATE VIEW ... AS ..." and  create view at db level by 
 db.executesql(  ) 
4. Define corresponding table for created view using 
 db.some_table.any_field.clone(name = alias_for_some_table_any_field) 

all  could be wrapped in the  function( view_query, alias_map) 
Parsing sql string (item 2) is not a better way,  but DAL doesn't support 
aliases for fields :(

P.S. db.table.field.clone() - very useful function, but still undocumented






On Friday, December 9, 2016 at 4:31:48 AM UTC+3, Richard wrote:
>
> Hello Val K,
>
> I am not sure I understand fully what your are talking about. On one hand, 
> I do understand that you would like a proper way to define SQL VIEW in 
> web2py and you propose to add a switch/flag/argument to define_table() to 
> do so, which would result in a select only table or something like that... 
> It could make sens, but I am not sure it would be accept base on my 
> experience it wouldn't pass as it seems a bit hacky and Massimo would not 
> implement it that way in DAL... Actually, I think there is no proper way to 
> implement view in DAL, and it a shame (we could have care more and answer 
> this need) that we don't have it... But you can define a view as a table in 
> web2py and use all the available feature regarding selection with this 
> "false" table (except create/read/update/delete obviously). You can also, 
> write a plain SQL SELECT and embeded it into a db.executesql() function. 
> Disavantage of the later method is that you can't access field with dot 
> notation db.table_name.field_name as web2py doesn't know about field and 
> even table name in this case, as db.executesql() return rows...
>
> On the other hand, I heard you talk about "storedin" field and aliasing 
> but I don't really understand to which common pratice you refer there... 
> Are you talking of a normalized way to represent web2py list:reference 
> field with a proper many-to-many relation table or are you talking about 
> something else? Which level of normalization are you trying to achieve with 
> aliasing and storedin... I don't understand what you refering to here.
>
>
> Thanks
>
> Richard
>
> On Thu, Dec 8, 2016 at 5:49 PM, Val K  
> wrote:
>
>> It doesn't differ from reference fields. it is about automation 
>> distributed transaction. 
>> Table 'person' hasn't Field('alias_name' ) at db level, it's fake Field 
>> with reverse reference declaration ( 'storedin alias_opt.alias_name' ) that 
>> defines table.field that would be really involved in CRUD-process of table 
>> 'person'
>>
>> On Wednesday, December 7, 2016 at 5:29:28 AM UTC+3, Dave S wrote:
>>>
>>>
>>> On Tuesday, December 6, 2016 at 3:41:38 PM UTC-8, Richard wrote:

 UP, never get any answer...

>>>
>>> How would this differ from reference fields?
>>>
>>> /dps
>>>  
>>>

 On Sat, Jan 23, 2016 at 4:08 PM, Val K  wrote:

> Hi guys!
> I have an idea to improve DAL in scope of work with normalized DB.
> As known It's a common practice to avoid NULL value by creating 
> separate (option) table(s) to store non required fields.  
> So, it would be great to have a field type like "storedin 
> table_name.field_name" 
> For example:
>
> db.define_table('alias_opt', Field('name'),  Field('alias_name', 
> 'reference 
> person'))
> db.define_table('person', Field('name'),  Field('alias_name', 'storedin 
> alias_opt.alias_name'))
>
> #INSERT:
> db.person.insert(name='Alex',  alias_name='Macedonian') 
> # means:
>id=db.person.insert(name='Alex')
>db.alias_opt.insert(id=id, alias_name='Macedonian')  
>
> #UPDATE:
> db(db.person.id==id).update(... , alias_name=None)
> # means:
>   # update person
>   ...
>   # update option  table
>   update_opt_args = filter_storedin_fields(update_args) 
>   opt_rec =  db.alias_opt(id)
>   opt_rec.update(update_opt_args)
>   if not any(opt_rec.values()): # -  all fields of option table 
> record is None
>  del  db.alias_opt(id)  
> else:
>  db.alias_opt.update_or_insert(id==id,   **update_opt_args)   
>  
>
> #DELETE:
> del db.person(id)  also means   del db.alias_opt(id),  like ondelete=
> 'CASCADE'
>
> #SELECT:
> rows = db(db.person).select()
> # means:
>  rows = db(db.person).select( left=[ db.alias_opt.on( db.alias_opt.id 
> == db.person.id ) ] )
> but only "storedin" fields should 

[web2py] Re: Smartgrid linked tables gotcha

2016-12-09 Thread Anthony
On Friday, December 9, 2016 at 10:39:01 AM UTC-5, Eric Waldman wrote:
>
> Bumping this because it saved me while trying to figure out why my tables 
> weren't linking. I don't believe this is mentioned anywhere in the 
> book/docs and they should be updated. Is there any way I can help with that?
>

Can you show an example of some code that doesn't work as expected? The 
"fields" argument to smartgrid should be a dictionary, with table names as 
keys. It would be odd to expect to apply the same list of fields to each 
table.

In any case, if you want to contribute to the documentation, you can always 
submit a pull request here: https://github.com/web2py/web2py-book.

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: Difference of two date field in years

2016-12-09 Thread Anthony
On Friday, December 9, 2016 at 11:31:37 AM UTC-5, Amit Kumar Modak wrote:
>
> How to get the difference of two date field in years.
> dateutil.relativedelta.relativedelta is not working as it is not able to 
> recognise date fields as date.
>

Always show your 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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: global name 'web2py_extract' is not defined

2016-12-09 Thread Anthony
That means the function web2py_extract has not been defined within that 
context. Is that a function you created? If so, where is it defined, and in 
what context are you attempting to call it?

On Friday, December 9, 2016 at 11:43:52 AM UTC-5, Amit Kumar Modak wrote:
>
>  The following line of code is giving error 
>
> global name 'web2py_extract' is not defined
>
>
>
> response.flash=web2py_extract('month', db.Player.DateOfBirth)
>

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


[web2py] Re: Web2py multiple table joins

2016-12-09 Thread Val K
Maybe try to replace db.auth_user.id  with  auth.user.id or just 
auth.user_id 

On Friday, December 9, 2016 at 9:13:27 AM UTC+3, mfarees...@gmail.com wrote:
>
> Hi
> I want to write a query in web2py. The purpose of this query is to return 
> all users that belong to a user group specified in the query. The 
> additional data I want with each user is his organization (if any), 
> managing_countries (if any), and shops (if any). Note that a user might 
> *either* own a shop or work in an organization, but not both. A person 
> working in an organization will also have a record in the 
> managing_countries table.
> Here is an ERD:
>
>
> 
>
>
> I wrote a query but I did not get the desired results. It is returning 
> data even when it is not present, so I think a left outer join is required 
> here.
>
> auth_managing_countries = db(db.managing_countries.user_id == 
> auth.user.id).select().first().countries
> user_role_clause = ((db.auth_group.role == UserGroups.employee) |
> (db.auth_group.role == UserGroups.owner))
> auth_id_clause= user_role_clause &
> (db.auth_group.id == db.auth_membership.group_id) &
> (db.auth_membership.user_id == db.auth_user.id)
> managing_countries_clause = (db.managing_countries.user_id == 
> db.auth_user.id) &
>   
> (db.managing_countries.countries.belongs(auth_managing_countries))
> shop_country_clause = ((db.shop.country.belongs(auth_managing_countries)) &
>(db.user_shop.shop_id == db.shop.id) &
>(db.user_shop.user_id == db.auth_user.id))
> query = auth_id_clause & managing_countries_clause | shop_country_clause
> db(query).select()
>
> 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: reading file from path

2016-12-09 Thread J Boggy
Sry my mistake.
cap=cv2.VideoCapture(path to /static/videos/success.mp4).
when i checked cap.isOpened() it return false but i also check 
os.path.exists(path to success.mp4) it return true.But it was not web2py 
error.it was opencv error.now i have been fixed.
 

-- 
Resources:
- http://web2py.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] global name 'web2py_extract' is not defined

2016-12-09 Thread Amit Kumar Modak
 The following line of code is giving error 

global name 'web2py_extract' is not defined



response.flash=web2py_extract('month', db.Player.DateOfBirth)

-- 
Resources:
- http://web2py.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: Jquery Decision Tree

2016-12-09 Thread Massimo Di Pierro
To other web2py users. 

I would like to add that Mark Billion is a lawyer from Delaware. He is a 
terrific lawyer. Most importantly is the only lawyer I know who is also a 
developer. This is a unique set of skills and some of you may find valuable.

Massimo


On Friday, 9 December 2016 09:52:26 UTC-6, Massimo Di Pierro wrote:
>
> Sorry I just got It. My recommendation is to use vue.js
>
> here is an example
>
> 
> 
>   
>   
>   
> 
>   
>   
> 
> 
>   
>   
> 
> Shoot!
>   
> 
>   
>   a: ${a}, b:${b}, c:${c}, message:${message}
> 
>   
>   https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.4/vue.min.js
> ">
>   
> var app = new Vue({
>   el: '#app',
> delimiters: ['${', '}'],
> data: {
>   a: false,
>   b: false,
>   c: false,
>   message: 'Hello Vue!'
> },
> methods: {
>   shoot() { alert('shoot ' + app.message); }
> }
> });
>   
> 
>
> You can use {{=ASSIGNJS(x=y)}} to pass a web2py variable y to a js 
> variable x.
>
>
> On Thursday, 8 December 2016 11:38:08 UTC-6, Mark Billion wrote:
>>
>> Im really looking just for some suggestions of particularly light weight 
>> ones
>>
>

-- 
Resources:
- http://web2py.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] Difference of two date field in years

2016-12-09 Thread Amit Kumar Modak
How to get the difference of two date field in years.
dateutil.relativedelta.relativedelta is not working as it is not able to 
recognise date fields as date.

Thanks,
Amit

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


Re: [web2py] Systemd/uwsgi issue on setup-web2py-nginx-uwsgi-ubuntu.sh install

2016-12-09 Thread wish7code
Sorry, I guess I just opened a duplicate issue.. The behaviour was already 
reported with https://github.com/web2py/web2py/issues/1443



On Friday, 9 December 2016 16:55:34 UTC+1, Richard wrote:
>
> Yes, you should have a look if there is no issue open, open a new issue, 
> and if there is no PR pending correcting this issue submit one...
>
> I fix that in my own environnement restoring script, but I guess I forgot 
> to report this problem, but I remember having notice this issue a couples 
> of months ago when I was working to update my environment script.
>
> Thanks
>
> Richard
>
> On Fri, Dec 9, 2016 at 3:57 AM,  wrote:
>
>> Yes, I took master..
>>
>> I think, I now identified the issue: the installer starts the service on 
>> first run (see 
>> https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh#L218),
>>  
>>
>> but it fails to activate it permanently. What's missing here is a
>>
>> systemctl enable emperor.uwsgi.service
>>
>> which would activate the uwsgi service permanently as in the older 
>> upstart versions of this script..
>>
>> Shall I open an issue or send a PR? What's the preferred version?
>>
>> Cheers
>> Toby
>>
>>
>> On Thursday, 8 December 2016 22:52:50 UTC+1, Richard wrote:
>>>
>>> Did you take the last version of the script the one available in trunk 
>>> (or github master)?
>>>
>>> I not, try that version of the script first...
>>>
>>> Here : 
>>> https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh
>>>
>>> If you still experiment the same problem consider open an issue :
>>>
>>> https://github.com/web2py/web2py/issues
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>> On Thu, Dec 8, 2016 at 4:46 PM,  wrote:
>>>
 Hello friends,

 I started a new web2py project on ubuntu 16.04 from scratch using 
 https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh

 When trying to access the website I get 502 bad gateway errors, 
 probably related to an uwsgi issue.
 This is the systemctl output:

 $ systemctl status emperor.uwsgi.service
 ● emperor.uwsgi.service - uWSGI Emperor
Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service; disabled; 
 vendor preset: enabled)
Active: inactive (dead)

 If I start uwsgi manually, everything works fine, i.e.

 $ systemctl start emperor.uwsgi.service
 ● emperor.uwsgi.service - uWSGI Emperor
Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service; disabled; 
 vendor preset: enabled)
Active: active (running) since Thu 2016-12-08 22:36:02 CET; 8s ago
  Main PID: 1404 (uwsgi)
Status: "uWSGI is ready"
 Tasks: 5
Memory: 32.5M
   CPU: 190ms
CGroup: /system.slice/emperor.uwsgi.service
├─1404 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
├─1417 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
├─1418 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
├─1419 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
└─1420 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini



 $ /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini   works too

 Any idea, how I could fix/debug this?

 Thanks & cheers
 Toby

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

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

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


Re: [web2py] Re: Web2py with ngix

2016-12-09 Thread wish7code
https://github.com/web2py/web2py/issues/1545

Cheers
Toby

On Friday, 9 December 2016 02:32:58 UTC+1, Richard wrote:
>
> Could you link issue here?
>
>
> Richard
>
> On Thu, Dec 8, 2016 at 5:03 PM,  wrote:
>
>> I just posted an issue with uwsgi and setup-web2py-nginx-uwsgi-ubuntu.sh to 
>> the mailing list ( 
>> https://groups.google.com/forum/#!topic/web2py/U_GTzcdXdKE )
>> This might possible be related..
>>
>> On Thursday, 8 December 2016 05:53:58 UTC+1, J Boggy wrote:
>>
>>> Web2py with ngix start work well.
>>> But when i start uwsgi 
>>> it show  uwsgi.service not found error.
>>> If i need to create service i don't know how to create.
>>> I follow this way
>>>
>>> https://www.digitalocean.com/community/tutorials/how-to-deploy-web2py-python-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
>>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


[web2py] Re: reading file from path

2016-12-09 Thread Massimo Di Pierro
What error do you get? I am surprised about the file name. Normally files 
in uploads are put there but SQLFORM and they have a much longer name.

On Thursday, 8 December 2016 20:33:40 UTC-6, J Boggy wrote:
>
> I USE cv2.VideoCapture(os.path.join(reques.folder,'uploads','success.mp4') 
> to get video frame from file which work well in my pc. But when i tested on 
> vps it cannot read from path.how should intry

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


Re: [web2py] Systemd/uwsgi issue on setup-web2py-nginx-uwsgi-ubuntu.sh install

2016-12-09 Thread Richard Vézina
If you include the id of the issue in your commit message it will close the
opened issue when your PR will be accepted.

Richard

On Fri, Dec 9, 2016 at 10:55 AM, Richard Vézina  wrote:

> Yes, you should have a look if there is no issue open, open a new issue,
> and if there is no PR pending correcting this issue submit one...
>
> I fix that in my own environnement restoring script, but I guess I forgot
> to report this problem, but I remember having notice this issue a couples
> of months ago when I was working to update my environment script.
>
> Thanks
>
> Richard
>
> On Fri, Dec 9, 2016 at 3:57 AM,  wrote:
>
>> Yes, I took master..
>>
>> I think, I now identified the issue: the installer starts the service on
>> first run (see https://github.com/web2py/web2
>> py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh#L218),
>> but it fails to activate it permanently. What's missing here is a
>>
>> systemctl enable emperor.uwsgi.service
>>
>> which would activate the uwsgi service permanently as in the older
>> upstart versions of this script..
>>
>> Shall I open an issue or send a PR? What's the preferred version?
>>
>> Cheers
>> Toby
>>
>>
>> On Thursday, 8 December 2016 22:52:50 UTC+1, Richard wrote:
>>>
>>> Did you take the last version of the script the one available in trunk
>>> (or github master)?
>>>
>>> I not, try that version of the script first...
>>>
>>> Here : https://github.com/web2py/web2py/blob/master/scripts/setup
>>> -web2py-nginx-uwsgi-ubuntu.sh
>>>
>>> If you still experiment the same problem consider open an issue :
>>>
>>> https://github.com/web2py/web2py/issues
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>> On Thu, Dec 8, 2016 at 4:46 PM,  wrote:
>>>
 Hello friends,

 I started a new web2py project on ubuntu 16.04 from scratch using
 https://github.com/web2py/web2py/blob/master/scripts/setup-w
 eb2py-nginx-uwsgi-ubuntu.sh

 When trying to access the website I get 502 bad gateway errors,
 probably related to an uwsgi issue.
 This is the systemctl output:

 $ systemctl status emperor.uwsgi.service
 ● emperor.uwsgi.service - uWSGI Emperor
Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service;
 disabled; vendor preset: enabled)
Active: inactive (dead)

 If I start uwsgi manually, everything works fine, i.e.

 $ systemctl start emperor.uwsgi.service
 ● emperor.uwsgi.service - uWSGI Emperor
Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service;
 disabled; vendor preset: enabled)
Active: active (running) since Thu 2016-12-08 22:36:02 CET; 8s ago
  Main PID: 1404 (uwsgi)
Status: "uWSGI is ready"
 Tasks: 5
Memory: 32.5M
   CPU: 190ms
CGroup: /system.slice/emperor.uwsgi.service
├─1404 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
├─1417 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
├─1418 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
├─1419 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
└─1420 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini



 $ /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini   works too

 Any idea, how I could fix/debug this?

 Thanks & cheers
 Toby

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

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

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


Re: [web2py] Systemd/uwsgi issue on setup-web2py-nginx-uwsgi-ubuntu.sh install

2016-12-09 Thread Richard Vézina
Yes, you should have a look if there is no issue open, open a new issue,
and if there is no PR pending correcting this issue submit one...

I fix that in my own environnement restoring script, but I guess I forgot
to report this problem, but I remember having notice this issue a couples
of months ago when I was working to update my environment script.

Thanks

Richard

On Fri, Dec 9, 2016 at 3:57 AM,  wrote:

> Yes, I took master..
>
> I think, I now identified the issue: the installer starts the service on
> first run (see https://github.com/web2py/web2py/blob/master/scripts/
> setup-web2py-nginx-uwsgi-ubuntu.sh#L218),
> but it fails to activate it permanently. What's missing here is a
>
> systemctl enable emperor.uwsgi.service
>
> which would activate the uwsgi service permanently as in the older upstart
> versions of this script..
>
> Shall I open an issue or send a PR? What's the preferred version?
>
> Cheers
> Toby
>
>
> On Thursday, 8 December 2016 22:52:50 UTC+1, Richard wrote:
>>
>> Did you take the last version of the script the one available in trunk
>> (or github master)?
>>
>> I not, try that version of the script first...
>>
>> Here : https://github.com/web2py/web2py/blob/master/scripts/setup
>> -web2py-nginx-uwsgi-ubuntu.sh
>>
>> If you still experiment the same problem consider open an issue :
>>
>> https://github.com/web2py/web2py/issues
>>
>> Thanks
>>
>> Richard
>>
>> On Thu, Dec 8, 2016 at 4:46 PM,  wrote:
>>
>>> Hello friends,
>>>
>>> I started a new web2py project on ubuntu 16.04 from scratch using
>>> https://github.com/web2py/web2py/blob/master/scripts/setup-
>>> web2py-nginx-uwsgi-ubuntu.sh
>>>
>>> When trying to access the website I get 502 bad gateway errors, probably
>>> related to an uwsgi issue.
>>> This is the systemctl output:
>>>
>>> $ systemctl status emperor.uwsgi.service
>>> ● emperor.uwsgi.service - uWSGI Emperor
>>>Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service; disabled;
>>> vendor preset: enabled)
>>>Active: inactive (dead)
>>>
>>> If I start uwsgi manually, everything works fine, i.e.
>>>
>>> $ systemctl start emperor.uwsgi.service
>>> ● emperor.uwsgi.service - uWSGI Emperor
>>>Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service; disabled;
>>> vendor preset: enabled)
>>>Active: active (running) since Thu 2016-12-08 22:36:02 CET; 8s ago
>>>  Main PID: 1404 (uwsgi)
>>>Status: "uWSGI is ready"
>>> Tasks: 5
>>>Memory: 32.5M
>>>   CPU: 190ms
>>>CGroup: /system.slice/emperor.uwsgi.service
>>>├─1404 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>>>├─1417 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>>>├─1418 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>>>├─1419 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>>>└─1420 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>>>
>>>
>>>
>>> $ /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini   works too
>>>
>>> Any idea, how I could fix/debug this?
>>>
>>> Thanks & cheers
>>> Toby
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.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: Blog Template - Github

2016-12-09 Thread David
Yes, I just now downloaded it to my laptop and went through the tutorial

-- 
Resources:
- http://web2py.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: Jquery Decision Tree

2016-12-09 Thread Massimo Di Pierro
Sorry I just got It. My recommendation is to use vue.js

here is an example



  
  
  

  
  


  
  

Shoot!
  

  
  a: ${a}, b:${b}, c:${c}, message:${message}

  
  https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.4/vue.min.js";>
  
var app = new Vue({
  el: '#app',
delimiters: ['${', '}'],
data: {
  a: false,
  b: false,
  c: false,
  message: 'Hello Vue!'
},
methods: {
  shoot() { alert('shoot ' + app.message); }
}
});
  


You can use {{=ASSIGNJS(x=y)}} to pass a web2py variable y to a js variable 
x.


On Thursday, 8 December 2016 11:38:08 UTC-6, Mark Billion wrote:
>
> Im really looking just for some suggestions of particularly light weight 
> ones
>

-- 
Resources:
- http://web2py.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: switch to python 3

2016-12-09 Thread Massimo Di Pierro
Very interested. In fact I recently made this: http://iotcallme.com/ (still 
experimental)

Massimo

On Wednesday, 7 December 2016 06:48:45 UTC-6, dlypka wrote:
>
> I propose a new framework:
> things2py
> (Massimo might guess what I am talking about - think hardware and the "T" 
> in IoT).
> I have bit of code that could jump start it
>
> On Friday, November 4, 2016 at 10:34:55 PM UTC-4, saeed mehrabi wrote:
>>
>> Hello
>> When do you want to switch to python 3?
>> I am waiting impatiently.
>> best regards 
>>
>

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


Re: [web2py] Re: Web2py with ngix

2016-12-09 Thread Richard Vézina
Yes, there were a lot of changes related to systemd as the way to init
deamon as change a lot... Despite all the criticism about systemd, I found
it a lot more simpler to write init (just a few lines of code) compare to
the old /etc/init.d/ bash script file...

Regards

Richard



On Fri, Dec 9, 2016 at 9:00 AM, Mirek Zvolský  wrote:

> Thanks, Richard.
> I have my Web2py fork and I will send PR in the future if I will know,
> what to improve.
>
> I have just now compared current Web2py script --vs-- version of script I
> have used (it was in my fork, but I have reinstalled without it) --vs--
> configuration files on my well working server,
>
> and I see all of them have all 3 configuration files (/etc/init/..,
> /etc/uwsgi/.., /etc/systemd/system/..)
> and these files are identical.
> So I think the installation with the nginx/ubuntu script (from trunk) will
> work.
>
> There was some problem in OLD history (2015?):
> /etc/uwsgi/web2py.ini was missing (web2py 2.13.4) + there was a missing
> code in /etc/systemd/system/emperor.uwsgi.service
>
> see this thread: https://groups.google.com/foru
> m/#!starred/web2py/ZM9IIEjtHSI
>
> I think today is all ok with current stable and with trunk too.
>
>
>
>
> On Thursday, 8 December 2016 18:01:46 UTC+1, Richard wrote:
>>
>> No problem...
>>
>> You maybe could post diff of your change, it would greatly help to
>> understand what you change.
>>
>> Maybe it get rejected because it was applying for Debian only?
>>
>> Anyway thanks for your contribution, I just want to point you in the
>> rigth direction to improve chance your work didn't get lost on the list as
>> it happen sometimes.
>>
>> :)
>>
>> Richard
>>
>>
>>
>> On Thu, Dec 8, 2016 at 10:29 AM, Mirek Zvolský  wrote:
>>
>>> Hi Richard.
>>>
>>> I'm beginner with Linux (upgrade from Windows to Linux was one of best
>>> steps in my professional life!).
>>> However at this time it is for me not good idea to write bash scripts
>>> for some complex product.
>>>
>>> In fact I made PR in this case (when I have added something from other
>>> post in this user group into the Web2py nginx/ubuntu script).
>>> It was not accepted, but maybe the team has implemented/reimplemented
>>> the changes into the framework full or partially.
>>>
>>> But I am not sure about this (and haven't time to test it).
>>> This is the reason why I have written:
>>>   - give first opportunity to the script from framework (github
>>> web2py/web2py),
>>>   - if it fails, then (maybe) my version could work.
>>>
>>>
>>>
>>>
>>> On Thursday, 8 December 2016 16:08:32 UTC+1, Richard wrote:

 Hello Mirek,

 Your contribution is pretty much appreciate, but it would make more
 sens that you submit your improvements as a PR over github and then point
 other users over you fork or the PR pending acceptation our your commit
 once PR accepted...

 Thanks for your help

 Richard

 On Thu, Dec 8, 2016 at 7:27 AM, Mirek Zvolský  wrote:

> One thing more
> In my opinion the service is controlled without ".service" in name.
>
> systemctl start emperor.uwsgi(if 
> /etc/systemd/system/emperor.uwsgi.service
> used)
>
> systemctl start uwsgi(if the name is /etc/systemd/system/uwsgi.service
> as (maybe) in your 'digitalocean' article)
>
>
>
>
>
> On Thursday, 8 December 2016 05:53:58 UTC+1, J Boggy wrote:
>
>> Web2py with ngix start work well.
>> But when i start uwsgi
>> it show  uwsgi.service not found error.
>> If i need to create service i don't know how to create.
>> I follow this way
>> https://www.digitalocean.com/community/tutorials/how-to-depl
>> oy-web2py-python-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to web2py+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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

Re: [web2py] Show images and pdf online

2016-12-09 Thread Massimo Di Pierro
assuming

db.define_table('mytable',Field('myfile','upload'))

and

from = SQLFORM(db.mytable)

and 

record = db.mytable(somenumber)

You can do

{{if record.myfile.endswith('.jpg'):}}
   
{{else:}}
   download
{{pass}}


On Monday, 5 December 2016 22:06:58 UTC-6, Áureo Dias Neto wrote:
>
> No, the function show pdf's online, but images, insiste to download it, i 
> want to show it online
>
> 2016-12-06 0:19 GMT-02:00 Dave S :
>
>> On Monday, December 5, 2016 at 3:56:39 PM UTC-8, Áureo Dias Neto wrote:
>>>
>>> It's still downloading files...
>>>
>>>
>> Are you saying that a download request never terminates?   Can you use 
>> your browser's developer tools to see what's happening in terms of 
>> requests-responses (as shown on the network tab)?
>>
>> You might also recognize Antonio's response in the example from Chapter 3 
>> of the web2py book (in image blog):
>> > >
>>
>> Good luck!
>>
>> /dps
>>
>>  
>>
>>> 2016-12-05 10:38 GMT-02:00 António Ramos :
>>>
 i think this helps

 def download():
 return response.download(request,* db,attachment=False*)

 2016-12-05 12:11 GMT+00:00 Áureo Dias Neto :

> Hello guy's, 
>
> I want to show uploaded photos and pdf's documments, to users, online
>
> Example, a page show thumbnails of photos uploaded, and when user 
> click on thumbnail, it open a full photo or pdf online
>
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to the Google 
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to web2py+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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

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

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


Re: [web2py] Re: Removing need for first and last name in auth

2016-12-09 Thread Alexei Vinidiktov
Thanks, stifan.

Now, the only problem is the first and last name fields on the profile page
are required. Can I make them optional?

On Fri, Dec 9, 2016 at 4:28 AM, 黄祥  wrote:

> i think you can use conditional if to check the url and then hide the
> fields
> e.g.
> if 'register' in request.args :
> db.auth_user.first_name.readable = db.auth_user.first_name.writable =
> False
> db.auth_user.last_name.readable = db.auth_user.last_name.writable = False
>
> 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.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Alexei Vinidiktov

-- 
Resources:
- http://web2py.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: DAL SQLFORM.grid sort error

2016-12-09 Thread Michael Griffiths
I had this exact error.  Turned out I was setting request.vars['order'] to 
a value that conflicted with SQLFORM.grid.  If your using the 'order' 
variable name - change it to something else.

On Monday, September 14, 2015 at 11:10:12 PM UTC+10, Dmitri Ermolaev wrote:
>
> DAL error
> h = CAT(
> SQLFORM.grid(db.gifts,
> deletable=False,
> editable=False,
> details=False,
> selectable=None,
> create=False,
> csv=False,
> ),
>
>
> error 
> 
>
>
> 2467.
> 2468.
> 2469.
> 2470.
> 2471.
> 2472.
>
> 2473.
> 2474.
> 2475.
> 2476.
>
>
> order = request.vars.order or ''
> if sortable:
> if order and not order == 'None':
> otablename, ofieldname = order.split('~')[-1].split('.', 1)
> sort_field = db[otablename][ofieldname]
>
> exception = sort_field.type in ('date', 'datetime', 'time')
> if exception:
> orderby = (order[:1] == '~' and sort_field) or ~sort_field
> else:
>
> Variables
> sort_field undefined
> db 
> otablename '%7Egifts'
> ofieldname 'id'
>
>

-- 
Resources:
- http://web2py.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] download stream file

2016-12-09 Thread Htet Wai Kyu
def serve():
filename=request.args(0)
response.headers['ContentType']="application/octet-stream";
response.headers['Content-Disposition']='attachment;filename='+filename;
path=os.path.join(request.folder,"static","videos",filename)
return response.stream(path)

Download

It's work well in my laptop  but when the other guys cannot take download .
when they visit to my site.

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


Re: [web2py] Re: auth.settings.registration_requires_approval has no effect

2016-12-09 Thread Teemu R
I fought today with this specific issue (whatever I did, I was not able to 
get registrations to having a pending state, but all new registrations 
ended up being logged in immediately.)

The culprit in my case turned out to be an innocent looking row that 
somehow had been inserted at the beginning of controllers/default.py:

auth=Auth(db)

This basically resets the auth object to its default state (I assume).

Just thought to add this here as a one potential solution in case there are 
people having similar problems.

-Teemu


On Thursday, August 20, 2015 at 8:09:26 PM UTC+3, Karl-Thomas Schmidt wrote:
>
> Thanks, Jaime Sempere, 
>
> i tried this in all kinds of variations. Still no pending registrations. 
> And still immediately logged in after registering. 
>
> Some strange things besides: Having done an update of web2py to new 2.12,3 
> it still shows 2.11.2-stable+timestamp.2015.05.30.16.33.24 and recommends 
> again updating. 
>
> Having desperatly seeked for my failure i ended up in a very fresh 
> downloaded 
> 2.12.3 and it STILL shows the old version. 
> a "grep -r " does what one would expect: it shows 
> nothing. 
>
> If it happens that my administrative interface sessions times out, i get a 
> messed up screen where the relogin form displays somewhere right to the 
> middle. 
> Logging in with this forms results in an unkown error. Clicking this 
> ticket 
> takes my back to admin interface flashing that the error ticket is 
> unvalid. 
>
> This behaviour showed up first time with old version 2.11.2- 
> stable+timestamp.2015.05.30.16.33.24 
>
> This drives me crazy. 
> And led me to stupid things, like restarting nginx 1.2.1 and uwsgi 2.0.9 
>
> Meanwhile i draw the conclusion that the internet hates me, german Debian 
> Wheezy servers are gaga and Massimo does not want me to use web2py. 
>
> Can you pass me an address of a good doctor? 
>
>
>
> Am Mittwoch, 19. August 2015, 15:38:47 schrieb Jaime Sempere: 
> > Im using same web2py version and python 2.7.x 
> > 
> > My db.py works (user is inserted on db marked as 'pending') with this 
> > configuration: 
> > 
> > from gluon.tools import Auth, Service, PluginManager 
> > 
> > auth = Auth(db) 
> > 
> > service = Service() plugins = PluginManager() 
> > 
> > ## create all tables needed by auth if not custom tables 
> > auth.define_tables(username=False, signature=False) 
> > 
> > ## configure auth policy 
> > auth.settings.registration_requires_verification = False 
> > auth.settings.registration_requires_approval = True 
> > auth.settings.login_after_registration = False 
> > auth.settings.reset_password_requires_verification = True 
> > 
> > 
> > Try with all this configuration to see if it works... 
> > 
> > 
> > El miércoles, 19 de agosto de 2015, 15:22:32 (UTC+2), Karl-Thomas 
> Schmidt 
> > 
> > escribió: 
> > > Hi@ all, 
> > > 
> > > Having this lines in db.py 
> > > auth = Auth(db) 
> > > auth.settings.registration_requires_approval = True 
> > > auth.settings.login_after_registration = False 
> > > a new registration immediatly logs in and corresponding db field is 
> still 
> > > empty. 
> > > 
> > > Running 2.11.2-stable+timestamp.2015.05.30.16.33.24 (Running on 
> > > nginx/1.2.1, 
> > > Python 2.7.3) 
> > > 
> > > What do i miss here? 
>
>

-- 
Resources:
- http://web2py.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: Smartgrid linked tables gotcha

2016-12-09 Thread Eric Waldman
Bumping this because it saved me while trying to figure out why my tables 
weren't linking. I don't believe this is mentioned anywhere in the 
book/docs and they should be updated. Is there any way I can help with that?

On Tuesday, October 15, 2013 at 3:00:09 PM UTC-4, Cliff Kachinske wrote:
>
> A link to the child table will not appear in smartgrid if you do this:
> db.define_table('parent',Field('name'))
> db.define_table('child',Field('name'),Field('parent','reference parent'))
> fields=[db.parent.name]
> grid = SQLFORM.smartgrid(db.parent,linked_tables=['child'])
>
> You must instead do this to make a link to the list of children appear.
> fields=[db.parent.name, db.child.id]
>
>

-- 
Resources:
- http://web2py.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] Non-Editable field in SQLFORM

2016-12-09 Thread Amit Kumar Modak
Hello,

How can I make a field non-editable in SQLFORM, while it should be allowed 
to take a value in insert.


Regards,
Amit

-- 
Resources:
- http://web2py.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: Blog Template - Github

2016-12-09 Thread Marlysson Silva
Do you have git installed in your pc?

Em sexta-feira, 9 de dezembro de 2016 12:15:22 UTC-3, David escreveu:
>
> "Git init in your folder" 
>
> I'm not sure what this means
>

-- 
Resources:
- http://web2py.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: Blog Template - Github

2016-12-09 Thread David
"Git init in your folder" 

I'm not sure what this means

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


Re: [web2py] Re: Scheduler task every first day of every month ?

2016-12-09 Thread Marlysson Silva
Why you don't make this programmatically? there you could use libs as 
calendar to get first day of the month..
Or get current day and calculate difference to next first day of the month

Em sexta-feira, 9 de dezembro de 2016 10:44:34 UTC-3, Ramos escreveu:
>
> how do i define first day of every month ?
>
> [image: Imagem inline 1]
>
> 2016-12-09 12:18 GMT+00:00 Marlysson Silva  >:
>
>> The problem it with make the sheduler or with date?
>>
>> To try using some_year/some_month/1 dont't work?
>>
>>
>> Em sexta-feira, 9 de dezembro de 2016 07:17:14 UTC-3, Ramos escreveu:
>>>
>>> Hello all,
>>>  i dont know how to define a task to run every 1st day of every month.
>>>
>>> Thank you
>>> Antonio
>>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Re: [web2py] Re: Web2py with ngix

2016-12-09 Thread Mirek Zvolský
Thanks, Richard.
I have my Web2py fork and I will send PR in the future if I will know, what 
to improve.

I have just now compared current Web2py script --vs-- version of script I 
have used (it was in my fork, but I have reinstalled without it) --vs-- 
configuration files on my well working server,

and I see all of them have all 3 configuration files (/etc/init/.., 
/etc/uwsgi/.., /etc/systemd/system/..)
and these files are identical.
So I think the installation with the nginx/ubuntu script (from trunk) will 
work.

There was some problem in OLD history (2015?):
/etc/uwsgi/web2py.ini was missing (web2py 2.13.4) + there was a missing 
code in /etc/systemd/system/emperor.uwsgi.service

see this thread: 
https://groups.google.com/forum/#!starred/web2py/ZM9IIEjtHSI

I think today is all ok with current stable and with trunk too.




On Thursday, 8 December 2016 18:01:46 UTC+1, Richard wrote:
>
> No problem...
>
> You maybe could post diff of your change, it would greatly help to 
> understand what you change.
>
> Maybe it get rejected because it was applying for Debian only?
>
> Anyway thanks for your contribution, I just want to point you in the rigth 
> direction to improve chance your work didn't get lost on the list as it 
> happen sometimes.
>
> :)
>
> Richard
>
>
>
> On Thu, Dec 8, 2016 at 10:29 AM, Mirek Zvolský  > wrote:
>
>> Hi Richard.
>>
>> I'm beginner with Linux (upgrade from Windows to Linux was one of best 
>> steps in my professional life!).
>> However at this time it is for me not good idea to write bash scripts for 
>> some complex product.
>>
>> In fact I made PR in this case (when I have added something from other 
>> post in this user group into the Web2py nginx/ubuntu script).
>> It was not accepted, but maybe the team has implemented/reimplemented the 
>> changes into the framework full or partially.
>>
>> But I am not sure about this (and haven't time to test it).
>> This is the reason why I have written:
>>   - give first opportunity to the script from framework (github 
>> web2py/web2py),
>>   - if it fails, then (maybe) my version could work.
>>
>>
>>
>>
>> On Thursday, 8 December 2016 16:08:32 UTC+1, Richard wrote:
>>>
>>> Hello Mirek,
>>>
>>> Your contribution is pretty much appreciate, but it would make more sens 
>>> that you submit your improvements as a PR over github and then point other 
>>> users over you fork or the PR pending acceptation our your commit once PR 
>>> accepted...
>>>
>>> Thanks for your help
>>>
>>> Richard
>>>
>>> On Thu, Dec 8, 2016 at 7:27 AM, Mirek Zvolský  wrote:
>>>
 One thing more
 In my opinion the service is controlled without ".service" in name.

 systemctl start emperor.uwsgi(if 
 /etc/systemd/system/emperor.uwsgi.service used)

 systemctl start uwsgi(if the name is 
 /etc/systemd/system/uwsgi.service as (maybe) in your 'digitalocean' 
 article)





 On Thursday, 8 December 2016 05:53:58 UTC+1, J Boggy wrote:

> Web2py with ngix start work well.
> But when i start uwsgi 
> it show  uwsgi.service not found error.
> If i need to create service i don't know how to create.
> I follow this way
>
> https://www.digitalocean.com/community/tutorials/how-to-deploy-web2py-python-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
>
 -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google 
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to web2py+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

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

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


Re: [web2py] Re: Scheduler task every first day of every month ?

2016-12-09 Thread António Ramos
how do i define first day of every month ?

[image: Imagem inline 1]

2016-12-09 12:18 GMT+00:00 Marlysson Silva :

> The problem it with make the sheduler or with date?
>
> To try using some_year/some_month/1 dont't work?
>
>
> Em sexta-feira, 9 de dezembro de 2016 07:17:14 UTC-3, Ramos escreveu:
>>
>> Hello all,
>>  i dont know how to define a task to run every 1st day of every month.
>>
>> Thank you
>> Antonio
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: good solution for indexing script which should run always

2016-12-09 Thread Mirek Zvolský
So I have received no recommendation to this.
There was no problem with the systemd service,
but (to be more portable,...) I have moved now to the scheduler.

If somebody is interested, here is my code.
I can/need initialize the scheduler with one (admins) access to url 
myapp/sysadmin/start_idx.

@auth.requires_membership('admin')
def start_idx():
if DEBUG_SCHEDULER:
idx()
return 'Indexing finished.'
else:
if db((db.scheduler_task.application_name == 'codex2020/sysadmin') &
(db.scheduler_task.task_name == 'idx')).select().first():
return 'Task idx already queued. Remove it from scheduler_task 
table if you want re-create it.'
else:
scheduler.queue_task(
idx,
pargs=[],
pvars={},
start_time=datetime.datetime.now(),
stop_time=None,
timeout=2147483647,
prevent_drift=False,
period=20,
immediate=False,
repeats=0
)
return 'Task idx was added.'






On Thursday, 27 October 2016 12:36:06 UTC+2, Mirek Zvolský wrote:
>
> I need run a script which for marked records in one table creates 
> "indexing" or "helpers" records in another table.
> This script should:
> - switch this activity and sleep(10) /should sleep after it will not find 
> any marked record/
> - run always
> - run in 1 instance only /to avoid indexing of same records from 2 
> instances/
>
> I decide to solve it as systemd service.
> My QUESTION IS: Is this good decision, or should I use something web2py 
> specific (scheduler?) ?
>
> -
> If somebody is interested in the "systemd service" solution, I made in 
> based on this article:
>
> http://www.raspberrypi-spy.co.uk/2015/10/how-to-autorun-a-python-script-on-boot-using-systemd/
>
> ...and I have added into the [service] section: Restart=on-failure
>
>

-- 
Resources:
- http://web2py.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 task every first day of every month ?

2016-12-09 Thread Marlysson Silva
The problem it with make the sheduler or with date?

To try using some_year/some_month/1 dont't work?

Em sexta-feira, 9 de dezembro de 2016 07:17:14 UTC-3, Ramos escreveu:
>
> Hello all,
>  i dont know how to define a task to run every 1st day of every month.
>
> Thank you
> Antonio
>

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


Re: [web2py] Re: Scheduler task every first day of every month ?

2016-12-09 Thread António Ramos
and via appadmin how do i do that?

2016-12-09 11:44 GMT+00:00 黄祥 :

> pls try :
> *controllers/default.py*
> start_bom = '%s-%s-01 00:00:00' % (request.now.year, request.now.month)
>
> def queue_task_0():
> scheduler.queue_task('scheduler_name', start_time = start_bom,
> next_run_time = start_bom)
> session.flash = T("Task 0 Queued")
> redirect(URL('index.html') )
>
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: Blog Template - Github

2016-12-09 Thread Marlysson Silva
What your doubt?

Em quinta-feira, 8 de dezembro de 2016 18:07:26 UTC-3, David escreveu:
>
> Thanks for replying 
>
> The correct address is 
> http://hypenews.pythonanywhere.com/init/default/hypenewsthehypenewsqq123 
>
> I created the repository but step two has me stumped. Can you elaborate?
>
>

-- 
Resources:
- http://web2py.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: Video write

2016-12-09 Thread Marlysson Silva
How are your code?

Em quinta-feira, 8 de dezembro de 2016 22:33:04 UTC-3, J Boggy escreveu:
>
> Yes .i have been try 
> 

[web2py] Re: Scheduler task every first day of every month ?

2016-12-09 Thread 黄祥
pls try :
*controllers/default.py*
start_bom = '%s-%s-01 00:00:00' % (request.now.year, request.now.month)

def queue_task_0():
scheduler.queue_task('scheduler_name', start_time = start_bom, 
next_run_time = start_bom)
session.flash = T("Task 0 Queued")
redirect(URL('index.html') )

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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: assign content to sqlform help-block

2016-12-09 Thread Pierre
this one was tough

  form = SQLFORM()
  form.elements('span.help-block')[2].insert(0, T("blablablabla."))


-- 
Resources:
- http://web2py.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 task every first day of every month ?

2016-12-09 Thread António Ramos
Hello all,
 i dont know how to define a task to run every 1st day of every month.

Thank you
Antonio

-- 
Resources:
- http://web2py.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: Starting scheduler worker from controller

2016-12-09 Thread Gael Princivalle
Ok I've made the perfect system that start a new worker when it's 
necessary. My problem is that web2py don't run the tasks and I don't know 
why (so my system is not so perfect!!).

I've add this task in the scheduler. It only save a file "alert_file.txt":

def save_alert_file():
file = open('%s/static/alert_file.txt' %request.folder, 'w')
file.write('')
file.close()

I run it every 300 second (5 minutes).

Webfaction servers use Centos 7.
I've made a bash script called hyd.sh that start the worker of my app 
called "hydrover_oleodinamica" if the file datetime is older than the 
current datetime minus 7 minutes:
file=
"$HOME/webapps/w2p_2_12_3/web2py/applications/hydrover_oleodinamica/static/alert_file.txt"
file_datetime_s=$(date -r $file +%s)
alert_datetime_s=$(date --date '- 7 minutes' +%s)
if [ $alert_datetime_s -gt $file_datetime_s ];

then
  nohup /usr/local/bin/python2.7 ~/webapps/w2p_2_12_3/web2py/web2py.py -K 
hydrover_oleodinamica & 2>&1 > $HOME/hyd.log &
fi

It works fine.

I've add it in the server crontab that run it every 10 minutes:
*/10 * * * * $HOME/hyd.sh

If I cancel all workers in the db and all related processes in the server, 
this system works like a sharm.
A worker is started, all tasks are running.
After 10 minutes no other worker is started, perfect.

If the Webfaction server get restarted, all the processes are killed 
include the workers.
In this case the worker is started, it's in the db but tasks don't run.
And so the crontab start a new worker every 10 minutes.

Someones knows why?
As I can't restart the Webfaction server by myself it's difficult to make 
test but I think that when a worker is started by my script after a server 
restart, the flag "Is ticker" is false in the worker db record.

What does it mean?

Thanks, regards.




Il giorno giovedì 17 novembre 2016 23:35:31 UTC+1, Niphlod ha scritto:
>
> I'll say it once again: you need a scheduler to run out-of-band pieces of 
> things (tasks) that ARE NOT embedded in the web-serving process(es).
> At that point you may as well process out-of-band tasks with a simple ajax 
> call, and save yourself setting up the scheduler at all.
>
> It's strongly discouraged to start ANY process inside the webserver 
> (stderr/stdout clumsiness with wsgi, enforced timeout on the webserver, 
> DDoS attacks, etc). Starting a python process inside a controller (even if 
> it's the scheduler) has the same exact cons.
>
> The scheduler NEEDS (read: there is absolutely no valid reason not to) to 
> be started as an external and independant process from the webserver: if 
> you need it to be started when the server comes up,  you NEED to use your 
> system's "service" architecture (init.d, systemd, supervisord, windows 
> service, etc) .
> Or, if you're using uwsgi, you can use its facility to spawn external 
> processes (it's in the default installation script).
>
>
>

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


Re: [web2py] Systemd/uwsgi issue on setup-web2py-nginx-uwsgi-ubuntu.sh install

2016-12-09 Thread wish7code
Yes, I took master..

I think, I now identified the issue: the installer starts the service on 
first run (see 
https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh#L218),
 

but it fails to activate it permanently. What's missing here is a

systemctl enable emperor.uwsgi.service

which would activate the uwsgi service permanently as in the older upstart 
versions of this script..

Shall I open an issue or send a PR? What's the preferred version?

Cheers
Toby


On Thursday, 8 December 2016 22:52:50 UTC+1, Richard wrote:
>
> Did you take the last version of the script the one available in trunk (or 
> github master)?
>
> I not, try that version of the script first...
>
> Here : 
> https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh
>
> If you still experiment the same problem consider open an issue :
>
> https://github.com/web2py/web2py/issues
>
> Thanks
>
> Richard
>
> On Thu, Dec 8, 2016 at 4:46 PM,  wrote:
>
>> Hello friends,
>>
>> I started a new web2py project on ubuntu 16.04 from scratch using 
>> https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh
>>
>> When trying to access the website I get 502 bad gateway errors, probably 
>> related to an uwsgi issue.
>> This is the systemctl output:
>>
>> $ systemctl status emperor.uwsgi.service
>> ● emperor.uwsgi.service - uWSGI Emperor
>>Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service; disabled; 
>> vendor preset: enabled)
>>Active: inactive (dead)
>>
>> If I start uwsgi manually, everything works fine, i.e.
>>
>> $ systemctl start emperor.uwsgi.service
>> ● emperor.uwsgi.service - uWSGI Emperor
>>Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service; disabled; 
>> vendor preset: enabled)
>>Active: active (running) since Thu 2016-12-08 22:36:02 CET; 8s ago
>>  Main PID: 1404 (uwsgi)
>>Status: "uWSGI is ready"
>> Tasks: 5
>>Memory: 32.5M
>>   CPU: 190ms
>>CGroup: /system.slice/emperor.uwsgi.service
>>├─1404 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>>├─1417 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>>├─1418 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>>├─1419 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>>└─1420 /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
>>
>>
>>
>> $ /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini   works too
>>
>> Any idea, how I could fix/debug this?
>>
>> Thanks & cheers
>> Toby
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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