Re: [web2py] Re: Web2py binaries

2019-04-19 Thread Nico Zanferrari
Thanks for testing, Dave, I'm happy to hear that it's working fine!

I think that the Welcome app with latest web2py versions don't look so fine
in Windows and python 3, but I cannot see any difference from running it
from sources. Let me know if I'm wrong or there are anything else.

Nico

Il giorno gio 18 apr 2019 alle ore 10:59 Dave S  ha
scritto:

>
>
> On Thursday, April 18, 2019 at 12:48:04 AM UTC-7, Dave S wrote:
>>
>>
>>
>> On Sunday, April 14, 2019 at 1:28:30 PM UTC-7, Nico Zanferrari wrote:
>>>
>>> Hi all,
>>>
>>> I've  just updated the experimental binaries for MacOs and Windows to
>>> the latest web2py version (2.18.5) on
>>> https://github.com/nicozanf/web2py-pyinstaller . They now contain
>>> python 3.7.3 64 bit. Also, the web2py sources inside the ZIP is now
>>> replaceble with newer web2py versions when needed ;-)
>>>
>>> There is only a problem with the APP version of MacOs binaries, that is
>>> not working due to this PyInstaller bug
>>> . But the MacOs
>>> command version works fine.
>>>
>>>
>>> Please, help my work by testing them!
>>>
>>>
>>> Cheers,
>>> Nico
>>>
>>>
>>
>>  I sent email per the README, but copying the group here:
>>
>> Stage 1:  installation -- pass
>> Stage 2:  Welcome App -- seems to be problems with CSS, especially in the
>> navigation bar.  Each menu shows up, but in faint blue on white, small
>> font, and the pull-downs wrap instead of item-per-line.
>> Admin App -- seems to work fine in early testing.
>> Stage 3:  Port one of my apps -- pending.
>>
>>
> One of my simpler apps is mostly working, after a hasty pounding of print
> statements ("#", rather than "(" and ")" ).  I got a ticket for a sort()
> that wasn't an attribute of the dict-like thingy I was interested in.
> That's a five minute test, but it included some SQLFORMs, and a custom
> validator.  I cheated and used my old static folder at this point.
>
> /dps
>
>
>
>
>> Chrome: Version 73.0.3683.103 (Official Build) (64-bit)
>> Windows 10 Pro build number 17763
>>
>>
>> Il giorno lun 18 mar 2019 alle ore 03:42 Massimo Di Pierro <
>>> massimo...@gmail.com> ha scritto:
>>>
 Fantastic. Will process this within the week and make it the new
 default.

 On Friday, 15 March 2019 07:55:16 UTC-7, Nico Zanferrari wrote:
