Re: [web2py] Making my binary standalone apps function faster

2018-12-31 Thread Lovedie JC
I'm an amateur but learned that using gpu, docker platforms work well.
Of course some good coding.

On Mon, 31 Dec 2018, 09:09 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.
>

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

2018-12-31 Thread 黄祥
perhaps profiling can help you understand what's going on your app and fix 
it base on that report
pls try web2py efficiency tricks

ref:
http://web2py.com/books/default/chapter/29/13/deployment-recipes#Efficiency-and-scalability

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-31 Thread Pbop
The key thing to understand when using the Shibboleth SP is that you are 
protecting a virtual folder. When you land on that folder, which can also 
be a web2py route, the SP checks to see if you are authenticated and if not 
sends you to the IDP. Only once you are authenticated does the end point 
load. Once authenticated, exposed in the header is identity information 
about the user. It is sort of like Active Directory where once 
authenticated with AD, the header contains the users login id. The 
difference is the identify information in the header is defined by what 
identity attributes the IDP wants to release to the SP and can contain any 
user identity information including login id, employee  number, first name, 
last name, email, department, shoe size... really whatever identity 
information the IDP provides and which it wants to release to the SP. 

In the example below, I am getting a variety of header fields that I know 
the SP is getting. An API call is made to another function that looks the 
user up in an external system and if found redirects the user into that 
system with signed url. If not found, the identity information is used to 
add the person on the fly also to that external system which then lands the 
user into their home page. Either way, our Web2Py app is used very narrowly 
to handle the results of authentication pulling the needed information to 
route the user into this external application either as an existing user or 
as a new user. Truth be told, any technology that can read the browser 
header can be used, but in Web2Py it is ridiculously easy.  

To SAMLize your web2py app go 
to https://wiki.shibboleth.net/confluence/display/SHIB2/Installation and 
download and install the SP to the system of your choice. 

One last thing, testshib.org is no more, and they talk about docker 
containers to download working environments; however, it looks like this 
site is able to do the same thing: https://samltest.id/

I am not sure how much the code snippet will help but here you go. Happy 
New Year All! 

'''
Shibboleth Login Functionality
'''

from gluon.storage import Storage
import datetime, requests, json, traceback

def start():

# Load Shibboleth Attributes
data = request.env
ISU = Storage()

# ISU.university_id = data['HTTP_ISUUNIVERSITYID']
ISU.university_id = data['HTTP_SHIBISUUNIVERSITYID']
ISU.email = data['HTTP_SHIBISUOFFICIALEMAIL']
ISU.name = data['HTTP_SHIBSN']
ISU.firstname = data['HTTP_SHIBGIVENNAME']
ISU.shib_id = data['HTTP_SHIBISULOGONID']
#ISU.university_id = 'foobar'

if (ISU.university_id == '' or ISU.university_id == None) :
ISU.university_id = ''
# Check if we should view debug
if lweb.enable_debug == True:
response.view = 'login/start.html'
else:
response.view = 'login/redirect.html'
error = None
# Check if we have the university id
if (ISU.university_id == '' or ISU.university_id == None) and (ISU.shib_id 
== '' or  ISU.shib_id == None) :
error = 'No Darn University Id found'
return locals()
# Load the client state from ISU
lwebInfo = None
try:
lwebInfo = Storage(getState(ISU.university_id))
except:
error = 'Error loading Remote State from AbilityLMS:%s' % 
traceback.format_exc().replace("\n", '')
return locals()
# Check for errors from LWEB api
if lwebInfo != None:
if lwebInfo.hasError == True:
error = 'Error from AbilityLMS:%s' % lwebInfo.stateObj['debug']
return locals()
elif lwebInfo.stateObj['Result'] == 'INVALIDDATE':
error = 'Invalid Date sent to AbilityLMS API: %s' % 
lwebInfo.stateObj['URL'].split('!~Redhead!~')[1]
return locals()
elif lwebInfo.stateObj['Result'] == 'INVALIDLEARNER':
xLearner_LoginID = 'Learner_LoginID=' + ISU.university_id
xLearner_EmailAddress = '&Learner_EmailAddress=' + ISU.email
xLearner_FirstName = '&Learner_FirstName=' + ISU.firstname
xLearner_LastName = '&Learner_LastName=' + ISU.name
xLearner_ShibLoginID = '&Shib_LoginID=' + ISU.shib_id
xLoginURL = lweb.AbilityLMS_URL + 
'/Programs/Custom/Control/ISU_Register.wml?' + xLearner_LoginID + 
xLearner_EmailAddress + xLearner_LastName + xLearner_ShibLoginID + 
xLearner_FirstName
redirect(xLoginURL + '&remoteST=%s' % lwebInfo.stateObj['ClientState'])

