Re: [web2py] Re: AssertionError: Header names/values must be of type str

2023-10-26 Thread Massimo DiPierro
Can you try once more?

On Wed, 25 Oct 2023 at 23:03, Al Ex  wrote:

> I tried with a new installation of web2py
>
> $ git clone --recursive https://github.com/web2py/web2py.git
>
>
> It gives the same error
>
> *
> ERROR:Rocket.Errors.Thread-11:Traceback (most recent call last):
>
>   File "/Users/z/Documents/web2py/gluon/rocket.py", line 1347, in run
> self.run_app(conn)
>
>   File "/Users/z/Documents/web2py/gluon/rocket.py", line 1865, in run_app
> output = self.app(environ, self.start_response)
>
>   File "/Users/z/Documents/web2py/gluon/main.py", line 688, in
> app_with_logging
> ret[0] = wsgiapp(environ, responder2)
>
>   File "/Users/z/Documents/web2py/gluon/main.py", line 600, in wsgibase
> return http_response.to(responder, env=env)
>
>   File "/Users/z/Documents/web2py/gluon/http.py", line 127, in to
> responder(status, rheaders)
>
>   File "/Users/z/Documents/web2py/gluon/main.py", line 683, in responder2
> return responder(s, h)
>
>   File "/Users/z/Documents/web2py/gluon/rocket.py", line 1827, in
> start_response
> self.header_set = Headers(response_headers)
>
>   File
> "/Users/z/.pyenv/versions/3.10.2/lib/python3.10/wsgiref/headers.py", line
> 39, in __init__
> self._convert_string_type(v)
>
>   File
> "/Users/z/.pyenv/versions/3.10.2/lib/python3.10/wsgiref/headers.py", line
> 45, in _convert_string_type
> raise AssertionError("Header names/values must be"
>
> AssertionError: Header names/values must be of type str (got 50)
>
> On October 26, 2023 at 14:43:28, Massimo Di Pierro (
> massimo.dipie...@gmail.com) wrote:
>
> I believe this is now fixed in master, thanks to Carlos' suggestion. Can
> you please give it a try?
>
> On Monday, 23 October 2023 at 13:30:34 UTC-7 alex wrote:
>
>> Hi, Running web2py in virtualenviroment (python 3.9.5, it happens also in
>> python 3.10.10)
>>
>> 
>>
>> ERROR:Rocket.Errors.Thread-3:Traceback (most recent call last):
>>
>>   File "/Users/z/dev/web2py/gluon/rocket.py", line 1294, in run
>> self.run_app(conn)
>>
>>   File "/Users/z/dev/web2py/gluon/rocket.py", line 1796, in run_app
>> output = self.app(environ, self.start_response)
>>
>>   File "/Users/z/dev/web2py/gluon/main.py", line 648, in app_with_logging
>> ret[0] = wsgiapp(environ, responder2)
>>
>>   File "/Users/z/dev/web2py/gluon/main.py", line 562, in wsgibase
>> return http_response.to(responder, env=env)
>>
>>   File "/Users/z/dev/web2py/gluon/http.py", line 129, in to
>> responder(status, rheaders)
>>
>>   File "/Users/z/dev/web2py/gluon/main.py", line 643, in responder2
>> return responder(s, h)
>>
>>   File "/Users/z/dev/web2py/gluon/rocket.py", line 1759, in start_response
>> self.header_set = Headers(response_headers)
>>
>>   File "/Users/z/.pyenv/versions/3.9.5/lib/python3.9/wsgiref/headers.py",
>> line 39, in __init__
>> self._convert_string_type(v)
>>
>>   File "/Users/z/.pyenv/versions/3.9.5/lib/python3.9/wsgiref/headers.py",
>> line 45, in _convert_string_type
>> raise AssertionError("Header names/values must be"
>>
>> AssertionError: Header names/values must be of type str (got 50)
>>
>> 
>> Any hints?
>> Thank you
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/2f971066-7e75-440e-80e0-cc132afacc93n%40googlegroups.com
> 
> .
>
>

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


Re: [web2py] Re: Web3py

2019-06-16 Thread Massimo DiPierro
Not with the usual syntax. Looking for a way to allow this in the new form
api

On Sun, Jun 16, 2019, 09:51 Fekete Zoltán  wrote:

> Hi Massimo,
>
> In web2py I highly rely on dynamically modifiable forms. Based on
> calculations some fields are required or even hidden, others not.
>
> Will be possible to do so in web3py?
>
> Thank you,
>
> FeZ
>
> On 2019. június 15. 8:17:43 Massimo Di Pierro 
> wrote:
>
>> db.tablename.fieldname.readable = False # SAFE
>> def test():
>> db.tablename.fieldname.readable = False # NOT SAFE
>>
>> *models.py*
>> def on_define_tablename(table):
>> table.fieldname.readable = False # SAFE
>> db.define_table('tablename',
>> Field('fieldname'),
>> on_define = on_define_tablename)
>>
>> BUT things like on_define = on_define_tablename
>> are no longer necessary in web3py. Tables are defined when the files are
>> imported not at every request (like in web2py) and therefore you do not
>> need optimization tricks any more.
>>
>>
>> On Friday, 14 June 2019 22:03:04 UTC-7, 黄祥 wrote:
>>>
>>> Be careful that you can no longer change attributes everywhere you like
 as in:

 db.tablename.fieldname.readable = False

 In web2py this is ok. In web3py this is not safe. Attributes must be
 global. The state of fixtures must not be modified inside actions.

>>>
>>> is it mean in controller not safe, but in on_define, safe or not ?
>>> *e.g.*
>>> *controller.py*
>>> db.tablename.fieldname.readable = False # not safe in web3py
>>> def test():
>>> db.tablename.fieldname.readable = False # not safe in web3py
>>>
>>> *models.py*
>>> def on_define_tablename(table):
>>> table.fieldname.readable = False # safe or not ?
>>> db.define_table('tablename',
>>> Field('fieldname'),
>>> on_define = on_define_tablename)
>>>
>>> best regards,
>>> stifan
>>>
>>>
>>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/82e955db-788c-4280-9504-0bbd242882eb%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAJYrZrnUquuSCkGkHYVPQ1CzQfZh2fsDLBKzZzQu1%3DjB2n6nYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Greetings

2018-12-25 Thread Massimo DiPierro
Merry Christmas everybody

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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-09-01 Thread Massimo DiPierro
also we can assume git is already installed so it is a matter of calling 
subprocess. I would take a patch to simplify the code. :-)

> On Sep 1, 2017, at 11:21 PM, Martin Weissenboeck  wrote:
> 
> I agree!
> 
> Am 02.09.2017 06:18 schrieb "Massimo Di Pierro"  >:
> There is an advantage in having some minimal version control functionality 
> available through the web admin.
> We just have the wrong functionality. 
> 
> What we need is commit, push, and pull only. In that an admin can upgrade an 
> app by pressing a button in admin, without having to login.
> 
> 
> On Thursday, 31 August 2017 21:06:25 UTC-5, Dave S wrote:
> 
> 
> 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.


Re: [web2py] Re: Why isn't WEB2PY a part of Googles summer of code? Will it be this time?

2016-10-12 Thread Massimo DiPierro
i cannot commit 10hrs either.. but review the link

On Oct 12, 2016 2:20 AM, "Mathieu Clabaut"  wrote:

>
> The dates are published : https://developers.google.com/
> open-source/gsoc/timeline
> We have some time to prepare an application if we decide to go.
> Just for us to know, Google advertises that : "Mentors should expect to
> spend at least 10 hours a week for each student".
> It seems a reasonable average to me in order to be useful for the student,
> but I'm still afraid I'd be overly optimistic in saying I will be able to
> spare 10 hours a week…
>
> So unless unexpected changes in my life, it is probably not a good idea to
> promise things I won't be able to cope with.
> …
>
>
> On Wed, Oct 12, 2016 at 5:16 AM Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> If you need any help with the proposal, let me know.
>>
>>
>> On Friday, 7 October 2016 01:46:17 UTC-5, Mathieu Clabaut wrote:
>>
>> Hello,
>>
>>  I'm pondering to volunteer as a mentor for a pytest web2py framework,
>> but I'm a bit afraid of my low level of availability.
>>
>>  What I a have in mind is a pytest plugin to allow three level of testing
>> :
>> 1. unit testing (with or without view rendering),
>> 2. fast WebClient level testing (without javascript),
>> 3. slow UI level testing (with javascript enable, via
>> selenium+pytest-splinter or something like that).
>> And for each level, a set of tests applied to the example application,
>> that would contribute to overall web2py testing, the whole thing being run
>> in continuous integration environment.
>>
>> I've already got some code for the 3 levels (which is now integrated with
>> the application under test, but which could probably be rewritten with not
>> too much difficulty has an independent py.test plugin), mostly working.
>>
>>  I'd better be not alone as a mentor, so if someone wants to jump in,
>> please do not be shy :-) I'd certainly prefer to be there in support than
>> to bear alone the whole mentoring role.
>>
>> -Mathieu
>>
>> On Thu, Oct 6, 2016 at 11:58 PM joseph simpson  wrote:
>>
>> Develop a standard testing framework for Web2py.
>>
>> On Thu, Oct 6, 2016 at 12:25 PM, Dave S  wrote:
>>
>>
>>
>> On Thursday, October 6, 2016 at 7:29:03 AM UTC-7, Steve Joe wrote:
>>
>> I am seeing that Django, RoR all are on GSOC. Maybe web2py too should be
>> there.
>>
>>
>> That requires a project proposal with a fairly well defined scope (I've
>> seen the Mercurial people dealing with that).  Do you have any  specific
>> suggestions?
>>
>> /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.
>>
>>
>>
>>
>> --
>> Joe Simpson
>> “Reasonable people adapt themselves to the world. Unreasonable people
>> attempt to adapt the world to themselves. All progress, therefore,
>> depends on unreasonable people.”
>> George Bernard Shaw
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are 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: Web2PY server is hanging

2016-05-19 Thread Massimo DiPierro
Can you tell us more? What server? What database? What is the app about.

Usually it hags because of code error:
- you access something that is not thread safe, for example os.chdir(...)
- you lock some object and do not release

Please tell us more and we can help debug.

On Thu, May 19, 2016 at 5:29 PM, Kommoju, Rajgopal <
rajgopal.komm...@hitachiconsulting.com> wrote:

>
>
> Team,
>
>
>
> Today I have noticed the server is hanging not allowing me to work with
> WEB2py, please help.
>
>
>
> Thanks,
>
> Raj Gopal.
>
>
> --
> This e-mail is intended solely for the person or entity to which it is
> addressed and may contain confidential and/or privileged information. Any
> review, dissemination, copying, printing or other use of this e-mail by
> persons or entities other than the addressee is prohibited. If you have
> received this e-mail in error, please contact the sender immediately and
> delete the material from any computer. To unsubscribe send an email to:
> unsubscr...@hitachiconsulting.com Hitachi Consulting Corporation, 14643
> Dallas Parkway, Suite 800, Dallas, Texas 75254 (HCAD0411)
> --
>

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

2016-05-15 Thread Massimo DiPierro
Below are instructions for creating an AWS Elastic Beanstalk instance.

Instructions are based on this:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html

Anybody knows how to get Amazon to publish the instructions?


Massimo



$ pip install awsebcli

$ pip install virualenv

$ wget http://web2py.com/examples/static/web2py_src.zip

$ virtualenv eb-virt

$ source eb-virt/bin/activate

(eb-virt)$ mkdir ebweb2py

(eb-virt)$ cd ebweb2py

(eb-virt)$ pip freeze > requirements.txt

(eb-virt)$ deactivate

$ unzip ../web2py_src.zip

$ web2py/handlers/wsgihandler.py web2py

$ mkdir .ebextensions

$ echo < .ebextensions/web2py.config


At thi point the folder structure should be

ebweb2py:

  .ebextensions/

 web2py.config

  requirements.txt

  web2py/

wsgihandler.py

web2py.py

...


$ eb init -p python2.7 web2py-tutorial


Get security credentials from
https://console.aws.amazon.com/iam/home#security_credential

(specifically a pair of aws-access-id and aws-secret-key).


$ eb init

You have not yet set up your credentials or your credentials are incorrect

You must provide your credentials.

(aws-access-id): [...]

(aws-secret-key): [...]

...

Type a keypair name.

(Default is aws-eb): [...]

Generating public/private rsa key pair.

Enter passphrase (empty for no passphrase): [...]


$ eb create web2py-env

$ eb open

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

2016-01-13 Thread Massimo DiPierro
It is another experiment.

It is a rewrite of some of the web2py modules and supports 90% of the
current web2py syntax at 2.5x the speed. It works. It it cleaner and should
be easier to port to python 3 than current web2py.

We are debating on web2py developers what to do:
1) backport some of the new modules to web2py (specifically the new Form
class instead of SQLFORM)
2) try to reach a 99.9% compatibility and release it as new major version
with guidelines for porting legacy apps
3) make some drastic changes in backward compatibility and release as a
different framework (but change what? we like web2py as it is)

