[web2py] Re: SQLFORM.grid() buttons have no names? 2.17.2-stable

2018-12-30 Thread Paul Ellis
Seems to me that it would as simple as using the buttonclass key as a name 
or id in the gridbutton function. But I am not a professional so I don't 
know if this is a good idea. 

def gridbutton(buttonclass='buttonadd', buttontext=T('Add'),
   buttonurl=url(args=[]), callback=None,
   delete=None, trap=True, noconfirm=None, title=None):
if showbuttontext:
return A(SPAN(_class=ui.get(buttonclass)), CAT(' '),
 SPAN(T(buttontext), _title=title or T(buttontext),
  _class=ui.get('buttontext')),
 _href=buttonurl,
 callback=callback,
 delete=delete,
 noconfirm=noconfirm,
 _class=ui.get('button'),
 cid=request.cid,
 _name=buttonclass) # added this line
else:
return A(SPAN(_class=ui.get(buttonclass)),
 _href=buttonurl,
 callback=callback,
 delete=delete,
 noconfirm=noconfirm,
 _title=title or T(buttontext),
 _class=ui.get('button'),
 cid=request.cid,
 _name=buttonclass) # added this line


-- 
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] Making my binary standalone apps function faster

2018-12-30 Thread mostwanted
Hi guys, I develop a-lot of stand alone apps with web2py but my problem is 
that i find the performing slower, every-time there is data entry or a 
query it takes a while to save information and  or bring out the query 
results, is there a way in which i can make my apps faster?

Mostwanted

-- 
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] CAS error

2018-12-30 Thread Carlos Cesar Caballero Díaz
Well, actually I have being not able to replicate the issue, maybe was 
something related to sessions or the browser cache, but right now I am 
not sure what was wrong.


Greetings.

El 30/12/18 a las 4:45 p.m., Massimo Di Pierro escribió:

Thanks

On Friday, 7 December 2018 07:15:33 UTC-8, Carlos Cesar Caballero wrote:

Hi Massimo, I am working on a fix, hopefully I will submit a PR soon.

Greetings.

El 7/12/18 a las 3:03 a.m., Massimo Di Pierro escribió:

can you please open an issue about this?

On Thursday, 29 November 2018 13:51:14 UTC-8, Carlos Cesar
Caballero wrote:

Hi guys, after some clean tests, the issue is not happening
with Python
2.7, so it seems to be a Python 3 issue.

Greetings.


El 29/11/18 a las 1:34 p.m., Carlos Cesar Caballero Díaz
escribió:
> Hi, I am using the web2py version
> 2.17.2-stable+timestamp.2018.10.06.18.54.02 in Ubuntu
Linux, and I am
> not able to use CAS. I have a web2py app as server, an
another as
> client, and when client try to log in, the browser starts a
redirect
> loop and returns a ERR_TOO_MANY_REDIRECTS error. There are
no error
> tickets in client or server apps, and the behavior is
happening using
> python 2.7 and 3.6.
>
> I have configured the client just using:
>
> auth = Auth(db, cas_provider =
> 'http://127.0.0.1:8000/welcome/default/user/cas
')
>
> I want to authenticate against the welcome app as I have
being doing
> with past web2py versions.
>
> Any idea how to fix this?
>
>
> Greetings.
>

-- 
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: error exporting data (CSV) using smartgrid

2018-12-30 Thread Web2_3py
for me:

*export_to_csv_file*

under python2 , no problem

under python3 , the following problem

  File 
"C:\Users\assus\Desktop\Flash\python3\web2py_2_17_2_src\web2py\gluon\packages\dal\pydal\objects.py",
 line 2619, in export_to_csv_file
writer.writerow(unquote_colnames(colnames))
TypeError: a bytes-like object is required, not 'str'

-- 
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] SQLFORM.grid() buttons have no names? 2.17.2-stable

2018-12-30 Thread Paul Ellis
Is there a reason there are no names or ids attached to the grid buttons?
Like addBtn, deleteBtn and so on. 

There's no identifying information on the buttons to make it easy to change 
the text or colour, for example. I don't want 'Add record' I want something 
more contextual depending on the grid.

I want to change the colour of the delete button. 

The edit button is only visible to admins and only for some records. I want 
them to see it is an admin function so they are careful with it. It doesn't 
always have the same index location in the "row-buttons" div. 

I can give a dict() to the ui argument and change the colour of all of the 
buttons, but that's not ideal.

I am pretty sure the buttons used to be named.


-- 
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: An Easy way to Support ADFS / AZURE / OKTA / Sibboleth and other SAML2 SSO Scenarios

2018-12-30 Thread 黄祥
+1
interested to learn it too

thx n best regards,
stifan

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