elif lwebInfo.stateObj['Result'] == 'SUCCESS':
redirect(lweb.AbilityLMS_URL + lweb.landing_path + '?remoteST=%s' % 
lwebInfo.stateObj['ClientState'])
else:
error = 'Unkown Error:%s' % BEAUTIFY(lwebInfo)
return locals()
return locals()



On Saturday, December 8, 2018 at 10:37:13 AM UTC-5, 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 AD

[web2py] multiple grids per one page

2018-12-31 Thread Vlad
I just came across a warning that only one grid can be used per a 
controller. 

I wasn't aware of this before, and on one page I have 4 grids which work 
perfectly fine. 

Is it some specific functionality that doesn't work right with multiple 
grids? 

Also, if I specify a unique name (formname parameter?) - does this fix the 
problem or the problem is bigger than that? 

-- 
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: multiple grids per one page

2018-12-31 Thread jonathan . clark
Where is that warning?

I also have multiple grids per page which work well.

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


Re: [web2py] Re: multiple grids per one page

2018-12-31 Thread Eliezer (Vlad) Tseytkin
originally I saw it elsewhere, but have just located it in the book:

Multiple grids per controller function

Because of the way grid works one can only have one grid per controller
function, unless they are embedded as components via LOAD. To make the
default search grid work in more than one LOADed grid, please use a
different formname for each one.

this is from here:
http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid

but given that it works just fine, or at least seems to work - I am
wondering what's the extent of the problem. I don't use ajax or even
different formnames - I simply threw a few grids on the page and didn't
notice anything wrong.

On Mon, Dec 31, 2018 at 7:11 PM  wrote:

> Where is that warning?
>
> I also have multiple grids per page which work well.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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-31 Thread 黄祥
cant access http://testshib.org

following https://wiki.shibboleth.net/confluence/display/SHIB2/IdPInstall 
*not succeed*
docker pull debian
docker run -it debian /bin/bash

apt update
apt install -y default-jdk curl unzip 
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/
curl -L -O -C - http:
//shibboleth.net/downloads/identity-provider/latest/shibboleth-identity-provider-3.4.2.zip
unzip shibboleth-identity-provider-*.zip
shibboleth-identity-provider-*/bin/install.sh
java -jar /opt/shibboleth-idp/war/idp.war

no main manifest attribute, in /opt/shibboleth-idp/war/idp.war

following 
https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLinuxRPMInstall
*not succeed*
docker pull centos
docker run -it centos /bin/bash

cat << EOF > /etc/yum.repos.d/shibboleth.repo
[shibboleth]
name=Shibboleth (CentOS_7)
# Please report any problems to https://issues.shibboleth.net
type=rpm-md
mirrorlist=https://shibboleth.net/cgi-bin/mirrorlist.cgi/CentOS_7
gpgcheck=1
gpgkey=https://shibboleth.net/downloads/service-provider/RPMS/repomd.xml.key
enabled=1
EOF
yum install -y shibboleth
/sbin/service shibd start

Redirecting to /bin/systemctl start shibd.service
Failed to get D-Bus connection: Operation not permitted

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] Upload CSV file though app admin getting an error in 2.17.2

2018-12-31 Thread sandeep patel
Hello All,
I am getting an error while uploading a CSV  file to table though app admin.

[image: error.PNG]


I am using python3.6 and web2py 2.17.2.

Thanks
SP

-- 
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: Upload CSV file though app admin getting an error in 2.17.2

2018-12-31 Thread Dave S
On Monday, December 31, 2018 at 10:17:38 PM UTC-8, sandeep patel wrote:
>
> Hello All,
> I am getting an error while uploading a CSV  file to table though app 
> admin.
>
> [image: error.PNG]
>
>
> I am using python3.6 and web2py 2.17.2.
>
> Thanks
> SP
>


What is the error?

CSV uploads don't automatically display any rows, so the "0 selected" isn't 
an error.

/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: Upload CSV file though app admin getting an error in 2.17.2

2018-12-31 Thread sandeep patel
Please Refer attached image.

Seeing a  flash message from web2py
unable to parse CSV.  iterator should return strings, not bytes (did you
open the file in text mode?)

Thanks


On Tue, Jan 1, 2019 at 12:39 PM Dave S  wrote:

> On Monday, December 31, 2018 at 10:17:38 PM UTC-8, sandeep patel wrote:
>>
>> Hello All,
>> I am getting an error while uploading a CSV  file to table though app
>> admin.
>>
>> [image: error.PNG]
>>
>>
>> I am using python3.6 and web2py 2.17.2.
>>
>> Thanks
>> SP
>>
>
>
> What is the error?
>
> CSV uploads don't automatically display any rows, so the "0 selected"
> isn't an error.
>
> /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.
>

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