For now I am working on 2 to see how far I can push the backward
compatibility. But there are some functionalities I want remove or move in
an optional module (from legacy_web2py import *).

Feel free to share your opinion on web2py developers.

Massimo


On Wed, Jan 13, 2016 at 11:04 PM, kelson _  wrote:

> I was looking at your recent web3py commits and hoped you could provide
> the web3py vision/intent (or point me towards it if I missed the
> discussion).
>
> Thanks,
> kelson
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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] Fwd: aiosmtpd 1.0a1 - asyncio-based implementations of SMTP/LMTP

2015-10-20 Thread Massimo DiPierro
This is nice if you want a pure python SMTP server

Begin forwarded message:

> From: Barry Warsaw 
> Subject: aiosmtpd 1.0a1 - asyncio-based implementations of SMTP/LMTP
> Date: October 20, 2015 at 8:51:29 AM CDT
> To: 
> Reply-To: python-l...@python.org
> 
> I'm very happy to announce the first alpha release of aiosmtpd, an
> asyncio-based implementation of SMTP and LMTP.
> 
> http://aiosmtpd.readthedocs.org/en/latest/
> https://pypi.python.org/pypi/aiosmtpd/1.0a1
> 
> This library can be used as a standalone server, or as a testing framework for
> applications that send email.  It's inspired by several previous packages
> including the stdlib smtpd.py, lazr.smtptest, Benjamin Bader's aiosmtp, and
> submodules in GNU Mailman.
> 
> This is an alpha release, so it can obviously use lots of feedback, and
> contributions are very much welcome.  We're developing the library on GitLab;
> see the RTD link above for details.
> 
> Brought to you by the aiosmtpd hacking cabal of Andrew Kuchling, Eric Smith,
> Jason Coombs, R. David Murray and myself.
> 
> Our aim is to include aiosmtpd in the Python 3.6 stdlib as a better
> alternative to smtpd.py.
> 
> Cheers,
> -Barry
> -- 
> https://mail.python.org/mailman/listinfo/python-announce-list
> 
>Support the Python Software Foundation:
>http://www.python.org/psf/donations/

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

2015-10-16 Thread Massimo DiPierro
The book is somewhat old but it still contains some useful recipes. Here are 
some discount codes.

Begin forwarded message:
> 
> 
> These are the details:
> Web2py Application Development Cookbook - e-book
> Discount Code: web2py50
> Discount: 50%
> Expiry Date: 31st Dec, 2015
> 
> Web2py Application Development Cookbook - print book
> Discount Code: web2py20
> Discount: 20%
> Expiry Date: 31st Dec, 2015
> 
> You can give these out in your mailing lists.
> 
> Also, it would be great if you could put a banner up on the website with 
> these codes.
> I can provide you with the banner if you could give me the dimensions you'll 
> need.
> 
> 
>  

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

2015-03-07 Thread Massimo DiPierro
I run some tests and I cannot reproduce the problem but I pointed you to the 
wrong function.
This works for me and does what you asked:

db = DAL()
db.define_table('a',Field('b'))
db.a.insert(b=xxx)
query = SQLFORM.build_query([db.a.b],'xxx')
print db(query).select()

Does it work for you?


On Mar 6, 2015, at 6:40 PM, Ron Chatterjee achatterjee...@gmail.com wrote:

 In my db.py I have from gluon.tools import*. Thats the issue?
 
 On Mar 6, 2015 7:31 PM, Massimo DiPierro massimo.dipie...@gmail.com wrote:
 Do you have any from …. import Field in your code?
 
 
 On Mar 6, 2015, at 6:20 PM, Ron Chatterjee achatterjee...@gmail.com wrote:
 
 I think the issue is with the line isinstance (field, Field). When I pass 
 the field.it is a gluon.dal.objects.Field n u r comparing that with 
 pydal.object.Field. I m not sure but its failing both if and else. So it 
 goes to raise. Lol
 
 On Mar 6, 2015 6:59 PM, Massimo DiPierro massimo.dipie...@gmail.com 
 wrote:
 What is wrong with smart_query?
 
 On Fri, Mar 6, 2015 at 5:56 PM, Ron Chatterjee achatterjee...@gmail.com 
 wrote:
 Can u fix smart_query for me? Lol
 
 On Mar 6, 2015 6:53 PM, Massimo DiPierro massimo.dipie...@gmail.com 
 wrote:
 there should be instructions in the file. You need to install whoosh
 
 On Mar 6, 2015, at 5:50 PM, Ron Chatterjee achatterjee...@gmail.com wrote:
 
 Does anyone know how to install haystack? I see a python file with .py 
 extension. I need to install whoosk and sunburnt first? Thought may be give 
 haystack a try.
 
 
 
 On Friday, March 6, 2015 at 1:08:28 PM UTC-5, Massimo Di Pierro wrote:
 It may need some love. Very few people have used this. It should work fine. 
 It works for me.
 
 On Friday, 6 March 2015 11:40:25 UTC-6, Ron Chatterjee wrote:
 Omg, this is exactly what I was looking for. Sooo spooky
 
 On Mar 6, 2015 12:35 PM, Massimo DiPierro massimo@gmail.com wrote:
 https://github.com/mdipierro/web2py-haystack
 
 On Mar 6, 2015, at 11:29 AM, Ron Chatterjee achatte...@gmail.com wrote:
 
 Is whoosh is supported in DAL. Any example? Or have a js that create 
 SQLFORM.search like SQLFOrM.smartgrid? Searching is important
 
 
 
 
 

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

2015-03-06 Thread Massimo DiPierro
there should be instructions in the file. You need to install whoosh

On Mar 6, 2015, at 5:50 PM, Ron Chatterjee achatterjee...@gmail.com wrote:

 Does anyone know how to install haystack? I see a python file with .py 
 extension. I need to install whoosk and sunburnt first? Thought may be give 
 haystack a try.
 
 
 
 On Friday, March 6, 2015 at 1:08:28 PM UTC-5, Massimo Di Pierro wrote:
 It may need some love. Very few people have used this. It should work fine. 
 It works for me.
 
 On Friday, 6 March 2015 11:40:25 UTC-6, Ron Chatterjee wrote:
 Omg, this is exactly what I was looking for. Sooo spooky
 
 On Mar 6, 2015 12:35 PM, Massimo DiPierro massimo@gmail.com wrote:
 https://github.com/mdipierro/web2py-haystack
 
 On Mar 6, 2015, at 11:29 AM, Ron Chatterjee achatte...@gmail.com wrote:
 
 Is whoosh is supported in DAL. Any example? Or have a js that create 
 SQLFORM.search like SQLFOrM.smartgrid? Searching is important
 
 

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

2015-03-06 Thread Massimo DiPierro
What is wrong with smart_query?

On Fri, Mar 6, 2015 at 5:56 PM, Ron Chatterjee achatterjee...@gmail.com
wrote:

 Can u fix smart_query for me? Lol
 On Mar 6, 2015 6:53 PM, Massimo DiPierro massimo.dipie...@gmail.com
 wrote:

 there should be instructions in the file. You need to install whoosh

 On Mar 6, 2015, at 5:50 PM, Ron Chatterjee achatterjee...@gmail.com
 wrote:

 Does anyone know how to install haystack? I see a python file with .py
 extension. I need to install whoosk and sunburnt first? Thought may be
 give haystack a try.



 On Friday, March 6, 2015 at 1:08:28 PM UTC-5, Massimo Di Pierro wrote:

 It may need some love. Very few people have used this. It should work
 fine. It works for me.

 On Friday, 6 March 2015 11:40:25 UTC-6, Ron Chatterjee wrote:

 Omg, this is exactly what I was looking for. Sooo spooky
 On Mar 6, 2015 12:35 PM, Massimo DiPierro massimo@gmail.com
 wrote:

 https://github.com/mdipierro/web2py-haystack

 On Mar 6, 2015, at 11:29 AM, Ron Chatterjee achatte...@gmail.com
 wrote:

 Is whoosh is supported in DAL. Any example? Or have a js that create
 SQLFORM.search like SQLFOrM.smartgrid? Searching is important





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

2015-03-06 Thread Massimo DiPierro
Do you have any from …. import Field in your code?


On Mar 6, 2015, at 6:20 PM, Ron Chatterjee achatterjee...@gmail.com wrote:

 I think the issue is with the line isinstance (field, Field). When I pass the 
 field.it is a gluon.dal.objects.Field n u r comparing that with 
 pydal.object.Field. I m not sure but its failing both if and else. So it goes 
 to raise. Lol
 
 On Mar 6, 2015 6:59 PM, Massimo DiPierro massimo.dipie...@gmail.com wrote:
 What is wrong with smart_query?
 
 On Fri, Mar 6, 2015 at 5:56 PM, Ron Chatterjee achatterjee...@gmail.com 
 wrote:
 Can u fix smart_query for me? Lol
 
 On Mar 6, 2015 6:53 PM, Massimo DiPierro massimo.dipie...@gmail.com wrote:
 there should be instructions in the file. You need to install whoosh
 
 On Mar 6, 2015, at 5:50 PM, Ron Chatterjee achatterjee...@gmail.com wrote:
 
 Does anyone know how to install haystack? I see a python file with .py 
 extension. I need to install whoosk and sunburnt first? Thought may be give 
 haystack a try.
 
 
 
 On Friday, March 6, 2015 at 1:08:28 PM UTC-5, Massimo Di Pierro wrote:
 It may need some love. Very few people have used this. It should work fine. 
 It works for me.
 
 On Friday, 6 March 2015 11:40:25 UTC-6, Ron Chatterjee wrote:
 Omg, this is exactly what I was looking for. Sooo spooky
 
 On Mar 6, 2015 12:35 PM, Massimo DiPierro massimo@gmail.com wrote:
 https://github.com/mdipierro/web2py-haystack
 
 On Mar 6, 2015, at 11:29 AM, Ron Chatterjee achatte...@gmail.com wrote:
 
 Is whoosh is supported in DAL. Any example? Or have a js that create 
 SQLFORM.search like SQLFOrM.smartgrid? Searching is important
 
 
 
 

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

2015-03-06 Thread Massimo DiPierro
https://github.com/mdipierro/web2py-haystack

On Mar 6, 2015, at 11:29 AM, Ron Chatterjee achatterjee...@gmail.com wrote:

 Is whoosh is supported in DAL. Any example? Or have a js that create 
 SQLFORM.search like SQLFOrM.smartgrid? Searching is important
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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] Fwd: Get a Web2py cloud instance in less than 30 seconds

2015-03-02 Thread Massimo DiPierro
from Enrique @ terminal.com:

 We were playing a little bit with web2py and we think it's a really good 
 product, so we decided create a new snapshot with web2py and add it to our 
 app store. 
 In short, that means that you can start our own fully-functional web2py cloud 
 instance in less than 30 seconds and you can try it for free!
 
 This is the link to the web2py snap: https://www.terminal.com/tiny/WELxJg3288
 
 

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

2015-02-24 Thread Massimo DiPierro
the DAL has only these API:

db(query).select(….)
db(query).update(…)
db(query).count()
db(query).delete()
table.insert(…)

which map into the corresponding SQL SELECT, UPDATE, COUNT, DELETE and INSERT.

If you define a table with
   db.define_table(‘person’,Field(‘name’))
than you refer to it by db.person
If you define it with
   Person = db.define_table(‘person’,Field(‘name’))
than you can refer to it by simply Person.

other the query all the other arguments are optional.


On Feb 24, 2015, at 7:49 AM, Abhijit Chatterjee achatterjee...@gmail.com 
wrote:

 Hello,
 
 Does anyone know how to rewrite this two contoller line? After model and 
 view, I am trying to get familiar with controller and I am finding when a 
 code is summarized, its hard to understand at times. Wondering if someone can 
 break it down for me a little?
 
 first def:
 
 (1) categories = db(db.category).select(orderby=db.category.name)
 
 why two dbs? can we rewrite this without the select? Is select is a web2py 
 key word? I come from a MATLAB world where we define the structure first and 
 then use. I don't recall I defined select to be a struct.
 
 (2) similarly on my second def:
 
 category = db.category(request.args(0))
 
 Now, I only see one db instead of two. Why? I understand the request args 
 means where I click. Which argument is it.
 
 also this line,
 
 news = db(db.news.category == category.id).select(orderby=db.news.vote)
 
 Its hard to understand when lot of arguments are combined into one. Anyone 
 can help break it down for me a little? Any idea about how to rewrite that, 
 may be even using ifstatement without structure if 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] SQLite, or some other database?

2015-01-03 Thread Massimo DiPierro
Hello Martin,

I agree this is allowed in SQL. If an expression is allowed in SQL you can wrap 
it in Expression (from gluon.dal import Expression) and pass it in place of any 
parameter. Yet if you chose to do it you introduce a dependency on the specific 
SQL dialect.  The problem with passing “true” is exactly that.