[web2py] Re: How to assign a group to a big auth_user list?

2018-12-30 Thread 黄祥
you can assign the new id to the variable and pass it to add_membership() 
function

pls try (not tested, and change group_id with the group id number you want 
to assign)
for kardex in db(db.kardex).select():
new_user_id = db.auth_user.validate_and_insert(
first_name=kardex.first_name, last_name=kardex.last_name, 
email=kardex.email, password=kardex.password)
auth.add_membership(group_id, new_user_id)

best regards,
stifan

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


[web2py] Re: An Easy way to Support ADFS / AZURE / OKTA / Sibboleth and other SAML2 SSO Scenarios

2018-12-30 Thread Massimo Di Pierro
Thank you!

Can you please post a more complete example of integration? This will be 
very useful to many people here.

On Saturday, 8 December 2018 07:37:13 UTC-8, Pbop wrote:
>
> Greetings Fellow Web2Pyers,
>
> It's the season of giving. I hope what I share inspires others to share 
> some of their tips and tricks in Web2Py that others can use! Many thanks to 
> the community for your great help in the past! 
>
> This post assumes the reader has limited exposure to SAML2. The solution 
> here allows any Web2Py app hosted on servers you control to work with any 
> SAML2 IDP (in theory). 
>
> SAML2 is a mark-up language to support federated single-sign services 
> which include Microsoft ADFS and AZURE, Shibboleth, OKTA to name a few. 
> What's cool with federated SSO is your web2py app can support SSO with any 
> of these services with only registration information needing to be shared. 
> Conversely, when you authenticate into any of these providers, you gain 
> access to any other application with the same credentials also registered 
> into the provider. 
>
> For those not familiar with how SAML2 works, there are two pieces of 
> technology needed: an IDP (identity provider) and the SP (service 
> provider).  Microsoft refers to the IDP as Claims Provider and SP as 
> Relaying Party. The IDP is where the user authenticates and contains 
> identity information about the user and what applications the user is 
> allowed to access. The SP is the application (your Web2Py app)  that wants 
> to use the IDP for sign-on services. When the user lands to the SP and is 
> not authenticated, the user is redirected to the IDP. The IDP will present 
> the user with a login form which means the user is authenticating into the 
> IDP, not directly into your application. On submission of credentials, the 
> IDP completes the sign-on process and redirects the authenticated and 
> authorized user back to the SP (your application). When redirecting the 
> user back to the SP, the post back includes whatever identity information 
> the IDP is authorized to release to the SP such as first and last name, 
> email, organization... This is different than CAS or AD which returns only 
> a login name or unique identifier. The IDP can release any information it 
> has about the user which means your app gains access to both authentication 
> and identity management services.  
>
> While there are a number of python based SAML2 implementations including a 
> 5 year old web2py version, it gets fairly deep into details that can be 
> entirely avoided with what I am about to share. 
>
> Shibboleth is a SAML2 implementation you can use to make your Web2Py app 
> SAML2 ready immediately. Shibboleth is used mostly in higher education and 
> includes both IDP and SP software installations. Both installations are 
> open source downloads that you can install to a web server (Unix and IIS), 
> but we're only interested in the service provider installation. The service 
> provider when installed to your server can protect a folder, including a 
> web2py application/controller/function folder. By protecting the folder 
> your web2py app is running against, you instantly gain SAML2 capability and 
> out of the box support to any SAML2 IDP. This is because all of the 
> identity attributes are now available in value pairs in the header (the 
> web2py request.env object) once the user is authenticated. 
>
> To show how easy this is, let's say the folder we want the Shibboleth 
> service provider to protect is welcome\secure where secure is your 
> controller in the welcome app using a default function. When the user lands 
> to that folder, the Shibboleth SP kicks in and redirects the user to the 
> IDP. Your web2py app will not even respond until Shibboleth has 
> authenticated you. The user logs on at the IDP, the IDP determines the user 
> is authenticated and then redirects back to the protected folder. Since 
> Shibboleth has determined you are now authorized to use the folder, your 
> web2py app fires and all of the identity attributes are now available for 
> your web2py application in the request.env object to use as you need. 
>
> Here is a set of headers from a Shibboleth authentication... This 
> represents what the IDP is releasing back to the SP and in turn represent 
> header variables available to your web2py app.  
>
> http_cn : Joe Shmoe
> http_officialemail : jsh...@schmoeland.com
> http_uclalabasuuid : 202e96f3-919f-479e-80e1-9a03f2416b9d
> http_uid : f0007939
>
> For your web2Py app to use this data it is simple variable assignments...
>
> # Load Shibboleth Attributes
> data = request.env
> ucla = Storage()   
> ucla.university_id = data['http_uid']
> ucla.email = data['http_officialemail']
> ...
>  
> # Onward... 
>
> What identity attributes (header variables) are returned are a function of 
> the Shibboleth SP configuration with whatever IDP you are using and what 
> your app needs. Shibboleth handles producing 

