Re: [web2py] Re: Off Topic:Pony

2018-03-15 Thread Carlos Cesar Caballero Díaz
Personally I will only see PonyORM as a viable tool if they finally 
implement a working migrations tool.


Greetings.


El 16/03/18 a las 00:22, Massimo Di Pierro escribió:
yes this it nice. We should take the time to determine which features 
of pydal are missing in ponyorm if any. If not maybe web3py should be 
based on ponyorm.


On Thursday, 8 March 2018 17:47:39 UTC-6, greenpoise wrote:

Nice indeed. Thanks

On Wednesday, March 7, 2018 at 3:19:14 AM UTC-8, Ramos wrote:

Nice ...
https://ponyorm.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 
.

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: change button form style

2018-03-15 Thread Massimo Di Pierro
web2py does not handle style. You have to edit the css. All web2py does it 
generate the html you apply style to. that html uses bs2, or bs3 or bs4 
classes. 
If you need anything else we recommend you use jQuery to replace classes or 
use custom forms.

On Thursday, 15 March 2018 15:04:06 UTC-5, Andrea Fae' wrote:
>
> Can I have any examples about changing some style of form components, like 
> for example buttons, text fields, labels,etc?
> Thanks
>

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


Re: [web2py] auth.settings.actions_disabled.append('register')

2018-03-15 Thread Massimo Di Pierro
That used to be done automatically when registration was disabled. It made 
the layout unnecessarily complex. Any action could be disabled and that;s a 
lot of if statements.

On Saturday, 10 March 2018 21:34:49 UTC-6, alex wrote:
>
> What about removing this: 
>
>  href="{{=URL('default','user/register')}}">{{=T('Sign up')}}
>
> from layout.html?
>
>
> On March 11, 2018 at 4:42:52, Andrea Fae' (and...@gmail.com) wrote:
>
> Sometimes problems arises. I need to eliminate "sign up" menu item from 
> LOGIN but nevertheless I inserted this line
>
> auth.settings.actions_disabled.append('register')
>
> or this
>
> auth.settings.actions_disabled = ['register']
>
> in the db.py I can see the item in the menu, and when I click I see "404 
> NOT FOUND" page.
>
> One time only this line could delete this menu item.
>
> Do I forgot anything?
> Thanks 
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
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: Search box in navbar in defaut layout.html

2018-03-15 Thread Massimo Di Pierro
useless. We just thought some people may find a use for it or remove it if 
they do not need it. The default layout is an example.

On Saturday, 10 March 2018 14:51:10 UTC-6, Mark Erbaugh wrote:
>
> What is the purpose and usage of the Search box displayed in the navbar 
> when using the default layout.html?
>
> Here's the code in layout.html:
>
> 
>placeholder="Search">
>   
>
> Thanks.
>

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


[web2py] Re: web2py_osx.zip seems way out of date ???

2018-03-15 Thread Massimo Di Pierro
For some reason you have two version of pydal, the one under 
web2py/gluon/packages and one in python site-packages and you are using the 
latter.
That should not be the case. You should use the one under web2py