If you have a boolean value instead of an expressions DAL wants you to resolve 
it at the Python level since there is no need to pass it to the database (it 
would work but would introduce extra un-necessary work). This is why DAL does 
not provide a way to pass boolean conditions but only queries.

You suggest:
 if boolean1:
 q |= db.table.field1  1
 if boolean2:
 q |= db.table.field2  1

That’s the best way to do it in my mind.

Massimo



On Jan 3, 2015, at 8:39 AM, Martin Weissenboeck mweis...@gmail.com wrote:

 Hi Massimo, thank you very much for this detailed explanation.
 
 About the boolean query:
 You are right (of course :-)), that a query like 
 (db.mytable.field'C')  b 
 with b as a boolean expression is not mentioned in the manual.
 But I think it is not forbidden in SQL and it coulld be useful.
 
 What I want is to switch on or off some parts of a query. A simplified 
 example:
 q = ((db.table.field11)boolean1) | ((db.table.field21)boolean2) ...
 
 This would also work:
 if boolean1:
 q |= db.table.field1  1
 if boolean2:
 q |= db.table.field2  1
 
 Maybe this would be a better solution and it does not need  a  boolean1...
 But I need an inital value for q and now I have the same problem: I need a 
 q = False
 at the beginning. What shall I do? Use a silly query like db.table.id==0 
 which would be always false? 
 
 Or is there another solution without these problems?
 
 Therefore: maybe it would be possible to add two querys, one giving always 
 False, the other True?
 
 About groupby:
 
 sqlite does not like distinct (lines 1 and 3), but groupby works now as 
 expected (line 6). sqlite and postgres are now compatible to each other 
 (lines 2 and 6).
 Testtables
 
 # DatebaseCommand Result
 0 sqlite  db(db.mytable.id0).select( orderby=db.mytable.field2, 
 groupby=db.mytable.field2)   
 mytable.idmytable.field1  mytable.field2
 2 B   x
 5 E   y
 1 sqlite  db(db.mytable.id0).select( orderby=db.mytable.field2, 
 distinct=db.mytable.field2)  near ON: syntax error
 2 sqlite  db(db.mytable.id0).select(db.mytable.field2, 
 orderby=db.mytable.field2, groupby=db.mytable.field2) 
 mytable.field2
 x
 y
 3 sqlite  db(db.mytable.id0).select(db.mytable.field2, 
 orderby=db.mytable.field2, distinct=db.mytable.field2)near ON: syntax 
 error
 4 postgresdb(db.mytable.id0).select( orderby=db.mytable.field2, 
 groupby=db.mytable.field2)   column mytable.id must appear in the GROUP 
 BY clause or be used in an aggregate function LINE 1: SELECT mytable.id, 
 mytable.field1, mytable.field2 FROM myta... ^
 5 postgresdb(db.mytable.id0).select( orderby=db.mytable.field2, 
 distinct=db.mytable.field2)  
 mytable.idmytable.field1  mytable.field2
 1 A   x
 3 C   y
 6 postgresdb(db.mytable.id0).select(db.mytable.field2, 
 orderby=db.mytable.field2, groupby=db.mytable.field2) 
 mytable.field2
 x
 y
 7 postgresdb(db.mytable.id0).select(db.mytable.field2, 
 orderby=db.mytable.field2, distinct=db.mytable.field2)
 mytable.field2
 x
 y
 
 
 2015-01-03 14:03 GMT+01:00 Massimo Di Pierro massimo.dipie...@gmail.com:
 These are not valid DAL expressions:
 
 db((db.mytable.field1'C')  1).select()
 db((db.mytable.field1'C')  (1==1)).select()
 db((db.mytable.field1'C')  'True').select()
 db((db.mytable.field1'C')  'TRUE').select()
 
 the argument of db() must be a query or a logical expression comprised of 
 queries. 1, True, 'True', 'TRUE' are not queries. The fact that occasionally 
 you do not get an error is purely accidental. You should not use these 
 expressions. Nowhere in the manual we say this is allowed. Future versions of 
 web2py may check (and should) and will block them.
 
 In the other case the problem is that the query should be:
 
 db(db.mytable.id0).select(db.mytable.field2, orderby=db.mytable.field2, 
 groupby=db.mytable.field2)
 
 and it should work in both cases.
 
 If you do not specify that you are selecting only field2, they you are 
 selecting all fields and the query becomes ambiguous (which id should be used 
 for the grouped records?). Sqlite does not care and returns a random one. 
 postgresql checks and complains. Apparently this was solved in SQL3 but most 
 engines do not follow SQL3.
 
 http://stackoverflow.com/questions/19601948/must-appear-in-the-group-by-clause-or-be-used-in-an-aggregate-function
 
 The standard SQL distinct syntax (in DAL: db(...).select(...,distinct=True)) 
 does not solve this problem. So the postgresql folks introduced DISTINCT ON 
 (in DAL: db(...).select(..., distinct=field)) but this is a 

[web2py] Re: [web2py-dev] Unexpected common filter behavior

2014-10-31 Thread Massimo DiPierro
db(query).select(*fields)

is supposed to translated into

SELECT *fields (from TABLE) WHERE query

where TABLES are inferred automatically from fields or from query. In principle 
one can have fields without a query (no WHERE) and a query without fields 
(select *).


On Oct 31, 2014, at 3:12 PM, Niphlod niph...@gmail.com wrote:

 +1: never coded with that syntax and it feels unnatural to me.
 
 On Friday, October 31, 2014 8:47:44 PM UTC+1, Leonel Câmara wrote:
 In my opinion this bug is caused by bad design that complicates things 
 unnecessarily. Why are we allowing users to ask for fields in the select for 
 tables they haven't included in the query?
 
 -- 
 -- mail from:GoogleGroups web2py-developers mailing list
 make speech: web2py-develop...@googlegroups.com
 unsubscribe: web2py-developers+unsubscr...@googlegroups.com
 details : http://groups.google.com/group/web2py-developers
 the project: http://code.google.com/p/web2py/
 official : http://www.web2py.com/
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-developers group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py-developers+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: [web2py-dev] Unexpected common filter behavior

2014-10-31 Thread Massimo DiPierro
But it is critical to be able to filter fields at the database level.

I think db as the send of all records db(...) as a subset, db(...)(...) as a 
set of all subset, etc. db(...).select(..fields..) specified which columns to 
filter from the set.



On Oct 31, 2014, at 3:12 PM, Niphlod niph...@gmail.com wrote:

 +1: never coded with that syntax and it feels unnatural to me.
 
 On Friday, October 31, 2014 8:47:44 PM UTC+1, Leonel Câmara wrote:
 In my opinion this bug is caused by bad design that complicates things 
 unnecessarily. Why are we allowing users to ask for fields in the select for 
 tables they haven't included in the query?
 
 -- 
 -- mail from:GoogleGroups web2py-developers mailing list
 make speech: web2py-develop...@googlegroups.com
 unsubscribe: web2py-developers+unsubscr...@googlegroups.com
 details : http://groups.google.com/group/web2py-developers
 the project: http://code.google.com/p/web2py/
 official : http://www.web2py.com/
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-developers group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py-developers+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] ssl certificate?

2014-09-14 Thread Massimo DiPierro
Any recommendation about where to buy a cheat ssl certificate? I have used 
RapidSSL before. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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-dev] Version 2.9.6 indeed breaks backward compat for some users

2014-09-12 Thread Massimo DiPierro
I used to have JS but I then I learned it and it is not that bad. ;-)

On Sep 12, 2014, at 1:36 AM, Niphlod niph...@gmail.com wrote:

 muhaha, funny all the push you're giving towards client-side widgets 
 autocomplete NEEDS to be js code, and it's probably one of the three that 
 NEED js (just a bit or a lot) to be used fairly. I'm not a fan of inlining js 
 (as you know already, I had strong feeling to remove any occurrence of js in 
 python code) but hey, we got you're a fan of client-side :-P
 
 On Friday, September 12, 2014 4:16:55 AM UTC+2, Massimo Di Pierro wrote:
 What's broken in autocomplete? Was it a preexisting condition? Another reason 
 for client-side widgets. Autocomplete is JS code.
 
 On Sep 11, 2014, at 2:35 PM, Leonel Câmara leonel...@gmail.com wrote:
 
 
 -- 
 -- mail from:GoogleGroups web2py-developers mailing list
 make speech: web2py-develop...@googlegroups.com
 unsubscribe: web2py-developers+unsubscr...@googlegroups.com
 details : http://groups.google.com/group/web2py-developers
 the project: http://code.google.com/p/web2py/
 official : http://www.web2py.com/
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-developers group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py-developers+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: [web2py-dev] Version 2.9.6 indeed breaks backward compat for some users

2014-09-11 Thread Massimo DiPierro
What's broken in autocomplete? Was it a preexisting condition? Another reason 
for client-side widgets. Autocomplete is JS code.

On Sep 11, 2014, at 2:35 PM, Leonel Câmara leonelcam...@gmail.com wrote:

 Has this been finalized yet? The autocomplete widget also needs fixing.
 
 -- 
 -- mail from:GoogleGroups web2py-developers mailing list
 make speech: web2py-develop...@googlegroups.com
 unsubscribe: web2py-developers+unsubscr...@googlegroups.com
 details : http://groups.google.com/group/web2py-developers
 the project: http://code.google.com/p/web2py/
 official : http://www.web2py.com/
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-developers group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py-developers+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] new web2py videos

2014-08-30 Thread Massimo DiPierro
Nico has helped edit and re-organize some my class lectures about web2py. They 
are now split into 30 small videos:

https://vimeo.com/album/3016728

Please join me in thanking Nico.

Massimo

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

2014-01-08 Thread Massimo DiPierro
The problem is speed. I believe the getitem should be as fast as possible. This 
was changed before so that the trasformation of the rows occurred only once and 
not every time a row column is accessed.

On Jan 8, 2014, at 8:41 AM, Anthony wrote:

 Let's discuss on the developers list.
 
 On Tuesday, January 7, 2014 9:52:16 PM UTC-5, Joe Barnhart wrote:
 Maybe the best answer is to change Row so that it always holds the full set 
 of keys (table:field) and change the __getitem__ method to look up the key 
 recursively if only one part is provided.  Here is a sample method which 
 implements this strategy of testing keys for dicts within dicts.  Our case is 
 a little simpler since we never recurse more than one level deep.
 
 def _finditem(obj, key):
 if key in obj: return obj[key]
 for k, v in obj.items():
 if isinstance(v,dict):
 item = _finditem(v, key)
 if item is not None:
 return item
 
 This has the advantage of working with existing code and preserving as much 
 information as possible in the Row object.  I have a feeling this could make 
 the internals of web2py a good deal more consistent.  Less testing for 
 special cases is always good!
 
 -- Joe B.
 
 On Tuesday, January 7, 2014 3:48:39 PM UTC-8, Anthony wrote:
 Note, same problem with .sort (it modifies the Row objects in self.records), 
 so we should probably fix that as well (will be a bit more complicated).
 
 Anthony
 
 On Tuesday, January 7, 2014 11:03:56 AM UTC-5, Anthony wrote:
 The Rows.find() method does the following:
 
 for row in self:
 if f(row):
 if a=k: records.append(row)
 k += 1
 if k==b: break
 
 In a Rows object, there is self.records, which is a list of Row objects. Each 
 Row object has at least one top-level key with the table name, and the record 
 is stored in the value associated with that key:
 
 Row {'person': {'first_name': 'Bob', 'last_name': 'Smith'}}
 
 When .find() is called on a Rows object with compact=True, the __iter__ 
 method (called by the for row in self loop) returns a transformed version 
 of each Row object, removing the top-level table key:
 
 Row {'first_name': 'Bob', 'last_name': 'Smith'}
 
 I believe this is an unnecessary transformation, and it is what is 
 subsequently causing the .render() method to fail (the .render() method 
 expects the top-level table key to be there, whether or not compact=True). I 
 propose the following change to .find():
 
 for i, row in enumerate(self):
 if f(row):
 if a=k: records.append(self.records[i])
 k += 1
 if k==b: break
 
 The above code appends self.records[i] instead of row, which preserves the 
 original Row objects instead of including transformed objects. Anyone see any 
 problems with that change?
 
 Also, is there any reason all of the Rows methods (i.e., find, exclude, 
 __and__, __or__) should not be preserving the compact attribute of the 
 original Rows object? Perhaps we should change them all to do so. (Note, this 
 is a separate issue unrelated to the above problem with .find() and 
 .render().)
 
 Anthony
 
 On Tuesday, January 7, 2014 10:47:28 AM UTC-5, Anthony wrote:
 .render() works fine on Rows objects with compact=True, and it also works 
 fine on the results of .sort(), .exclude(), , and | operations. The only 
 problem is with the results of .find() operations when the original Rows 
 object has compact=True. The problem is that the .find() method modifies the 
 Row objects in self.records when compact=True, which it probably should not 
 due.
 
 Aside from this issue, perhaps the various Rows methods should preserve the 
 compact attribute -- not sure why they don't.
 
 Forwarding to the developers list for discussion.
 
 Anthony
 
 On Tuesday, January 7, 2014 3:10:00 AM UTC-5, Joe Barnhart wrote:
 I've been experimenting with the render method of the Rows class, and I am 
 very impressed.  But one drawback I found is that the Rows object must have 
 its value set to compact=False to work properly with render().  It isn't a 
 problem if the Rows object is used directly without any operators, but I 
 discovered that many, if not most, Rows methods do not preserve the compact 
 setting.
 
 For example. if you sort the Rows, it leaves compact=True.  Ditto, if you 
 use extract or find on the Rows object.  The  and | operators also 
 set the compact variable to True.  The upshot is that you can't use any of 
 these operators on the Rows object and then use render on the resulting 
 object.
 
 It is a simple change to add the preservation of the compact flag during 
 any of these steps, but I'm unsure if this will break existing code.  Other 
 than coming up with a completely parallel set of methods, which leave compact 
 set the way it came in, I can't think of another approach will be provably 
 backwards-compatible.
 
 Here is an example:
 
 
 

