[web2py] Re: AttributeError: 'SQLite' object has no attribute 'file_open'

2017-08-31 Thread Jitun John
You are totally correct my friend.
I updated gluon\packages\dal\pydal with latest pyDal to resolve the issue.


On Friday, September 1, 2017 at 3:37:53 AM UTC+5:30, Massimo Di Pierro 
wrote:
>
> you have the latest web2py but you have an older pydal.
>
> On Tuesday, 29 August 2017 03:47:39 UTC-5, Jitun John wrote:
>>
>> Hi Massimo,
>>
>> I have the 2.15.3 version installed, but the issue remains.
>> I confirm the same code works on 2.14.6
>>
>>
>>
>> 
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sunday, August 13, 2017 at 2:40:08 AM UTC+5:30, Massimo Di Pierro 
>> wrote:
>>>
>>> Committed c995fd7 that should fix this
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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: db.company.insert() error

2017-08-31 Thread Ben Lawrence
Thanks guys for your time. No I do not know what a _before_insert hook is, 
so I doubt that there is one here.

here is


def insert_company(valid_name, valid_email):
""" Inserts a company record if there is a new domain_tag
"""
c_id = 0 # is the reference to the company record
# what is the company domain ?
email_tup = valid_email.split(u'@')
if len(email_tup) > 1:  # it is an email address
c_domain = email_tup[1]
elif len(email_tup) == 1:
c_domain = valid_email
else: # give up
c_domain = valid_name.upper()
# use this to find the company, 
c_rows = db(db.company.domain_tag == c_domain).select()
if len(c_rows)==0:  # add the company
c_id = db.company.update_or_insert(
name = get_company_name(c_domain),
e_mail = valid_email,
domain_tag = c_domain )
else:  # length MUST be one
c_id = c_rows.last().id
return c_id


You know what,
I am running all this on ubuntu 16 in an LXD container with software raid 
on the metal. I am really starting to wonder if DAL and postgres and lxd 
and software raid are somehow getting ahead of themselves in timing? 
Perhaps there is no feedback or not enough feedback of "operation 
completed"  somewhere?

 
On Wednesday, August 30, 2017 at 1:59:04 AM UTC-7, Val K wrote:
>
> As I see, it's a scheduler task -  show all code of insert_company
> Is there any _before_insert hook?
>
> On Wednesday, August 30, 2017 at 1:22:57 AM UTC+3, Ben Lawrence wrote:
>>
>> 2.15.3-stable+timestamp.2017.08.07.07.32.04
>> (Running on nginx/1.10.3, Python 2.7.12)
>>
>>
>> Hi
>> I hesitate to ask this because it will betray my stupidity
>>
>> I have this:
>>
>> *c_rows = db(db.company.domain_tag == c_domain).select()*
>> if *len(c_rows)==0*:  # add the company
>> c_id = db.company.insert(
>> name = get_company_name(c_domain),
>> e_mail = valid_email,
>> *domain_tag = c_domain )*
>> else:  # length MUST be one
>> c_id = c_rows.last().id
>>
>> and this the error:
>>
>> File "applications/remail/models/scheduler.py", line 120, in 
>> insert_company
>> domain_tag = c_domain )
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py", line 
>> 734, in insert
>> ret = self._db._adapter.insert(self, row.op_values())
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
>> line 486, in insert
>> raise e
>> IntegrityError: duplicate key value violates unique constraint 
>> "company_domain_tag_key"
>> DETAIL:  Key (domain_tag)=(platronics.com) already exists.
>>
>>
>> Wha?! if domain_tag is already there would len(c_rows) > 0  and so would 
>> not try to insert the record?
>>
>>
>>

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

2017-08-31 Thread Dave S


On Thursday, August 31, 2017 at 3:26:43 PM UTC-7, Massimo Di Pierro wrote:
>
> I think we should drop mercurial support and move to git consistently.
>

Perhaps drop all VCS built-ins, and let the role be better served by VCS 
tools external to the web2py code.

/dps


> On Wednesday, 30 August 2017 06:21:13 UTC-5, mweissen wrote:
>>
>> I want to try the admin versioning.
>> mercurial is installed, hg --version shows 2.8.2
>>
>> And a click on versioning gives "Sorry, could not find mercurial 
>> installed"
>>
>> What is wrong - any ideas?
>> Regards, Martin
>>
>>

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


[web2py] Re: mercurial

2017-08-31 Thread Massimo Di Pierro
I think we should drop mercurial support and move to git consistently.