On Friday, 9 March 2018 14:16:09 UTC-6, marco mansilla wrote:
>
> I recently got this problem in Linux Debian, after upgrading web2py, fixed 
> with
>
> $sudo pip install pydal -U
>
>
>
> On Saturday, February 24, 2018 at 3:03:05 AM UTC-3, jim kaubisch wrote:
>>
>> Thanks for the reply, Dave.
>>
>> There have been a number of issues surrounding the last couple of 
>> versions of Mac OS which come down to the fact that Apple has tightened 
>> security of the core of the system, As a result of that, some third party 
>> code doesn't always run because its trying to do things that it probably 
>> should never have been able to do, and that are no longer permitted - I was 
>> tearing my hair out the last couple of days trying to update my version of 
>> pyinstaller with pip failing no matter what I did because the system would 
>> not allow it to delete old files that it expected to be able to :(
>>
>> The problem here may ultimately be tied up with this general issue. I 
>> will keep poking at it. It seems I'm the only one who has the problem :(
>>
>> Jim
>>
>> On Thursday, February 15, 2018 at 2:05:26 AM UTC-8, Dave S wrote:
>>>
>>> On Wednesday, February 14, 2018 at 6:23:44 PM UTC-8, jim kaubisch wrote:

 Has no-one else had this problem?

>>>
>>> I run web2py on Windows or on linux, and having multiple versions has 
>>> not been a problem.  That's the way I usually upgrade, copying my 
>>> applications across, and looking for js/css/appadmin changes.   Lets me 
>>> switch back easily, and I'm not running anywhere that the size of web2py 
>>> makes for a problem.
>>>
>>> I don't often use a Mac, so I don't know how that environment changes 
>>> things, other than some of the key labels.
>>>
>>> /dps
>>>  
>>>


 On Wednesday, February 7, 2018 at 10:47:19 AM UTC-8, jim kaubisch wrote:
>
> Hi,
>
> I needed to directed my attention away from my web2py project a few 
> months ago but am now trying to get back into it. 
> A wise Step 1 would seem to be to update from 2.14.6 to the current 
> version (2.16.1 I assume).
>
> First tried from source but got 
>
> Traceback (most recent call last):
>
>   File "web2py.py", line 21, in 
>
> import gluon.widget
>
>   File “./Development/web2py/gluon/__init__.py", line 38, in 
>
> from .dal import DAL, Field
>
>   File “./Development/web2py/gluon/dal.py", line 17, in 
>
> from pydal.migrator import Migrator, InDBMigrator
>
> ImportError: cannot import name InDBMigrator
>
>
> I still have 2.14.6 installed (in a separate sub-tree) - is that the 
> problem?
>
>
> so I downloaded the mac "mac_osx.zip" to try that but - 
>
> after unzipping, when I try to run the resulting web2py/web2py.app I 
> just get a pop up saying "web2py error". 
>
> When I look at the file info for the web2py.app file it says Version 
> 2.4.7, dated 29 May, 2013
>
>
> What am I doing wrong? 
>
> The app file info certainly doesn't look encouraging. 
>
> I assume having 2 versions of web2py in separate sub-trees shouldn't 
> be a problem
>
>
> Thanks,
>
> Jim
>
>
>

-- 
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: Sites Powered by web2py

2018-03-15 Thread Massimo Di Pierro
You are right. Must do a better job at that. Will review next week.

On Thursday, 8 March 2018 21:47:45 UTC-6, Alexander Scarlat MD wrote:
>
> Tried today to upload a new website
> https://www.text2codes.com/
> and got the same link to internal error ticket.
>
> IMHO, I think the list needs be curated the same way Massimo did with the 
> Web2Py consultants list a couple of years ago.
>
> Cheers 
> Alex2
>
> On Sunday, April 2, 2017 at 1:58:27 PM UTC-7, Alex wrote:
>>
>> The section for "Sites Powered by web2py" does not look very promising 
>> and also seems outdated. Most pages don't have a screenshot and some of 
>> them are not even working anymore. When I try to visit the first site I get 
>> a link to an internal error ticket.
>>
>> Submitting a new page does not work. We tried to add our website but it 
>> does not show up. Maybe you want to add it: https://breedarchive.com
>>
>> Further I'd encourage you to completely restructure the powered by 
>> section because the current page probably has the opposite desired effect 
>> and scares off new visitors. Hundreds of applications, many of them with 
>> questionable content, is not really helpful. It would be much better to 
>> only show a very small selection (~5) of high quality web2py sites. Each 
>> one with a screenshot and a short description.
>>
>> regards,
>> Alex
>>
>>

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


[web2py] Re: Off Topic:Pony

2018-03-15 Thread Massimo Di Pierro
yes this it nice. We should take the time to determine which features of 
pydal are missing in ponyorm if any. If not maybe web3py should be based on 
ponyorm.

On Thursday, 8 March 2018 17:47:39 UTC-6, greenpoise wrote:
>
> Nice indeed. Thanks
>
> On Wednesday, March 7, 2018 at 3:19:14 AM UTC-8, Ramos wrote:
>>
>> Nice ...
>> https://ponyorm.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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Problem Pickling Session

2018-03-15 Thread Massimo Di Pierro
do you have session in cookie or db? Do you have a line in your code like 
session.connect()?

On Wednesday, 7 March 2018 16:11:29 UTC-6, Mark Erbaugh wrote:
>
> Web2Py is 2.16.1-stable+timestamp.2017.11.14.05.54.25
>
> I tried deleting all the files in the application (both my application and 
> admin) sessions folders, but still have the same 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.


[web2py] Re: SQLFORM.grid buttons

2018-03-15 Thread Massimo Di Pierro
we should release a new version soon where font-awesome s the default.

On Wednesday, 7 March 2018 07:12:18 UTC-6, Esprit Garonne wrote:
>
> Many Thanks, 
> Omg! I am really enjoying to test  this framework. 
>
> On Tuesday, March 6, 2018 at 8:33:26 PM UTC+1, Esprit Garonne wrote:
>>
>> Hello, 
>> Does it a bug All buttons in SQLFORM have only text link. And I am 
>> working on school project for carpool, Could someone help me 
>> to build "etapes" like this https://www.blablacar.fr/offer-seats/1
>> I need only  how to add city or remove it for a "one trajet"  Could I do 
>> it with SQLFORM.factory with JQUERY?
>> Many thx
>> This is my model 
>>  
>> db.define_table('t_villes',
>> Field('dep', type='string', notnull=True,
>>   label=T('Département')),
>> Field('nom', type='string', notnull=True,
>>   label=T('ville')),
>> Field('code_postal', type='string', notnull=True,
>>   label=T('Code postal')),
>> Field('longitude_deg', type='float', notnull=True,
>>   label=T('Longitude')),
>> Field('latitude_deg', type='float', notnull=True,
>>   label=T('Latitude')),
>> format='%(nom)s %(code_postal)s'
>>)
>>
>>
>> db.define_table(
>> 't_trajets',
>> Field('membre_voiture_id','reference t_voitures'),
>> Field('lieu_depart_id','reference t_villes',requires=
>> IS_IN_DB(db,'t_villes.id','t_villes.nom')),
>> Field('lieu_arrive_id',db.t_villes),
>> Field('depart_le','datetime'),
>> Field('frequence',requires=IS_IN_SET(FREQUENCES),default=
>> FREQUENCES[0]),
>> Field('type',requires=IS_IN_SET(TYPE_TRAJETS),default=
>> TYPE_TRAJETS[0]),
>> Field('fumeur',requires=IS_IN_SET(FUMEUR),default=FUMEUR[
>> 1]),
>> Field('commentaire','text'),
>>
>> Field( 'place_offert','integer'),
>>auth.signature
>>  
>> 
>> )
>> db.define_table('t_etapes_ville',
>> Field('trajet_id','reference t_trajets',requires=IS_IN_DB(db,'
>> t_trajets.id','t_trajets.lieu_depart_id')),
>> Field('ville_id',db.t_villes,requires=IS_IN_DB(db,'t_villes.id',
>> 't_villes.nom')),
>> Field('ordre_depart','integer'),
>>
>>)
>>
>>
>>
>>

-- 
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] Linux Torvalds on vulnerability

2018-03-15 Thread Massimo Di Pierro
Interesting read

http://www.zdnet.com/article/linus-torvalds-slams-cts-labs-over-amd-vulnerability-report/

It reminds me of when people criticize web2py because admin/appadmin allow 
arbitrary code execution. Of course they do! Admin is designed to allow the 
developer (admin) to write any code via the web interface. Do not want a 
web interface for that? delete the admin app.

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] login, redirects, and multiple apps

2018-03-15 Thread Dave S
I have a server with one web2py instance  (fronted by nginx/uwsgi), two 
apps, and a routes.py that says app1 is default.

I recently (that is, last night) added a new function to app2, protected 
(as usual) with @auth.requires_membship('innercircle').  In addition, I had 
to create a new user 'goodguy' and add it to 'innercircle'.  I tested from 
a browser instance that also had routine use of app1.   I spent a lot of 
time that was supposed to be for testing the form in trying to get logged 
in correctly.  I eventually tried .../user/profile, and found I was not 
getting logged in as 'goodguy', I was getting logged in as 'ordinaryjoe', 
an id that existed in both app1 and app2 (independent DBs, both sqlite3).  
Also, even though I was specifying 'host:app2/default/newfunc,' I was being 
redirected to 'host:user/login?next=newfunc', which looks like (when login 
doesn't fail) it ends up trying to find newfunc in app1.  Being explicit 
about 'host:/app2/default/user/login?next=app2/default/newfunc' didn't seem 
to help.

I finally opened a tab in a different browser, and was able to get to the 
right place, but it seemed like a lot of Sturm und Drang by that time.  For 
the record, server web2py 2.15.4, python 2.7.13, aws linux; clients Firefox 
58.0.2, Chrome 63.0.3239.132, on W10. Also, the successful effort was on 
Chrome, and today I used the dev tools to record the network activity for 
the form submit (I'm preparing to use curl to submit the form), and I could 
see from the request headers that there was session id cookie for both app1 
and app2 (yes, I've used app1 on that browser, also).
 
Should I be doing something in routes.py to make all this work better, or 
are the user functions problematic in the 1x web2py 2x apps scenario, or 
was I just a victim of browser caches?

Dave S
/dps

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


Re: [web2py] Re: Customizing Fields the lazy way

2018-03-15 Thread Richard Vézina
I found a pretty unclean workaround...

You have to set the widget like this :

db.tablename.REFERENCEDTABLEOFCHILDFIELD.widget = \
lazy_options_widget(on_key='no_table_PARENTFIELDNAME__selected',
off_key='PARENTFIELDNAME__unselected',
where=lambda PARENTFIELDNAME:
(some where clause),
trigger=record_row.get('PARENTFIELDNAME', None),
orderby=db.REFERENCEDTABLEOFCHILDFIELD.id,
suggest_widget=False,
widget_chained=True,
row=record_row,

field_requires=db.tablename.REFERENCEDTABLEOFCHILDFIELD.requires
# We pass the original field requires that we want to be execute in context
to limit as much as possible the number of records that will be pulled out
the database and only when the parent field will be updated...
#user_signature=True,
# If you want to process ajax requests at the
time of the object construction
# (not at the form rendered), specify your
target field in the following:
)
db.tablename.REFERENCEDTABLEOFCHILDFIELD.requires = IS_IN_SET([1, 2,
3])  # Here redefine the child field or lazy option controlled field with
dummy not computer intensive requires that will be never displayed


NOTE: I have a customized version of lazy_option_widget (NOT THIS ONE :
https://github.com/scubism/sqlabs/blob/master/modules/plugin_lazy_options_widget.py)
that support reference field... So it might not make more sens without the
code so here it is...

# -*- coding: utf-8 -*-
# This plugins is licensed under the MIT license:
http://www.opensource.org/licenses/mit-license.php
# Authors: Kenji Hosoda 
# Support for reference field : Richard Vézina

from gluon import *


class lazy_options_widget(SQLFORM.widgets.options):

def __init__(self,
 on_key,
 off_key,
 where,
 trigger=None,  # Rename this attribute
 suggest_widget=True,  # In case you don't want to use
plugin_suggest_widget, set suggest_widget to
   # False. In this case, this piece of
js with be including :
   #
$("select[name=]").change(function() {
   # var val =
$(this).children(":selected").attr("value");
   #
 $(this).trigger($(this).attr("id") + "__selected", [val]);
   # });
   # Where 
will be replaced with the field name of the
   # conditional field name.
 widget_chained=False,  # In case the widget field is also
a conditional field for another widget field
# you need to trigger event like
"WIDGET_FIELD_NAME__selected" when the widget
# field option is finally selected
 widget_trigger_event_js=None,  # If you need to trigger
something when the widget field option is
# finally selected you can
pass a piece of js here that will be injected
# into the form when the
conditional field trigger event "__selected"
 default='---',
 keyword='_lazy_options_%(fieldname)s',
 orderby=None,
 user_signature=False,
 hmac_key=None,
 row=None,  # In order to set values and filtered drop down
appropriately based on values of
# conditional and widget field when the form is
populated. Since you can't get row like this
# Field(..., widget=lambda field, value, row:
...
# When form is populated (update form) you need
to define a row object base on the id of
# the record like this :
# row = db(db.table.id = request.vars.id
).select(db.table.ALL).first()
# and pass it to lazy_option_widget...
 field_requires=None,  # Better to set the field requires
here to get it evaluated in a lazy manner
 ):
self.on_key, self.off_key, self.where = (
on_key, off_key, where
)
self.field_requires = field_requires
self.trigger, self.default, self.keyword, self.orderby = (
trigger, default, keyword, orderby,
)
self.user_signature, self.hmac_key = user_signature, hmac_key

self.row = row

self.suggest_widget, self.widget_trigger_event_js,
self.widget_chained = (suggest_widget,

  widget_trigger_event_js,

   

Re: [web2py] Re: Customizing Fields the lazy way

2018-03-15 Thread Richard Vézina
I wonder if we could we also make field lazy that way in context of custom
form...

I find some issue with some of my custom form where I use Field() to define
my field that will be use... This form is also dynamic, I manipulate field
visibility and lazy_option_widget() to make some field depend of other
field... The things is with data build up...
requires=IS_EMPTY_OR(IS_IN_DB(_set_, 'table.id', ...)), is loading at first
(on form load) all the records almost everything as I can't specify the id
which will be selected in the parent field the one controlling the
lazy_option controlled field (hope I am understandable)... Multiply this by
3-4 time for each lazy_option controlled field and you ends up pulling
multiple time the same records...

I would be interred in making the IS_IN_DB() triggered select occuring only
when options needed to be displayed... I guess this is a flaw in the way
lazy_option_widget() is implemented in the first place though...

Richard

On Sun, Mar 26, 2017 at 6:34 AM, Joe Barnhart 
wrote:

> That's kinda clever.  I may think of that!
>
> -- Joe
>
>
> On Thursday, March 23, 2017 at 4:19:05 PM UTC-7, Anthony wrote:
>>
>> Note, you might as well also add 'type': 'string' to your dictionary, and
>> maybe 'length': 20. You can also give yourself some flexibility by creating
>> a function:
>>
>> def phone_field(name, **kwargs):
>> defaults = {'type': 'string',
>> 'length': 20,
>> 'requires': IS_EMPTY_OR(IS_PHONE()),
>> 'widget': lambda fld,val: SQLFORM.widgets.string.widget(
>> fld, val, _type='tel', _class='form-control')}
>> defaults.update(**kwargs)
>> return Field(name, **defaults)
>>
>> 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.


[web2py] Re: Where is Auth table on Database Administration?

2018-03-15 Thread greenpoise
that was it!
thanks




On Tuesday, March 6, 2018 at 9:34:19 PM UTC-8, Massimo Di Pierro wrote:
>
> that happens when you redefined db=DAL(...) maybe have shadow models/db.py
>
> On Thursday, 1 March 2018 17:40:39 UTC-6, Anthony wrote:
>>
>> Don't think so.
>>
>> On Thursday, March 1, 2018 at 6:20:07 PM UTC-5, greenpoise wrote:
>>>
>>> Did anything changed that now the AUth table is not displayed on the 
>>> Database Administration tool??
>>>
>>>
>>> Thanks
>>>
>>

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


[web2py] Re: self.error ProgrammingError(u'ERROR', u'42P07', u'relation ..., u'1066', u'heap_create_with_catalog'

2018-03-15 Thread greenpoise
Just noticed this had a followup.

I did as you said and sure enough, some of the tables name had reserved 
words (dont ask me how they would work before but now they wouldnt). 
Anyways, that did the trick.


Thanks



On Tuesday, March 6, 2018 at 9:33:39 PM UTC-8, Massimo Di Pierro wrote:
>
> never see that error.  use postgres all the time. Can you try with a fresh 
> db and nothing in databases... adding one table at the time? My help narrow 
> it down.
>
> On Thursday, 1 March 2018 16:37:04 UTC-6, greenpoise wrote:
>>
>> Hello there.
>>
>> Been trying to revive an app I had and somewhere in between updates it 
>> broke which is not a big deal but here is the thing. I switched (on a new 
>> blank .py model), to postgresql from SQLITE and all I get is errors similar 
>> to this:
>>
>> self.errorProgrammingError(u'ERROR', u'42P07', u'relation ..., u'1066', 
>> u'heap_create_with_catalog', u'', u'')
>>
>> so..after a while I decided to go back to SQLite and the tables work and 
>> are created. Just wanted to throw this in here.
>>
>>
>> thanks
>>
>

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


[web2py] Re: OAUTH2.0 help

2018-03-15 Thread greenpoise
I need a push on this one. Now that I know how to properly Authenticate, 
also retrieve the code and the access_token which in turn is the same one 
used to refresh_token, how can I put everything together? I need to check 
whether the token is expired ( I am thinking a session) and if it is, 
authentication needs to happen again. So, all in all I have these pieces of 
code (they all work as far as I know):

*Authenticate:*

params = {"response_type": "code",
  "client_id": CLIENT_ID,
  "scope": "employee:customers_read"}
url = "https://jimbaroo.com/oauth/authorize.php?; + 
urllib.urlencode(params)
return dict(url=url)Enter code here...

*Get Access_token:*
code = current.request.vars.code
   

payload = {"client_id":CLIENT_ID,
 "client_secret":CLIENT_SECRET,
 "code":code,
 "grant_type":"authorization_code"}
url="https://jimbaroo.com/oauth/access_token.php;
r = requests.request("POST",url, data=payload)
 
token = r.json()
access_token = token['access_token']
current.session.token = access_token

*Refresh:*
refresh_token_request = 
requests.get('https://jimbaroo.com/oauth/access_token.php', 
data=payload).json()   

payload = {
"refresh_token":current.session.token,
"client_secret":CLIENT_SECRET,
"client_id":CLIENT_ID,
"grant_type":"refresh_token"
   }

thanks appreciated



On Wednesday, March 7, 2018 at 6:04:15 PM UTC-8, greenpoise wrote:
>
> Hi Dave, thanks for the input. I was able to post the temporary code and 
> get an authentication code. I will post tomorrow my updated code. I feel i 
> am close. Thanks

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


[web2py] Re: SQL strings and SQLTABLE issue in last web2py release. Is there a solution for it?

2018-03-15 Thread Paolo Caruccio
Leonel's suggestion worked but I had to set the key within headers 
dictionary and column name within column lists of SQLTABLE to 

'''GROUP_CONCAT("RISCHI"."rischio", \', \')'''

However, it seems to me that pyDal accepts SQL strings but it is SQLTABLE 
that doesn't handle them as before. So I have two questions.

1) If pyDal regularly returns the rows of a select containing a SQL string, 
why doesn't SQLTABLE - which should just serialize these in a view - accept 
them?

2) since the problem is generated by the following line

tablemap = dict(((f.tablename, f.table) if isinstance(f, Field) else (f.
_table._tablename, f._table) for f in fieldmap.values()))

In the SQLTABLE class is it doable  to apply the Leonel suggested code or 
to make a fallback to the old working code when f._table is None ?

Thank you for your attention.



Il giorno giovedì 15 marzo 2018 16:02:32 UTC+1, Anthony ha scritto:
>
> On Thursday, March 15, 2018 at 7:59:42 AM UTC-4, Leonel Câmara wrote:
>>
>> I'm going to say it outright I don't think this should be supported.
>>
>> I don't think this should be considered a backwards compatibility 
>> problem, because you're not using the DAL API you're just sending SQL in a 
>> string.
>>
>
> Agreed, it's not strictly a backward compatibility issue. Therefore, we 
> don't necessarily need to restore the old functionality exactly (i.e., 
> allow SQL strings to be passed to .select() and expect SQLTABLE to display 
> the results), but it would be good to provide some means of achieving 
> similar results.
>  
>
>> from pydal.objects import Expression
>> dialect = db._adapter.dialect
>>
>> def group_concat(first, second, query_env={}):
>> return "GROUP_CONCAT(%s, '%s')" % (dialect.expand(first, query_env), 
>> second)
>>
>> rischi_della_mansione = Expression(db, group_concat, db.RISCHI.id, ', ', 
>> 'string')
>>
>>
>> We need to define that the proper way to put custom SQL mixed with DAL 
>> code is using Expression and document how to use it. SQL in strings isn't 
>> acceptable, for that you use executesql.
>>
>
> The above is not part of the DAL public API either, and it is a rather 
> cumbersome way to add custom SQL to a select. So, rather than simply 
> documenting the above, it would be better if we could come up with a 
> simplified API for adding custom SQL expressions to both queries  (i.e., 
> "WHERE" clauses) and selects. In the short term, I suppose we could 
> document the above as a workaround, but I'm not sure we want to commit to 
> that as a public API that must be supported indefinitely (we then lose the 
> freedom to change any of those exposed internal implementation details).
>
> 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: How to verify woocommerce webhook signature in web2py auth decorator

2018-03-15 Thread Manuele Pesenti
Il 15/03/18 20:21, Anthony ha scritto:
> Hard to say what's wrong. Where did you get that signature and request
> body? You might be better off getting help from folks who know
> WooCommerce, as this issue does not appear to be web2py specific.
>
Yes for sure! Thanks a lot.

    M.

-- 
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] change button form style

2018-03-15 Thread Andrea Fae'
Can I have any examples about changing some style of form components, like 
for example buttons, text fields, labels,etc?
Thanks

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


Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-03-15 Thread Anthony
Hard to say what's wrong. Where did you get that signature and request 
body? You might be better off getting help from folks who know WooCommerce, 
as this issue does not appear to be web2py specific.

Anthony

On Thursday, March 15, 2018 at 1:09:31 PM UTC-4, Manuele wrote:
>
> On 01/03/2018 00:50, Anthony wrote: 
>
> > I think you're on the right track. If you need the original request 
> > body to verify the signature, request.body.read() should do it. Does 
> > that not work? 
> Hi Anthony, 
> actually no :( it doesn't work, here[1] I tried to extrapolate the very 
> essential code in order to test a use case. 
> To obtain the data I used such a web service like "requestb.in" as a 
> webhook url and saved the woocommerce product. 
>
> running the test the result is: 
>
> $ python -m test 
> E 
> == 
> ERROR: test_authenticate (__main__.TestWoo) 
> -- 
> Traceback (most recent call last): 
>File "[...]/woohook/test.py", line 16, in test_authenticate 
>  res = WooHook.check(body, signature, secret) 
>File "woohook.py", line 23, in check 
>  raise AuthenticationError(result) 
> AuthenticationError: WNeVWlUGBX6pSusRngDavUWlck6eAhVpTRoTYBbJdYM= 
>
> -- 
> Ran 1 test in 0.000s 
>
> FAILED (errors=1) 
>
> Any idea or suggestion will be appreciated! 
>
> Cheers 
>  Manuele 
>
> [1] https://gist.github.com/manuelep/b6f6c00b4dec5234ab97229199bb223d 
>
>

-- 
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: Passing an integer javascript variable from view to controller

2018-03-15 Thread Leonel Câmara
You can do this by sending it using json. But, if you don't mind me asking, 
what are you trying to do?



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


Re: [web2py] Re: How to verify woocommerce webhook signature in web2py auth decorator

2018-03-15 Thread Manuele Pesenti

On 01/03/2018 00:50, Anthony wrote:

I think you're on the right track. If you need the original request 
body to verify the signature, request.body.read() should do it. Does 
that not work?

Hi Anthony,
actually no :( it doesn't work, here[1] I tried to extrapolate the very 
essential code in order to test a use case.
To obtain the data I used such a web service like "requestb.in" as a 
webhook url and saved the woocommerce product.


running the test the result is:

$ python -m test
E
==
ERROR: test_authenticate (__main__.TestWoo)
--
Traceback (most recent call last):
  File "[...]/woohook/test.py", line 16, in test_authenticate
    res = WooHook.check(body, signature, secret)
  File "woohook.py", line 23, in check
    raise AuthenticationError(result)
AuthenticationError: WNeVWlUGBX6pSusRngDavUWlck6eAhVpTRoTYBbJdYM=

--
Ran 1 test in 0.000s

FAILED (errors=1)

Any idea or suggestion will be appreciated!

Cheers
    Manuele

[1] https://gist.github.com/manuelep/b6f6c00b4dec5234ab97229199bb223d

--
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: Angular 2 and web2py

2018-03-15 Thread Anthony
On Thursday, March 15, 2018 at 11:05:56 AM UTC-4, 
anil.a...@capitalfloat.com wrote:
>
> I tried integrating angular5+ framework in my already existing  web2py 
> framework and Its running fine, Changed delimiter and interpolation in 
> angular .   I am not able to fetch variables defined in web2py from script 
> tag in index.html, is the only issue 
>
> For exp : 
>
>   
> var baseUrl = "{{=BASE_PATH_APPFORM}}";//  Not able to render 
> web2py variable here in index.html 
> 
>

What happens instead? Do you get an error? Where is that variable defined?

Anthony

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


[web2py] Re: Angular 2 and web2py

2018-03-15 Thread anil.arya via web2py-users
I tried integrating angular5+ framework in my already existing  web2py 
framework and Its running fine, Changed delimiter and interpolation in 
angular .   I am not able to fetch variables defined in web2py from script 
tag in index.html, is the only issue 

For exp : 

  
var baseUrl = "{{=BASE_PATH_APPFORM}}";//  Not able to render 
web2py variable here in index.html 



On Friday, January 6, 2017 at 3:57:50 PM UTC+5:30, John Philip wrote:
>
> Hi there,
>
> I searched for this however I could not find an answer. Is it possible to 
> use Angular 2 in web2py ? 
>
> thanks and regards,
>
> John
>

-- 
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] Passing an integer javascript variable from view to controller

2018-03-15 Thread Ashwanth Unni
How to pass an integer javascript variable from view to controller?

-- 
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: SQL strings and SQLTABLE issue in last web2py release. Is there a solution for it?

2018-03-15 Thread Anthony
On Thursday, March 15, 2018 at 7:59:42 AM UTC-4, Leonel Câmara wrote:
>
> I'm going to say it outright I don't think this should be supported.
>
> I don't think this should be considered a backwards compatibility problem, 
> because you're not using the DAL API you're just sending SQL in a string.
>

Agreed, it's not strictly a backward compatibility issue. Therefore, we 
don't necessarily need to restore the old functionality exactly (i.e., 
allow SQL strings to be passed to .select() and expect SQLTABLE to display 
the results), but it would be good to provide some means of achieving 
similar results.
 

> from pydal.objects import Expression
> dialect = db._adapter.dialect
>
> def group_concat(first, second, query_env={}):
> return "GROUP_CONCAT(%s, '%s')" % (dialect.expand(first, query_env), 
> second)
>
> rischi_della_mansione = Expression(db, group_concat, db.RISCHI.id, ', ', 
> 'string')
>
>
> We need to define that the proper way to put custom SQL mixed with DAL 
> code is using Expression and document how to use it. SQL in strings isn't 
> acceptable, for that you use executesql.
>

The above is not part of the DAL public API either, and it is a rather 
cumbersome way to add custom SQL to a select. So, rather than simply 
documenting the above, it would be better if we could come up with a 
simplified API for adding custom SQL expressions to both queries  (i.e., 
"WHERE" clauses) and selects. In the short term, I suppose we could 
document the above as a workaround, but I'm not sure we want to commit to 
that as a public API that must be supported indefinitely (we then lose the 
freedom to change any of those exposed internal implementation details).

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: How to serve same view for multiple urls

2018-03-15 Thread Anthony
On Thursday, March 15, 2018 at 8:01:48 AM UTC-4, Ur. Kr. wrote:
>
> I'm currently using React/ReactRouter/Redux. The main issue is for web2py 
> to serve the same view wherefrom the javascript determines what other 
> requests to make and what to render. 
> Now if I have 
> controller file controllers/default.py 
> Then I go to default/page
> This doesn't work if there's no `page` function in default.py and if there 
> isn't a page.html file the views folder. 
> For the SPA I need it to just serve a single HTML file regardless of the 
> url components after "default/".
> I suppose I could use the # fragment: default#/page
>

It sounds like it's not that you want to use the same *view *with each 
request but rather the same controller action. In other words, all of the 
different URLs of your app are really client-side URLs, so no matter what 
URL is requested, you want web2py to call the same controller action and 
simply return the SPA. To do that, in a model file, you can add something 
like this:

if request.controller == 'default':
request.function = 'index'
response.view = 'default/index.html'

Assuming the client-side routes are all at the /default URL path (which 
presumably you will hide using the web2py router), the above will re-route 
any request for the /default path to the index() function, which you should 
set up to return the SPA. You could also use the pattern-based rewrite 
system to do something similar.

Any other web2py server-side routes should go in other controllers (e.g., 
Auth endpoints) to make it easy to distinguish client-side vs. server-side 
routes.

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] LDAP authentication questions

2018-03-15 Thread Richard Vézina
For 1 you already have this opportunity as you example is mostly the same
as :

auth.settings.login_methods = \
[auth,
 ldap_auth(...)]

So web2py will try authenticate user against web2py data, if it fails it
will try the AD.

2) There's the tricky part... The simplest would be to inform your user on
the registration page to contact you if they are member of the staff, so
you create their account for them, so no web2py password would be
requires... If this is not acceptable you customize the registration form some
how and avoid asking for creating a password for the user member of the
staff. The simplest way would be to create a first form asking if the
person is member of the staff and depending of the answer directing on the
right form. Finally you could create a synching AD/web2py users module, so
all the possible staff member get their account create into web2py and you
can even manage the access to your app from the AD like that by creating a
AD group for which you grant access to your app. I did just that
recently... It a lot of work :)

3) To avoid that situation, you have to leave the password field of
auth_user table empty for the user that need to be granted access against
AD.