[web2py] Re: [web2py-dev] Rows.compact and other Rows methods

2014-01-08 Thread Massimo DiPierro
This would be slow and confusing. What if there is a table in the join called 
first_name? What if both tables in a join have a column first_name?

On Jan 8, 2014, at 9:12 AM, Anthony wrote:

 This is an interesting idea. Instead of bothering with the compact 
 attribute, we could make it so any Row object automatically works like a 
 compact Row whenever it includes only one top-level key. So, if you have:
 
 Row {'person': {'first_name': 'Bob', 'last_name': 'Smith'}}
 
 you could do either row.person.first_name or row.first_name, regardless of 
 the value of the compact attribute. The problem, though, is what happens if 
 there is a field name that is the same as the table name. In that case, we 
 would have to make the default to return either the full sub-record 
 associated with the table, or just the field within the table, but neither 
 approach would be fully backward compatible.
 
 I suppose we could keep using the compact attribute, and simply pass it to 
 the Row object, so the Row object itself knows whether it is compact or not. 
 This would also be necessary for the Row.as_dict and related methods to 
 remain backward compatible. But then the Row object needs to be able to hold 
 a private attribute (e.g., __compact).
 
 Thoughts on this?
 
 Anthony
 
 On Wednesday, January 8, 2014 9:41:19 AM UTC-5, Anthony wrote:
 Let's discuss on the developers list.
 
 On Tuesday, January 7, 2014 9:52:16 PM UTC-5, Joe Barnhart wrote:
 Maybe the best answer is to change Row so that it always holds the full set 
 of keys (table:field) and change the __getitem__ method to look up the key 
 recursively if only one part is provided.  Here is a sample method which 
 implements this strategy of testing keys for dicts within dicts.  Our case is 
 a little simpler since we never recurse more than one level deep.
 
 def _finditem(obj, key):
 if key in obj: return obj[key]
 for k, v in obj.items():
 if isinstance(v,dict):
 item = _finditem(v, key)
 if item is not None:
 return item
 
 This has the advantage of working with existing code and preserving as much 
 information as possible in the Row object.  I have a feeling this could make 
 the internals of web2py a good deal more consistent.  Less testing for 
 special cases is always good!
 
 -- Joe B.
 
 On Tuesday, January 7, 2014 3:48:39 PM UTC-8, Anthony wrote:
 Note, same problem with .sort (it modifies the Row objects in self.records), 
 so we should probably fix that as well (will be a bit more complicated).
 
 Anthony
 
 On Tuesday, January 7, 2014 11:03:56 AM UTC-5, Anthony wrote:
 The Rows.find() method does the following:
 
 for row in self:
 if f(row):
 if a=k: records.append(row)
 k += 1
 if k==b: break
 
 In a Rows object, there is self.records, which is a list of Row objects. Each 
 Row object has at least one top-level key with the table name, and the record 
 is stored in the value associated with that key:
 
 Row {'person': {'first_name': 'Bob', 'last_name': 'Smith'}}
 
 When .find() is called on a Rows object with compact=True, the __iter__ 
 method (called by the for row in self loop) returns a transformed version 
 of each Row object, removing the top-level table key:
 
 Row {'first_name': 'Bob', 'last_name': 'Smith'}
 
 I believe this is an unnecessary transformation, and it is what is 
 subsequently causing the .render() method to fail (the .render() method 
 expects the top-level table key to be there, whether or not compact=True). I 
 propose the following change to .find():
 
 for i, row in enumerate(self):
 if f(row):
 if a=k: records.append(self.records[i])
 k += 1
 if k==b: break
 
 The above code appends self.records[i] instead of row, which preserves the 
 original Row objects instead of including transformed objects. Anyone see any 
 problems with that change?
 
 Also, is there any reason all of the Rows methods (i.e., find, exclude, 
 __and__, __or__) should not be preserving the compact attribute of the 
 original Rows object? Perhaps we should change them all to do so. (Note, this 
 is a separate issue unrelated to the above problem with .find() and 
 .render().)
 
 Anthony
 
 On Tuesday, January 7, 2014 10:47:28 AM UTC-5, Anthony wrote:
 .render() works fine on Rows objects with compact=True, and it also works 
 fine on the results of .sort(), .exclude(), , and | operations. The only 
 problem is with the results of .find() operations when the original Rows 
 object has compact=True. The problem is that the .find() method modifies the 
 Row objects in self.records when compact=True, which it probably should not 
 due.
 
 Aside from this issue, perhaps the various Rows methods should preserve the 
 compact attribute -- not sure why they don't.
 
 Forwarding to the developers list for discussion.
 
 Anthony
 
 On Tuesday, January 7, 2014 

[web2py] Happy New Year everybody!

2014-01-01 Thread Massimo DiPierro
Happy new year everybody,

some good news:
1) python is growing popularity
https://sites.google.com/site/pydatalog/pypl/python-blog/pythonisthelanguageoftheyear
2) there will be a web2py tutorial at PyCon. I will tell you more asap!
3) the web2py community is still growing and in 2013 I saw more and more high 
quality programs built with web2py.

Massimo

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


[web2py] Re: [web2py-dev] having trouble with data-xxx when they are not a simple option

2013-10-30 Thread Massimo DiPierro
yes. It is the same. You can send me a patch of a pull request.

On Oct 30, 2013, at 12:37 PM, DenesL wrote:

 
 I meant the web2py online book  or is this the same somehow?.
 
 
 On Tuesday, October 29, 2013 8:03:36 PM UTC-4, Niphlod wrote:
 free and available here  github.com/mdipierro/web2py-book
 
 On Tuesday, October 29, 2013 10:13:28 PM UTC+1, DenesL wrote:
 
 Is the book open to editors?.
 I still would like to add an example about this in there.
 
 -- 
 -- mail from:GoogleGroups web2py-developers mailing list
 make speech: web2py-develop...@googlegroups.com
 unsubscribe: web2py-developers+unsubscr...@googlegroups.com
 details : http://groups.google.com/group/web2py-developers
 the project: http://code.google.com/p/web2py/
 official : http://www.web2py.com/
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-developers group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py-developers+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

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


Re: [web2py] Why does Web2py add 'orderby' to grid queries?

2013-10-09 Thread Massimo DiPierro
Should'd grid elements be ordered to allow pagination?