On Wednesday, 30 August 2017 06:21:13 UTC-5, mweissen wrote:
>
> I want to try the admin versioning.
> mercurial is installed, hg --version shows 2.8.2
>
> And a click on versioning gives "Sorry, could not find mercurial installed"
>
> What is wrong - any ideas?
> Regards, Martin
>
>

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


[web2py] Re: Link to 2.15.3 downloads 2.15.2

2017-08-31 Thread Massimo Di Pierro
very strange. Will repush a new version. May fix this. let me know if 
problem persists after tomorrow.

On Thursday, 31 August 2017 04:17:33 UTC-5, icodk wrote:
>
> On http://www.web2py.com/ there is a link to the download area:
> 2.15.3-stable+timestamp.2017.08.07.12.51.45 ( 
> LGPLv3 License 
> )
> However, clicking on the   For Windows button under the For normal users , 
> downloads 2.15.2
>
> (https://mdipierro.pythonanywhere.com/examples/static/web2py_win.zip)
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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: Small correction to the manual

2017-08-31 Thread Massimo Di Pierro
good catch. Thanks. Can you try submit a patch to the book in git?

On Wednesday, 30 August 2017 09:57:04 UTC-5, Paul Furber wrote:
>
> In this section of the manual: 
> http://www.web2py.com/books/default/chapter/29/10/services#parse_as_rest--experimental-
>
> There is a paragraph explaining how to use cURL to test a restful API as 
> follows:
>
> If you have the "curl" utility installed you can try:
>
> $ curl -d "name=Tim" http://127.0.0.1:8000/myapp/default/api/friend.json
> {"errors": {}, "id": 1}
>
>
> ---
> That example (it's the first one) won't work because the code for POST 
> above doesn't do any pattern matching. It should be:
>
> $ curl -d "name=Tim" http://127.0.0.1:8000/myapp/default/api/person.json
> {"errors": {}, "id": 1}
>
> so it passes the table name directly. 
>
>
>

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

2017-08-31 Thread Massimo Di Pierro
Honestly. Support for ingres was added long ago and it did work. then pydal 
was rewritten to be more modular and I do not now believe anybody has 
tested ingres since that rewrite. If you want to help we can setup chat 
time and run some tests together and see whether there is any problem.

Massimo

On Wednesday, 30 August 2017 09:56:53 UTC-5, jimsmith13...@gmail.com wrote:
>
> I have to use an Ingres DB and would like to create a web app using a 
> Python framework. Unlike other frameworks I see web2py says it supports 
> Ingres. Is anybody successfully using web2py with an Ingres DB and does it 
> work well?
>

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


[web2py] Re: Two database join query

2017-08-31 Thread Massimo Di Pierro
This is logically impossible. The role of a database it to store data and 
execute queries about the local data. If you have two, which one should 
execute the query? Each one of them can only search local data. databases 
do not talk to each other.

The only solution is not to do it in a query but do the join at the python 
level:

rows = db1(db1.table1).select()
ids = [row.pid for row in rows]
rows_tojoin = db2(db2.table2.pid.belongs(ids)).select()
maps = {row.pid: row for row in rows_tojoin}
joined = []
for row in rows:
 joined.append({'table1':row, 'table2':maps[row.pid]})
for row in joined:
 print row['table1'], row['table2']



sql ="SELECT db1.id, db1.title,db2.data FROM db1.table1 INNER JOIN 
db2.table2 ON db2.table2.pid == db1.table1.pid"




On Monday, 28 August 2017 11:04:29 UTC-5, Artem wrote:
>
> Hello !
> Hope someone can help . Thanks in advance !
> I have two database :
> db1 = DAL('sqlite://first.sqlite')
> db2 = DAL('sqlite://second.sqlite')
> with tables :
> db1.define_table('table1',
> Field('id',requires=IS_NOT_EMPTY()),
> Field('pid',type='integer'),
> Field('title',type='string'),
> )
> and
> db2.define_table('table2',
> Field('id',requires=IS_NOT_EMPTY()),
> Field('pid',type='integer'),
> Field('data',type='string'),
> )
> How to execute sqlite join ,something like: 
> sql ="SELECT db1.id, db1.title,db2.data FROM db1.table1 INNER JOIN 
> db2.table2 ON db2.table2.pid == db1.table1.pid"
> db1.executesql(sql) doesn't work 
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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: how to create pdf report in web2py???

2017-08-31 Thread Massimo Di Pierro
Nice!

On Saturday, 26 August 2017 08:19:30 UTC-5, Alex wrote:
>
> We created a report tool since creating pdf reports in a web application 
> is a common problem and none of the existing solutions were optimal for us. 
> We needed something that is easy to integrate, easy to use (to design the 
> reports) and easy to maintain (e.g. to create new versions of an existing 
> report template).
>
> https://www.reportbro.com
>
> The designer to create report templates is a javascript plugin which can 
> easily be integrated in a web application. Server-side we developed a 
> python package - which you can either download or install via pip - to 
> create the pdf (or xlsx) file with a given report template and data. 
> Because it's python it is easy to use in an existing web2py app.
>
> We appreciate any kind of feedback!
>
> Alex
>
>

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


[web2py] Re: AttributeError: 'SQLite' object has no attribute 'file_open'

2017-08-31 Thread Massimo Di Pierro
you have the latest web2py but you have an older pydal.

On Tuesday, 29 August 2017 03:47:39 UTC-5, Jitun John wrote:
>
> Hi Massimo,
>
> I have the 2.15.3 version installed, but the issue remains.
> I confirm the same code works on 2.14.6
>
>
>
> 
>
>
>
>
>
>
>
>
> On Sunday, August 13, 2017 at 2:40:08 AM UTC+5:30, Massimo Di Pierro wrote:
>>
>> Committed c995fd7 that should fix this
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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: Rocket logs and server crash

2017-08-31 Thread Massimo Di Pierro
Can you tell us more about your setup?

On Monday, 28 August 2017 13:54:05 UTC-5, Dave S wrote:
>
> I came in to a message from UptimeRobot that my server was down (4:20 am 
> mytime).  So I check the logs ...
>
> The httpserver.log file ends at 4:02, with the last successful UptimeRobot 
> check.  The logs/web2py.log has 3 entries beyond that, at 4:05 Rocket is 
> throwing an exception because self.sslobj.do_handshake() got "Connection 
> reset by peer".  Unfortunately, the traceback report doesn't indicate who 
> the peer is  is this something left over from the UR check, or a 
> different client trying to access the service?
>
> ps -ef indicated that all my python processes were still running, but my 
> browser timed out looking for the index page.  I killed all the processes, 
> restarted everything, and server is now responding normally to me and to 
> UptimeRobot.  Even though I'm preparing to switch to nginx, I'd like to 
> better understand the Rocket "crash".
>
> The process had been started from the command line, and put in the 
> background (and the parent shell eventually quitted).  As an orphan 
> process, no console messages are on the screen, and there is no more detail 
> in the logs than the 3 tracebacks (all the same).  The top level is 
> rocket.py, line 590 (2.14.6), in listen(), which calls self.wrap_socket(), 
> etc.  Is there any place besides the log to look for artifacts that would 
> give me more information?  Oh, /var/log/messages has a "Possible SYN 
> flooding pn port 443" entry at 4:05.
>
> Thanks for any pointers.
>
> Dave
> /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: Is it posible to fallback to static files when a controller is not found?

2017-08-31 Thread Massimo Di Pierro
routes_out is used when mapping a URL('controller','function') into an 
actual url. It is called reversed routing in other frameworks.

On Sunday, 27 August 2017 17:49:47 UTC-5, Alfonso Serra wrote:
>
> Simpler and better approach:
>
> routes_in = (
> # do not reroute admin unless you want to disable it
> (BASE + '/admin', '/admin/default/index')
> , (BASE + '/admin/$anything', '/admin/$anything')
> # do not reroute appadmin unless you want to disable it
> , (BASE + '/$app/appadmin', '/$app/appadmin/index')
> , (BASE + '/$app/appadmin/$anything', '/$app/appadmin/$anything')
>
> # default controller
> , ('/', '/%s/default/index' % default_application)
> , ('/$c', '/%s/$c/index' % default_application)
> , ('/$c/$f', '/%s/$c/$f' % default_application)
> , ('/$anything', '/%s/static/$anything' % default_application)
> , (BASE + '/$anything', '/$anything')
> ]
>
> routes_out = (
> # do not reroute admin unless you want to disable it
> ('/admin/$anything', BASE + '/admin/$anything')
> # do not reroute appadmin unless you want to disable it
> , ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything')
> )
>
> Works well, when a static file is not found i get the http right code. I 
> have to put aside web2py default autoroutes but this is what i wanted.
>
> I still dont quite get routes_out, when is a route coming from the app? is 
> it only on redirections? Thanks.
>

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


Re: {Disarmed} [web2py] Re: pytest and controllers protected with auth

2017-08-31 Thread António Ramos
Hello Carlos please share the app with all of us. I´m very interested.
Regards


Sem
vírus. www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

2017-08-31 21:25 GMT+01:00 Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu>:

> Thank you all you guys, right now I am a little busy with other projects,
> but I will follow your suggestions, and will post my results.
>
>
> Greetings.
>
> El 22/08/17 a las 09:57, Richard Vézina escribió:
>
> Will try to wrapp up my stuff... It base on web2py.test, but I add a test
> launcher and extract save pytest output into a text file to be consulted
> after the ending of the test... I do include this file as a test report
> into my app for the client to see that all tests passed... It works with
> selenium/splinter, so test are write with splinter API... So it kind of
> "merge" of web2py.test and welcome_augmented because of splinter usage...
> It use chromedriver or geckodriver (both tested).
>
> I can share that with you...
>
> I will create a dummy app and a basic test case...
>
> Richard
>
> On Mon, Aug 21, 2017 at 5:26 PM, Dave S  wrote:
>
>>
>>
>> On Monday, August 21, 2017 at 1:53:51 PM UTC-7, Dave S wrote:
>>>
>>>
>>>
>>> On Friday, August 18, 2017 at 10:35:01 AM UTC-7, Carlos Cesar Caballero
>>> wrote:

 I have been facing with that issue too, the error is because there are
 no logged in user, and the redirect is raised, the main problem with this
 approach is that I have been not able to correctly log in a user...

 Being honest, I haven't found a satisfactory way for testing web2py
 applications.

 Greetings.

>>>
>>>
>>> If you're using the webclient tool, as in the book examples, there is
>>> provision for logging in clients.  In one of his posts answering a test
>>> question, Massimo recommends putting the test code in modules rather
>>> than controllers to avoid exposing the test interface.
>>>
>>> http://web2py.com/books/default/chapter/29/14/other-recipes>
>>> (no anchor on the subheader)
>>>
>>>
>> If you need some end-to-end testing using different environments, there's
>> browserling.com:
>>
>> [clipped from one of my old posts] if you need to do testing of your
>> website in a lot of browsers, but don't have that many in your own lab,
>> https://www.browserling.com/>
>> might be helpful.  They have an array of target machines with different
>> OS/browser combinations and give you a virtual window to them.
>>
>> To access all the combinations requires subscribing, but the prices
>> aren't too bad.  Certainly less than buying 10 used laptops.  For free
>> access, the choices are limited and you only get a 3 minute session each
>> try, but even that might be helpful.  Additional features include their Bug
>> Hunter tool, but maybe you've already been testing with Selenium or another
>> tool.  There are also tools for recording and sharing and screenshots.
>>
>> /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 *MailScanner ha detectado un intento de fraude
>> en la siguiente página web "groups.google.com". No confíe en esta página
>> web:* *MailScanner ha detectado un intento de fraude en la siguiente
>> p�gina web "groups.google.com". No conf�e en esta p�gina web:*
>> 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 *MailScanner ha detectado un intento de fraude en
> la siguiente página web "groups.google.com". No confíe en esta página web:* 
> *MailScanner
> ha detectado un intento de fraude en la siguiente p�gina web
> "groups.google.com". No conf�e en esta p�gina web:*
> 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 

{Disarmed} [web2py] Re: pytest and controllers protected with auth

2017-08-31 Thread Carlos Cesar Caballero Díaz
Thank you all you guys, right now I am a little busy with other 
projects, but I will follow your suggestions, and will post my results.



Greetings.


El 22/08/17 a las 09:57, Richard Vézina escribió:
Will try to wrapp up my stuff... It base on web2py.test, but I add a 
test launcher and extract save pytest output into a text file to be 
consulted after the ending of the test... I do include this file as a 
test report into my app for the client to see that all tests passed... 
It works with selenium/splinter, so test are write with splinter 
API... So it kind of "merge" of web2py.test and welcome_augmented 
because of splinter usage... It use chromedriver or geckodriver (both 
tested).


I can share that with you...

I will create a dummy app and a basic test case...

Richard

On Mon, Aug 21, 2017 at 5:26 PM, Dave S > wrote:




On Monday, August 21, 2017 at 1:53:51 PM UTC-7, Dave S wrote:



On Friday, August 18, 2017 at 10:35:01 AM UTC-7, Carlos Cesar
Caballero wrote:

I have been facing with that issue too, the error is
because there are no logged in user, and the redirect is
raised, the main problem with this approach is that I have
been not able to correctly log in a user...

Being honest, I haven't found a satisfactory way for
testing web2py applications.

Greetings.



If you're using the webclient tool, as in the book examples,
there is provision for logging in clients.  In one of his
posts answering a test question, Massimo recommends putting
the test code in modules rather than controllers to avoid
exposing the test interface.

http://web2py.com/books/default/chapter/29/14/other-recipes>
(no anchor on the subheader)


If you need some end-to-end testing using different environments,
there's browserling.com :

[clipped from one of my old posts] if you need to do testing of
your website in a lot of browsers, but don't have that many in
your own lab,
https://www.browserling.com/ >
might be helpful.  They have an array of target machines with
different OS/browser combinations and give you a virtual window to
them.

To access all the combinations requires subscribing, but the
prices aren't too bad.  Certainly less than buying 10 used
laptops.  For free access, the choices are limited and you only
get a 3 minute session each try, but even that might be helpful. 
Additional features include their Bug Hunter tool, but maybe

you've already been testing with Selenium or another tool. There
are also tools for recording and sharing and screenshots.

/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 *MailScanner ha detectado un intento de
fraude en la siguiente p�gina web "groups.google.com". /No/ conf�e
en esta p�gina web:* 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 *MailScanner ha detectado un intento de fraude 
en la siguiente p�gina web "groups.google.com". /No/ conf�e en esta 
p�gina web:* 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: mercurial

2017-08-31 Thread Dave S


On Thursday, August 31, 2017 at 11:18:14 AM UTC-7, Richard wrote:
>
> Hello Martin,
>
> And sorry if I hurt feels (community), but it only me thinking...
>
> If I was you, I would avoid rely to such web2py feature (I am thinking to 
> web2py upgrade button in admin here)... First the versioning feature limit 
> you to linear change history (no branches) and to mercurial... Mercurial is 
> nice, but if I start all over I would pick git over mercurial except for 
> tortoise-ng which I would miss a lot. Git is so much more widespread than 
> mercurial and mastering it allow you to contribute to many open source 
> software on github (ex.: web2py).
>
>
There is the hg-git extension to allow access to git repos from mercurial.  
I haven't gotten around to using it yet, so I can't give specific advice.  
(I've used hg-convert to make local copies of SVN repos, but not to update 
the SVN repos.  hg-convert can also be used to turn a branch into a 
project, and other housekeeping tasks.)

I have limited experience with git and github (see web2py book), but that 
looks to change.

If you are alone in a project, linear commit history is workable, but at 
> some point you will want to branch to focus on a bug while developping a 
> feature so you will be force to do it, and then you not anymore can 
> appreciate your whole history in web2py, so...
>

I like branches even when working alone.  That's one reason why my tuit 
isn't round ... my itch takes me to the command line.

 

>
> Richard
>
>
/dps
 

> On Thu, Aug 31, 2017 at 1:26 AM, Martin Weissenboeck  > wrote:
>
>> Thank you for your fast response.
>> I think if "versioning" does not work in web2py the button and the 
>> chapter from the book should be removed. It is frustrating to try 
>> something, which does not work. I always think that I have made a mistake.
>>
>> Regards Martin
>>
>> 2017-08-30 22:32 GMT+02:00 Dave S >:
>>
>>>
>>>
>>> On Wednesday, August 30, 2017 at 12:11:01 PM UTC-7, mweissen wrote:

 Now another instance of web2py and another ticket.
 It seems that web2py does not match this version of mercurial.
 Who uses "versioning" with success?


>>> It's an interface issue.  web2py uses an internal interface that's 
>>> subject to change, and which indeed did change for at least one of the 
>>> commands web2py uses.  I've been meaning to work up using the command 
>>> server (an official mercurial interface), but haven't filed my tuit very 
>>> round yet.
>>>
>>> (I use mercurial in my project, but since I use branches and the web2py 
>>> usage didn't include that, I just use command-line mercurial.  If you're 
>>> looking for a mercurial gui, TortoiseHg is the best known, and has been 
>>> ported to Linux as well as Windows.  I'm not sure what to use on Macs, but 
>>> that's probably listed in the wiki at mercurial-scm.org)
>>>
>>> /dps
>>>
>>>  
>>>
 ​
 Error ticket for "admin"Ticket ID

 62.46.34.69.2017-08-30.18-52-32.0686f969-19c0-4400-9e6c-2f79cec2c962
  addremove() takes at least 3 arguments (1 
 given)Version
 web2py™ Version 2.15.3-stable+timestamp.2017.08.07.12.51.45
 Python Python 2.7.12: /usr/local/bin/uwsgi (prefix: /usr)Traceback

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.

 Traceback (most recent call last):
   File "/home/www-data/web2py/gluon/restricted.py", line 219, in restricted
 exec(ccode, environment)
   File "/home/www-data/web2py/applications/admin/controllers/mercurial.py" 
 ,
  line 87, in 
   File "/home/www-data/web2py/gluon/globals.py", line 409, in 
 self._caller = lambda f: f()
   File "/home/www-data/web2py/applications/admin/controllers/mercurial.py" 
 ,
  line 50, in commit
 addremove(repo)
 TypeError: addremove() takes at least 3 arguments (1 given)

 Error snapshot [image: help] 
 
 (addremove() takes at least 3 arguments (1 
 given))​

 2017-08-30 13:20 GMT+02:00 Martin Weissenboeck :

> I want to try the admin versioning.
> mercurial is installed, hg --version shows 2.8.2
>
> And a click on versioning gives "Sorry, could not find mercurial 
> installed"
>
> What is wrong - any ideas?
> Regards, Martin
>
>

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

Re: [web2py] Re: mercurial

2017-08-31 Thread Richard Vézina
Hello Martin,

And sorry if I hurt feels (community), but it only me thinking...

If I was you, I would avoid rely to such web2py feature (I am thinking to
web2py upgrade button in admin here)... First the versioning feature limit
you to linear change history (no branches) and to mercurial... Mercurial is
nice, but if I start all over I would pick git over mercurial except for
tortoise-ng which I would miss a lot. Git is so much more widespread than
mercurial and mastering it allow you to contribute to many open source
software on github (ex.: web2py).

If you are alone in a project, linear commit history is workable, but at
some point you will want to branch to focus on a bug while developping a
feature so you will be force to do it, and then you not anymore can
appreciate your whole history in web2py, so...

Richard

On Thu, Aug 31, 2017 at 1:26 AM, Martin Weissenboeck 
wrote:

> Thank you for your fast response.
> I think if "versioning" does not work in web2py the button and the chapter
> from the book should be removed. It is frustrating to try something, which
> does not work. I always think that I have made a mistake.
>
> Regards Martin
>
> 2017-08-30 22:32 GMT+02:00 Dave S :
>
>>
>>
>> On Wednesday, August 30, 2017 at 12:11:01 PM UTC-7, mweissen wrote:
>>>
>>> Now another instance of web2py and another ticket.
>>> It seems that web2py does not match this version of mercurial.
>>> Who uses "versioning" with success?
>>>
>>>
>> It's an interface issue.  web2py uses an internal interface that's
>> subject to change, and which indeed did change for at least one of the
>> commands web2py uses.  I've been meaning to work up using the command
>> server (an official mercurial interface), but haven't filed my tuit very
>> round yet.
>>
>> (I use mercurial in my project, but since I use branches and the web2py
>> usage didn't include that, I just use command-line mercurial.  If you're
>> looking for a mercurial gui, TortoiseHg is the best known, and has been
>> ported to Linux as well as Windows.  I'm not sure what to use on Macs, but
>> that's probably listed in the wiki at mercurial-scm.org)
>>
>> /dps
>>
>>
>>
>>> ​
>>> Error ticket for "admin"Ticket ID
>>>
>>> 62.46.34.69.2017-08-30.18-52-32.0686f969-19c0-4400-9e6c-2f79cec2c962
>>>  addremove() takes at least 3 arguments (1
>>> given)Version
>>> web2py™ Version 2.15.3-stable+timestamp.2017.08.07.12.51.45
>>> Python Python 2.7.12: /usr/local/bin/uwsgi (prefix: /usr)Traceback
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>>
>>> Traceback (most recent call last):
>>>   File "/home/www-data/web2py/gluon/restricted.py", line 219, in restricted
>>> exec(ccode, environment)
>>>   File "/home/www-data/web2py/applications/admin/controllers/mercurial.py" 
>>> ,
>>>  line 87, in 
>>>   File "/home/www-data/web2py/gluon/globals.py", line 409, in 
>>> self._caller = lambda f: f()
>>>   File "/home/www-data/web2py/applications/admin/controllers/mercurial.py" 
>>> ,
>>>  line 50, in commit
>>> addremove(repo)
>>> TypeError: addremove() takes at least 3 arguments (1 given)
>>>
>>> Error snapshot [image: help]
>>> 
>>> (addremove() takes at least 3 arguments (1
>>> given))​
>>>
>>> 2017-08-30 13:20 GMT+02:00 Martin Weissenboeck :
>>>
 I want to try the admin versioning.
 mercurial is installed, hg --version shows 2.8.2

 And a click on versioning gives "Sorry, could not find mercurial
 installed"

 What is wrong - any ideas?
 Regards, Martin


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

[web2py] Re: Launch web2py shell from within a running interpreter session

2017-08-31 Thread Brendan Barnwell
On Thursday, August 31, 2017 at 8:05:51 AM UTC-7, Anthony wrote:
>
> Here is a variation of something I use in Jupyter notebook:
>
> import os
> import gluon.shell
> from gluon.settings import global_settings
> from gluon.storage import Storage
>
> def web2py_environment(app, controller=None, web2py_path=os.getcwd()):
> # Update global_settings.
> global_settings.gluon_parent = global_settings.applications_parent = 
> web2py_path
> global_settings.cmd_options = Storage(shell=True) # for code that 
> tests for shell
> with open(os.path.join(web2py_path, 'VERSION'), 'rb') as version_info:
> global_settings.web2py_version = version_info.read().split()[-1].
> strip()
> # Create the web2py environment.
> environment = gluon.shell.env(app, import_models=True, c=controller,
> dir=os.path.join(web2py_path, 'applications', app))
> folder = environment['request'].folder
> if controller:
> pyfile = os.path.join(folder, 'controllers', controller + '.py')
> if os.path.isfile(pyfile):
> execfile(pyfile, environment)
> globals().update(**environment)
>
> In your shell, import the above function and call:
>
> web2py_environment('yourapp', 'yourcontroller')
>
> Note, if the web2py folder is not the current working directory, you will 
> need to explicity specify the web2py path (though you could certainly hard 
> code that for your system rather than specifying it explicitly in the call).
>
> You can simplify the above code a bit if you don't need to add a 
> controller to the environment, and updating those global settings isn't 
> strictly necessary to get a working environment.
>

Cool, that seems to work nicely, 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: how to make check box appear to enable multiple selections

2017-08-31 Thread runruh11
See this previous post; it was a question I asked
https://groups.google.com/forum/#!searchin/web2py/checkboxes$20with$20is_in_set%7Csort:relevance/web2py/UtbNmh-DF30/XaEXUF6gCgAJ
what I appreciated from Jim Russell's reply is advice of storing the items 
in a list.  This option uses IS_IN_SET as opposed to IS_IN_DB; not sure if 
that is an option for your project.

On Wednesday, August 30, 2017 at 5:52:36 PM UTC-7, Alex Glaros wrote:
>
> How to make check boxes appear? Below allows user to select multiple 
> dropdown items only if they are contiguous. No checkboxes appear which 
> would allow user to select non-contiguous items.
>
> def select_tables_to_pick_object_of_a_role():
>  potential_role_types = db((db.ObjectType.object_type_table_name != None) 
> & (db.ObjectType.object_type_table_name !=''))._select(db.ObjectType.
> object_type_table_name) 
>  limited_choices = (db.ObjectType.object_type_table_name.belongs(
> potential_role_types))
>  form = SQLFORM.factory( 
>  Field('object_type_table_name', type='list:string', requires = IS_IN_DB(
> db(limited_choices), 'ObjectType.object_type_table_name', 
> '%(object_type_table_name)s', multiple=True, zero = T('choose one')), 
> widget=SQLFORM.widgets.multiple.widget))
>  if form.process().accepted: 
>  response.flash = form.vars.object_type_table_name
>
>
> Thanks,
>
> Alex Glaros
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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: Launch web2py shell from within a running interpreter session

2017-08-31 Thread Anthony
Here is a variation of something I use in Jupyter notebook:

import os
import gluon.shell
from gluon.settings import global_settings
from gluon.storage import Storage

def web2py_environment(app, controller=None, web2py_path=os.getcwd()):
# Update global_settings.
global_settings.gluon_parent = global_settings.applications_parent = 
web2py_path
global_settings.cmd_options = Storage(shell=True) # for code that tests 
for shell
with open(os.path.join(web2py_path, 'VERSION'), 'rb') as version_info:
global_settings.web2py_version = version_info.read().split()[-1].
strip()
# Create the web2py environment.
environment = gluon.shell.env(app, import_models=True, c=controller,
dir=os.path.join(web2py_path, 'applications', app))
folder = environment['request'].folder
if controller:
pyfile = os.path.join(folder, 'controllers', controller + '.py')
if os.path.isfile(pyfile):
execfile(pyfile, environment)
globals().update(**environment)

In your shell, import the above function and call:

web2py_environment('yourapp', 'yourcontroller')

Note, if the web2py folder is not the current working directory, you will 
need to explicity specify the web2py path (though you could certainly hard 
code that for your system rather than specifying it explicitly in the call).

Anthony




On Thursday, August 31, 2017 at 2:02:13 AM UTC-4, Brendan Barnwell wrote:
>
> I use DreamPie, a wrapper around the Python interpreter.  I would like to 
> be able to use the web2py console shell from within DreamPie.  I could also 
> imagine wanting to use it from within other alternative Python 
> interpreters, for instance inside the IPython QT console or a console 
> embedded in an IDE.
>
> The easiest way to do this would be if I could launch the web2py 
> environment from within an already-running Python session.  So that I would 
> start up whatever shell I want, and then do something like:
>
> >>> import web2py
> >>> web2py.set_up_shell(app='my_app')
>
> and have the same environment as if I had run "python web2py.py -S my_app".
>
> Is this possible?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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: Getting 404 NOT FOUND error when accessing a few pages of my app.

2017-08-31 Thread Rahul
Hello Everyone,
   So here I am back and happy to report that my application is now 
working fine. 

*Cause *- I cannot pin point the cause as there were no tickets generated. 
I fixed a function missing for an import function (import string) 
basically. 
*What was fixed *- 

   1. Had to use old stable build (2.5 months old) and upgrade the entire 
   code 
   2. Code profiling and checking was done for all 14k + lines  (line by 
   line ... no mercy :(  there )
   3. All updates were done manually (excluding db changes) 
   4. Again I got "Socket timed out before request" rocket error twice for 
   two modules which was fixed by closing the code block in view by using 
   {{pass}}. Perhaps the parser needs a fix for this. 
   
We can mark this thread "Done". 

Thanks,

*Sincerely*, Rahul Dhakate. 


On Friday, August 18, 2017 at 11:10:33 AM UTC+5:30, Rahul wrote:
>
> Okay after setting up my project on another machine I am still getting 
> this error. I am sure that there is something that might have got deleted 
> or changed accidently in my project. I'll check the same and get back with 
> the problem and solution. This might take some time though :( 
>
> Thanks,
>
> Rahul. 
>
> On Wednesday, August 16, 2017 at 12:09:56 AM UTC+5:30, Anthony wrote:
>>
>> On Tuesday, August 15, 2017 at 7:49:09 AM UTC-4, Rahul wrote:
>>>
>>> Hi Anthony, 
>>>  Thanks for getting back. No changes were made that would break 
>>> the system so badly.  
>>> And although today I did copy the single project on the same machine but 
>>> with a newly setup web2py 2.15.3. 
>>> I will try using this project on another machine by configuring it from 
>>> scratch.
>>>
>>> Does using routes do any magic to web2py or its app by copying/changing 
>>> any file for routes as 404 is a strange error to get.
>>>
>>
>> No. The 404 indicates web2py isn't finding the app/controller/function 
>> identified from the URL after rewrite.
>>
>>

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

2017-08-31 Thread Lars
The code needs to be in model not in modules.

Could anyone explain why ?



On Thursday, August 31, 2017 at 12:38:32 PM UTC+2, Lars wrote:
>
> Hi,
>
> I have this code in dlogging.py in the modules folder of my app :
>
> import logging
> import logging.handlers
>
>
> def get_configured_logger(name):
> global logger
> logger = logging.getLogger(name)
> if len(logger.handlers) == 0:
> fh = logging.FileHandler(os.path.join('/'.join(os.path.realpath(
> __file__).split('/')[:-3]),
>  'logs/system.log'))
> formatter = logging.Formatter('%(asctime)s - %(levelname)s 
> %(message)s')
> fh.setFormatter(formatter)
> logger.addHandler(fh)
> logger.setLevel(logging.DEBUG)
> return logger
>
> logger = get_configured_logger('web2py.app.system')
>
> I don't understand why it works in the shell but not from web2py from 
> inside a module class (with from dloggig import logger). Could anybody 
> figure why ?
>
> Thanks
>
> w2p : 2.15.3 py : 3.5.3
>
>
>

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

2017-08-31 Thread Lars
Hi,

I have this code in dlogging.py in the modules folder of my app :

import logging
import logging.handlers


def get_configured_logger(name):
global logger
logger = logging.getLogger(name)
if len(logger.handlers) == 0:
fh = logging.FileHandler(os.path.join('/'.join(os.path.realpath(
__file__).split('/')[:-3]),
 'logs/system.log'))
formatter = logging.Formatter('%(asctime)s - %(levelname)s 
%(message)s')
fh.setFormatter(formatter)
logger.addHandler(fh)
logger.setLevel(logging.DEBUG)
return logger

logger = get_configured_logger('web2py.app.system')

I don't understand why it works in the shell but not from web2py from 
inside a module class. Could anybody figure why ?

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] Link to 2.15.3 downloads 2.15.2

2017-08-31 Thread icodk
On http://www.web2py.com/ there is a link to the download area:
2.15.3-stable+timestamp.2017.08.07.12.51.45 ( 
LGPLv3 License 
)
However, clicking on the   For Windows button under the For normal users , 
downloads 2.15.2

(https://mdipierro.pythonanywhere.com/examples/static/web2py_win.zip)

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