NOTE: If you use AD think to use ldapS connection over port 636 (LDAP +
SSL) to avoid clear text authenication credentials flowing over your LAN.

This could be achieve like this depending if the SSL certificate is self
sign or not your config migth tweaks a bit, read the ldap_auth.py module
for guidance on the available switches...

auth.settings.login_methods = \
[auth,
 ldap_auth(mode='ad',
   #
---
   # To unlock LDAPS with self-signed certificate this line
should be
   # present in ldap_auth.py :
   # ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT,
ldap.OPT_X_TLS_NEVER)
   # This line should be inside : ldap_auth()
   # Ref:
https://onemoretech.wordpress.com/2015/06/25/connecting-to-ldap-over-self-signed-tls-with-python/
   # Ref:
http://bneijt.nl/blog/post/connecting-to-ldaps-with-self-signed-cert-using-python/
   # Ref:
https://mail.python.org/pipermail/python-ldap/2015q4/003631.html
   port=636,
   secure=True,
   self_signed_certificate=True,
   )]

Good luck

Richard



On Thu, Mar 15, 2018 at 6:10 AM, Johann Spies 
wrote:

> I am trying out ldap authentication after I have last used it in 2006.
>
> My ldap knowledge is minimal.
>
> After reading the documentation in the book and in ldap_auth.py I
> have a few questions about authentication and ldap.
>
> Background: Only a few users (probably not more than 5 or 6) will use
> this app as logged in users.
>
> All of them (or maybe except one or two) will not be staff members of
> our university.  Staff members and students can be authenticated
> against the Active Directory (AD) of the university.  The others not.
>
> We will only allow specific people to authenticate.  Registration of
> users will not be available through the user webinterface.
>
> As I understand the documentation web2py will work through the list
> (auth.settings.login_methods) trying the next method if the previous
> authentication method fails.
>
> I do not have any admin-function as far as the AD is concerned.  So
> I can do nothing there that have an effect on our authentication
> except query the AD through LDAP.
>
>
> In the model:
>
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
> auth.settings.login_methods.append(ldap_auth(
> mode='ad', server='ouradserver',
> base_dn='ou=Users,dc=stb,dc=sun,dc=ac,dc=za,O=SU',
> manage_user=True,
> user_firstname_attrib='cn:1',
> user_lastname_attrib='cn:2',
> user_mail_attrib='mail'))
>
> My auth.settings.login_methods:
> [,
>  .
> ldap_auth_aux>]
>
>
>
> Now my questions:
>
>
>
> 1. Is it possible to combine the normal auth and ldap methods in such
> a way that staff members authenticate against AD and the others
> against the local auth-table?
>
> 2. How do I manage the user registration if the answer on 1 is "Yes".
>
> 3. I have tested the system with myself as user on both the local and
> the AD.  If my local password is different from that on the AD, I can
> login with the local password.  That should not be.  How do I get it
> that if the username is local and on the AD the last will override the
> first?
>
> Regards
> Johann
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe 