On Oct 8, 2013, at 6:45 PM, Michele Comitini wrote:

 Whenever there is a big performance impact it's better not to make 
 assumptions on what is the most common use case.
 I hate to hear the web2py is slow refrain because it's false if you have a 
 good knowledge of web2py.  What concerns me is that doing hidden things that 
 impact on performance scares the newcomer and the casual tester.
 
 ---
 Suppose I am new to web2py, but not a newbie to programming and python.  I 
 have a big database and I want to publish things out of it with a nice 
 framework.  I know that accessing the db is critical.  I heard web2py is easy 
 to use.
 
 I do a simple test.  I want to know if there are more than one record of the 
 kind I am looking for:
 
 len(db(db.long_table.value=='Am I the only one 
 here?').select(db.long_table.id, limitby(0,2)))
 
 I expect it faster than count() on a really big table.  Result slow as hell.  
 Consequence is ... ok I will use a better framework and I will post somewhere 
 that web2py is nice, but slow, not for serious projects.
 ---
 
 Even worse in older releases doing a db.long_table(value='Am I the only one 
 here?') was slow, very slow and those shortcuts in web2py code are used 
 everywhere.  To the casual user it was the clear sign that no one did serious 
 testing on a large database.
 
 mic
 
 
 
 2013/10/8 Niphlod niph...@gmail.com
 the smartest thing to do would be to avoid orderby when there are less 
 records than paginate.
 However, it's unusual to have a query misbehaving for a couple hundreds 
 records, and I really don't see the point on using grid with paginate=1.
 Given that pagination is 99% of the time required, we need to orderby on 
 something
 What we should orderby to then? The only assured field that has an implicit 
 index is the id (being a PK). Orderby(ing) a PK should definitely not require 
 a full scan.
 I don't see any particular case other than exceptional misbehaving tables to 
 turn off the ordering.
 
 
 On Tuesday, October 8, 2013 1:53:50 PM UTC+2, Anthony wrote:
 
 db.table(id=3) is for returning the sole matching record, so you don't have 
 to worry about the database's arbitrary ordering of results. But when using 
 limitby to return a particular subset of records (e.g., when doing 
 pagination), don't you need to specify an orderby to guarantee that the 
 results on each query will remain in the same order?
 
 Yes you need to do it, and you need to do it in a proper way.  That is why i 
 think that forcing orderby when limitby is used is not a good idea.  Seems 
 just a hack for the grid, not a generic approach.  IMHO it's better to be 
 explicit.
 Consider that on datasets of size comparable to the window imposed by the 
 limitby, the result is that if one uses limitby then he goes slower than 
 without it, because of the implicit orderby. Maybe he wonders why (and all 
 sorts of bad things about web2py ;- )
 
 I suppose we could default orderby_on_limitby to False in the general case 
 and leave it to the developer to explicitly orderby when using limitby, but 
 what do you propose for the grid?
 
 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/groups/opt_out.
 

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


[web2py] web2py 2.7.1 is OUT

2013-10-04 Thread Massimo DiPierro
Changelog

- jQuery 1.10.2
- codemirror 3.18, thanks Paolo
- namespaces in T(Welcome, ns=namespace), thanks jamarcer (experimental)
- more Auth options, thanks Charles
- more admin configuration, thanks Roberto
- new gluon.contrib.strip.StripeForm for PCI compliant payments
- webclient can hendle lists, thanks Yair
- allows SQLFORM.grid(...,ignore_common_filters=True)
- more translations, thanks Vladyslav
- better session2trash.py, works with scheduler, thanks niphlod
- fixed problem with ENABLED/DISABLED
- many bug fixes, thanks Simone, Michele, Anthony, Paolo, Roberto, Tim, and 
many others

Warm thank you to all those who contributed.

Massimo

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


Re: [web2py] Re: Some forms need to be submitted multiple times.

2013-09-22 Thread Massimo DiPierro
Please open a ticket. I have an idea about what to do.

On Sep 22, 2013, at 12:31 PM, szimszon wrote:

 Hi!
 
 I have some apps where I usually do multiple things simultaneously or I have 
 to look at some page for information (page with form too) and copypast to 
 the first. But I have to reload the first page because the single form key. 
 It can be really annoying :( So if it could be change I'm for the change. :-)
 
 2013. szeptember 22., vasárnap 18:16:57 UTC+2 időpontban Christian Foster 
 Howes a következőt írta:
 and i don't mind the design at alli can't think of a good reason 
 that a real user would be in this situation.  i tend to break things 
 when testing or doing rote admin tasks (with my admin forms not web2py 
 admin) 
 
 cfh 
 
 
 On 9/22/13 9:11 , Massimo Di Pierro wrote: 
  That is by design. Perhaps we should change it. The problem is how not to 
  pollute the session with un-used keys. 
  
  On Sunday, 22 September 2013 10:53:26 UTC-5, Christian Foster Howes wrote: 
  
  i have noticed that if in the same browser i open the same page with the 
  same form in multiple tabs my stored session data only stores 1 form key, 
  so the most recently loaded tab will submit the form fine, the others will 
  be denied until i reload the page.  any chance you have form key 
  duplication?  or are losing the form key somehow? 
  
  On Saturday, September 21, 2013 7:16:17 AM UTC-7, Ian W. Scott wrote: 
  
  Thanks Niphlod. I submit the form and get back the same form, empty. It's 
  as if the submitted data is just dumped and the page reloads as if 
  nothing 
  had been sent. 
  
  I'll try the replacement you suggest and get back to you. 
  
  Ian 
  
  On Friday, September 20, 2013 5:12:35 PM UTC-4, Niphlod wrote: 
  
  I can't replicate it  but 1st thing to debug: remove that requires 
  and replace with a requires=IS_IN_SET(('America/Toronto')) ... 
  
  BTW: submitting 2 or 3 times what means exactly? that you put email 
  and password and you hit submit and you get back an error, the same 
  login 
  form, the login form empty,  (fill the blanks :-P) ? 
  
  On Friday, September 20, 2013 10:26:39 PM UTC+2, Ian W. Scott wrote: 
  
  Sorry for the slow response. I'm experiencing this with 2.6.3 but have 
  also had the problem with the last couple of versions. It has been the 
  kind 
  of thing that I keep putting off debugging because I'm not sure where 
  to 
  start. 
  
  Could it have to do with the way I'm extending the auth_user table? In 
  my db.py I have 
  
  auth = Auth(db, hmac_key=Auth.get_or_create_key())  # 
  authent/authorization 
  
  #adding custom field for user time zone 
  auth.settings.extra_fields['auth_user'] = [ 
   Field('time_zone', 
 'string', 
 default='America/Toronto', 
 requires=IS_IN_SET((common_timezones)), 
 widget=SQLFORM.widgets.options.widget 
 ) 
  ] 
  
  Although I'm able to use the data from that field without any trouble. 
  
  Ian 
  
  On Wednesday, September 18, 2013 12:41:19 PM UTC-4, Massimo Di Pierro 
  wrote: 
  
  Which version? 
  
  On Wednesday, 18 September 2013 10:15:46 UTC-5, Ian W. Scott wrote: 
  
  I'm experiencing an odd problem where some of my forms (including 
  registration and login forms) need to be submitted 2 or 3 times 
  before they 
  are processed. It's been hard to solve because it doesn't seem 
  entirely 
  consistent. Has anyone run into this, and does anyone have any idea 
  what 
  the cause would be? 
  
  Thanks, 
  
  Ian 
  
  
  

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


[web2py] http links in https wiki pages

2013-09-18 Thread Massimo DiPierro
This problem come up at the office today. I am posting a solution here since it 
may come up in the future.

If you have a wiki (web2py wiki or not) which runs under https and contains 
links to http pages, modern browsers will block those links for security 
reasons.
To prevent the blocking, you can inject this code at the bottom of layout.html:

scriptwindow.jQuery || document.write('script 
src=//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\x3C/script');/script
script 
jQuery('a[href^=http://;]').on('click',function(){jQuery(this).attr('target','_blank');});/script

It includes the jQuery library (if not alredyd installed) then hooks to the 
click events of every a tag when the href starts with http://. Before 
processing the click event it alters the tag by adding a  
target=_blank. this forces the link to open in a new window and it should 
by-pass the block.

Massimo

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


[web2py] London Meetup

2013-07-13 Thread Massimo DiPierro
Is there anybody in London willing to give a talk on web2py at a Python meetup?

Massimo

-- 

--- 
You received this message because you are 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/groups/opt_out.




[web2py] web2py EuroPython 2013 Talk

2013-07-06 Thread Massimo DiPierro
Thanks to the EuroPython organizers. It was an excellent conference. I attended 
at the last moment and I had the opportunity to give a talk in the open space. 
Here it is:

http://www.youtube.com/watch?v=LsLgZUGM3kg

-- 

--- 
You received this message because you are 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/groups/opt_out.




[web2py] IMPORTANT: web2py 2.6.0-development

2013-06-26 Thread Massimo DiPierro
There is a major change upcoming in web2py 2.6 (which can be tested in trunk).

The change involves a better rewrite of web2py.js agreed upon the developers 
and implemented by Niphlod.

Because of this change  applications which use components will break unless you 
upgrade the old web2py.js with the new one.

Anyway, try the latest trunk, check it out, and send us comments.

Massimo 
  

-- 

--- 
You received this message because you are 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/groups/opt_out.




[web2py] Real Python Coding Challenge Today!

2013-06-22 Thread Massimo DiPierro
You may be interested in this event:

http://www.eventbrite.com/event/7191029563

Real Python: Coding Challenge
Saturday, June 22, 2013 from 10:00 AM to 11:00 AM (PDT)

Michael Herman (http://www.linkedin.com/profile/view?id=143023108) is the 
author on the Real Python for Web development which covers web2py.

http://www.kickstarter.com/projects/1369857650/real-python-for-web-development-featuring-web2py




-- 

--- 
You received this message because you are 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/groups/opt_out.




Re: [web2py] upgrading appengine has broken web2py

2013-06-18 Thread Massimo DiPierro
I did see two problems addressed in a commit today.

gql imports drivers from dal.py but drivers was renamed DRIVERS. If people did 
not notice this it means they are not importing gql. This is great. It means 
this backward compatibility file can be removed. So I just did.

The second issue is that gae_memcache has an increment method instead of incr, 
as expected by memdb. This is now fixed too.

Please submit any patch you may have, even if partial.

massimo

On Jun 18, 2013, at 8:20 AM, Christian Foster Howes wrote:

 Carl,
 
 i have been working through my web2py upgrade to 2.5.1 + GAE SDK 1.8.1 
 upgrade and am not seeing any problems with DAL or GQL.  i did have to change 
 some cache.ram.flush_all() to cache.ram.clear() to work with the latest 
 web2py, and am making adjustments to work with the updated custom_import code.
 
 cfh
 
 On 6/18/13 1:57 , Massimo Di Pierro wrote:
 None except that some very old web2py GAE applications may be doing import
 gql. It is there only for backward compatibility.
 
 On Tuesday, 18 June 2013 03:21:00 UTC-5, Carl wrote:
 
 hi Massimo,
 
 What would be the implications of removing the gql modulefrom Web2py?
 
 
 
 
 On 12 April 2013 16:17, Massimo Di Pierro 
 massimo@gmail.comjavascript:
 wrote:
 
 I proposed in web2py 2.5 we remove the gql module.
 
 
 On Friday, 12 April 2013 05:21:10 UTC-5, Carl wrote:
 
 Removing the line from gluon.contrib.gql import * removed the error
 and allows my app to launch.
 
 I next run into this error:
   File F:\wp\TestEnvoy\web2py\gluon\**main.py, line 555, in wsgibase
 session._try_store_in_db(**request, response)
   File F:\wp\TestEnvoy\web2py\gluon\**globals.py, line 747, in
 _try_store_in_db
 record_id = table.insert(**dd)
   File F:\wp\TestEnvoy\web2py\gluon\**contrib\memdb.py, line 256, in
 insert
 id = self._create_id()
   File F:\wp\TestEnvoy\web2py\gluon\**contrib\memdb.py, line 291, in
 _create_id
 id = self._tableobj.incr(shard_id)
 AttributeError: 'MemcacheClient' object has no attribute 'incr'
 
 One for me to investigate.
 
 
 
 On Friday, 12 April 2013 11:06:38 UTC+1, Carl wrote:
 
 has my db.py content fallen out of date?
 
 it includes:
 from gluon.sql import SQLCustomType
 
 if request.env.web2py_runtime_**gae: # if running on Google App Engine
 from gluon.contrib.gql import *
 db = DAL('gae')
 
 
 On Friday, 12 April 2013 11:00:09 UTC+1, Carl wrote:
 
 actually.. while getting an unknown ticket if I request the url a
 second time I get this:
 
   File F:\wp\TestEnvoy\web2py\**applications\init\models\db.**py,
 line 13, in module
 from gluon.contrib.gql import *
   File F:\wp\TestEnvoy\web2py\gluon\**custom_import.py, line 100,
 in custom_importer
 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
 ImportError: No module named gql
 
 That's fairly obvious because I've just delete gql.py! :)
 
 
 On Friday, 12 April 2013 07:48:27 UTC+1, Carl wrote:
 
 If I remove the file (and its .pyc) then I get a web2py Ticket
 issued: unknown
 
 I'll try upgrading again.
 
 
 
 On Friday, 12 April 2013 02:58:27 UTC+1, Massimo Di Pierro wrote:
 
 What if you delete that file?
 
 On Thursday, 11 April 2013 12:31:15 UTC-5, Carl wrote:
 
 With an update to appengine, all is still fine when running web2py
 locally.
 but if I run dev_appserver then on start-up I get the following
 kicked out at the console...
 
  File F:\wp\TestEnvoy\web2py\gluon\**contrib\gql.py, line 5, in
 module
 from gluon.dal import DAL, Field, Table, Query, Set,
 Expression, Row, Rows, *drivers*, BaseAdapter, SQLField, SQLTable,
 SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, 
 SQLALL,
 SQLCustomType, gae
 ImportError: cannot import name *drivers*
 *
 *
 \contrib\gql.py exists for backward compatibility.
 
 This looks like I've tripped up somewhere really simple. Can anyone
 point me in the right direction?
 
  --
 
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/0XH6l1394mA/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
 
 
 

-- 

--- 
You received this message because you are 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/groups/opt_out.




[web2py] EuroPython

2013-06-07 Thread Massimo DiPierro
Anybody here going to EuroPython?
I may be able to make it for a day or two and if other people are going we can 
organize an Open Space meeting.

-- 

--- 
You received this message because you are 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/groups/opt_out.




[web2py] bootstrap interface builder

2013-04-17 Thread Massimo DiPierro
http://www.layoutit.com/

-- 

--- 
You received this message because you are 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/groups/opt_out.




[web2py] Re: 'list:reference', contains, Mysql, instr

2013-01-21 Thread Massimo DiPierro
Now I understand the problem. You want to pass an expression where a value is 
expected. I do not believe we can support this. INSTR does not solve the 
problem because it would not be correct to looks for substrings. In fact 
paper.authors may contain '|12|13|' and it would incorrectly return that author 
'2' is one of authors because it is a substring.

You have to do it in two steps:

person = db(db.person.name='').select().first()
papers = db.paper.authors.contains(person.id).select()

Massimo


On Jan 21, 2013, at 3:33 PM, pablo.ang...@uam.es wrote:

 
 
 El lunes, 21 de enero de 2013 18:56:07 UTC+1, Massimo Di Pierro escribió:
 Before we attempt to fix this. It works for me as it is with sqlite. Why does 
 doesn't it wirk with mysql? MySQL has a LIKE operator. Wat error do you get?
 
 execution of:
 
 db(db.paper.authors.contains(person.id))._select()
 
 gives:
 
 SELECT  person.id, paper.id, paper.title, paper.authors FROM person, paper 
 WHERE (paper.authors LIKE '%|person.id|%');
  
 which I think tries to find those papers whose authors field contains the 
 literal person.id, instead of the pairs (paper,person) such that the person 
 is one of the authors of the paper.
 
 With the modification I wrote before, it gets converted into:
 
 'SELECT  person.id, paper.id, paper.title, paper.authors FROM person, paper 
 WHERE INSTR(paper.authors, person.id);'
 
 with a different meaning.
 
 I can see why using the INSTR operator on MySQL may be better but do we know 
 it is faster?
 
 I haven't made any speed test, I'd go for anything that works in sqlite and 
 mysql/mariadb.
 
 Thanks for your attention!
  
 
 Massimo
 
 On Monday, 21 January 2013 08:55:40 UTC-6, pablo@uam.es wrote:
   Hello:
   I was getting incorrect SQL from statements like:
 
 db(db.paper.authors.contains(person.id)).select()
 
 where
 
 db.define_table('paper',
 Field('title'),
 Field('authors', 'list:reference person'),
 )
 
 
   so I rewrote dal.MySQLAdapter.CONTAINS from:
 
 def CONTAINS(self, first, second):
 if first.type in ('string', 'text'):
 key = '%'+str(second).replace('%','%%')+'%'
 elif first.type.startswith('list:'):
 key = '%|'+str(second).replace('|','||').replace('%','%%')+'|%'
 return '(%s LIKE %s)' % (self.expand(first),self.expand(key,'string'))
 
 into:
 
 def CONTAINS(self, first, second):
 if first.type in ('string', 'text'):
 key = '%'+str(second).replace('%','%%')+'%'
 elif first.type.startswith('list:reference'):
 return 'INSTR(%s, %s)'%(first, str(second))
 elif first.type.startswith('list:'):
 key = '%|'+str(second).replace('|','||').replace('%','%%')+'|%'
 return '(%s LIKE %s)' % (self.expand(first),self.expand(key,'string'))
 
 now the above query works, but that's in MySQL, not SQLite, which apparently 
 does not have  a INSTR operation, despite the fact that it is advertised!
 
 https://www.sqlite.org/lang_corefunc.html
 
 Can anybody think of a solution that works in more databases

-- 





[web2py] web2py winservice

2012-12-05 Thread Massimo DiPierro
I just closed this ticket but could not test it:
http://code.google.com/p/web2py/issues/detail?can=2start=0num=100q=colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summarygroupby=sort=id=265

Can some someboby help me check winservice is not broken in trunk?

-- 





[web2py] web2py book in Chinese

2012-12-05 Thread Massimo DiPierro
Thanks to Ming Huang we now have the web2py book in Chinese in PDF:

https://dl.dropbox.com/u/18065445/web2py/web2py_manual_chinese_3rd.1.pdf

If you can help convert it to Markmin and ok generating a better PDF from the 
ODT, please let me know.

Massimo

-- 





Re: [web2py] GAE - SQL cloud connection

2012-11-16 Thread Massimo DiPierro

On Nov 16, 2012, at 5:17 AM, rif wrote:

 Done (http://code.google.com/p/web2py/issues/detail?id=1172)
 
 Are the migrations issues to GoogleSQL still present?

I am not aware of any issue. Can you point me to some something about this?

 
 -rif
 
 vineri, 16 noiembrie 2012, 12:57:14 UTC+2, Massimo Di Pierro a scris:
 Please open a ticket and we will fix this asap.
 
 On Friday, 16 November 2012 04:49:35 UTC-6, rif wrote:
 I created today a sql cloud database. And I got the same error.
 
 I changed to path VARCHAR(255) and now it works. Anybody else having the same 
 problem?
 
 -rif
 
 marți, 7 august 2012, 18:27:13 UTC+3, Massimo Di Pierro a scris:
 Why does 512 result in Specified key was too long; max key length is 767 
 bytes. Is one counting unicode and one bytes? If setting this length to 128 
 is the only option, I will change it but I am afraid it may be too short to 
 store .table files. Did you encounter any problem after this change?
 
 On Friday, 6 January 2012 18:43:22 UTC-6, howesc wrote:
 i don't know if i'm gonna regret this later, but in dal.py i changed that 
 field length to 128:
 
 self.db.executesql(CREATE TABLE IF NOT EXISTS web2py_filesystem 
 (path VARCHAR(128), content LONGTEXT, PRIMARY KEY(path) ) ENGINE=InnoDB;)
 
 now it works again.
 
 -- 
  
  
  

-- 





[web2py] GAE users… help

2012-10-01 Thread Massimo DiPierro
What about this ticket?
http://code.google.com/p/web2py/issues/detail?can=2start=0num=100q=colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary%20Modifiedgroupby=sort=-modifiedid=990

Massimo

-- 





[web2py] new google trands

2012-09-29 Thread Massimo DiPierro
Looks like Google has improved google Trands:

http://www.google.com/trends/explore#q=web2py

At least now seems to provide significative results for web2py. Not sure how 
reliable but we actually see a trend.

-- 





[web2py] Re: [web2py-dev] on Redis Rows turns in to list() ?

2012-09-13 Thread Massimo DiPierro
I am not sure. Please open a ticket do it gets tracked.

On Sep 13, 2012, at 9:03 AM, Bruno Rocha wrote:

 I noted that this happens with memcached too.
 
 type 'exceptions.AttributeError' 'list' object has no attribute 'find'
 
 My cached .select(cache=(cache.memcache, 1200)) is retrived as a list.
 
 Function argument list
 (menus=[Row {'show_order': 0, 'parent': 1, 'title': 'Co...2, 6, 3, 18, 20, 
 21), 'modified_by': 1, 'id': 2}, Row {'show_order': 0, 'parent': 1, 
 'title': 'Co...2, 6, 3, 18, 20, 41), 'modified_by': 1, 'id': 3}, Row 
 {'show_order': 0, 'parent': None, 'title': ...2, 6, 4, 19, 48, 10), 
 'modified_by': 1, 'id': 1}, Row {'show_order': 0, 'parent': 1, 'title': 
 'Pa...12, 6, 8, 6, 50, 55), 'modified_by': 1, 'id': 4}, Row {'show_order': 
 0, 'parent': 1, 'title': 'Ne...12, 6, 8, 6, 51, 25), 'modified_by': 1, 'id': 
 5}], visibility=1, parent=None, place='top')
 
 Code listing
 
 
 148.
 149.
 150.
 151.
 152.
 153.
 
 154.
 155.
 156.
 157.
 
 
 def get_menu(menus, visibility=1, parent=None, place=top):
 
 
 ret = []
 if not parent:
 
 
 ret = menus.find(lambda row: (row.parent == 0 or row.parent == None) 
 and row.visibility == visibility and row.place == place)
 
 
 
 else:
 ret = menus.find(lambda row: row.parent == parent and row.visibility 
 == visibility and row.place == place)
 
 
 return ret
 
 
 and I cannot use .find or other methods, this does not happens when using 
 internal cache.ram.
 
 Is that the expected behavior?
 
 
 
 -- 
 -- mail from:GoogleGroups web2py-developers mailing list
 make speech: web2py-develop...@googlegroups.com
 unsubscribe: web2py-developers+unsubscr...@googlegroups.com
 details : http://groups.google.com/group/web2py-developers
 the project: http://code.google.com/p/web2py/
 official : http://www.web2py.com/
  
  

-- 





[web2py] Re: [web2py-dev] on Redis Rows turns in to list() ?

2012-09-13 Thread Massimo DiPierro
try pickle and unpickle this:
rows = db(db.tests.id0).select(cache=(cache.disk, 200), cacheable=True)

perhaps something is failing there?


On Sep 13, 2012, at 2:14 PM, Niphlod wrote:

 uhm. web2py 2.0.8 ... this works
 
 rows = db(db.tests.id0).select(cache=(cache.disk, 200))
 rows = db(db.tests.id0).select(cache=(cache.disk, 200))
 print rows.find(lambda row: row.id == 1)
 
 this don't
 
 rows = db(db.tests.id0).select(cache=(cache.disk, 200), cacheable=True)
 rows = db(db.tests.id0).select(cache=(cache.disk, 200), cacheable=True)
 print rows.find(lambda row: row.id == 1)
 
 the same exact thing is happening using cache.redis (cacheable=True doesn't 
 work, the other works)
 
 -- 
 -- mail from:GoogleGroups web2py-developers mailing list
 make speech: web2py-develop...@googlegroups.com
 unsubscribe: web2py-developers+unsubscr...@googlegroups.com
 details : http://groups.google.com/group/web2py-developers
 the project: http://code.google.com/p/web2py/
 official : http://www.web2py.com/
  
  

-- 





[web2py] Re: [web2py-dev] on Redis Rows turns in to list() ?

2012-09-13 Thread Massimo DiPierro
Rows object, that cached (pickled) returns a list, but it's not transformed 
back to a full Rows object. this is because of legacy pickling code. We can 
fix it.

On Sep 13, 2012, at 2:44 PM, Niphlod wrote:

 doh. found!
 maybe it's better to put it in the book.
 
 cacheable makes the select return a stripped Rows object. When you use 
 cache, if cacheable is False, you store the list of the results, that are 
 turned into a Rows object filling a new empty copy.
 So, cacheable=False cached results are then transformed to a full Rows object 
 (find() works) ... cacheable=False returns a Rows object, that cached 
 (pickled) returns a list, but it's not transformed back to a full Rows 
 object.
 
 On Thursday, September 13, 2012 9:33:27 PM UTC+2, Niphlod wrote:
 no errors but both (cacheable and not cacheable) are gluon.dal.Rows before 
 pickling and list after pickle.dumps()
 
 On Thursday, September 13, 2012 9:18:59 PM UTC+2, Massimo Di Pierro wrote:
 try pickle and unpickle this:
 rows = db(db.tests.id0).select(cache=(cache.disk, 200), cacheable=True)
 
 perhaps something is failing there?
 
 
 On Sep 13, 2012, at 2:14 PM, Niphlod wrote:
 
 uhm. web2py 2.0.8 ... this works
 
 rows = db(db.tests.id0).select(cache=(cache.disk, 200))
 rows = db(db.tests.id0).select(cache=(cache.disk, 200))
 print rows.find(lambda row: row.id == 1)
 
 this don't
 
 rows = db(db.tests.id0).select(cache=(cache.disk, 200), cacheable=True)
 rows = db(db.tests.id0).select(cache=(cache.disk, 200), cacheable=True)
 print rows.find(lambda row: row.id == 1)
 
 the same exact thing is happening using cache.redis (cacheable=True doesn't 
 work, the other works)
 
 -- 
 -- mail from:GoogleGroups web2py-developers mailing list
 make speech: web2py-d...@googlegroups.com
 unsubscribe: web2py-develop...@googlegroups.com
 details : http://groups.google.com/group/web2py-developers
 the project: http://code.google.com/p/web2py/
 official : http://www.web2py.com/
  
  
 
 
 -- 
 -- mail from:GoogleGroups web2py-developers mailing list
 make speech: web2py-develop...@googlegroups.com
 unsubscribe: web2py-developers+unsubscr...@googlegroups.com
 details : http://groups.google.com/group/web2py-developers
 the project: http://code.google.com/p/web2py/
 official : http://www.web2py.com/
  
  

-- 





[web2py] short term roadmap

2012-09-08 Thread Massimo DiPierro
I have been speaking with some friends and heavy web2py users and we agree that 
the following issue need to be addressed:

1) Improve Mercurial and Git support. Currently Git+web2py allows clone and 
push whirl Hg+web2py allows commit, status and revert. I think we need 
an abstraction layer that allows clone, push, commit, status, revert, 
and pull with both the version control system (with a preference for Git). I 
think we need an abstraction layer on top of both VCS even if for now we may 
support only one of them.

2) Handle gthub callback so that a push to github triggers a local web2py pull 
(for testing)

3) make it easier to run tests and manage databases (rename, backup, etc) at 
the click of a button.

4) Bootstrap looks great but it is not consistent throughout the welcome app. 
The idea is that this should be edited in web2py.css instead of any python code 
to allow backwards compatibility. Also we should avoid changing bootstrap.css 
so that we can just drop-in new versions of bootstrap, and or bootswatches. So 
we need someone with good CSS skills. It shouldn't be too much extra work to 
make it look great out of the box.

