[web2py] Re: Folder sessions

2019-02-04 Thread Константин Комков
I tried like that:

[image: 323.png]

Arguments: python c:\XXX\X\web2py.py -S stud -M -R 
c:\XXX\X\scripts\sessions2trash.py -A -o -x 3600 -f -v

I think something wrong in arguments becouse it don't work.

Thank you *Stifan*, *Dave S!*

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message 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] DAL limitby in python3

2019-02-04 Thread Maurice Waka
In python 2.7, I was able to set the limit of the last number of rows to be 
displayed except the exact last one as:
results = db(db.answer.author == auth.user.id).select(db.answer.ALL)[-10:-1]

But after switching to python 3.6, i keep getting this error:


 File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/objects.py", line 
2780, in __getitem__
 keys = list(row.keys())
AttributeError: 'list' object has no attribute 'keys'


How do I overcome this?
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.


[web2py] Web2py with python3: difference in error reporting

2019-02-04 Thread 'Yan Wong' via web2py-users
I'm contemplating switching my web2py site to python3. However, when I do 
so, the error messages logged to applications/myapp/errors, to which I'm 
directed if I have made a web2py python coding error, seem a lot less 
useful, for instance they don't seem to give sensible line numbers into my 
code files to help locate the error. Should this normally worth OK (i.e. 
have I set something up wrongly?). ISTR this is true both for a compiled 
site and a non-compiled 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.


[web2py] Re: how do I Select in a FORM using a database.

2019-02-04 Thread Dave S


On Monday, February 4, 2019 at 9:32:02 AM UTC-8, Ben Duncan wrote:
>
> Ok, I have a standard FORM doing a web page.
> How do you do a select from a a database table in a FORM helper:
>
> ie what is equivalent to the sqlform.factory of:
> 
> Field('companyid',
> 
> requires=IS_IN_DB(db,db.company.company_number,'%(company_name)s')),
>
> Thanks
>
>
>
> *Ben Duncan*
> DBA / Chief Software Architect 
> Mississippi State Supreme Court
> Electronic Filing Division
>


I'm not sure I understand your question.  If you want a *requires()* to be 
applied, I don't think you have to do anything extra after putting in the 
requirement.  If you want to do a lookup after form.accepts(), you just use 
form.vars, no?

Most of my use of plain FORM() is for stuff that isn't in the DB.

/dps




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


[web2py] Re: Folder sessions

2019-02-04 Thread Dave S


On Monday, February 4, 2019 at 4:52:51 AM UTC-8, 黄祥 wrote:
>
> from the book:
>
>- *sessions* store information related to each particular user.
>
> *ref*:
> http://web2py.com/books/default/chapter/29/04/the-core#Applications
>
> think you can clear that folder (remove it folders or files or through 
> web2py admin (clean up), but pls ensure that noone is using it when you 
> clear it, because it will clear the active logged in users.
>
> best regards,
> stifan
>


An even better reference is 
http://web2py.com/books/default/chapter/29/13/deployment-recipes#Cleaning-up-sessions>

Nice little script there.  For a low-traffic server, you can run it 
manually, and for a high volume server you can put it in scheduler task or 
cron job.

/dps

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


[web2py] Re: what is the best practice for importing modules in a module?

2019-02-04 Thread Yi Liu
I agree. I am considering switch to pyGal. 

And Plotly is the only online plotting service though. Other options you 
have to serve your own plots.

On Monday, February 4, 2019 at 8:51:43 AM UTC-8, Leonel Câmara wrote:
>
> To be honest I think this is bad enough of a problem that I would simply 
> stop using plotly. This is ridiculously slow and there many many 
> alternatives in the python worl.d
>

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


[web2py] how do I Select in a FORM using a database.

2019-02-04 Thread Ben Duncan
Ok, I have a standard FORM doing a web page.
How do you do a select from a a database table in a FORM helper:

ie what is equivalent to the sqlform.factory of:

Field('companyid',

requires=IS_IN_DB(db,db.company.company_number,'%(company_name)s')),

Thanks



*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message 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: what is the best practice for importing modules in a module?

2019-02-04 Thread Leonel Câmara
To be honest I think this is bad enough of a problem that I would simply 
stop using plotly. This is ridiculously slow and there many many 
alternatives in the python worl.d

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


[web2py] Re: what is the best practice for importing modules in a module?

2019-02-04 Thread Yi Liu
Yes, Anthony. Thanks for taking the efforts to look up poorly issue. I also 
found the same github thread. It took almost 7 seconds on my server to 
import plotly in a regular Python console, so it IS the very and only 
bottleneck!

After all, if I am not supposed to import them, what is the best way? Put 
import custom module inside a model function? my new idea :)