[web2py] Re: Problem with wsgihandler.py Apache/Python3

2018-12-30 Thread Massimo Di Pierro
This looks correct. Can you please submit a PR?

On Friday, 7 December 2018 07:47:00 UTC-8, Carl Petersen wrote:
>
> I was able to get web2py up and running by changing the following line 
> (131) in http.py  I don't expect that this was the proper way to do it 
> (especially considering backward compatibility), but at lease it might 
> point out where the issue is:
>
> elif isinstance(body, (str, bytes, bytearray)):
>  if isinstance(body, unicodeT):
>  body = to_bytes(body)
>  return [body]
> elif hasattr(body, '__iter__'):
> return [x.encode('utf-8') for x in body]  - Changed from  
> "return body"
> else:
> body = str(body)
> if isinstance(body, unicodeT):
> body = to_bytes(body)
> return [body]
>  
> I didn't know whether I should just apply to_bytes(body) like the other 
> returns because the other returns were coded "return [body]" instead of 
> "return body".
>
> Thanks
>
> On Friday, December 7, 2018 at 7:50:16 AM UTC-6, Carl Petersen wrote:
>>
>> Hello,
>>
>> I'm having a similar issue.  I'm using Python 3.6.6, mod_wsgi 4.6.5, 
>> Apache 2.4.6 with web2py 2.17.2.
>>
>> I can get to the welcome screen, but as soon as I try to access the admin 
>> application I get the following on my screen:
>>
>> Internal Server Error
>>
>> The server encountered an internal error or misconfiguration and was 
>> unable to complete your request.
>>
>> Please contact the server administrator at root@localhost to inform them 
>> of the time this error occurred, and the actions you performed just before 
>> this error.
>>
>> More information about this error may be available in the server error 
>> log.
>>
>>
>> And this in my apache error_log:
>>
>>  [Fri Dec 07 08:32:14.626246 2018] [mpm_prefork:notice] [pid 30005] 
>> AH00163: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips 
>> mod_wsgi/4.6.5 Python/3.6 configured -- resuming normal operations
>>
>> [Fri Dec 07 08:32:33.572686 2018] [wsgi:error] [pid 30007] [remote 
>> 10.20.100.133:56416] mod_wsgi (pid=30007): Exception occurred processing 
>> WSGI script '/opt/web-apps/web2py/wsgihandler.py'.
>>
>> [Fri Dec 07 08:32:33.572836 2018] [wsgi:error] [pid 30007] [remote 
>> 10.20.100.133:56416] TypeError: sequence of byte string values expected, 
>> value of type str found
>>
>> Any assistance would be greatly appreciated.
>>
>>
>>
>> On Sunday, September 2, 2018 at 1:03:30 PM UTC-5, motionbutterfly wrote:
>>>
>>> Hello, I was wondering if anyone here could help me. I've been migrating 
>>> a web2py application from Python2.7 to Python3.4, this application was 
>>> already being hosted in a webserver with Apache2.4 following the steps in 
>>> the Deployment Recipes chapter of the web2py book. I reconfigured apache to 
>>> run with python 3, and reinstalled mod_wsgi using pip. My problem is that 
>>> as soon as I load my application I get an internal error, and when I click 
>>> on the ticket it shows me "500 Internal Server Error", and when I look up 
>>> the error log for apache this is what comes up: 
>>>
>>> [Thu Aug 23 22:42:17.748139 2018] [wsgi:warn] [pid 2268:tid 
>>> 139927378876288] mod_wsgi: Compiled for Python/3.4.2rc1+.
>>> [Thu Aug 23 22:42:17.748154 2018] [wsgi:warn] [pid 2268:tid 
>>> 139927378876288] mod_wsgi: Runtime using Python/3.4.2.
>>> [Thu Aug 23 22:42:17.896498 2018] [mpm_event:notice] [pid 2268:tid 
>>> 139927378876288] AH00489: Apache/2.4.10 (Debian) OpenSSL/1.0.1t 
>>> mod_wsgi/4.3.0 Python/3.4.2 mod_perl/2.0.9dev Perl/v5.20.2 configured -- 
>>> resuming normal operations
>>> [Thu Aug 23 22:42:17.896584 2018] [core:notice] [pid 2268:tid 
>>> 139927378876288] AH00094: Command line: '/usr/sbin/apache2'
>>> [Thu Aug 23 22:45:29.528373 2018] [wsgi:error] [pid 2272:tid 
>>> 139927187830528] 
>>> [Thu Aug 23 22:45:29.528468 2018] [wsgi:error] [pid 2272:tid 
>>> 139927187830528] 10
>>> [Thu Aug 23 22:45:29.968522 2018] [wsgi:error] [pid 2272:tid 
>>> 139927213033216] Loads pas\xc3\xb3
>>> [Thu Aug 23 22:45:35.289112 2018] [wsgi:error] [pid 2272:tid 
>>> 139927179421440] [remote 186.89.23.145:25178] mod_wsgi (pid=2272): 
>>> Exception occurred processing WSGI script 
>>> '/home/www-data/web2py/wsgihandler.py'.
>>> [Thu Aug 23 22:45:35.289293 2018] [wsgi:error] [pid 2272:tid 
>>> 139927179421440] [remote 186.89.23.145:25178] TypeError: sequence of 
>>> byte string values expected, value of type str found
>>>
>>> Which seems to suggest that the problem is inside the wsgihandler.py 
>>> script, but doesn't point out where. Has this happened to anyone else 
>>> before?
>>>
>>> Thanks in advance for any help.
>>>
>>

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