5) Port admin on top of bootstrap (while preserving the artwork).


If you want to work on any of these topics, there may be funding available. I 
think 1) should be a priority for web2py 2.1 or 2.2.



P.S. Friends have suggested looking to the following links:

Here are some issues and examples of what is possible from
wrapbootstrap.com templates:
1. Web2py forms: they are using no styling webkit (see
registration/login/password reset). (Example:
http://wbpreview.com/previews/WB00U99JJ/login.html
2. Navbar has login/logout/password which seems to be styled
differently that the other menu items. (Nice dropdown example:
http://wbpreview.com/previews/WB0087188/account.html)
3. Form Validation: would be nice to use bootstrap form validation
perhaps with popovers overriding of the the redflash for incomplete
forms.  (Example:
http://wbpreview.com/previews/WB0F35928/form-validation.html )
4. Notifications: Use Bootstrap notifications for flash, overriding
the web2py growl notifications. (Lot's of options here:
http://wbpreview.com/previews/WB0881879/noty.html)



-- 





Re: [web2py] Re: DB Migration (sqlite-pgsql) Problems with 1.99.7 - 2.0.6 - 2.0.7 Versions

2012-09-06 Thread Massimo DiPierro
So, what is wrong with those SQL? I think web2py is generating the correct 
ones. What am I missing?

On Sep 6, 2012, at 8:40 AM, Christian Espinoza wrote:

 Massimo,
 
 SELECT  auth_user.id, auth_user.username, auth_user.first_name, 
 auth_user.last_name,\
 auth_user.sede_id, auth_user.email, auth_user.estado, auth_user.password, 
 auth_user.created_on, auth_user.modified_on, auth_user.registration_key,\
 auth_user.reset_password_key, auth_user.registration_id FROM auth_user WHERE 
 (auth_user.id  0) ORDER BY auth_user.id LIMIT 1 OFFSET 0;
 
 INSERT INTO 
 auth_user(username,first_name,last_name,registration_key,reset_password_key,registration_id,modified_on,created_on,sede_id,password,estado,email)\
 VALUES ('-1','admin','admin','','','','2012-09-06 
 10:36:50','2012-09-06 10:36:50',1,'admin','activo','ad...@live.com');
 
 Thanks in advance
 Christian.
 
 2012/9/6 Massimo Di Pierro massimo.dipie...@gmail.com
 Can you add a 
 print command
 after
 command = a[0]
 I want to know what is the invalid command. The ticket only shows part if it.
 
 On Wednesday, 5 September 2012 17:27:49 UTC-5, Christian Espinoza wrote:
 Hi Massimo, this is:
 
 File /opt/web-apps/web2py/gluon/dal.py in log_execute at line 1653
 
 Code listing
 1648.
 1649.
 1650.
 1651.
 1652.
 1653.
 
 1654.
 1655.
 1656.
 1657.
 command = a[0]
 
 
 if self.db._debug:
 
 
 logger.debug('SQL: %s' % command)
 
 
 self.db._lastsql = command
 
 
 t0 = time.time()
 
 
 ret = self.cursor.execute(*a, **b)
 
 
 
 self.db._timings.append((command,time.time()-t0))
 
 
 del self.db._timings[:-TIMINGSSIZE]
 
 
 return ret
 Variables
 a ('SELECT auth_user.id, auth_user.username, auth_u...r.id  0) ORDER BY 
 auth_user.id LIMIT 1 OFFSET 0;',)
 b  {}
 self   gluon.dal.PostgreSQLAdapter object
 ret   undefined
 self.cursor   gluon.contrib.pg8000.dbapi.CursorWrapper object
 self.cursor.execute   bound method CursorWrapper._fn of 
 gluon.contrib.pg8000.dbapi.CursorWrapper object
 
 2012/9/5 Massimo Di Pierro massimo@gmail.com
 Did you install psycopg2? If not it is probably using pg8000. Can you please 
 help us debug? Edit dal.py and in the function log_excecute can you print the 
 value of the command variable? What does it print when it fails?
 
 On Wednesday, 5 September 2012 11:29:42 UTC-5, Christian Espinoza wrote:
 Hello, I'm in trouble with a webapp that I'have.
 
 I develop it using sqlite only for a best approach of web2py features with it.
 
 And I'm trying to migrate it to a Postgresql DB to put it on Testing phase.
 
 But It doesn't work with PostgreSQL, only work with sqlite, I'd tried with  
 1.99.7 - 2.0.6 -  2.0.7 Versions
 
 At 2.0.7 and 2.0.6 showme: type 'exceptions.ValueError' invalid literal for 
 int() with base 10: 'SELECT'
 
 At 
 
 
 
 Traceback (most recent call last):
 
 
   File /opt/web-apps/web2py/gluon/restricted.py, line 209, in restricted
 
 
 exec ccode in environment
 
 
   File /opt/web-apps/web2py-2.0.7/applications/sadma/models/db.py, line 
 236, in module
 
 
 if db(db.auth_user).isempty():
 
 
   File /opt/web-apps/web2py/gluon/dal.py, line 8722, in isempty
 
 
 return not self.select(limitby=(0,1))
 
 
   File /opt/web-apps/web2py/gluon/dal.py, line 8743, in select
 
 
 return adapter.select(self.query,fields,attributes)
 
 
   File /opt/web-apps/web2py/gluon/dal.py, line 1583, in select
 
 
 return self._select_aux(sql,fields,attributes)
 
 
   File /opt/web-apps/web2py/gluon/dal.py, line 1556, in _select_aux
 
 
 self.execute(sql)
 My Connection string:
 #db = DAL('sqlite://storage.sqlite')
 db = DAL('postgres://user:pass@localhost/dbapp')
 Running on Centos 6.0, external Postgresql Server with 9 version, Python 2.6.6
 
 Thanks in advance
 Christian.
 
 -- 
  
  
  
 
 
 -- 
  
  
  
 

-- 





Re: [web2py] Re: DB Migration (sqlite-pgsql) Problems with 1.99.7 - 2.0.6 - 2.0.7 Versions

2012-09-06 Thread Massimo DiPierro
Again… what is wrong with the generated SQL? I do not know how to fix it if I 
do not understand why postgres is complaining.

Massimo

On Sep 6, 2012, at 9:09 AM, Christian Espinoza wrote:

 The last one was with psycopg2, this is the last value of command using  
 pg8000:
 
 SELECT  auth_group.id, auth_group.role, auth_group.description FROM 
 auth_group WHERE (auth_group.id  0) ORDER BY auth_group.id LIMIT 1 OFFSET 0;
 
 The failure appears when I try to init some values in a empty postgresql 
 database, with a empty sqlite db all works fine...
 Im using if db(db.auth_group).isempty():
 To check if is empty to insert the firsts values...
 
 Christian.
 
 2012/9/6 Christian Espinoza chespin...@gmail.com
 Massimo,
 
 SELECT  auth_user.id, auth_user.username, auth_user.first_name, 
 auth_user.last_name,\
 auth_user.sede_id, auth_user.email, auth_user.estado, auth_user.password, 
 auth_user.created_on, auth_user.modified_on, auth_user.registration_key,\
 auth_user.reset_password_key, auth_user.registration_id FROM auth_user WHERE 
 (auth_user.id  0) ORDER BY auth_user.id LIMIT 1 OFFSET 0;
 
 INSERT INTO 
 auth_user(username,first_name,last_name,registration_key,reset_password_key,registration_id,modified_on,created_on,sede_id,password,estado,email)\
 VALUES ('-1','admin','admin','','','','2012-09-06 
 10:36:50','2012-09-06 10:36:50',1,'admin','activo','ad...@live.com');
 
 Thanks in advance
 Christian.
 
 2012/9/6 Massimo Di Pierro massimo.dipie...@gmail.com
 Can you add a 
 print command
 after
 command = a[0]
 I want to know what is the invalid command. The ticket only shows part if it.
 
 On Wednesday, 5 September 2012 17:27:49 UTC-5, Christian Espinoza wrote:
 Hi Massimo, this is:
 
 File /opt/web-apps/web2py/gluon/dal.py in log_execute at line 1653
 
 Code listing
 1648.
 1649.
 1650.
 1651.
 1652.
 1653.
 
 1654.
 1655.
 1656.
 1657.
 command = a[0]
 
 
 
 if self.db._debug:
 
 
 
 logger.debug('SQL: %s' % command)
 
 
 
 self.db._lastsql = command
 
 
 
 t0 = time.time()
 
 
 
 ret = self.cursor.execute(*a, **b)
 
 
 
 
 self.db._timings.append((command,time.time()-t0))
 
 
 
 del self.db._timings[:-TIMINGSSIZE]
 
 
 
 return ret
 Variables
 a ('SELECT auth_user.id, auth_user.username, auth_u...r.id  0) ORDER BY 
 auth_user.id LIMIT 1 OFFSET 0;',)
 b  {}
 self   gluon.dal.PostgreSQLAdapter object
 ret   undefined
 self.cursor   gluon.contrib.pg8000.dbapi.CursorWrapper object
 self.cursor.execute   bound method CursorWrapper._fn of 
 gluon.contrib.pg8000.dbapi.CursorWrapper object
 
 2012/9/5 Massimo Di Pierro massimo@gmail.com
 Did you install psycopg2? If not it is probably using pg8000. Can you please 
 help us debug? Edit dal.py and in the function log_excecute can you print the 
 value of the command variable? What does it print when it fails?
 
 On Wednesday, 5 September 2012 11:29:42 UTC-5, Christian Espinoza wrote:
 Hello, I'm in trouble with a webapp that I'have.
 
 I develop it using sqlite only for a best approach of web2py features with it.
 
 And I'm trying to migrate it to a Postgresql DB to put it on Testing phase.
 
 But It doesn't work with PostgreSQL, only work with sqlite, I'd tried with  
 1.99.7 - 2.0.6 -  2.0.7 Versions
 
 At 2.0.7 and 2.0.6 showme: type 'exceptions.ValueError' invalid literal for 
 int() with base 10: 'SELECT'
 
 At 
 
 
 
 
 Traceback (most recent call last):
 
 
 
   File /opt/web-apps/web2py/gluon/restricted.py, line 209, in restricted
 
 
 
 exec ccode in environment
 
 
 
   File /opt/web-apps/web2py-2.0.7/applications/sadma/models/db.py, line 
 236, in module
 
 
 
 if db(db.auth_user).isempty():
 
 
 
   File /opt/web-apps/web2py/gluon/dal.py, line 8722, in isempty
 
 
 
 return not self.select(limitby=(0,1))
 
 
 
   File /opt/web-apps/web2py/gluon/dal.py, line 8743, in select
 
 
 
 return adapter.select(self.query,fields,attributes)
 
 
 
   File /opt/web-apps/web2py/gluon/dal.py, line 1583, in select
 
 
 
 return self._select_aux(sql,fields,attributes)
 
 
 
   File /opt/web-apps/web2py/gluon/dal.py, line 1556, in _select_aux
 
 
 
 self.execute(sql)
 My Connection string:
 #db = DAL('sqlite://storage.sqlite')
 db = DAL('postgres://user:pass@localhost/dbapp')
 Running on Centos 6.0, external Postgresql Server with 9 version, Python 2.6.6
 
 Thanks in advance
 Christian.
 
 -- 
  
  
  
 
 
 -- 
  
  
  
 
 

-- 





Re: [web2py] Again: how redirect without propagate the .load extension?

2012-08-08 Thread Massimo DiPierro
I agree. Please check trunk again.

On Aug 8, 2012, at 2:04 PM, Anthony wrote:

 On Wednesday, August 8, 2012 1:18:11 PM UTC-4, Massimo Di Pierro wrote:
 ok, I defaulted to type='http' as you did but I allowed a type='auto' as well.
 
 Good idea. Actually, I'm not sure we need the separate auto option -- 
 type='client' only makes sense for Ajax requests anyway, so why not just make 
 client behave like auto (i.e., when type == client, ignore the type 
 unless it's an Ajax request):
 
 from gluon import current
 if type == 'client' and current.request.ajax:
  raise HTTP(200, **{'web2py-redirect-location': location})
 
 Also, I'm re-thinking whether we should go with a type argument that can 
 take multiple values or a simple boolean (e.g., client_side=True). I was 
 originally thinking type could be extended to take an internal value, but 
 perhaps client-side and internal should be considered to be independent 
 rather than mutually exclusive (i.e., you might want a redirect to be both 
 internal, and client-side -- after the internal redirect to generate the 
 response, the redirect itself should still happen on the client in the full 
 window). In that case, we'd need a separate argument to specify internal 
 independently (i.e., internal=True, client_side=True), so the client-side 
 specification might as well just be a boolean. Thoughts?
 
 Anthony
 

-- 





[web2py] MARKMIN change of behavior

2012-08-08 Thread Massimo DiPierro
There is a manor change of behavior in MARKMIN. 

Before:

- markmin 
# title
aaa

bbb
-- end markmin 

would render as

h1titleh1paaa/pp/p

After:

the same markmin would render

h1title aaa/h1p/p

In other words now headers (#, ##, ###) can be continued to the next line and 
need an empty new line to be separated from the first paragraph.
I think the new behavior is better and previous behavior should be considered a 
bug.

Anyway. I just wanted people to know, in case there are major objections.

Massimo


-- 





Re: [web2py-dev] [web2py] Re: strange response.flash

2012-08-06 Thread Massimo DiPierro
Sorry. I misread your email.

Massimo

On Aug 4, 2012, at 10:53 AM, Anthony wrote:

 I see. I think the problem is only with response.flash within Ajax 
 components. The message is escaped on the server via urllib2.quote, and then 
 decoded in the browser via decodeURIComponent (see source code):
 
 jQuery('.flash').html(decodeURIComponent(flash)).slideDown();
 
 The problem is that if there are any ascii encodings in flash, 
 decodeURIComponent seems to expect a valid URI and throws an error otherwise, 
 which is what is happening when the unicode characters are included. A 
 previous version of web2py.js did the escaping in Javascript on the client 
 side, but with the same effect.
 
 A fix might be to use xmlescape() to do any escaping on the server side 
 (which is effectively the same as the escaping of a regular flash message), 
 and then don't do any escaping or decoding on the client side -- so the above 
 line would change to:
 
 jQuery('.flash').html(flash).slideDown();
 
 To do the server-side escaping, I think we can change line 552 in main.py 
 from:
 
 urllib2.quote(str(response.flash).replace('\n',''))
 
 to:
 
 xmlescape(response.flash).replace('\n','')
 
 (Would also have to import xmlescape from html.py.)
 
 Anthony
 
 
 -- 
 -- mail from:GoogleGroups web2py-developers mailing list
 make speech: web2py-develop...@googlegroups.com
 unsubscribe: web2py-developers+unsubscr...@googlegroups.com
 details : http://groups.google.com/group/web2py-developers
 the project: http://code.google.com/p/web2py/
 official : http://www.web2py.com/
  
  

-- 





Re: [web2py-dev] [web2py] Re: strange response.flash

2012-08-05 Thread Massimo DiPierro
I think

response.flash = A(Hello World, _href=#) 

should be allowed. It was always allowed. This is a backward compatibility 
issue. Yet I see there is a potential security issue there.
I am not sure what the exact solution should be. Perhaps automatic sanitization 
of flash messages before response?

response.flash = XML(str(response.flash), sanitize=True).xml()


On Aug 5, 2012, at 10:22 PM, Niphlod wrote:

 Would serialized HTML messages be escaped then ?
 
 What if someone uses response.flash = A(Hello World, _href=#) ?
 
 On Monday, August 6, 2012 4:50:31 AM UTC+2, Anthony wrote:
 Bump. Should we replace str() with xmlescape() so Ajax flash messages get 
 escaped, just like regular flash messages and everything else in the view?
 
 Anthony
 
 On Saturday, August 4, 2012 9:23:53 PM UTC-4, Anthony wrote:
 On Saturday, August 4, 2012 7:00:18 PM UTC-4, dbdeveloper wrote:
 I do not understand what the problem with decodeURIComponent()?
 
 When I tried trunk, I think there was a problem with the encoding of my 
 controller file (ANSI instead of UTF-8) -- in that case, I guess 
 urllib2.quote didn't yield the correct output for decodeURIComponent (same 
 problem in the earlier version, when the escaping was done on the client side 
 via the Javascript escape() function). Now it works.
 
 In any case, a remaining issue is that there's still no escaping of 
 potentially dangerous content in the flash message. Everything written to 
 HTML by web2py is typically escaped, including regular flash messages. The 
 only content that isn't getting escaped are flash messages for Ajax 
 components. To be consistent (and safe), we should probably escape those 
 messages as well (you can always put them in an XML() if you don't want them 
 escaped, as with any template content). In main.py, I replaced:
 
 urllib2.quote(str(response.flash).replace('\n',''))
 
 with:
 
 urllib2.quote(xmlescape(response.flash).replace('\n',''))
 
 With that change, the flash message still looks fine (see screenshot below).
 
 Anthony
 
 
 
 
 
 
 
 -- 
 -- mail from:GoogleGroups web2py-developers mailing list
 make speech: web2py-develop...@googlegroups.com
 unsubscribe: web2py-developers+unsubscr...@googlegroups.com
 details : http://groups.google.com/group/web2py-developers
 the project: http://code.google.com/p/web2py/
 official : http://www.web2py.com/
  
  

-- 





[web2py] Re: A blog app with no models - to include in /appliances

2012-07-16 Thread Massimo DiPierro
Can you please resend me the updated w2p file and a screenshot?

On Jul 16, 2012, at 4:31 PM, Bruno Rocha wrote:

 Hi,
 
 I just found that my example of Model Less Blog is not listed in 
 web2py.com/appliances
 
 This app can be a start point for those who want to test and improve the 
 Model less approach
 
 This is a simple blog app, all logic is under /modules and there are no model 
 files.
 
 download the w2p: 
 https://github.com/downloads/rochacbruno/web2py_model_less_app/web2py.app.modellessapp.w2p
 
 code: https://github.com/rochacbruno/web2py_model_less_app
 
 Article: 
 http://www.web2pyslices.com/slice/show/1479/model-less-apps-using-data-models-and-modules-in-web2py
 
 I really expect to have some official support/documentation and best 
 practices for this kind of solution in web2py docs.
 
 
 Bruno Cezar Rocha
 http://www.CursoDePython.com.br
 
   rochacbruno  blouweb
 Blog: Generate a thumbnail that fits in a box
 Get a signature like this. Click here.
 

-- 





Re: [web2py] how to use cache decorator within modules?

2012-07-15 Thread Massimo DiPierro
Not yet. Please open a ticket about this.

On Mar 1, 2011, at 5:05 AM, Carl Roach wrote:

 thanks Massimo.
 The ability to have cache decorators in modules would be great.
 
 On 1 March 2011 02:09, Massimo Di Pierro massimo.dipie...@gmail.com wrote:
 Jonathan and I have a plan to make this easy but it will not be in
 until 1.93 or 1.94.
 
 On Feb 28, 3:12 pm, pbreit pbreitenb...@gmail.com wrote:
  Yeah, I'm having a hard time figuring out when and how to put stuff in
  modules. And what the implications are of putting functions in /models.
 



Re: [web2py] Re: how to use cache decorator within modules?

2012-07-15 Thread Massimo DiPierro
Works fine.

You can pass and use cache. You just cannot use it to decorate functions 
because decorators run only once, when the module is imported. Unless we make 
them lazy but I have not tried it yet...

On Jul 15, 2012, at 8:52 PM, Bruno Rocha wrote:

 So what happens when I do this?
 
 
 modules/mymodule.py
 
 
 from gluon import current
 
 class MyHandler(object):
 def __init__(self, db):
 myrows = db(myquery).select(cache=(current.cache.ram, 300))
 
 
 
 
 
 
 -- Forwarded message --
 From: villas villa...@gmail.com
 Date: Sun, Jul 15, 2012 at 10:06 PM
 Subject: Re: [web2py] Re: how to use cache decorator within modules?
 To: web2py@googlegroups.com
 Cc: Massimo Di Pierro massimo.dipie...@gmail.com
 
 
 Can we use cache decorators in modules now? 
 If not,  can I use cache in any way (inside a module)?
 
 Thanks,  D
 



[web2py] Re: [web2py-dev] Asyncronous Application Sync

2012-07-11 Thread Massimo DiPierro
There are two issue: 1) protocol for transferring data; 2) exporting and 
importing from database.

rabbitmq etc. only address 1 and you do not need any. Web2py already has a web 
server a many RPC systems you can use.
The real issue is 2. If your tables have a uuid field, db.export_to_csv_field 
and db.import_from_csv_file should do what you ask.

I am planning to improve this functionality but it would help to know if it 
works for you as it is and what problems you encounter with it.



On Jul 11, 2012, at 12:06 PM, Alfonso de la Guarda wrote:

 Hi,
 
 
 I have a web2py app in 2 places:
 - City location
 - Rainforest location
 
 The app is the same for both cases, however the city app is the main.
 
 I need to synchronize the information entered in the location of the
 jungle to the city but not bi-directionally due to low bandwidth, in
 addition should be automatic as soon as there is availability of
 connectivity (ie queue management / messaging).
 
 Has anyone had experiences like this with web2py specifically? ( I can
 surely work with rabbitmq, hornetmq, etc. but there is an approach for
 web2py?)
 
 
 Saludos,
 
 
 Alfonso de la Guarda
 Twitter: @alfonsodg
 Redes sociales: alfonsodg
   Telef. 991935157
 1024D/B23B24A4
 5469 ED92 75A3 BBDB FD6B  58A5 54A1 851D B23B 24A4
 
 -- mail from:GoogleGroups web2py-developers mailing list
 make speech: web2py-develop...@googlegroups.com
 unsubscribe: web2py-developers+unsubscr...@googlegroups.com
 details: http://groups.google.com/group/web2py-developers
 the project: http://code.google.com/p/web2py/
 official: http://www.web2py.com/



Re: [web2py] Re: Standalone DAL leaves mysql connections opened

2012-06-28 Thread Massimo DiPierro
Can I see the code?

On Jun 28, 2012, at 10:08 AM, Daniel González Zaballos wrote:

 It does not work.
 
 If I use the self.db = 0 sometimes i get this error (and connections are 
 open):
 
 mod_wsgi (pid=1419): Exception occurred processing WSGI script 
 '/home/demetrio/devel/python_virtual_2.6/web2py/applications/forge2/scripts/auth.py'.
 Traceback (most recent call last):
 File 
 /home/demetrio/devel/python_virtual_2.6/web2py/applications/forge2/scripts/auth.py,
  line 64, in check_password
 close_auth(auth)
 File 
 /home/demetrio/devel/python_virtual_2.6/web2py/applications/forge2/scripts/base_auth.py,
  line 68, in close_auth
 auth.close()
 File 
 /home/demetrio/devel/python_virtual_2.6/web2py/applications/forge2/scripts/base_auth.py,
  line 97, in close
 self.db.close()
 File /home/demetrio/devel/python_virtual_2.6/web2py/gluon/dal.py, line 
 6343, in __getattr__
  return self[key]
 File /home/demetrio/devel/python_virtual_2.6/web2py/gluon/dal.py, line 
 6337, in __getitem__
  return dict.__getitem__(self, str(key))
  KeyError: 'close'
 
 With BaseAdapter.close_all_instances('commit') its the same
 
 
 El 28/06/12 16:47, Massimo Di Pierro escribió:
 why not simply?
 
 db.commit()
 db.close()
 
 if db in an on object attribute like self.db you can do
 
 if self.db:
self.db.commit()
self.db.close()
self.db = 0
 
 you can also do:
 
 BaseAdapter.close_all_instances('commit')
 
 
 
 On Friday, 22 June 2012 11:23:47 UTC-5, demetrio wrote:
 
 Hi everyone,
 
 I have connected WebDAV and SVN auth with a wsgi script. I needed to use a 
 standalone DAL. When you do a dav petition with the navigator it makes a lot 
 of petitions. Well, the thing is that always there is a connection opened (i 
 can see them with PhpMyAdmin)
 
 if self.db: 
 self.db._adapter.close()
 
 seeing this issue: http://code.google.com/p/web2py/issues/detail?id=731
 
 I have tried a lot of the lines that i found there
 
 something like:
 
 if self.db:
 from gluon.dal import BaseAdapter
 BaseAdapter.close_all_instances(None)
 BaseAdapter.close_all_instances('commit')
 BaseAdapter.close_all_instances('rollback')
 
 something like:
 if self.db:
 from gluon.dal import thread as dal_thread
 dal_thread.instances.remove(self.db._adapter)
 self.db._adapter.close()
 
 and even something desesperated like:
 if self.db:
 from gluon.dal import thread as dal_thread
 dal_thread.instances.remove(self.db._adapter)
 self.db._adapter.close()
 self.db._adapter.close_all_instances(None)
 self.db._adapter.close_all_instances('commit')
 self.db._adapter.close_all_instances('rollback')
 
 from gluon.dal import ConnectionPool
 ConnectionPool.close_all_instances(None)
 ConnectionPool.close_all_instances('commit')
 ConnectionPool.close_all_instances('rollback')
 
 from gluon.dal import BaseAdapter
 BaseAdapter.close_all_instances(None)
 BaseAdapter.close_all_instances('commit')
 BaseAdapter.close_all_instances('rollback')
 
 But always, in the best, it leaves at least one connection opened, and i 
 don't know how to deal with it.
 
 I have using web2py 1.99.7 in both development and production environments.
 
 Any ideas? in this moment we are building a python mysql script, but we want 
 to use DAL to make it runnable on any of the web2py/DAL supported db
 
 Thanks in advance
 
 



[web2py] apologies

2012-03-13 Thread Massimo DiPierro
About the PyCon talk.

I apologize to all of you who should have been mentioned and were not. I took 
the list of contributors from web2py.com/examples/default/who and generated a 
word map from it.

If you are not listed on that page and you feel you should be, please email me. 
Any omission is an oversight, not intentional.

Massimo

[web2py] Fwd: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we had

2011-12-21 Thread Massimo DiPierro
:-)

Begin forwarded message:

 From: ja...@jacobian.org
 Subject: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we had
 Date: December 21, 2011 2:25:39 PM CST
 To: mdipie...@cs.depaul.edu
 
 Dear Massimo Di Pierro,
 
 I'm very pleased tell you that your talk has been accepted for PyCon
 2012 - congratulations! Please check that the details below are
 correct, and read through this email for your next steps.
 
Title: web2py: ideas we stole and ideas we had
URL: https://us.pycon.org/2012/schedule/presentation/112/
 
 We'll be publishing the list of accepted talks within 24 hours, so if
 you can no longer give this talk, please contact me immediately so I
 can find a replacement. If you need to make changes to your title or
 abstract, please contact me.
 
 We haven't yet completed the schedule, so we don't yet know whether
 you've been allocated a 30 or a 45 minute time slot. We'll be
 announcing the schedule shortly after the New Years, so please stay
 tuned.
 
 If you have particular scheduling requirements (if you plan to come to
 PyCon late or leave early, for example), please let me know as soon as
 possible so that I can take your requirements into account.
 
 You should register for the conference at
 https://us.pycon.org/2012/registration/ as soon as possible; early-
 bird registration ends January 10th, 2012.
 
 Unlike many conferences, PyCon doesn't give free tickets to speakers,
 nor do we cover travel expenses. We do this because PyCon is a
 grassroots, community- organized conference and our core mission is to
 keep costs low. Thus, we ask everybody who can afford to pay to do so.
 However, we recognize that buying tickets and paying for travel can
 represent a financial hardship to some, and we really want to see you
 at PyCon! So, if you can't afford a ticket and/or travel expenses,
 please apply for financial aid.
 
 More information about financial aid can be found at
 https://us.pycon.org/2012/assistance/. If you're applying, make sure
 to mention that you're an accepted speaker.  Please contact Peter
 Kropf (pkr...@gmail.com) if you've got any questions.
 
 If you need assistance with visas or immigration documents, please
 contact Rami Chowdhury (rami.chowdh...@gmail.com).
 
 If you have any other questions, comments, or feedback, please feel
 free to contact me (ja...@jacobian.org), my co-chair, Tim Lesher
 (tles...@gmail.com), or the conference chair, Jesse Noller
 (jnol...@python.org).
 
 On behalf of the PyCon staff, I want to thank you for your submission.
 We're really looking forward to seeing you at the conference: PyCon is
 an amazing conference because of our amazing speakers, and we're
 thrilled that you're one of them.
 
 See you in Santa Clara!
 
 Jacob Kaplan-Moss
 PyCon 2012 Program Committee Chair
 ja...@jacobian.org