On Monday, February 4, 2019 at 5:28:04 AM UTC-8, Anthony wrote:
>
> On Monday, February 4, 2019 at 12:58:58 AM UTC-5, Yi Liu wrote:
>>
>> Thank you for your reply, Dave. If I understand you correctly, I already 
>> did what you suggested: move those imports into a module file. It did not 
>> help.
>>
>
> The problem is that you moved the imports to a module, but then you 
> imported *that *module in your model file, which is equivalent to simply 
> having all the imports in your model file. Note that model files are 
> executed on every request (unless you are using the conditional model 
> functionality), so any imports also happen on every request (including any 
> imports made by your imported modules). Typically this does not slow things 
> down on subsequent requests because Python keeps the imported objects in 
> memory, but in this case it sounds like Plotly also executes some fairly 
> slow code on import (https://github.com/plotly/plotly.py/issues/740).
>
> 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: what is the best practice for importing modules in a module?

2019-02-04 Thread Anthony
On Monday, February 4, 2019 at 12:58:58 AM UTC-5, Yi Liu wrote:
>
> Thank you for your reply, Dave. If I understand you correctly, I already 
> did what you suggested: move those imports into a module file. It did not 
> help.
>

The problem is that you moved the imports to a module, but then you 
imported *that *module in your model file, which is equivalent to simply 
having all the imports in your model file. Note that model files are 
executed on every request (unless you are using the conditional model 
functionality), so any imports also happen on every request (including any 
imports made by your imported modules). Typically this does not slow things 
down on subsequent requests because Python keeps the imported objects in 
memory, but in this case it sounds like Plotly also executes some fairly 
slow code on import (https://github.com/plotly/plotly.py/issues/740).

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] Bootstrap tooltips require tether

2019-02-04 Thread Константин Комков
I use web2py 2.17.2-stable+timestamp.2018.10.06.18.54.02. I created new 
welcom app and included my css dtyles with Bootstrap v4.0.0-beta. Then I 
created ajax request and have had error: Uncaught Error: Bootstrap tooltips 
require Tether.
This problem can be solved if include

>  src="https://npmcdn.com/tether@1.2.4/dist/js/tether.min.js";>

Then I thought that my old projects work without it. Whats up? I copied one 
of old project and tried make ajax request and again got this error!
Why old projects work without tether.min.js if its get Bootstrap 
v4.0.0-beta too and in both projects I use 'formstyle = bootstrap3_inline' 
in Configuration? 
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message 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: Folder sessions

2019-02-04 Thread 黄祥
from the book:

   - *sessions* store information related to each particular user.

*ref*:
http://web2py.com/books/default/chapter/29/04/the-core#Applications

think you can clear that folder (remove it folders or files or through 
web2py admin (clean up), but pls ensure that noone is using it when you 
clear it, because it will clear the active logged in users.

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] Folder sessions

2019-02-04 Thread Константин Комков
Hello!

[image: 212.png]
Can somebody tell about folder with name sessions in project. In my case 
that folder have many enclosed folders. Can I clear that folder?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message 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: work with JSON string

2019-02-04 Thread Константин Комков
 Dave S, I parsed that JSON string in Python and didn't have error. As I 
think problem is in next string: 

> data: 'data='+JSON.stringify(data),

but I don't know how to see data in that moment. Now I solve it changing 
(;) symbol.

> var transfotmStr = $('#problem_input').val().split(';').join(',');
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message 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: problem with cpdb.py "EXCEPTION: could not set DAL"

2019-02-04 Thread Jon Subscripted
Hi Dave,
Yes, if you refer to the Python installed in the computer I'm using Python
2.7.5.

C:\Users\Jon\Downloads\web2py_winAPPLIANCES\web2py>python scripts/cpdb.py
-f applications/paravolcar10enero_tarde/databases  -y
sqlite://storage.sqlite -Y sqlite://storage3.sqlite -d ../gluon
No handlers could be found for logger "web2py"
WARNING:root:Unable to import plural rules: No module named plural_rules
EXCEPTION: could not set DAL
No module named dal
creating tables...
EXCEPTION: could not make a copy of the database
'NoneType' object is not iterable

C:\Users\Jon\Downloads\web2py_winAPPLIANCES\web2py>python.exe
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:22:17) [MSC v.1500 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Thanks, Jon.

PS. I'm not fully aware of the relationship between the existing Python
installation in the computer and the pre-packed Python (delivered as part
of Web2py).

On Sun, Feb 3, 2019 at 10:21 PM Dave S  wrote:

>
>
> On Saturday, February 2, 2019 at 6:05:55 AM UTC-8, Jonsubs wrote:
>>
>> Hi everyone,
>> I'm trying to copy my database (already populated) using cbpd.py but I
>> get an error.
>> (I'm working in Windows 10 with Web2py
>> 2.17.2-stable+timestamp.2018.10.06.18.54.02)
>>
>>
> So you're using the in-box python, which is python2?
>
> /dps
>
>
>> 1st I changed the database URI in appconfig.ini from
>> sqlite://storage.sqlite to sqlite://storage3.sqlite
>> 2nd I checked with SQLite Browser that sqlite://storage3.sqlite was
>> created and tables are created also (but empty)
>> 3rd I launched the command below, but I does not work.
>>
>> C:\Users\Jon\Downloads\web2py_winAPPLIANCES\web2py>python scripts/cpdb.py
>> -f applications/paravolcar10enero_tarde/databases  -y
>> sqlite://storage.sqlite -Y sqlite://storage3.sqlite -d ../gluon
>> No handlers could be found for logger "web2py"
>> WARNING:root:Unable to import plural rules: No module named plural_rules
>> EXCEPTION: could not set DAL
>> No module named dal
>> creating tables...
>> EXCEPTION: could not make a copy of the database
>> 'NoneType' object is not iterable
>>
>> Any suggestions? I do not really know how to interpret the error.
>> Thanks, Jon.
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message 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.