[web2py] How to put a variable in the A helper?

2018-12-30 Thread Stephan
Hi,
How do I put a variable in the 2a helper? %s does not seem to work within 
{{=A 

// download_file = "https://www.something.zip;

{{=A('Your File', 
callback=URL('tracker',vars=dict(contents=contents.id.id,art='zip')), 
_onclick="window.open('%s');") % (download_file)}} 


Thanks for helping,
Stephan

-- 
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] CAS error

2018-12-30 Thread Massimo Di Pierro
Thanks

On Friday, 7 December 2018 07:15:33 UTC-8, Carlos Cesar Caballero wrote:
>
> Hi Massimo, I am working on a fix, hopefully I will submit a PR soon.
>
> Greetings.
> El 7/12/18 a las 3:03 a.m., Massimo Di Pierro escribió:
>
> can you please open an issue about this?
>
> On Thursday, 29 November 2018 13:51:14 UTC-8, Carlos Cesar Caballero 
> wrote: 
>>
>> Hi guys, after some clean tests, the issue is not happening with Python 
>> 2.7, so it seems to be a Python 3 issue. 
>>
>> Greetings. 
>>
>>
>> El 29/11/18 a las 1:34 p.m., Carlos Cesar Caballero Díaz escribió: 
>> > Hi, I am using the web2py version 
>> > 2.17.2-stable+timestamp.2018.10.06.18.54.02 in Ubuntu Linux, and I am 
>> > not able to use CAS. I have a web2py app as server, an another as 
>> > client, and when client try to log in, the browser starts a redirect 
>> > loop and returns a ERR_TOO_MANY_REDIRECTS error. There are no error 
>> > tickets in client or server apps, and the behavior is happening using 
>> > python 2.7 and 3.6. 
>> > 
>> > I have configured the client just using: 
>> > 
>> > auth = Auth(db, cas_provider = 
>> > 'http://127.0.0.1:8000/welcome/default/user/cas') 
>> > 
>> > I want to authenticate against the welcome app as I have being doing 
>> > with past web2py versions. 
>> > 
>> > Any idea how to fix this? 
>> > 
>> > 
>> > Greetings. 
>> > 
>>
>> -- 
> 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: How to create an administration account (Sahana eden)

2018-12-30 Thread Massimo Di Pierro
Sorry. You need to ask Sahana developers. I know it is built on web2py but 
I am not familiar with the architecture and whether what they define is 
"admin" is the same as a web2py "admin"


On Thursday, 6 December 2018 23:43:37 UTC-8, Muhammad Ahsan Farooqui wrote:
>
>
> Hi,
>
> I have just added an instance of sahana eden. How can I add an admin user 
> to it? I added one user but it is not admin user so I cannot access db etc. 
>
> Please help. 
>
> Ahsan
>

-- 
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 assign a group to a big auth_user list?

2018-12-30 Thread jaimeburstmedia
Hi, hope can help me. I already import and convert a CSV file to auth_user 
with  this code. I don´t know how to automatically assign to a group this 
users when I import the CSV to kardex db? or I need to do it after they are 
all at auth_user db?

The kardex have more than 500 users thats why I need an easy way to assign 
a group to all of them.

Any idea of how to do it?

Thanks

db.define_table('kardex',
Field('first_name'),
Field('last_name'),
Field('email', requires=IS_EMAIL(
error_message='invalid email!')),
Field('password')
)
for kardex in db(db.kardex).select():
db.auth_user.validate_and_insert(
first_name=kardex.first_name, last_name=kardex.last_name, email=kardex.email, 
password=kardex.password)



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