>
> Hi all,
>
> I've was successful in making the experimental Mac app, too, with
> python3. Grab it from https://github.com/nicozanf/web2py-pyinstaller
> , where there are also all the instructions in order to build it by
> yourself ;-)
>
> A private feedback is appreciated.
>
> Nico
>
> Il giorno ven 15 mar 2019 alle ore 04:56 Massimo Di Pierro <
> massimo...@gmail.com> ha scritto:
>
>> The official version is currently broken.
>>
>> On Wednesday, 13 March 2019 15:53:09 UTC-7, Nico Zanferrari wrote:
>>>
>>> Hi,
>>>
>>> I've just updated the experimental Windows binary version with
>>> python 3.7.2 to web2py 2.18.4 . Also, now there is in addition the
>>> no_console binary and there is the python-ldap module included. Grab it
>>> from https://github.com/nicozanf/web2py-pyinstaller : please test
>>> it and give me a feedback.
>>>
>>> I'm still playing with the Mac version. Could someone confirm that
>>> the current official binary version is really working? After typing the
>>> password I've got the error 'module object has no attribute pbkdf2 
>>> hmac' -
>>> maybe for the python version included. According to this
>>> 
>>>  it
>>> should have at least 2.7.8 but it seems with 2.7.3.
>>>
>>> Cheers,
>>> Nico
>>>
>> --
>> 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 web...@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 web...@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 (S

[web2py] SQLFORM.smartgrid selectable return string or list

2019-04-19 Thread icodk
SQLFORM.smartgrid selectable  return string if only one checkbox was 
slected and returns a list if 2 or more was selected.
This  inconsitancy force me to check for type before processing can continue
For example, If I have a button that update selected records in the 
database call a function that do:


db(db.product.id.belongs(request.vars.id)).update(price=db.product.price+request.vars.inc_price)


However if only one line selected in the grid request.vars.id is a string and 
not a list, which cause an error

-- 
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: Web3py

2019-04-19 Thread Carlos Cesar Caballero Díaz
As almost everything in our world ORMs has advantages and disadvantages. 
The main criticism about ORMs is that they are leaky abstractions, that 
means they leaks details that it is supposed to abstract away, because 
there are times when you just need to use, for example, SQL directly or 
work with raw rows when making complex queries or improving performance 
because that is one of the ORMs disadvantages, they include an extra 
logical layer that, depending on the implementation can affect 
performance more or less.


But there are lot of people out there using ORMs and this is because 
they have advantages, compared with PyDAL, mostly when you are using big 
models, for example, compare this PyDAL model:


    def _get_somethig_plus_age(row, extra):
    return row.person.age + extra

    db.define_table('person',
    Field('name')
        Field('age', 'integer')
    Field.Method('get_somethig_plus_age', _get_somethig_plus_age)
    )

against this ORM-style model:

    class Person(Model):
    name = Field()
        age = Field('integer')

        def get_somethig_plus_age(self, extra):
            return self.age + extra

In an ORM, a model class represents a table, and when you query the DB, 
you get the class instance objects representing rows. Using this 
approach you can directly benefit from the advantages of the OOP and the 
code readability and organization improves a lot, mostly when models 
starts grow big.


Greetings.


El 19/4/19 a las 2:44 a.m., Dave S escribió:
On Thursday, April 18, 2019 at 3:48:09 PM UTC-7, Carlos Cesar 
Caballero wrote:


Hi Massimo, here is it: https://github.com/cccaballero/pydal-orm
. I
think including something like this with pydal will be a really good
improvement.

Greetings.


As someone who had some SQL training (but not proficiency) before  
using Web2Py,
and who has rarely had an issue with using the DAL (but then, I don't 
have complicated projects, either),

I could use some info on what makes an ORM great.

I know that Massimo has said in the past that it was a deliberate 
choice to do the DAL instead of an ORM

(is the DAL a DAO?),
and I see the contributors to Wikipedia have listed some concerns
along with the advantages
(client code gets to stick with working with objects ++
 high level of abstraction obscures what is happening --
 heavy reliance on ORM cited as major factor in poorly designed DBs --)

The third approach appears to be OODBMS where the store actually is 
built around objects via ODMs

rather than translating tables.  This gets into NoSQL territory, it seems.

So, educate me!

/dps

El 12/4/19 a las 4:33 p.m., Massimo Di Pierro escribió:
> Can you make it a module on pypi? Or should we include it in pydal?
>

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

For more options, visit https://groups.google.com/d/optout.


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Web3py

2019-04-19 Thread José Luis Redrejo
I think one of the reasons web2py is so productive and has an easy learn
curve is due to the fact of using DAL instead of an ORM.
I don't see any problem in using sqlalchemy with web2py if an ORM is
needed.  I would probably use it in some big projects for some of the
models.

But for the sake of the easy learning/productivity/quick development time I
would prefer to keep pydal as the default, at least for the features web2py
provides (auth, security, etc.)
Just my 20 cents.
José L.

El vie., 19 abr. 2019 a las 16:54, Carlos Cesar Caballero Díaz (<
carlos.caball...@cfg.jovenclub.cu>) escribió:

> As almost everything in our world ORMs has advantages and disadvantages.
> The main criticism about ORMs is that they are leaky abstractions, that
> means they leaks details that it is supposed to abstract away, because
> there are times when you just need to use, for example, SQL directly or
> work with raw rows when making complex queries or improving performance
> because that is one of the ORMs disadvantages, they include an extra
> logical layer that, depending on the implementation can affect performance
> more or less.
>
> But there are lot of people out there using ORMs and this is because they
> have advantages, compared with PyDAL, mostly when you are using big models,
> for example, compare this PyDAL model:
>
> def _get_somethig_plus_age(row, extra):
> return row.person.age + extra
>
> db.define_table('person',
> Field('name')
> Field('age', 'integer')
> Field.Method('get_somethig_plus_age', _get_somethig_plus_age)
> )
>
> against this ORM-style model:
>
> class Person(Model):
> name = Field()
> age = Field('integer')
>
> def get_somethig_plus_age(self, extra):
> return self.age + extra
>
> In an ORM, a model class represents a table, and when you query the DB,
> you get the class instance objects representing rows. Using this approach
> you can directly benefit from the advantages of the OOP and the code
> readability and organization improves a lot, mostly when models starts grow
> big.
>
> Greetings.
>
>
> El 19/4/19 a las 2:44 a.m., Dave S escribió:
>
> On Thursday, April 18, 2019 at 3:48:09 PM UTC-7, Carlos Cesar Caballero
> wrote:
>>
>> Hi Massimo, here is it: https://github.com/cccaballero/pydal-orm. I
>> think including something like this with pydal will be a really good
>> improvement.
>>
>> Greetings.
>>
>>
> As someone who had some SQL training (but not proficiency) before  using
> Web2Py,
> and who has rarely had an issue with using the DAL (but then, I don't have
> complicated projects, either),
> I could use some info on what makes an ORM great.
>
> I know that Massimo has said in the past that it was a deliberate choice
> to do the DAL instead of an ORM
> (is the DAL a DAO?),
> and I see the contributors to Wikipedia have listed some concerns
> along with the advantages
> (client code gets to stick with working with objects ++
>  high level of abstraction obscures what is happening --
>  heavy reliance on ORM cited as major factor in poorly designed DBs --)
>
> The third approach appears to be OODBMS where the store actually is built
> around objects via ODMs
> rather than translating tables.  This gets into NoSQL territory, it seems.
>
> So, educate me!
>
> /dps
>
> El 12/4/19 a las 4:33 p.m., Massimo Di Pierro escribió:
>> > Can you make it a module on pypi? Or should we include it in pydal?
>> >
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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: SQLFORM.smartgrid selectable return string or list

2019-04-19 Thread Anthony
It should be request.vars.records, not request.vars.id.

Note, request.vars is processed by the core framework, not by 
SQLFORM.smartgrid, so it will be a single value if the browser sends only 
one "records" field in the form data and a list otherwise. The core code 
that populates request.vars has no way of knowing that a given field 
containing a single value is supposed to be a list -- that has to be 
handled elsewhere. SQLFORM.smartgrid itself handles this properly, but if 
you are going to intercept request.vars and run some custom code outside of 
the grid, then it is up to you to do the check and convert to a list.

Keep in mind, the "selectable" argument to the grid should be a function 
that takes the list of ids -- presumably you can move your code into that 
function, in which case, you won't have to worry about this, as the grid 
will handle the conversion to a list.

Anthony

On Friday, April 19, 2019 at 9:28:21 AM UTC-4, icodk wrote:
>
> SQLFORM.smartgrid selectable  return string if only one checkbox was 
> slected and returns a list if 2 or more was selected.
> This  inconsitancy force me to check for type before processing can 
> continue
> For example, If I have a button that update selected records in the 
> database call a function that do:
>
>
> db(db.product.id.belongs(request.vars.id)).update(price=db.product.price+request.vars.inc_price)
>
>
> However if only one line selected in the grid request.vars.id is a string and 
> not a list, which cause an error
>
>

-- 
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: Web3py

2019-04-19 Thread Anthony
On Friday, April 19, 2019 at 10:54:11 AM UTC-4, Carlos Cesar Caballero 
wrote:
>
> As almost everything in our world ORMs has advantages and disadvantages. 
> The main criticism about ORMs is that they are leaky abstractions, that 
> means they leaks details that it is supposed to abstract away, because 
> there are times when you just need to use, for example, SQL directly or 
> work with raw rows when making complex queries or improving performance 
> because that is one of the ORMs disadvantages, they include an extra 
> logical layer that, depending on the implementation can affect performance 
> more or less.
>
> But there are lot of people out there using ORMs and this is because they 
> have advantages, compared with PyDAL, mostly when you are using big models, 
> for example, compare this PyDAL model:
>
> def _get_somethig_plus_age(row, extra):
> return row.person.age + extra
>
> db.define_table('person', 
> Field('name')
> Field('age', 'integer')
> Field.Method('get_somethig_plus_age', _get_somethig_plus_age)
> )
>
> against this ORM-style model:
>
> class Person(Model):
> name = Field()
> age = Field('integer')
>
> def get_somethig_plus_age(self, extra):
> return self.age + extra
>
> In an ORM, a model class represents a table, and when you query the DB, 
> you get the class instance objects representing rows. Using this approach 
> you can directly benefit from the advantages of the OOP and the code 
> readability and organization improves a lot, mostly when models starts grow 
> big.
>

In the case of the weppy ORM in particular, though, I think it really is 
just alternative syntax for everything that can already be done via pyDAL, 
typically with the same number of lines of code (note, the above examples 
would have the same number of lines if you added the 
@rowattr('get_something_plus_age') decorator required by weppy to the 
instance method).

Anthony

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


Re: [web2py] Re: Web3py

2019-04-19 Thread Anthony
On Thursday, April 18, 2019 at 6:48:09 PM UTC-4, Carlos Cesar Caballero 
wrote:
>
> Hi Massimo, here is it: https://github.com/cccaballero/pydal-orm. I 
> think including something like this with pydal will be a really good 
> improvement.
>

My only concern is whether the benefits are worth having to adopt all that 
new code (and update it when changes are made to pyDAL). Maybe it should 
remain an external package rather than being folded into pyDAL.

Anthony

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


Re: [web2py] Re: Web3py

2019-04-19 Thread Carlos Cesar Caballero Díaz
Yes, but that's not about the number of code lines, that's about the 
code organization and readability.


Greetings.

El 19/4/19 a las 4:17 p.m., Anthony escribió:
In the case of the weppy ORM in particular, though, I think it really 
is just alternative syntax for everything that can already be done via 
pyDAL, typically with the same number of lines of code (note, the 
above examples would have the same number of lines if you added the 
@rowattr('get_something_plus_age') decorator required by weppy to the 
instance method).


Anthony


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Web3py

2019-04-19 Thread Carlos Cesar Caballero Díaz
Well, that's a really fair concern, I was just mentioning, because I 
like ORMs and other popular projects like SQLAlchemy includes a DAL 
(they call it SQL abstraction toolkit) and an ORM on top of it, and if 
you look at popular web development full stack frameworks, almost all of 
them are relaying their models to ORMs.


Greetings

El 19/4/19 a las 4:22 p.m., Anthony escribió:
On Thursday, April 18, 2019 at 6:48:09 PM UTC-4, Carlos Cesar 
Caballero wrote:


Hi Massimo, here is it: https://github.com/cccaballero/pydal-orm
. I
think including something like this with pydal will be a really good
improvement.


My only concern is whether the benefits are worth having to adopt all 
that new code (and update it when changes are made to pyDAL). Maybe it 
should remain an external package rather than being folded into pyDAL.


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

For more options, visit https://groups.google.com/d/optout.


--
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.