[web2py] Re: How to serve same view for multiple urls

2018-03-15 Thread Leonel Câmara
You can set the view file using response.view = 'myview.html' in your 
controller function.

-- 
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] Bug in ldap library for python3?

2018-03-15 Thread Richard Vézina
Migth be interesting in this patch :
https://github.com/web2py/web2py/issues/1880

On Wed, Mar 14, 2018 at 12:43 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> It debian package... If you goes with pip it should be python-ldap...
>
> Good luck
>
> Richard
>
> On Wed, Mar 14, 2018 at 3:57 AM, Johann Spies 
> wrote:
>
>> Thanks Richard for your attention.
>>
>> I have checked my setup again and saw that I had the debian-package
>> python3-ldap3 and not python3-ldap.
>>
>> I have installed  python3-ldap and now it works - at least so far for
>> importing:
>>
>> from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>
>> Regards
>> Johann
>>
>> On 13 March 2018 at 19:05, Richard Vézina 
>> wrote:
>> > It might not be an issue with auth_ldap.py
>> >
>> > On Tue, Mar 13, 2018 at 12:29 PM, Richard Vézina
>> >  wrote:
>> >>
>> >> It works fine...
>> >>
>> >> On Tue, Mar 13, 2018 at 12:28 PM, Richard Vézina
>> >>  wrote:
>> >>>
>> >>> I try with a module of mine using ldap and had issues with ldapS
>> >>> connection...
>> >>>
>> >>> I had to follow this :
>> >>>
>> >>> https://github.com/python-ldap/python-ldap/issues/55
>> >>>
>> >>> l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
>> >>> l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
>> >>> # l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
>> >>> required...
>> >>> l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
>> >>> l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
>> >>>
>> >>> Then it connected properly under python3 only...
>> >>>
>> >>> Will make some test in python2 if the back port of the above cause any
>> >>> issue...
>> >>>
>> >>> Richard
>> >>>
>> >>>
>> >>> On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina
>> >>>  wrote:
>> 
>>  Please try this :
>> 
>>  sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
>>  # setuptools should be there... I was miss leading...
>>  sudo pip3 install python-ldap
>> 
>>  Please provide progress as if auth_ldap.py works properly with
>> python3
>>  once you install python-ldap properly under python3.
>> 
>>  Thanks
>> 
>>  Richard
>> 
>> 
>>  On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina
>>   wrote:
>> >
>> > I open this issue :
>> >
>> > https://github.com/python-ldap/python-ldap/issues/181
>> >
>> > On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina
>> >  wrote:
>> >>
>> >> python3-ldap -> ldap3
>> >> (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/) is not the
>> same thing
>> >> as python-ldap...
>> >>
>> >> It seems that python-ldap support python 3 :
>> >>
>> >> https://github.com/python-ldap/python-ldap
>> >>
>> >> Saddly enough, I hadn't successfully install python-ldap under
>> python3
>> >> with pip3... It fails over importing setuptools issue...
>> Setuptools is
>> >> installed, so I wonder what going on...
>> >>
>> >> It seems to be working with python 3.4+ :
>> >> https://www.python-ldap.org/en/latest/installing.html#build-
>> prerequisites
>> >>
>> >> If you have ubuntu you can try on your side :
>> >>
>> >> sudo pip3 install -U setuptools
>> >> sudo pip3 install python-ldap
>> >>
>> >>
>> >> It would be nice if python-ldap just works under python3 as we
>> >> wouldn't have to touch ldap_auth.py as python-ldap should have
>> keep the same
>> >> API under python3...
>> >>
>> >> Though ldap3 seems to offer interresting progres, but I didn't try
>> it.
>> >>
>> >> Please keep posting here your progress.
>> >>
>> >> Thanks
>> >>
>> >> Richard
>> >>
>> >>
>> >>
>> >> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies <
>> johann.sp...@gmail.com>
>> >> wrote:
>> >>>
>> >>> Version 2.16.1
>> >>>
>> >>> In python (2.7) I can do:
>> >>>
>> >>> python web2py.py -S welcome
>> >>> ..
>> >>>
>> >>> In [1]: from gluon.contrib.login_methods.ldap_auth import
>> ldap_auth
>> >>>
>> >>> In [2]:
>> >>>
>> >>> But not when I use python3 (and I have python3-ldap installed).
>> >>>
>> >>>
>> >>> ```
>> >>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>> >>> globals, locals, fromlist, level)
>> >>> 109 import_tb = None
>> >>> 110
>> >>> --> 111 return NATIVE_IMPORTER(name, globals, locals,
>> fromlist,
>> >>> level)
>> >>> 112
>> >>> 113
>> >>>
>> >>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in
>> >>> ()
>> >>>  12 except Exception as e:
>> >>>  13 logging.error('missing ldap, try "easy_install
>> >>> 

Re: [web2py] Re: How to serve same view for multiple urls

2018-03-15 Thread Ur. Kr.
I'm currently using React/ReactRouter/Redux. The main issue is for web2py 
to serve the same view wherefrom the javascript determines what other 
requests to make and what to render. 
Now if I have 
controller file controllers/default.py 
Then I go to default/page
This doesn't work if there's no `page` function in default.py and if there 
isn't a page.html file the views folder. 
For the SPA I need it to just serve a single HTML file regardless of the 
url components after "default/".
I suppose I could use the # fragment: default#/page

On Thursday, March 15, 2018 at 12:32:40 PM UTC+1, Massimiliano wrote:
>
> If I understand correctly what you mean, you need an entrypoint that could 
> be index in your controller that load the view.
> Now from the view you get and set data via ajax from/to other controller 
> functions.
>
> SPA are heavly javascript based.
>
> Take a look on discussions on Vue.js
>
> On Thu, Mar 15, 2018 at 11:53 AM, Ur. Kr.  > wrote:
>
>> Would also need a way to redirect to "index" controller instead of 
>> getting "invalid controller" when navigating to a URL without a controller. 
>>
>>
>> On Thursday, March 15, 2018 at 11:28:33 AM UTC+1, Ur. Kr. wrote:
>>>
>>> If you want to convert part of a web2py app into an SPA with client-side 
>>> routing, how do you make web2py serve the same view for multiple urls? 
>>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Massimiliano
>

-- 
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: SQL strings and SQLTABLE issue in last web2py release. Is there a solution for it?

2018-03-15 Thread Leonel Câmara
I'm going to say it outright I don't think this should be supported.

I don't think this should be considered a backwards compatibility problem, 
because you're not using the DAL API you're just sending SQL in a string.  
  
If you put that "GROUP_CONCAT" in a pyDAL Expression and that doesn't work 
then I would agree it's a problem. Try this:

from pydal.objects import Expression
dialect = db._adapter.dialect

def group_concat(first, second, query_env={}):
return "GROUP_CONCAT(%s, '%s')" % (dialect.expand(first, query_env), 
second)

rischi_della_mansione = Expression(db, group_concat, db.RISCHI.id, ', ', 
'string')


We need to define that the proper way to put custom SQL mixed with DAL code 
is using Expression and document how to use it. SQL in strings isn't 
acceptable, for that you use executesql.

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


Re: [web2py] Re: How to serve same view for multiple urls

2018-03-15 Thread Massimiliano
If I understand correctly what you mean, you need an entrypoint that could
be index in your controller that load the view.
Now from the view you get and set data via ajax from/to other controller
functions.

SPA are heavly javascript based.

Take a look on discussions on Vue.js

On Thu, Mar 15, 2018 at 11:53 AM, Ur. Kr.  wrote:

> Would also need a way to redirect to "index" controller instead of getting
> "invalid controller" when navigating to a URL without a controller.
>
>
> On Thursday, March 15, 2018 at 11:28:33 AM UTC+1, Ur. Kr. wrote:
>>
>> If you want to convert part of a web2py app into an SPA with client-side
>> routing, how do you make web2py serve the same view for multiple urls?
>>
> --
> 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.
>



-- 
Massimiliano

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


[web2py] Re: How to serve same view for multiple urls

2018-03-15 Thread Ur. Kr.
Would also need a way to redirect to "index" controller instead of getting 
"invalid controller" when navigating to a URL without a controller. 

On Thursday, March 15, 2018 at 11:28:33 AM UTC+1, Ur. Kr. wrote:
>
> If you want to convert part of a web2py app into an SPA with client-side 
> routing, how do you make web2py serve the same view for multiple urls? 
>

-- 
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] google analytics integration

2018-03-15 Thread Manuele Pesenti

Hi!

What's the difference between thees two (different?) approaches:

* https://support.google.com/analytics/answer/1008080?hl=en

* 
http://web2py.com/books/default/chapter/29/05/the-views?search=analytics#Default-page-layout


the script integrated in the web2py framework it's not so easy to 
analyze because it's minimized and at the moment we use a framework 
version equal to 2.14.6 for the deployment, any suggest about it?


Thanks a lot

    Manuele


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

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


[web2py] How to serve same view for multiple urls

2018-03-15 Thread Ur. Kr.
If you want to convert part of a web2py app into an SPA with client-side 
routing, how do you make web2py serve the same view for multiple urls? 

-- 
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] LDAP authentication questions

2018-03-15 Thread Johann Spies
I am trying out ldap authentication after I have last used it in 2006.

My ldap knowledge is minimal.

After reading the documentation in the book and in ldap_auth.py I
have a few questions about authentication and ldap.

Background: Only a few users (probably not more than 5 or 6) will use
this app as logged in users.

All of them (or maybe except one or two) will not be staff members of
our university.  Staff members and students can be authenticated
against the Active Directory (AD) of the university.  The others not.

We will only allow specific people to authenticate.  Registration of
users will not be available through the user webinterface.

As I understand the documentation web2py will work through the list
(auth.settings.login_methods) trying the next method if the previous
authentication method fails.

I do not have any admin-function as far as the AD is concerned.  So
I can do nothing there that have an effect on our authentication
except query the AD through LDAP.


In the model:

from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.login_methods.append(ldap_auth(
mode='ad', server='ouradserver',
base_dn='ou=Users,dc=stb,dc=sun,dc=ac,dc=za,O=SU',
manage_user=True,
user_firstname_attrib='cn:1',
user_lastname_attrib='cn:2',
user_mail_attrib='mail'))

My auth.settings.login_methods:
[,
 .ldap_auth_aux>]



Now my questions:



1. Is it possible to combine the normal auth and ldap methods in such
a way that staff members authenticate against AD and the others
against the local auth-table?

2. How do I manage the user registration if the answer on 1 is "Yes".

3. I have tested the system with myself as user on both the local and
the AD.  If my local password is different from that on the AD, I can
login with the local password.  That should not be.  How do I get it
that if the username is local and on the AD the last will override the
first?

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

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


Re: [web2py] Re: prevent multiple session at the same time

2018-03-15 Thread Manuele Pesenti



On 12/03/2018 15:08, Anthony wrote:


What if I cache on disk the result of a function that returns the
session id and I check if it corresponds to the real value?


Not sure what you mean. Where does the session ID produced by the 
function come from, and how is the "real value" defined? What are you 
suggesting different from Massimo's approach.


Anthony


Hi Anthony,
thanks for your replay, I read the message from Massimo now and I 
realize that I misunderstood something... Massimo said to create a uuid 
and store it in database. I thought that `session.id` could be used 
instead and it could be considered as a "real value" or better as the 
real current session identifier. That's the check I was thinking about:


if session.id != cache.disk('session_id_%s' % user.id, lambda: 
session.id, time_expire=3600):

    auth.logout()

On the other hand I'm not sure that not to perform a database select 
query on every request but use the filesystem it's a better choice. Is it?


Cheers
    Manuele

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