[web2py] Authomatic Single sign-on with MS Active Directory

2016-12-14 Thread piero crisci
Hello i am using  correctly the Ldap authentication .
But i was wondering if there was a chance to make authomatic sign on 
without insert the username and password again.
The users infact are on pc on the same domain of the application.
Anyone has a hint to help me with this?

-- 
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: Web2py freezing

2016-10-25 Thread piero crisci
The pool number is set to 10 .
I tried also with 10 worker threads
For what can i see there is something wrong in my app.
The example app and a wizard app are correctly processed.
Also the static pages like .html are fast rendered instead the pages 
rendered by the controller are very slow

default/index
*DYNAMIC PAGE DEFAULT/INDEX*
Server Software:Apache/2.4.23
Server Hostname:10.51.130.53
Server Port:80

Document Path:  /
Document Length:6381 bytes

Concurrency Level:  10
Time taken for tests:   3.454 seconds
Complete requests:  10
Failed requests:1
   (Connect: 0, Receive: 0, Length: 1, Exceptions: 0)
Total transferred:  68429 bytes
HTML transferred:   63809 bytes
*Requests per second:2.90 [#/sec] (mean)*


*STATIC PAGE INDEX.HTML (HELLO WORLD)*


Server Software:Apache/2.4.23
Server Hostname:10.51.130.53
Server Port:80

Document Path:  /Prototipo_RCG/static/downloads/index.html
Document Length:13 bytes

Concurrency Level:  10
Time taken for tests:   0.016 seconds
Complete requests:  10
Failed requests:0
Non-2xx responses:  10
Total transferred:  2640 bytes
HTML transferred:   130 bytes
*Requests per second:639.59 [#/sec] (mean)*
*Time per request:   15.635 [ms] (mean)*
*Time per request:   1.563 [ms] (mean, across all concurrent requests)*
*Transfer rate:  164.89 [Kbytes/sec] received*

It seem application is slow interpreting .pyc files


Il giorno martedì 25 ottobre 2016 10:56:21 UTC+2, mcm ha scritto:
>
> [Fri Oct 21 18:02:29.083973 2016] [mpm_winnt:notice] [pid 620:tid 320] 
> AH00354: Child: Starting 250 worker threads.
>
> This is a ridiculous high number of threads! ;-)
>
> If 10 is the magic number try looking at the pool number in your 
> appconfig.ini.
>
> If you need high concurrency try avoiding threads and use processes, 
> unless you are prepared to avoid mutexes anywhere in your code.
> So you may look into using uwsgi, gunicorn or other webservers that can 
> fork instead of threading.
> Uwsgi can be used alone or coupled with nginx. The latter if you need to 
> serve lots of static contents.
> Keep in mind that *real* concurrency is bound to the number of available 
> cores of your CPUs if you use too many threads and/or too many processes 
> you are going to have troubles if there is any resource 
> contention, synchronization, happening
>
> If all of the above does not work, try using a Linux distribution... and 
> if that problem persists, you need to show us the code!
>
> ciao,
> mic
>
> 2016-10-25 8:56 GMT+02:00 piero crisci >
> :
>
>> Hi massimo and thanks fot the hint
>> I tried with rocket from cmd line and this is result from Apache ab 
>> command line.
>> I got the same result i have with APACHE WSGI as you can see below
>>
>>
>> *MY APP WITH ROCKET *
>> This is the command launch
>> C:\web2py>python web2py.py
>> *No handlers could be found for logger "web2py"*
>> web2py Web Framework
>> Created by Massimo Di Pierro, Copyright 2007-2016
>> *Version 2.14.3-stable+timestamp.2016.03.26.23.02.0*2
>> Database drivers available: sqlite3, imaplib, pyodbc, pymysql, pg8000
>> please visit:
>> http://10.51.130.53/
>> starting browser...
>> please visit:
>> http://10.51.130.53:8080/
>> starting browser...
>>
>>
>> C:\Apache24\bin>ab -n 270 -c 90 -k -s 100 
>> 10.51.130.53:8080/Prototipo_RCG/defaul
>> t/index
>> This is ApacheBench, Version 2.3 <$Revision: 1748469 $>
>> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
>> Licensed to The Apache Software Foundation, http://www.apache.org/
>>
>> Benchmarking 10.51.130.53 (be patient)
>> Completed 100 requests
>> Completed 200 requests
>> Finished 270 requests
>>
>>
>> Server Software:Rocket
>> Server Hostname:10.51.130.53
>> Server Port:8080
>>
>> Document Path:  /Prototipo_RCG/default/index
>> Document Length:6437 bytes
>>
>> Concurrency Level:  90
>> Time taken for tests:   115.700 seconds
>> Complete requests:  270
>> Failed requests:43
>>(Connect: 0, Receive: 0, Length: 43, Exceptions: 0)
>> Keep-Alive requests:0
>> Total transferred:  1856249 bytes
>> HTML transferred:   1737989 bytes
>> *Requests per second:2.33 [#/sec] (mean)*
>> *Time per request:   38566.756 [ms] (mean)*
>> *Time per request:   428.520 [ms] (mean, across all concurrent 
>> requests)*
>> *Transfer rate:  15.67 [Kbytes/sec] received*
>

[web2py] Re: Web2py freezing

2016-10-24 Thread piero crisci
ha 
scritto:
>
> Something is very wrong here and I do not know what it is. Why are you 
> suing apache with WSCGI. This is not a recommended configuration. We do not 
> support Apache any more and we never supported WSCGI. Can you try rocket 
> and nginx?
>
> On Monday, 24 October 2016 10:47:49 UTC-5, piero crisci wrote:
>>
>> I update the version and i tried also on a WINDOWS 7 with the same 
>> configuration.
>> Here is the difference beetwen the WINDOWS SERVER 2012R2 and WINDOWS 7 
>> with the same configuration
>>
>> *APACHE*
>>
>> *Server version: Apache/2.4.23 (Win64)*
>>
>> *Server built:   Oct  1 2016 08:28:43*
>>
>> *Distributed by: The Apache Haus*
>>
>> *Compiled with:  Visual Studio 2008*
>>
>> *Server's Module Magic Number: 20120211:61*
>>
>> *Server loaded:  APR 1.5.2, APR-UTIL 1.5.4*
>>
>> *Compiled using: APR 1.5.2, APR-UTIL 1.5.4*
>>
>> *Architecture:   64-bit*
>>
>> *Server MPM: WinNT*
>>
>> *  threaded: yes (fixed thread count)*
>>
>> *forked: no*
>>
>> *Server compiled with*
>>
>> *-D APR_HAS_SENDFILE*
>>
>> *-D APR_HAS_MMAP*
>>
>> *-D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)*
>>
>> *-D APR_HAS_OTHER_CHILD*
>>
>> *-D AP_HAVE_RELIABLE_PIPED_LOGS*
>>
>> *-D DYNAMIC_MODULE_LIMIT=256*
>>
>> *-D HTTPD_ROOT="/Apache24"*
>>
>> *-D HTTPD_EXEC="/Apache24/bin/httpd.exe"*
>>
>> *-D DEFAULT_PIDLOG="logs/httpd.pid"*
>>
>> *-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"*
>>
>> *-D DEFAULT_ERRORLOG="logs/error.log"*
>>
>> *-D AP_TYPES_CONFIG_FILE="conf/mime.types"*
>>
>> *-D SERVER_CONFIG_FILE="conf/httpd.conf"*
>>
>>  
>>
>> ** The Apache Haus*
>>
>> ** is not affiliated with, or endorsed by, the Apache Software 
>> Foundation.*
>>
>> ** Apache HTTP Server, Apache, and the Apache feather logo are trademarks 
>> of*
>>
>> ** The Apache Software Foundation.*
>>
>>  
>>
>> *PYTHON*
>>
>> *Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit 
>> (AMD64)] on win*
>>
>> *32*
>>
>> *Type "help", "copyright", "credits" or "license" for more information.*
>>
>> *>>> *
>>
>>  
>>
>> EPPURE LE PRESTAZIONI OTTENUTE SONO MOLTO DIVERSE
>>
>> *Di seguito un benchmarking con il comando di APACHE:*
>>
>>  
>>
>> *SERVER  **
>>
>>  
>>
>> *Concurrency Level:  90*
>>
>> *Time taken for tests:   131.909 seconds*
>>
>> *Complete requests:  270*
>>
>> *Failed requests:45*
>>
>> *   (Connect: 0, Receive: 0, Length: 45, Exceptions: 0)*
>>
>> *Keep-Alive requests:0*
>>
>> *Total transferred:  1834657 bytes*
>>
>> *HTML transferred:   1710187 bytes*
>>
>> *Requests per second:2.05 [#/sec] (mean)*
>>
>> *Time per request:   43969.754 [ms] (mean)*
>>
>> *Time per request:   488.553 [ms] (mean, across all concurrent 
>> requests)*
>>
>> *Transfer rate:  13.58 [Kbytes/sec] received*
>>
>>  
>>
>> *MY MACHINE*
>>
>>  
>>
>> Concurrency Level:  90
>>
>> Time taken for tests:   28.872 seconds
>>
>> Complete requests:  2700
>>
>> Failed requests:0
>>
>> Non-2xx responses:  2700
>>
>> Keep-Alive requests:0
>>
>> Total transferred:  820800 bytes
>>
>> HTML transferred:   178200 bytes
>>
>> *Requests per second:93.52 [#/sec] (mean)*
>>
>> *Time per request:   962.384 [ms] (mean)*
>>
>> *Time per request:   10.693 [ms] (mean, across all concurrent 
>> requests)*
>>
>> *Transfer rate:  27.76 [Kbytes/sec] received*
>>
>> Il giorno venerdì 21 ottobre 2016 12:47:48 UTC+2, 黄祥 ha scritto:
>>>
>>> perhaps its easier to give the error log rather than just the 
>>> configuration, learn from a lot of discussion in this forum apache is not 
>>> recommended
>>>
>>> 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: Web2py freezing

2016-10-24 Thread piero crisci


I update the version and i tried also on a WINDOWS 7 with the same 
configuration.
Here is the difference beetwen the WINDOWS SERVER 2012R2 and WINDOWS 7 with 
the same configuration

*APACHE*

*Server version: Apache/2.4.23 (Win64)*

*Server built:   Oct  1 2016 08:28:43*

*Distributed by: The Apache Haus*

*Compiled with:  Visual Studio 2008*

*Server's Module Magic Number: 20120211:61*

*Server loaded:  APR 1.5.2, APR-UTIL 1.5.4*

*Compiled using: APR 1.5.2, APR-UTIL 1.5.4*

*Architecture:   64-bit*

*Server MPM: WinNT*

*  threaded: yes (fixed thread count)*

*forked: no*

*Server compiled with*

*-D APR_HAS_SENDFILE*

*-D APR_HAS_MMAP*

*-D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)*

*-D APR_HAS_OTHER_CHILD*

*-D AP_HAVE_RELIABLE_PIPED_LOGS*

*-D DYNAMIC_MODULE_LIMIT=256*

*-D HTTPD_ROOT="/Apache24"*

*-D HTTPD_EXEC="/Apache24/bin/httpd.exe"*

*-D DEFAULT_PIDLOG="logs/httpd.pid"*

*-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"*

*-D DEFAULT_ERRORLOG="logs/error.log"*

*-D AP_TYPES_CONFIG_FILE="conf/mime.types"*

*-D SERVER_CONFIG_FILE="conf/httpd.conf"*

 

** The Apache Haus*

** is not affiliated with, or endorsed by, the Apache Software Foundation.*

** Apache HTTP Server, Apache, and the Apache feather logo are trademarks 
of*

** The Apache Software Foundation.*

 

*PYTHON*

*Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] 
on win*

*32*

*Type "help", "copyright", "credits" or "license" for more information.*

*>>> *

 

EPPURE LE PRESTAZIONI OTTENUTE SONO MOLTO DIVERSE

*Di seguito un benchmarking con il comando di APACHE:*

 

*SERVER  **

 

*Concurrency Level:  90*

*Time taken for tests:   131.909 seconds*

*Complete requests:  270*

*Failed requests:45*

*   (Connect: 0, Receive: 0, Length: 45, Exceptions: 0)*

*Keep-Alive requests:0*

*Total transferred:  1834657 bytes*

*HTML transferred:   1710187 bytes*

*Requests per second:2.05 [#/sec] (mean)*

*Time per request:   43969.754 [ms] (mean)*

*Time per request:   488.553 [ms] (mean, across all concurrent 
requests)*

*Transfer rate:  13.58 [Kbytes/sec] received*

 

*MY MACHINE*

 

Concurrency Level:  90

Time taken for tests:   28.872 seconds

Complete requests:  2700

Failed requests:0

Non-2xx responses:  2700

Keep-Alive requests:0

Total transferred:  820800 bytes

HTML transferred:   178200 bytes

*Requests per second:93.52 [#/sec] (mean)*

*Time per request:   962.384 [ms] (mean)*

*Time per request:   10.693 [ms] (mean, across all concurrent requests)*

*Transfer rate:  27.76 [Kbytes/sec] received*

Il giorno venerdì 21 ottobre 2016 12:47:48 UTC+2, 黄祥 ha scritto:
>
> perhaps its easier to give the error log rather than just the 
> configuration, learn from a lot of discussion in this forum apache is not 
> recommended
>
> 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: Web2py freezing

2016-10-21 Thread piero crisci
I just checked error logs and i got this:

[Fri Oct 21 18:02:28.797956 2016] [wsgi:warn] [pid 4676:tid 436] mod_wsgi: 
Compiled for Python/2.7.9+.
[Fri Oct 21 18:02:28.798955 2016] [wsgi:warn] [pid 4676:tid 436] mod_wsgi: 
Runtime using Python/2.7.9.
[Fri Oct 21 18:02:28.799957 2016] [mpm_winnt:notice] [pid 4676:tid 436] 
AH00455: Apache/2.4.18 (Win64) mod_wsgi/4.4.6 Python/2.7.9 configured -- 
resuming normal operations
[Fri Oct 21 18:02:28.799957 2016] [mpm_winnt:notice] [pid 4676:tid 436] 
AH00456: Apache Lounge VC14 Server built: Dec  9 2015 11:13:29
[Fri Oct 21 18:02:28.799957 2016] [core:notice] [pid 4676:tid 436] AH00094: 
Command line: 'C:\\Apache24\\bin\\httpd.exe -d C:/Apache24'
[Fri Oct 21 18:02:28.799957 2016] [mpm_winnt:notice] [pid 4676:tid 436] 
AH00418: Parent: Created child process 620
[Fri Oct 21 18:02:29.050971 2016] [wsgi:warn] [pid 620:tid 320] mod_wsgi: 
Compiled for Python/2.7.9+.
[Fri Oct 21 18:02:29.051971 2016] [wsgi:warn] [pid 620:tid 320] mod_wsgi: 
Runtime using Python/2.7.9.
[Fri Oct 21 18:02:29.083973 2016] [mpm_winnt:notice] [pid 620:tid 320] 
AH00354: Child: Starting 250 worker threads.
[Fri Oct 21 18:02:57.639608 2016] [wsgi:error] [pid 620:tid 2416] No 
handlers could be found for logger "web2py"
Debugging i got just this error:
(OS 64)The specified network name is no longer available. : AH00341: 
winnt_accept: Asynchronous AcceptEx failed. 

Can' t understand why app is freezing. I just thinking is somenthing due to 
sessions or too much ajax calls




Il giorno venerdì 21 ottobre 2016 12:47:48 UTC+2, 黄祥 ha scritto:
>
> perhaps its easier to give the error log rather than just the 
> configuration, learn from a lot of discussion in this forum apache is not 
> recommended
>
> 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] Web2py freezing

2016-10-21 Thread piero crisci
Hello i am having problems with my web2py configuration using APACHE WSCGI 

I am using this configuration:
 - Windows Server 2012 R2
 - Mysql 5.7
 - Python 2.7.9
 - Apache 2.4

With more of 10 connection the application is freezing. I am not having 
answer  from the web server and all is stopped.
I m not sure why this is happening.

Anyone can help? 
If more info are needed let me Know

-- 
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.
#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see 
# http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/access_log"
# with ServerRoot set to "/usr/local/apache2" will be interpreted by the
# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" 
# will be interpreted as '/logs/access_log'.
#
# NOTE: Where filenames are specified, you must use forward slashes
# instead of backslashes (e.g., "c:/apache" instead of "c:\apache").
# If a drive letter is omitted, the drive on which httpd.exe is located
# will be used by default.  It is recommended that you always supply
# an explicit drive letter in absolute paths to avoid confusion.

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used.  If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "c:/Apache24"

#
# Mutex: Allows you to set the mutex mechanism and mutex file directory
# for individual mutexes, or change the global defaults
#
# Uncomment and change the directory if mutexes are file-based and the default
# mutex file directory is not on a local disk or is not appropriate for some
# other reason.
#
# Mutex default:logs

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the 
# directive.
#
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
Listen 443
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule auth_form_module modules/mod_auth_form.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_core_module modules/mod_authn_core.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_socache_module modules/mod_authn_socache.so
#LoadModule authnz_fcgi_module modules/mod_authnz_fcgi.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule authz_core_module modules/mod_authz_core.so
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modu

[web2py] SQLFORM.grid Search None value on a field

2016-01-22 Thread piero crisci
Hi 
I am using SQLFORM.grid of last version of web2py with MYSQL.
I would like to see all row of a table with a None value in a "Date" field.
SQLFORM.grid set the query in this format *db.t_tablename.f_datefield = ""* 
.
The query is converted in this MYSQL where condition:

   - AND t_tablename.f_datefield = NULL

Instead of :

   - AND t_tablename.f_datefield is  NULL

How can i solve this problem?
Thank for 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 from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] SQLFORM.grid and jQuery-bootgrid help

2016-01-17 Thread piero crisci
Hi
I am new using jQuery and not very skilled in general with Javascript.
I am using the Basic Jquery Bootgrid example 
on a SQLFORM.grid and it worked 
fine, except for one thing.
One of the TD column contains a "Server Generated link" with 
user_signature. 
Using Bootgrid the TD column html is converted into string.
I recreated the link with the javascript as showed in the examples but I 
would like to use the link created from server side. 
Anyone using the bootgrid knows if there is a property that i can use to 
let Jquery Bootgrid not modify the link rendered by the server?

Here is an example of what I did (3rd TD tag)



ID
Sender
Received




10238
x...@pingpong.com 
http://www.google.com/>?book=Pippo&signature=32hih327dsa*">Book



I would like to keep the red link is it possible?

Thanks for help
Kind Regards
Piero

-- 
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] Modal Class

2015-12-22 Thread piero crisci
Goodmornig
I am not a developer but I tryed to modify the modal class I found  at 
http://linuxapuntes.blogspot.it/2013/03/plugin-modal-bootstrap-web2py.html
It only create a Div based on bootstrap 3 version for modal box, a close 
button and a create button.
If you pass an url to create button it also load the content of the url via 
"ajax".
Hope it can be a good solution to help load content in boxes  . It also 
work with SQLFORM, SQLFORM.grid.


In the controller you can set :


def render_grid():
from modal_dialog import Modal
modal = Modal('', '', 'Label Modal', 'Area',class_btn='icon magnifier 
icon-edit glyphicon glyphicon-edit')
div_modal = DIV(modal.div_modal(''),modal_view.div_modal(''))
links = [lambda row:  DIV(modal.create_btn(URL(f='render_form', 
args=row.id)) ,) ]
grid = DIV(SQLFORM.grid(query=query, fields=fields,links=links, 
onupdate=False,  maxtextlength=200, 
user_signature=True,showbuttontext=False,

searchable=True,deletable=False,details=False,editable=False,create = 
False, csv =True,sortable=True))

return dict(grid = grid,div_modal=div_modal)


def render_form():
id_args= request.args(0) or redirect(URL('blank_comunicazione'))
form = crud.read(db.table, id_args)
return form 

Hope it helps.
Merry Christmas

-- 
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.
from gluon.html import A, DIV, H3, BUTTON, OPTION, TAG, I, XML, URL 
from gluon.sqlhtml import SQLFORM
from gluon.http import HTTP
from gluon import current
import uuid
from gluon.compileapp import LOAD

class Modal(object):
def __init__(self,  value, title_btn, title_modal,field, onclose='', class_btn ="icon-plus-sign"):
self.field = field
self.value = value
self.title_btn = title_btn
self.title_modal = title_modal
if self.field:
self.key = str(self.field).replace('.', '_')
else:
self.key = str(uuid.uuid4())

self.class_btn = class_btn
self.modal_id = 'modal_%s' % self.key
self._target = "c_" + self.key
self.request = current.request
self.response = current.response
self.session = current.session
self.onclose = onclose


def btn_close(self):
 # Button to trigger modal .
btn_close_modal = BUTTON("Chiudi", **{"_class": "btn",
 "_data-dismiss": "modal",
 "_aria-hidden": "true",
 "_onclick":"$('#contet_modal_%s').empty()"%self.modal_id,
 })
return btn_close_modal


def div_modal(self, content_modal):
div_modal = DIV(DIV(DIV(
 DIV(
 DIV(H3(self.title_modal, _id="myModalLabel"),_class="modal-title"),
 _class="modal-header"),
 DIV(content_modal, _class="modal-body", _id="contet_modal_%s" %self.modal_id),
 DIV(self.btn_close(),_class="modal-footer",),
_class="modal-content"),
 _class="modal-dialog modal-lg"),
 **{"_id": "%s" % self.modal_id,
"_class": "modal fade",
"_tabindex": "-1",
"_role": "dialog",
"_aria-hidden": "true",
"_aria-labelledby": "myModalLabel"}
 )
return div_modal


def create_btn(self,url=''):
btn_show_modal = A(self.title_btn,BUTTON(I(_class=self.class_btn)),_onclick="$('#%s').modal('show')"%self.modal_id, _href=url,cid='contet_modal_%s' % self.modal_id,
   **{"_class": "btn btn-link","_role": "button","_title": self.title_btn})
return btn_show_mod

[web2py] Re: How to implement Gmail Authentication

2015-04-09 Thread piero crisci
First of all you need to get the *google_auth.json file to use OAuth*
To get that you need to register your Google account as a webdeveloper
You can find how get the information on Google :)
 
Then u can change ur auth table  in this way
 
In the model.py
 
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db,secure=True)
crud, service, plugins = Crud(db), Service(), PluginManager()
## TABELLE USER --- ##
## create all tables needed by auth if not custom tables
auth.settings.extra_fields['auth_user']= [
  Field('phone', type='string', label='Telefono'),
  Field('country',type='string', label='Nazione'),
  Field('city',type='string', label='Città'),
  Field('address',type='string', label='Indirizzo'),
  Field('auth_login', type='string', default='basic', label='Tipo 
Login',readable=False, writable=False),
  Field('url_img', requires=IS_EMPTY_OR(IS_URL()), label='Link Immagine 
Profile',readable=False, writable=False),
  Field('nickname',  type='string', label='Nickname'),
  Field('birthdate',  type='date', label='Data Di nascita'),
  Field('gender', type = 'string', label='Genere' ,requires = 
IS_IN_SET(['M','F']), default = 'M'),
  Field('facebook_id', type='string', label='Username di 
Facebook',readable=False, writable=False),
  Field('twitter_id',  type='string', label='Username di 
Twitter',readable=False, writable=False),
  Field('google_id',  type='string', label='Username di 
Google',readable=False, writable=False ),
  Field('linkedin_id',  type='string', label='Username di 
Linkedin',readable=False, writable=False),
  ]
auth.define_tables(username=False, signature=True)
 
*In The Controller*
 
Import AccountAccess
def google():
if auth.is_logged_in():
redirect(URL(r=request, c='default', f='index'))
folder = request.folder
google_access = AccountAccess.GoogleAccount(folder)
auth.settings.login_form=google_access
 
return auth.login(next=URL(r=request, c='default', f='index'))
 
 
In the Module section
Create the *AccountAccess* module

import oauth2 as oauth
from gluon.contrib.login_methods.oauth10a_account import OAuthAccount as 
OAuthAccount10a
from gluon.contrib.login_methods.oauth20_account import OAuthAccount
from oauthtwitter_account import OAuthAccount as OauthAccountTwitter
import os
import storage
import urllib2
from oauth2 import Client, Consumer, Token

class GoogleAccount(OAuthAccount):
"OAuth 2.0 for Google"
def __init__(self,db,session,request,response,folder):
with open(os.path.join(folder, *'private/google_auth.json'*), 'rb') 
as f:
gai = storage.Storage(json.load(f)['web'])
self.db = db
self.request = request
self.response = response
self.session = session
g = dict(
request=request,
response=response,
session=session,
)
OAuthAccount.__init__(self,g, gai.client_id, gai.client_secret,
  gai.auth_uri, gai.token_uri,
  
scope='https://www.googleapis.com/auth/userinfo.profile 
https://www.googleapis.com/auth/userinfo.email 
https://www.googleapis.com/auth/plus.login',
  approval_prompt='auto',
  access_type = 'offline',
  state="auth_provider=google")
def get_user(self):
token = self.accessToken()
if not token:
return None
uinfo_url = 
'https://www.googleapis.com/oauth2/v1/userinfo?access_token=%s' % 
urllib2.quote(token, safe='')
uinfo = None
try:
uinfo_stream = urllib2.urlopen(uinfo_url)
except:
session.token = None
return None
data = uinfo_stream.read()
uinfo = json.loads(data)
username = uinfo['id']
if uinfo:
gender = 'M'
if uinfo['gender'][0].lower() == 'f':
gender = 'F'
existent = self.db(self.db.auth_user.email == 
uinfo["email"]).select(self.db.auth_user.id,self.db.auth_user.auth_login).first()
if existent:
if existent.auth_login <> 'Google':
diz_account = dict(
 username = uinfo['email'],
 gender = gender,
 auth_login = 'Google',
 url_img = uinfo.get('picture', ''),
 google_id = uinfo['id'],
 registration_id = uinfo['id']
)
existent.update_record(**diz_account)
return dict(first_name = uinfo.get('given_name', 
uinfo["name"].split()[0]),
last_name = uinfo.get('family_name', 
uinfo["name"].split()[-1]),
username = uinfo['email'],
email = uinfo['email'],
gender = gender,
 

Re: [web2py] Re: a very selfish request

2014-10-11 Thread piero crisci
I Made it too! Hope it will help 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] Web2py ajax call and Angularjs

2014-09-16 Thread piero crisci
I am testing angularjs with web2py.
In my web2py i have some ajax call that store the html code into a dialog 
box.
Now i would like to insert in html code from the callback some angularjs 
code.
But because ajax call is not into angular module , the code is not running.
The angular MVC work instead properly into main pages.
Anyone is trying the same thing  or got some hints for me?.
I cannot find any examples of how use web2py ajax (or jquer ajax) with 
angularjs

-- 
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] OAUTH - FACEBOOK - IMAGE PROFILE ACCOUNT

2014-08-25 Thread piero crisci
Hi all
I am trying to get Facebook user url photo profile .

With google Api i can get from user['picture'] but can manage how get in 
Facebook. It seem to be in the basic information from Facebook 
documentation but i can' t manage to retrieve it
this is what i wrote in my module (not in model)

class FaceBookAccount(OAuthAccount):
"""OAuth impl for FaceBook"""
AUTH_URL="https://graph.facebook.com/oauth/authorize";
TOKEN_URL="https://graph.facebook.com/oauth/access_token";

def __init__(self,db,client_id,client_secret, session,request,response):
self.db = db
self.request = request
self.response = response
self.session = session

g = dict(GraphAPI=GraphAPI,
 GraphAPIError=GraphAPIError,
 request=request,
 response=response,
 session=session,
 )

self.client_id = client_id,
self.client_secret = client_secret
OAuthAccount.__init__(self, g, client_id, client_secret,
  self.AUTH_URL, self.TOKEN_URL,
  scope='email',
  state="auth_provider=facebook",
  display='popup')
self.graph = None

def get_user(self):
'''Returns the user using the Graph API.
'''
if not self.accessToken():
return None

if not self.graph:
self.graph = GraphAPI((self.accessToken()))

user = None
try:
user = self.graph.get_object("me")
except GraphAPIError, e:
session.token = None
self.graph = None

if user:
if not user.has_key('username'):
username = user['id']
else:
username = user['username']
gender = 'M'
if user['gender'][0].lower() == 'f':
gender = 'F'

existent = self.db(self.db.auth_user.email == 
user["email"]).select(self.db.auth_user.id).first()
try:
data = user['picture']['data']['url']
except:
data = ''
if existent:
diz_account = dict(
 gender = gender,
 auth_login = 'Facebook',
 url_img = user.get('picture', data),
 birthdate = user.get('birthday', ''),
 facebook_id = user['id'],
 registration_id = user['id']
)
existent.update_record(**diz_account)

return dict(first_name = user.get('first_name', 
user["name"].split()[0]),
last_name = user.get('last_name', 
user["name"].split()[-1]),
username = user['email'],
email = user['email'],
gender = gender,
url_img = user.get('picture', ''),
auth_login = 'Facebook',
birthdate = user.get('birthday', ''),
facebook_id = user['id'],
registration_id = user['id']
)

else:
if not user.has_key('email'):
email = '%s.fakemail' %(user['id'])
else:
email = user['email']

return dict(first_name = user['first_name'],
last_name = user['last_name'],
username = '%s' %(email),
gender = gender,
url_img = user.get('picture', ''),
auth_login = 'Facebook',
birthdate = user.get('birthday', ''),
registration_id = user['id'],
email = '%s' %(email) )

-- 
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] Facebook OAuth - newbie question

2014-08-25 Thread piero crisci
You can try this

Modify in
#default.py

def user():
if auth.is_logged_in() and request.args[0] == 'login':
return redirect(URL('default','index'))
elif  auth.is_logged_in() == False and request.args[0] == 'login':
if  request.args[1] == 'facebook':
facebook_login = AccountAccess.FaceBookAccount()
facebook_login.login_url('/user/login/facebook')
auth.settings.login_form=facebook_login

form = auth()

return dict(form=form)


Il giorno venerdì 8 agosto 2014 05:24:11 UTC+2, lyn2py ha scritto:
>
> Ok, I have figured out why it didn't work for me.
>
> It's because I put the code in user/login/facebook, when I should have 
> just used user/login. Because the request.vars.code goes to user/login, it 
> is unable to read when I put the code in the former.
>
> It has created the user and it has logged me in, so all is good now. Now I 
> just need to figure out how to have Facebook login and the Web2py login 
> together...
>
>
>
> On Friday, August 8, 2014 11:10:06 AM UTC+8, lyn2py wrote:
>>
>> I looked through the code gluon.contrib.login_methods.oauth20_account and 
>> just banged out something to test in the module for the Facebook class.
>>
>> from gluon import current
>> print current.request.vars #gave 
>>
>>
>> Looks like it isn't getting the request.vars.code it's supposed to get...
>>
>>
>> On Friday, August 8, 2014 10:50:53 AM UTC+8, lyn2py wrote:
>>>
>>> Good one Michele!
>>>
>>> This was what I did:
>>>
>>> if not self.accessToken():
>>> print 'no accesstoken'
>>> return None
>>>
>>> No accessToken(), what then should I do? Or where should I consult?
>>>
>>> On Friday, August 8, 2014 5:40:09 AM UTC+8, Michele Comitini wrote:

 Could be a session problem.
 Check that your session is created and works across page reloads.

 Also check the get_user() method there could be some error raised there 
 (most likely by the GraphApi),  use the debugger or simply put some 
 logging 
 statements to see what's going on

 I had also troubles with https not properly setup on my side so check 
 that too


 2014-08-07 19:37 GMT+02:00 lyn2py :

> Hello, 
>
> I have setup the code for FB oauth per web2py book here:
> http://web2py.com/books/default/chapter/29/09/access-control
>
> The code here:
>
> ## Define oauth application id and secret.
>
> FB_CLIENT_ID='xxx'
> FB_CLIENT_SECRET=""
>
> ## import required modules
> try:
> import json
> except ImportError:
> from gluon.contrib import simplejson as json
> from facebook import GraphAPI, GraphAPIError
> from gluon.contrib.login_methods.oauth20_account import OAuthAccount
>
>
> ## extend the OAUthAccount class
> class FaceBookAccount(OAuthAccount):
>
> """OAuth impl for FaceBook"""
> AUTH_URL="https://graph.facebook.com/oauth/authorize";
>
> TOKEN_URL="https://graph.facebook.com/oauth/access_token";
>
> def __init__(self):
>
> OAuthAccount.__init__(self, None, FB_CLIENT_ID, FB_CLIENT_SECRET,
>
>   self.AUTH_URL, self.TOKEN_URL,
>
>   scope='email,user_about_me,user_activities, 
> user_birthday, user_education_history, user_groups, user_hometown, 
> user_interests, user_likes, user_location, user_relationships, 
> user_relationship_details, user_religion_politics, user_subscriptions, 
> user_work_history, user_photos, user_status, user_videos, 
> publish_actions, friends_hometown, friends_location,friends_photos',
>
>   state="auth_provider=facebook",
>   display='popup')
>
> self.graph = None
>
> def get_user(self):
>
> '''Returns the user using the Graph API.
> '''
> if not self.accessToken():
>
> return None
>
> if not self.graph:
>
> self.graph = GraphAPI((self.accessToken()))
>
> user = None
> try:
>
> user = self.graph.get_object("me")
>
> except GraphAPIError, e:
>
> session.token = None
>
> self.graph = None
>
> if user:
> if not user.has_key('username'):
>
> username = user['id']
>
> else:
> username = user['username']
>
> 
> if not user.has_key('email'):
>
> email = '%s.fakemail' %(user['id'])
>
> else:
> email = user['email']
>
> return dict(first_name = user['first_name'],
>
> last_name = user['last_name'],
>>

[web2py] Re: angularjs and web2py gluon.html elements

2014-08-08 Thread piero crisci
Yes i just did it :)

{=DIV('[[greeting.text]]',**{'_ng-controller':'HelloController',})}}
It works. 

Il giorno venerdì 8 agosto 2014 17:00:42 UTC+2, Niphlod ha scritto:
>
> dicts in python can't acced a key that holds '-' with that syntax.
>
> that being said, you can use the other one **{{'_ng-controller': 
> 'blablabla'}}
>
> On Friday, August 8, 2014 4:50:12 PM UTC+2, piero crisci wrote:
>>
>> Hello i am trying to use angular js with web2py.
>> I would like to use gluon.html for render the html elements but i am 
>> having some problem .
>> I modified angular js to use "[[" and "]]" as symbols.
>>
>> If i wrote the html code  using normal tag the page is normally working:
>>
>> 
>>   [[greeting.text]], World
>> 
>>
>> I would like to change the html view in this way:
>> *{{=DIV('[[greeting.text]] ', 'World', _ng-controller = 
>> 'HelloController')}}*
>>
>> The problem is using the char "-" as attribute of the DIV element 
>> attribute gives the following error
>>
>>
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>>
>> Traceback (most recent call last):
>>   File "C:\web2py\gluon\restricted.py", line 219, in restricted
>> ccode = compile2(code, layer)
>>   File "C:\web2py\gluon\restricted.py", line 202, in compile2
>> return compile(code.rstrip().replace('\r\n', '\n') + '\n', layer, 'exec')
>>   File "C:\web2py\applications\XX\views\default/helloworld.html", line 
>> 105
>> 
>> SyntaxError: keyword can't be an expression
>>
>> Any clue how i can solve this problem?
>> Thank for 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 from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] angularjs and web2py gluon.html elements

2014-08-08 Thread piero crisci
Hello i am trying to use angular js with web2py.
I would like to use gluon.html for render the html elements but i am having 
some problem .
I modified angular js to use "[[" and "]]" as symbols.

If i wrote the html code  using normal tag the page is normally working:


  [[greeting.text]], World


I would like to change the html view in this way:
*{{=DIV('[[greeting.text]] ', 'World', _ng-controller = 
'HelloController')}}*

The problem is using the char "-" as attribute of the DIV element attribute 
gives the following error


2.
3.
4.
5.
6.
7.
8.
9.

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 219, in restricted
ccode = compile2(code, layer)
  File "C:\web2py\gluon\restricted.py", line 202, in compile2
return compile(code.rstrip().replace('\r\n', '\n') + '\n', layer, 'exec')
  File "C:\web2py\applications\XX\views\default/helloworld.html", line 105

SyntaxError: keyword can't be an expression

Any clue how i can solve this problem?
Thank for 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 from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] pysimplesoap help

2014-03-19 Thread piero crisci
Yes it works!

Il giorno mercoledì 19 marzo 2014 17:51:42 UTC+1, Mariano Reingart ha 
scritto:
>
> Sorry, I forgot the underscore in http_headers in "the set th cookie" part
>
> *client.http_headers['Cookie'] = client.response['set-cookie']*
>
> Regards,
>
> Mariano Reingart
> http://www.sistemasagiles.com.ar
> http://reingart.blogspot.com
>
>
> On Wed, Mar 19, 2014 at 1:50 PM, Mariano Reingart 
> 
> > wrote:
>
>> This should work:
>>
>> *# call the autentication remote method:*
>>
>>  
>> *client.call('init',('host','localhost'),('port','4859'),('user','CRSPRIX),('password',''),('pnumber',''),('db','XX'),('encoding',None),('titlePageSize',10),('indexPageSize',10))
>>  
>> *
>>
>> *# set the cookie*
>>
>>  *client.http headers['Cookie'] = client.response['set-cookie']*
>>
>> *# call the methods that need the cookie:*
>>
>> *client.call('executeQuery',('query','[/doc/@nrecord]=00503459'))*
>>
>> Please confirm if that work, so I can add it to pysimplesoap library
>>
>> Best regards,
>>
>>
>> Mariano Reingart
>> http://www.sistemasagiles.com.ar
>> http://reingart.blogspot.com
>>
>>
>> On Wed, Mar 19, 2014 at 12:29 PM, piero crisci 
>> 
>> > wrote:
>>
>>> *this is the client obj*
>>> client = SoapClient(
>>> location=location_wsdl,
>>> wsdl=wsdl,
>>> ns = ns,
>>> sessions=True,
>>> trace=True, 
>>> http_headers={'Authorization': "Basic %s" % 
>>> auth},username=username,password=password)
>>> client['AuthHeaderElement'] = {'Authorization': "Basic %s" % auth}
>>> client['http_header'] = {'Authorization': "Basic %s" % auth}
>>>
>>> *This is the the 'init' call*
>>>
>>> client.call('init',('host','localhost'),('port','4859'),('user','CRSPRIX),('password',''),('pnumber',''),('db','XX'),('encoding',None),('titlePageSize',10),('indexPageSize',10))
>>>  
>>> *And this is the 'init' response*
>>>
>>> {'status': '200', 'transfer-encoding': 'chunked', 'set-cookie': 
>>> 'JSESSIONID=4EDBE009B6A581E6023B9203365BF1EC; Path=/3diws', 'server': 
>>> 'Apache-Coyote/1.1', 'date': 'Wed, 19 Mar 2014 15:23:24 GMT', 
>>> 'content-type': 'text/xml;charset=utf-8'}
>>>
>>> *This is the the 'executeQuery' call*
>>> client.call('executeQuery',('query','[/doc/@nrecord]=00503459'))
>>>
>>> *This is the response to the 'ExecuteQuery' call*
>>> {'status': '500', 'transfer-encoding': 'chunked', 'set-cookie': 
>>> 'JSESSIONID=ECC4905C2D52F7456F4968E2C30D6639; Path=/3diws', 'server': 
>>> 'Apache-Coyote/1.1', 'connection': 'close', 'date': 'Wed, 19 Mar 2014 
>>> 15:25:26 GMT', 'content-type': 'text/xml;charset=utf-8'}
>>>
>>>
>>>
>>> Il giorno mercoledì 19 marzo 2014 15:25:45 UTC+1, Mariano Reingart ha 
>>> scritto:
>>>>
>>>> Could you send me the content of client.response (http headers)?
>>>> Maybe it is returning a cookie or something equivalent 
>>>> Then, you can update client.http_headers with them and it should work
>>>>
>>>> Best regards,
>>>>
>>>> Mariano Reingart
>>>> http://www.sistemasagiles.com.ar
>>>> http://reingart.blogspot.com
>>>>
>>>>
>>>> On Wed, Mar 19, 2014 at 7:40 AM, piero crisci wrote:
>>>>
>>>>> Hi mariano i still got some problem
>>>>> I solved the problem with the basic authentication but i still have 
>>>>> some problem on calling webservice.
>>>>> The webservice infact need a first call for the db connection ('init' )
>>>>> After this call you can call the other services.
>>>>&g

Re: [web2py] pysimplesoap help

2014-03-19 Thread piero crisci
*this is the client obj*
client = SoapClient(
location=location_wsdl,
wsdl=wsdl,
ns = ns,
sessions=True,
trace=True, 
http_headers={'Authorization': "Basic %s" % 
auth},username=username,password=password)
client['AuthHeaderElement'] = {'Authorization': "Basic %s" % auth}
client['http_header'] = {'Authorization': "Basic %s" % auth}

*This is the the 'init' call*
client.call('init',('host','localhost'),('port','4859'),('user','CRSPRIX),('password',''),('pnumber',''),('db','XX'),('encoding',None),('titlePageSize',10),('indexPageSize',10))
 
*And this is the 'init' response*

{'status': '200', 'transfer-encoding': 'chunked', 'set-cookie': 
'JSESSIONID=4EDBE009B6A581E6023B9203365BF1EC; Path=/3diws', 'server': 
'Apache-Coyote/1.1', 'date': 'Wed, 19 Mar 2014 15:23:24 GMT', 
'content-type': 'text/xml;charset=utf-8'}

*This is the the 'executeQuery' call*
client.call('executeQuery',('query','[/doc/@nrecord]=00503459'))

*This is the response to the 'ExecuteQuery' call*
{'status': '500', 'transfer-encoding': 'chunked', 'set-cookie': 
'JSESSIONID=ECC4905C2D52F7456F4968E2C30D6639; Path=/3diws', 'server': 
'Apache-Coyote/1.1', 'connection': 'close', 'date': 'Wed, 19 Mar 2014 
15:25:26 GMT', 'content-type': 'text/xml;charset=utf-8'}



Il giorno mercoledì 19 marzo 2014 15:25:45 UTC+1, Mariano Reingart ha 
scritto:
>
> Could you send me the content of client.response (http headers)?
> Maybe it is returning a cookie or something equivalent 
> Then, you can update client.http_headers with them and it should work
>
> Best regards,
>
> Mariano Reingart
> http://www.sistemasagiles.com.ar
> http://reingart.blogspot.com
>
>
> On Wed, Mar 19, 2014 at 7:40 AM, piero crisci 
> 
> > wrote:
>
>> Hi mariano i still got some problem
>> I solved the problem with the basic authentication but i still have some 
>> problem on calling webservice.
>> The webservice infact need a first call for the db connection ('init' )
>> After this call you can call the other services.
>> I made this code :
>>  
>> from pysimplesoap.client import SoapClient
>> from pysimplesoap.client import SoapClient, SimpleXMLElement
>> location_wsdl = " *http://docway.demo.3di.it <http://docway.demo.3di.it>*
>> /3diws/services/eXtraWay<http://docway.demo.3di.it/3diws/services/eXtraWay>
>> "
>> wsdl =  *http://docway.demo.3di.it/ <http://docway.demo.3di.it/>*
>> /3diws/services/eXtraWay?wsdl<http://10.55.38.247:8080/3diws/services/eXtraWay?wsdl>
>> "
>> namespace_wsdl = " 
>> *http://docway.demo.3di.it/*<http://www.google.com/url?q=http%3A%2F%2Fdocway.demo.3di.it%2F3diws%2Fservices%2FeXtraWay%3Fwsdl&sa=D&sntz=1&usg=AFQjCNFAe47af7Nlfx1k8KJR8x-hsRTOAg>
>> 3diws/services/eXtraWay<http://10.55.38.247:8080/3diws/services/eXtraWay>
>> "
>> import base64
>> username='admin'
>> password=''
>>
>> auth = base64.b64encode('%s:%s' % (username, password))
>> client = SoapClient(location = location_wsdl, 
>> wsdl=wsdl,*sessions=True,*namespace=namespace_wsdl, 
>> http_headers={'Authorization': "Basic %s" % 
>> auth},username=username,password=password)
>> client['AuthHeaderElement'] = {'Authorization': "Basic %s" % auth}
>>
>> client.send('init',xml=xml_init)
>> client.send('executeQuery',xml=xml_execute_query)
>> When i call the 'executeQuery' i got as response that the connection is 
>> not established. The connection should be established with the 'Init' 
>> call . 
>> I got the same problem with SOAPUI but i managed to solve the problem 
>> activating the option "Maintain HTTP Session"
>> Even putting sessions = True is not solving the problem
>> Thank for help 
>> Piero
>>
>> Il giorno martedì 18 marzo 2014 07:26:35 UTC+1, Mariano Reingart ha 
>> scritto:
>>
>>> Hi piero:
>>>
>>> The first choice to connect to a webservice that requires username & 
>>> password (add_credentials), you will httplib2 installed:
>>>
>>> https:/

Re: [web2py] pysimplesoap help

2014-03-19 Thread piero crisci
Hi mariano i still got some problem
I solved the problem with the basic authentication but i still have some 
problem on calling webservice.
The webservice infact need a first call for the db connection ('init' )
After this call you can call the other services.
I made this code :
 
from pysimplesoap.client import SoapClient
from pysimplesoap.client import SoapClient, SimpleXMLElement
location_wsdl = " 
*http://docway.demo.3di.it*/3diws/services/eXtraWay<http://docway.demo.3di.it/3diws/services/eXtraWay>
"
wsdl =  
*http://docway.demo.3di.it/*/3diws/services/eXtraWay?wsdl<http://10.55.38.247:8080/3diws/services/eXtraWay?wsdl>
"
namespace_wsdl = " 
*http://docway.demo.3di.it/*<http://www.google.com/url?q=http%3A%2F%2Fdocway.demo.3di.it%2F3diws%2Fservices%2FeXtraWay%3Fwsdl&sa=D&sntz=1&usg=AFQjCNFAe47af7Nlfx1k8KJR8x-hsRTOAg>
3diws/services/eXtraWay <http://10.55.38.247:8080/3diws/services/eXtraWay>"
import base64
username='admin'
password=''
auth = base64.b64encode('%s:%s' % (username, password))
client = SoapClient(location = location_wsdl, 
wsdl=wsdl,*sessions=True,*namespace=namespace_wsdl, 
http_headers={'Authorization': "Basic %s" % 
auth},username=username,password=password)
client['AuthHeaderElement'] = {'Authorization': "Basic %s" % auth}

client.send('init',xml=xml_init)
client.send('executeQuery',xml=xml_execute_query)
When i call the 'executeQuery' i got as response that the connection is not 
established. The connection should be established with the 'Init' call . 
I got the same problem with SOAPUI but i managed to solve the problem 
activating the option "Maintain HTTP Session"
Even putting sessions = True is not solving the problem
Thank for help 
Piero

Il giorno martedì 18 marzo 2014 07:26:35 UTC+1, Mariano Reingart ha scritto:

> Hi piero:
>
> The first choice to connect to a webservice that requires username & 
> password (add_credentials), you will httplib2 installed:
>
> https://code.google.com/p/httplib2
>
> Then you could do:
>
> client = SoapClient(location = location_wsdl,sessions=True,
> username='admin',password='xx')
>
> Also, assuming your webservice supports basic auth, you could pass the 
> Authentication http header directly (it shouldn't need to install external 
> library):
>
> import base64
> auth = base64.b64encode('%s:%s' % (username, password)).replace('\n', '')
>
> client = SoapClient(location = location_wsdl, sessions=True, 
> http_headers={'Authorization': "Basic %s" % auth})
>
> Let me know if this solves your issue,
>
> Best regards
>
>
> Mariano Reingart
> http://www.sistemasagiles.com.ar
> http://reingart.blogspot.com
>
>
> On Mon, Mar 17, 2014 at 6:02 PM, piero crisci 
> 
> > wrote:
>
>> Hello i am trying to connect to this wsdl: 
>> http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl 
>> It requires http basic authentication  and i am using pysimplesoap 1.10 
>> and i tried this configuration:
>>
>> from pysimplesoap.client import SoapClient
>> location_wsdl = "http://docway.demo.3di.it/3diws/services";
>> wsdl = "http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl";
>> client = SoapClient(location = 
>> location_wsdl,sessions=True,http_headers={'username': 'admin', 'password': 
>> ''},username='admin',password='xx')
>>
>> I got this error
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File "build\bdist.win32\egg\pysimplesoap\client.py", line 133, in 
>> __init__
>>   File "build\bdist.win32\egg\pysimplesoap\client.py", line 469, in 
>> wsdl_parse
>>   File "build\bdist.win32\egg\pysimplesoap\helpers.py", line 71, in fetch
>>   File "build\bdist.win32\egg\pysimplesoap\transport.py", line 121, in 
>> request
>>   File "C:\python27\lib\urllib2.py", line 406, in open
>> response = meth(req, response)
>>   File "C:\python27\lib\urllib2.py", line 519, in http_response
>> 'http', request, response, code, msg, hdrs)
>>   File "C:\python27\lib\urllib2.py", line 444, in error
>> return self._call_chain(*args)
>>   File "C:\python27\lib\urllib2.py", line 378, in _call_chain
>> result = func(*args)
>>   File "C:\python27\lib\urllib2.py", line 527, in http_error_default
>> raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
>> urllib2.HTT

Re: [web2py] pysimplesoap help

2014-03-18 Thread piero crisci
Well i made it with pysimplesoad 1.12
Thanks!

Il giorno martedì 18 marzo 2014 20:44:54 UTC+1, piero crisci ha scritto:
>
> Hi Mariano and thanks for the help.
> I did what you said.
> I downloaded the httplib2 and the pysimplesoap 1.10
> In the pysimplesoad 1.10 the params "username" and "password" are not 
> present anymore
> I wrote the following code:
>
> from pysimplesoap.client import SoapClient
> location_wsdl = "http://docway.demo.3di.it/3diws/services";
> wsdl = "http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl";
> import base64
> username='admin'
> password='X'
> namespace_wsdl = "http://docway.demo.3di.it/3diws/services/eXtraWay";
> auth = base64.b64encode('%s:%s' % (username, password))
> client = SoapClient(location = location_wsdl, wsdl=wsdl,sessions=True, 
> namespace=namespace_wsdl,http_headers={'Authorization': "Basic %s" % auth})
>
>
> But i got the following error:
>   File "", line 1, in 
>   File "build\bdist.win32\egg\pysimplesoap\client.py", line 133, in 
> __init__
>   File "build\bdist.win32\egg\pysimplesoap\client.py", line 471, in 
> wsdl_parse
>   File "build\bdist.win32\egg\pysimplesoap\simplexml.py", line 196, in 
> __init__
>   File "C:\python27\lib\xml\dom\minidom.py", line 1930, in parseString
> return expatbuilder.parseString(string)
>   File "C:\python27\lib\xml\dom\expatbuilder.py", line 940, in parseString
> return builder.parseString(string)
>   File "C:\python27\lib\xml\dom\expatbuilder.py", line 223, in parseString
> parser.Parse(string, True)
> xml.parsers.expat.ExpatError: mismatched tag: line 1, column 939
>
>
>
> Il giorno martedì 18 marzo 2014 07:26:35 UTC+1, Mariano Reingart ha 
> scritto:
>>
>> Hi piero:
>>
>> The first choice to connect to a webservice that requires username & 
>> password (add_credentials), you will httplib2 installed:
>>
>> https://code.google.com/p/httplib2
>>
>> Then you could do:
>>
>> client = SoapClient(location = location_wsdl,sessions=True,
>> username='admin',password='xx')
>>
>> Also, assuming your webservice supports basic auth, you could pass the 
>> Authentication http header directly (it shouldn't need to install external 
>> library):
>>
>> import base64
>> auth = base64.b64encode('%s:%s' % (username, password)).replace('\n', '')
>>
>> client = SoapClient(location = location_wsdl, sessions=True, 
>> http_headers={'Authorization': "Basic %s" % auth})
>>
>> Let me know if this solves your issue,
>>
>> Best regards
>>
>>
>> Mariano Reingart
>> http://www.sistemasagiles.com.ar
>> http://reingart.blogspot.com
>>
>>
>> On Mon, Mar 17, 2014 at 6:02 PM, piero crisci wrote:
>>
>>> Hello i am trying to connect to this wsdl: 
>>> http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl 
>>> It requires http basic authentication  and i am using pysimplesoap 1.10 
>>> and i tried this configuration:
>>>
>>> from pysimplesoap.client import SoapClient
>>> location_wsdl = "http://docway.demo.3di.it/3diws/services";
>>> wsdl = "http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl";
>>> client = SoapClient(location = 
>>> location_wsdl,sessions=True,http_headers={'username': 'admin', 'password': 
>>> ''},username='admin',password='xx')
>>>
>>> I got this error
>>> Traceback (most recent call last):
>>>   File "", line 1, in 
>>>   File "build\bdist.win32\egg\pysimplesoap\client.py", line 133, in 
>>> __init__
>>>   File "build\bdist.win32\egg\pysimplesoap\client.py", line 469, in 
>>> wsdl_parse
>>>   File "build\bdist.win32\egg\pysimplesoap\helpers.py", line 71, in fetch
>>>   File "build\bdist.win32\egg\pysimplesoap\transport.py", line 121, in 
>>> request
>>>   File "C:\python27\lib\urllib2.py", line 406, in open
>>> response = meth(req, response)
>>>   File "C:\python27\lib\urllib2.py", line 519, in http_response
>>> 'http', request, response, code, msg, hdrs)
>>>   File "C:\python27\lib\urllib2.py", line 444, in error
>>> return self._call_chain(*args)
>>>   File "C:\python27\lib\urllib2.py",

Re: [web2py] pysimplesoap help

2014-03-18 Thread piero crisci
Hi Mariano and thanks for the help.
I did what you said.
I downloaded the httplib2 and the pysimplesoap 1.10
I wrote the following code:

from pysimplesoap.client import SoapClient
location_wsdl = "http://docway.demo.3di.it/3diws/services";
wsdl = "http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl";
import base64
username='admin'
password='3diadmin'
namespace_wsdl = "http://docway.demo.3di.it/3diws/services/eXtraWay";
auth = base64.b64encode('%s:%s' % (username, password))
client = SoapClient(location = location_wsdl, wsdl=wsdl,sessions=True, 
namespace=namespace_wsdl,http_headers={'Authorization': "Basic %s" % auth})


But i got the following error:
  File "", line 1, in 
  File "build\bdist.win32\egg\pysimplesoap\client.py", line 133, in __init__
  File "build\bdist.win32\egg\pysimplesoap\client.py", line 471, in 
wsdl_parse
  File "build\bdist.win32\egg\pysimplesoap\simplexml.py", line 196, in 
__init__
  File "C:\python27\lib\xml\dom\minidom.py", line 1930, in parseString
return expatbuilder.parseString(string)
  File "C:\python27\lib\xml\dom\expatbuilder.py", line 940, in parseString
return builder.parseString(string)
  File "C:\python27\lib\xml\dom\expatbuilder.py", line 223, in parseString
parser.Parse(string, True)
xml.parsers.expat.ExpatError: mismatched tag: line 1, column 939



Il giorno martedì 18 marzo 2014 07:26:35 UTC+1, Mariano Reingart ha scritto:
>
> Hi piero:
>
> The first choice to connect to a webservice that requires username & 
> password (add_credentials), you will httplib2 installed:
>
> https://code.google.com/p/httplib2
>
> Then you could do:
>
> client = SoapClient(location = location_wsdl,sessions=True,
> username='admin',password='xx')
>
> Also, assuming your webservice supports basic auth, you could pass the 
> Authentication http header directly (it shouldn't need to install external 
> library):
>
> import base64
> auth = base64.b64encode('%s:%s' % (username, password)).replace('\n', '')
>
> client = SoapClient(location = location_wsdl, sessions=True, 
> http_headers={'Authorization': "Basic %s" % auth})
>
> Let me know if this solves your issue,
>
> Best regards
>
>
> Mariano Reingart
> http://www.sistemasagiles.com.ar
> http://reingart.blogspot.com
>
>
> On Mon, Mar 17, 2014 at 6:02 PM, piero crisci 
> 
> > wrote:
>
>> Hello i am trying to connect to this wsdl: 
>> http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl 
>> It requires http basic authentication  and i am using pysimplesoap 1.10 
>> and i tried this configuration:
>>
>> from pysimplesoap.client import SoapClient
>> location_wsdl = "http://docway.demo.3di.it/3diws/services";
>> wsdl = "http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl";
>> client = SoapClient(location = 
>> location_wsdl,sessions=True,http_headers={'username': 'admin', 'password': 
>> ''},username='admin',password='xx')
>>
>> I got this error
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File "build\bdist.win32\egg\pysimplesoap\client.py", line 133, in 
>> __init__
>>   File "build\bdist.win32\egg\pysimplesoap\client.py", line 469, in 
>> wsdl_parse
>>   File "build\bdist.win32\egg\pysimplesoap\helpers.py", line 71, in fetch
>>   File "build\bdist.win32\egg\pysimplesoap\transport.py", line 121, in 
>> request
>>   File "C:\python27\lib\urllib2.py", line 406, in open
>> response = meth(req, response)
>>   File "C:\python27\lib\urllib2.py", line 519, in http_response
>> 'http', request, response, code, msg, hdrs)
>>   File "C:\python27\lib\urllib2.py", line 444, in error
>> return self._call_chain(*args)
>>   File "C:\python27\lib\urllib2.py", line 378, in _call_chain
>> result = func(*args)
>>   File "C:\python27\lib\urllib2.py", line 527, in http_error_default
>> raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
>> urllib2.HTTPError: HTTP Error 401: Unauthorized
>>
>> It seems like the basic authenitcation is not supported. am I wrong?
>> How i need to change the wsdl call? And how i can use a session to send 
>> different call?
>> Thx for help!
>>  
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py 

[web2py] pysimplesoap help

2014-03-17 Thread piero crisci
Hello i am trying to connect to this wsdl: 
http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl 
It requires http basic authentication  and i am using pysimplesoap 1.10 and 
i tried this configuration:

from pysimplesoap.client import SoapClient
location_wsdl = "http://docway.demo.3di.it/3diws/services";
wsdl = "http://docway.demo.3di.it/3diws/services/eXtraWay?wsdl";
client = SoapClient(location = 
location_wsdl,sessions=True,http_headers={'username': 'admin', 'password': 
''},username='admin',password='xx')

I got this error
Traceback (most recent call last):
  File "", line 1, in 
  File "build\bdist.win32\egg\pysimplesoap\client.py", line 133, in __init__
  File "build\bdist.win32\egg\pysimplesoap\client.py", line 469, in 
wsdl_parse
  File "build\bdist.win32\egg\pysimplesoap\helpers.py", line 71, in fetch
  File "build\bdist.win32\egg\pysimplesoap\transport.py", line 121, in 
request
  File "C:\python27\lib\urllib2.py", line 406, in open
response = meth(req, response)
  File "C:\python27\lib\urllib2.py", line 519, in http_response
'http', request, response, code, msg, hdrs)
  File "C:\python27\lib\urllib2.py", line 444, in error
return self._call_chain(*args)
  File "C:\python27\lib\urllib2.py", line 378, in _call_chain
result = func(*args)
  File "C:\python27\lib\urllib2.py", line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 401: Unauthorized

It seems like the basic authenitcation is not supported. am I wrong?
How i need to change the wsdl call? And how i can use a session to send 
different call?
Thx for 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 from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: IMAP: Insert email to Sent folder

2013-10-06 Thread piero crisci
I am testing it too and for some mail got this traceback:
ERROR:web2py.dal:Could not parse date text: 10 Dec 2012 02:23:50 +0100. 
need more than 1 value to unpack


Il giorno domenica 6 ottobre 2013 13:06:03 UTC+2, Alan Etkin ha scritto:
>
> Please add any example or comment on the issue here
>
> http://code.google.com/p/web2py/issues/detail?id=1707
>
>

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


[web2py] Reading and managing email boxes - features

2013-10-06 Thread piero crisci
I am trying to use the new features of imap connection.
I am using the code

imapdb = DAL("imap://user:password@server:port", pool_size=1)

First of all is it possible to use it also to send email or just to downlowd?

Second: if i want use multiple connection and pass to DAL user name and 
password from a database table is there a safe way to do it?

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


[web2py] Re: web2py Italy

2013-09-30 Thread piero crisci
Ciao  anche io uso web2py.
Mi fa molto piacere che ci siano una comunità italiana che lo utilizza!!!
Il giorno venerdì 27 settembre 2013 10:37:23 UTC+2, Gael Princivalle ha 
scritto:

> Hi.
>
> For web2py users that speak Italian, I've create the web2py-it group. It 
> could be a complementary tool for the Italian web2py community.
> https://groups.google.com/forum/?fromgroups#!forum/web2py-it
>
> Ciao !
>

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


[web2py] Password portfolio storage

2013-09-30 Thread piero crisci
Hello 
I was wonderfing about what was the best solution to create a password 
portfolio in web2py.
My intention was to create an application like O.T.R.S. 
This app should be able to manage different   e-mails (pop3, pop3s , 
imap,)comunication and create ticket for the iusse comunicated by the users.
The app should be able to add new, email and connect this e-mail to a 
queque. Each queque can be managed by a list of user.
For this reason in the application should be stored the authentication info 
used to get/send e-mails.
Have you got any idea to how realize it in a safe way?
 

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


[web2py] Re: good read on security

2012-11-22 Thread piero crisci
In Europe the privacy law is a bit different than in America and it would 
be interesting for me have some reference to your law's article.
I use to be the privacy reference in my administration and i can understand 
what the article means.
If you are interested in Italian's privacy law i can post some interesting 
article. 
I like our privacy law but sometimes privacy and security are not 
compatible. For example, in a company is not admited to log the activity of 
normal users on application if there is not an agreement with unions. So if 
there is an exploit sometimes is hard to find what happened.
Of course i am simplyfing the argument :).
Hope to share with you all more info about privacy and security.
Have a nice day.
 
 
It would be nice  to know more about security an
Il giorno mercoledì 21 novembre 2012 14:51:24 UTC+1, Massimo Di Pierro ha 
scritto:

>
> http://erratasec.blogspot.de/2012/11/you-are-committing-crime-right-now.html
>

-- 





[web2py] Pyrtf colour style problem

2012-11-13 Thread piero crisci
I am using pytrf for create a document.
I want to make the Heading font with a particular kind of colour, but i 
cannot manage to change the color of the font.
I manage to use only the standard colour in the StyleSheet.

Here is the code implemented:
def render_doc():
import gluon.contrib.pyrtf as q
doc.Sections.append(section)
section=q.Section(break_type=q.Section.PAGE, first_page_number=1)
ss=q.StyleSheet()
ss.Colours.accepted_type = True
ss.Colours.append(q.Colour('Equi',250,255,0))
para_ps = q.ParagraphPropertySet()
para_ps.SetAlignment(3)
p = q.Paragraph(para_ps) 
text_ps_heading = q.TextPropertySet(size=38,bold=True)
*text_ps_heading.SetColour(ss.Colours.Equi)   *
text_heading = q.Text('\par HEADING \par' ,text_ps_heading)
p.append(text_heading)
section.append(p)
response.headers['Content-Type']='text/rtf'
return q.dumps(doc)


The text_heading rendering appear BLACK

Instead if i change :
*text_ps_heading.SetColour(ss.Colours.Equi)   
*Into*
**text_ps_heading.SetColour(ss.Colours.Red) 
*
The text_heading rendering appear RED
Is like ss.Colours don't take the new colour CLASS.
Am i wrong?
How i could set a new colour in the ss.Colours?

-- 





[web2py] Re: existing tables in plugin_wiki

2012-11-12 Thread piero crisci
Try:
``name: read
table: message
record_id: id
``:widget

Instead of:
``
name: read
table: message
record_id: id
``:widget


Il giorno domenica 14 ottobre 2012 10:21:48 UTC+2, finlayson ha scritto:
>
> I have got the same error message with the classic friend database within 
> a wiki page. So now waiting for an upgrade? Or can you please show what to 
> cahnge. If I remember well in an earlier version of web2py 1.99.6 there was 
> no problem...
>
> Op woensdag 1 augustus 2012 17:38:27 UTC+2 schreef Massimo Di Pierro het 
> volgende:
>>
>> This is a bug in plugin_wiki but the bug is triggered by
>>
>> record_id: id
>>
>> id should be a number.
>>
>> On Wednesday, 1 August 2012 10:07:17 UTC-5, Larry Wapnitsky wrote:
>>>
>>> I'm attempting to access database tables created in my db.py file using 
>>> different aspects of plugin_wiki.  Whenever I enter the table name, I get 
>>> the following as my results on my "page":
>>>
>>> Traceback (most recent call last):
>>>   File 
>>> "/home/lwapnitsky/web2py/applications/EARS_web2py/models/plugin_wiki.py", 
>>> line 631, in render_widget
>>> args = dict((item[0].strip(), self.parse_value(item[1].strip())) for 
>>> item in items)
>>>   File 
>>> "/home/lwapnitsky/web2py/applications/EARS_web2py/models/plugin_wiki.py", 
>>> line 631, in 
>>> args = dict((item[0].strip(), self.parse_value(item[1].strip())) for 
>>> item in items)
>>> IndexError: list index out of range
>>>
>>>
>>> Here is the code on the wiki page that was generated by the builder:
>>> ``
>>> name: read
>>> table: message
>>> record_id: id
>>> ``:widget
>>>
>>> Thanks
>>>
>>

-- 





[web2py] Re: IS_STRONG and CRYPT

2012-10-17 Thread piero crisci
Sorry but i never opened a ticket before. Do you mean open a ticket in 
google groups or there is a Ticket Request System dedicated for the 
request?.
Thank again Richard and Massimo for the support.


Il giorno mercoledì 17 ottobre 2012 00:20:54 UTC+2, Massimo Di Pierro ha 
scritto:
>
> Can you please open a ticket about this?
>
> On Friday, 12 October 2012 10:04:35 UTC-5, piero crisci wrote:
>>
>> I tryed to find others with the same iusse problem without understand how 
>> to solve the problems :(
>>
>> I set in the db.py the follow table
>>
>> 
>> db.define_table('auth_user',
>> Field('username', type='string',
>>   label=T('Username')),
>> Field('first_name', type='string',
>>   label=T('First Name')),
>> Field('last_name', type='string',
>>   label=T('Last Name')),
>> Field('email', type='string',
>>   label=T('Email')),
>> Field('password', type='password',length=512,
>>   readable=False,
>>   label=T('Password')),
>> Field('created_on','datetime',default=request.now,
>>   label=T('Created On'),writable=False,readable=False),
>> Field('modified_on','datetime',default=request.now,
>>   label=T('Modified On'),writable=False,readable=False,
>>   update=request.now),
>> Field('registration_key',default='',
>>   writable=False,readable=False),
>> Field('reset_password_key',default='',
>>   writable=False,readable=False),
>> Field('registration_id',default='',
>>   writable=False,readable=False),
>> format='%(username)s',
>> migrate=settings.migrate)
>>
>>
>> db.auth_user.first_name.requires = 
>> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
>> db.auth_user.last_name.requires = 
>> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
>> #db.auth_user.password.requires = [ IS_STRONG(min=8, 
>> number=1,special=1,error_message = "La password deve contenere almeno 8 
>> Caratteri, un Numero, un Carattere Speciale, un carattere Maiuscolo"), 
>> CRYPT(key=auth.settings.hmac_key)]
>> db.auth_user.password.requires= [*IS_STRONG(min=8), 
>> CRYPT(auth.settings.hmac_key)*]
>>
>> db.auth_user.username.requires = IS_NOT_IN_DB(db, db.auth_user.username, 
>> error_message = 'Username già censita')
>> db.auth_user.email.requires = 
>> (IS_EMAIL(error_message=auth.messages.invalid_email),
>>IS_NOT_IN_DB(db, 
>> db.auth_user.email,error_message = 'Email già censita'))
>> auth.define_tables(migrate = settings.migrate)
>>
>> I set in the default.py this def for manage the user changes .
>>
>> @auth.requires_login()
>> @auth.requires_membership('risorse_umane' or 'admin')
>> def anagrafica_utenti_db_manage():
>> form = SQLFORM.smartgrid(db.auth_user,onupdate=auth.archive)
>> return locals()
>>
>> When i try to modify the name or the surname the framework rise the 
>> IS_STRONG control even if i don't touch the password string.
>> I am new with web2py and i want just to know if i need to create a form 
>> to make the user changes or i can fix this problem using the smartgrid.
>> I also set the "Requires approval" for the new registration. How can i 
>> delete the "Pending" in the registration key ? (I can t do it right now 
>> because of the IS_STRONG control.
>> Thanks for help
>> And sorry for bother you
>>
>

-- 





[web2py] Re: IS_STRONG and CRYPT

2012-10-14 Thread piero crisci
I made the changes you said, 
I also test the app with the V. 1.99.7
I also create a new app called TEST with the wizard without add anything 
else.
Once created the new APP i just add this lines to db.py :

db.auth_user.password.requires = 
[IS_STRONG(),CRYPT(key=auth.settings.hmac_key)]

I chose a good password and after i went to this link page to change user 
info
http://127.0.0.1:8000/TEST/appadmin/update/db/auth_user/1
I try the submit and i got the same IS_STRONG controls Error.
So with 2 differnts apps 2 different framework version, 2 different db i 
got the same Controll error.
Could it be due to the use of the Wizard App creation?.
Thanks for help

Il giorno sabato 13 ottobre 2012 16:42:26 UTC+2, Massimo Di Pierro ha 
scritto:
>
> You do not need two decorators:
>
> @auth.requires_login()
> @auth.requires_membership('risorse_umane' or 'admin')
>
> auth.requires_membership also requires login. 
> You cannot do 
> @auth.requires_membership('risorse_umane' or 'admin')
> because that is the same as
> @auth.requires_membership('risorse_umane')
> since 'risorse_umane' evaluates to True.
>
> There may be something else going on.
>
>
>
> On Friday, 12 October 2012 10:04:35 UTC-5, piero crisci wrote:
>>
>> I tryed to find others with the same iusse problem without understand how 
>> to solve the problems :(
>>
>> I set in the db.py the follow table
>>
>> 
>> db.define_table('auth_user',
>> Field('username', type='string',
>>   label=T('Username')),
>> Field('first_name', type='string',
>>   label=T('First Name')),
>> Field('last_name', type='string',
>>   label=T('Last Name')),
>> Field('email', type='string',
>>   label=T('Email')),
>> Field('password', type='password',length=512,
>>   readable=False,
>>   label=T('Password')),
>> Field('created_on','datetime',default=request.now,
>>   label=T('Created On'),writable=False,readable=False),
>> Field('modified_on','datetime',default=request.now,
>>   label=T('Modified On'),writable=False,readable=False,
>>   update=request.now),
>> Field('registration_key',default='',
>>   writable=False,readable=False),
>> Field('reset_password_key',default='',
>>   writable=False,readable=False),
>> Field('registration_id',default='',
>>   writable=False,readable=False),
>> format='%(username)s',
>> migrate=settings.migrate)
>>
>>
>> db.auth_user.first_name.requires = 
>> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
>> db.auth_user.last_name.requires = 
>> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
>> #db.auth_user.password.requires = [ IS_STRONG(min=8, 
>> number=1,special=1,error_message = "La password deve contenere almeno 8 
>> Caratteri, un Numero, un Carattere Speciale, un carattere Maiuscolo"), 
>> CRYPT(key=auth.settings.hmac_key)]
>> db.auth_user.password.requires= [*IS_STRONG(min=8), 
>> CRYPT(auth.settings.hmac_key)*]
>>
>> db.auth_user.username.requires = IS_NOT_IN_DB(db, db.auth_user.username, 
>> error_message = 'Username già censita')
>> db.auth_user.email.requires = 
>> (IS_EMAIL(error_message=auth.messages.invalid_email),
>>IS_NOT_IN_DB(db, 
>> db.auth_user.email,error_message = 'Email già censita'))
>> auth.define_tables(migrate = settings.migrate)
>>
>> I set in the default.py this def for manage the user changes .
>>
>> @auth.requires_login()
>> @auth.requires_membership('risorse_umane' or 'admin')
>> def anagrafica_utenti_db_manage():
>> form = SQLFORM.smartgrid(db.auth_user,onupdate=auth.archive)
>> return locals()
>>
>> When i try to modify the name or the surname the framework rise the 
>> IS_STRONG control even if i don't touch the password string.
>> I am new with web2py and i want just to know if i need to create a form 
>> to make the user changes or i can fix this problem using the smartgrid.
>> I also set the "Requires approval" for the new registration. How can i 
>> delete the "Pending" in the registration key ? (I can t do it right now 
>> because of the IS_STRONG control.
>> Thanks for help
>> And sorry for bother you
>>
>

-- 





[web2py] Re: IS_STRONG and CRYPT

2012-10-14 Thread piero crisci
I will remove the errors as soon as i get home. Do you think is this the 
reason  for the rising of the IS_STRONG() controls in the db.auth_user 
update?.
Let me know if i need to post controls, views or models.
Thank you all , Richard and Massimo.
I am trying to study all the framework, looking for case studies, tutorial 
but i think i am far to use the all potential of web2y. Hope to improve as 
soon as possible.
Have a nice day

Il giorno sabato 13 ottobre 2012 16:42:26 UTC+2, Massimo Di Pierro ha 
scritto:
>
> You do not need two decorators:
>
> @auth.requires_login()
> @auth.requires_membership('risorse_umane' or 'admin')
>
> auth.requires_membership also requires login. 
> You cannot do 
> @auth.requires_membership('risorse_umane' or 'admin')
> because that is the same as
> @auth.requires_membership('risorse_umane')
> since 'risorse_umane' evaluates to True.
>
> There may be something else going on.
>
>
>
> On Friday, 12 October 2012 10:04:35 UTC-5, piero crisci wrote:
>>
>> I tryed to find others with the same iusse problem without understand how 
>> to solve the problems :(
>>
>> I set in the db.py the follow table
>>
>> 
>> db.define_table('auth_user',
>> Field('username', type='string',
>>   label=T('Username')),
>> Field('first_name', type='string',
>>   label=T('First Name')),
>> Field('last_name', type='string',
>>   label=T('Last Name')),
>> Field('email', type='string',
>>   label=T('Email')),
>> Field('password', type='password',length=512,
>>   readable=False,
>>   label=T('Password')),
>> Field('created_on','datetime',default=request.now,
>>   label=T('Created On'),writable=False,readable=False),
>> Field('modified_on','datetime',default=request.now,
>>   label=T('Modified On'),writable=False,readable=False,
>>   update=request.now),
>> Field('registration_key',default='',
>>   writable=False,readable=False),
>> Field('reset_password_key',default='',
>>   writable=False,readable=False),
>> Field('registration_id',default='',
>>   writable=False,readable=False),
>> format='%(username)s',
>> migrate=settings.migrate)
>>
>>
>> db.auth_user.first_name.requires = 
>> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
>> db.auth_user.last_name.requires = 
>> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
>> #db.auth_user.password.requires = [ IS_STRONG(min=8, 
>> number=1,special=1,error_message = "La password deve contenere almeno 8 
>> Caratteri, un Numero, un Carattere Speciale, un carattere Maiuscolo"), 
>> CRYPT(key=auth.settings.hmac_key)]
>> db.auth_user.password.requires= [*IS_STRONG(min=8), 
>> CRYPT(auth.settings.hmac_key)*]
>>
>> db.auth_user.username.requires = IS_NOT_IN_DB(db, db.auth_user.username, 
>> error_message = 'Username già censita')
>> db.auth_user.email.requires = 
>> (IS_EMAIL(error_message=auth.messages.invalid_email),
>>IS_NOT_IN_DB(db, 
>> db.auth_user.email,error_message = 'Email già censita'))
>> auth.define_tables(migrate = settings.migrate)
>>
>> I set in the default.py this def for manage the user changes .
>>
>> @auth.requires_login()
>> @auth.requires_membership('risorse_umane' or 'admin')
>> def anagrafica_utenti_db_manage():
>> form = SQLFORM.smartgrid(db.auth_user,onupdate=auth.archive)
>> return locals()
>>
>> When i try to modify the name or the surname the framework rise the 
>> IS_STRONG control even if i don't touch the password string.
>> I am new with web2py and i want just to know if i need to create a form 
>> to make the user changes or i can fix this problem using the smartgrid.
>> I also set the "Requires approval" for the new registration. How can i 
>> delete the "Pending" in the registration key ? (I can t do it right now 
>> because of the IS_STRONG control.
>> Thanks for help
>> And sorry for bother you
>>
>

-- 





[web2py] Re: Problem with IS_STRONG() and CRYPT() methods

2012-10-13 Thread piero crisci
Hello Massimo and hello guys, sorry to bother you all. 
I got a problem with IS_STRONG and CRYPT(). Richard is trying to help me to 
solve it. I posted a new question because the problem is similar to this 
one but it regards the user approval from db.auth_user with the STRONG and 
CRYPT() activate on the password field.
I am using the framework 2.0.9 on the win 7 (for test). Could you help me 
with it?.
Thanks All


Il giorno sabato 14 agosto 2010 17:20:06 UTC+2, mdipierro ha scritto:
>
> This: 
>
>  name="password2" type="password" value="" />{{if 
> form.errors.password2:}}NO MATCH{{pass}} input> 
>
> Should have been: 
>
>  name="password_two" type="password" value="" />{{if 
> form.errors.password_two:}}NO MATCH{{pass}} 
>
> Make the change and it will work. 
>
> There should really be a form.custom.widget.password_two... I will 
> think about adding one. 
>
> Massimo 
>
> On Aug 14, 9:49 am, elfuego1  wrote: 
> > I did as you asked. 
> > Message should be at your email box. 
> > 
> > On 14 Sie, 15:55, mdipierro  wrote: 
> > 
> > > Please email it to me. 
> > 
> > > On Aug 14, 8:30 am, elfuego1  wrote: 
> > 
> > > > I can't send data from registration form to DB. I'm stuck on the 
> same 
> > > > page. I'm not redirected to post registration page. Only fields 
> > > > password and verify password are being cleaned. Looks like 
> > > > registration form is not working. 
> > 
> > > > Is there a way you could look at my application so I would move on 
> > > > with my coding? 
> > 
> > > > On 14 Sie, 15:11, mdipierro  wrote: 
> > 
> > > > > My mistake. It is 
> > 
> > > > > {{=form.custom.submit}} 
> > 
> > > > > not {{=form.custom.widget.submit}} 
> > 
> > > > > On Aug 14, 8:02 am, elfuego1  wrote: 
> > 
> > > > > > How do I fix that? 
> > 
> > > > > > On 14 Sie, 15:01, elfuego1  wrote: 
> > 
> > > > > > > In user.html I have now: 
> > 
> > > > > > > {{if request.args(0)=='login':}}{{=auth.login()}} 
> > 
> > > > > > > {{elif request.args(0)=='register':}} 
> > > > > > > {{=form.custom.begin}} 
> > > > > > > {{=form.custom.widget.first_name}} 
> > > > > > > ... 
> > > > > > > {{=form.custom.widget.submit}} 
> > > > > > > {{=form.custom.end}} 
> > 
> > > > > > > I have a submit button only on login page (which is generated 
> > > > > > > automatically). 
> > > > > > > But on registration page where I have custom form I have only 
> "None" 
> > > > > > > displayed instead of a button?? 
> > 
> > > > > > > On 14 Sie, 12:07, mdipierro  wrote: 
> > 
> > > > > > > > In the controller you should ONLY use 
> > 
> > > > > > > > form=auth.register() 
> > 
> > > > > > > > DO NOT make the registration form with FORM, SQLFORM, 
> accepts, etc. 
> > 
> > > > > > > > If you need to add fields, define your own db.auth_user 
> table 
> > 
> > > > > > > > If you need to customize presentation use 
> > 
> > > > > > > > {{=form.custom.begin}} 
> > > > > > > > {{=form.custom.widget.first_name}} 
> > > > > > > >  
> > > > > > > > {{=form.custom.widget.submit}} 
> > > > > > > > {{=form.custom.end}} 
> > 
> > > > > > > > insert any HTML you need. Use CSS and jQuery to style it. 
> > 
> > > > > > > > On Aug 14, 5:03 am, elfuego1  wrote: 
> > 
> > > > > > > > > OK. Then can you PLEASE tell me how should I write 
> registration part 
> > > > > > > > > to use full power of the framework? 
> > 
> > > > > > > > > In controllers/default.py I have my custom form in def 
> register(). 
> > > > > > > > > I invoke it in views/default/register.html with: 
> > > > > > > > > {{=form}} 
> > 
> > > > > > > > > HOW DO I  SAVE IT TO DATABASE??? 
> > > > > > > > > I just need this information and everything will work just 
> fine. 
> > 
> > > > > > > > > On 14 Sie, 11:48, mdipierro  
> wrote: 
> > 
> > > > > > > > > > You have two problems: 
> > 
> > > > > > > > > > 1) 
> > 
> > > > > > > > > > insert(request.vars.password...) 
> > > > > > > > > > should be 
> > > > > > > > > > insert(...form.vars.password...) 
> > 
> > > > > > > > > > request.vars contains the raw data sent from user, 
> form.vars contains 
> > > > > > > > > > the same data filtered by validators. 
> > 
> > > > > > > > > > 2) 
> > 
> > > > > > > > > > you are bypassing a lot of login that is normally 
> performed by auth. 
> > > > > > > > > > For example you do not get default groups for new users. 
> Eventually 
> > > > > > > > > > this will bite you. 
> > 
> > > > > > > > > > Massimo 
> > 
> > > > > > > > > > On Aug 14, 4:43 am, elfuego1  
> wrote: 
> > 
> > > > > > > > > > > When I look into database I can see the password in a 
> readable form. 
> > > > > > > > > > > No hash there. 
> > > > > > > > > > > I tested registration on a standard cookbook 
> application and the hash 
> > > > > > > > > > > there works for password field. 
> > 
> > > > > > > > > > > So I started thinking what am I doing wrong. And then 
> it stuck me and 
> > > > > > > > > > > I think I found the problem. 
> > > > > > > > > > > When I was sending my form NOTHING was stored into 
> database. I

Re: [web2py] IS_STRONG and CRYPT

2012-10-13 Thread piero crisci
I am using the web2py framework on win 7 launching it with the web2py.exe 
As you said i checked the link but is alright. I have no clue what is 
wrong. I got the rise of the control of IS_STRONG() even in the update 
section. I have seen that if i change the password and i submit the update, 
the check work well, but if after i do another submit without change the 
password the check of IS_STRONG rise again. But the password should  not 
involved in the controls  if not changed.
Is like the the password field in the 
http://127.0.0.1:8000/sgddms/appadmin/update/db/auth_user/1 is not correct 
verified by the IS_STRONG() controls during the submit.
Any suggestion?
Sorry for my english i hope i am explaing well the problem.
I can also post the source code if needed.


Il giorno venerdì 12 ottobre 2012 20:50:15 UTC+2, Richard ha scritto:
>
> I don't have this problem, I can submit my form in appadmin db.auth.user...
>
> Make sure you are on this page :
>
> http://127.0.0.1:8000/sgddms/appadmin/update/db/auth_user/1
>
>
> Replace 127.0.0.1:8000 if needed.
>
> Also, replace the 1 at the end with the id of your user.
>
> You should see only big dot in the password form input field??
>
> Richard
>
>
> On Fri, Oct 12, 2012 at 2:38 PM, piero crisci 
> 
> > wrote:
>
>> The password is correct  it contaings numbers, caps and symbols. I would 
>> like to set also the others attribute of IS_LONG like number=1 , special=1, 
>> etc.
>> The string i posted above was just for a simple try.
>> It seems like the password is bad rapresented in the form of the 
>> appadmin--> db.auth_user. 
>> Here it is as the password is represented in the field of DB. Mysql 
>> pbkdf2(1000,20,sha512)$8d8a8c6c0124ecb5$1063c7b41a67b4bf11efbbe21e30087ccd7b6d51
>> Thanks for help
>>
>> Il giorno venerdì 12 ottobre 2012 20:13:19 UTC+2, Richard ha scritto:
>>>
>>> Piero is your password respecting your IS_STRONG min length?
>>>
>>> Also, if the only thing you want to enforce with IS_STRONG is the 
>>> minimum length of the user password, you can enforce it with CRYPT :
>>>
>>> requires = CRYPT(min_length=auth.**settings.password_min_length,
>>>   error_message=T('too short')
>>>
>>> Or
>>>
>>> requires = CRYPT(min_length=8,
>>>   error_message=T('too short')
>>>
>>>
>>> Richard
>>>
>>>
>>> On Fri, Oct 12, 2012 at 1:21 PM, piero crisci wrote:
>>>
>>>> Dear Richard i did what you said.
>>>> But even with appadmin, if i change the user.info using db.auth_user 
>>>> when i submit the information i get the rise of the error_message set in 
>>>> the IS_STRONG control.
>>>> If i remove the string in the db.py
>>>> db.auth_user.password.**requires= [*IS_STRONG(min=8), 
>>>> CRYPT(auth.settings.hmac_key)*]
>>>> I can remove the pending in the registration key but i lose IS_STRONG 
>>>> control for the users password.
>>>> For now i set this string:
>>>> db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_**key, 
>>>> min_length=8, error_message = 'Lunghezza minima richiesta 8 caratteri')
>>>>
>>>> In this way i can have at least control the password length, but for 
>>>> being compliance with the policy requested i should use the IS_STRONG 
>>>> checks
>>>> How can i solve this problem?
>>>> Thanks againg
>>>>
>>>> Il giorno venerdì 12 ottobre 2012 19:00:13 UTC+2, Richard ha scritto:
>>>>>
>>>>> You can use the appadmin for these tasks :
>>>>>
>>>>> http://DOMAINOR127.0.0.1:80/**YO**URAPPNAME/appadmin<http://DOMAINOR127.0.0.1:80/YOURAPPNAME/appadmin>
>>>>>
>>>>> Then you will have a list of all your tables that you can access by 
>>>>> clicking over their name. You should understand rapidly how it's working.
>>>>>
>>>>> Ask other questions here if you need more help about that.
>>>>>
>>>>> Richard
>>>>>
>>>>>
>>>>> On Fri, Oct 12, 2012 at 11:04 AM, piero crisci wrote:
>>>>>
>>>>>> I tryed to find others with the same iusse problem without understand 
>>>>>> how to solve the problems :(
>>>>>>
>>>>>> I set in the db.py the follow table
>>>>>>
>>>>>> ####
>&

Re: [web2py] IS_STRONG and CRYPT

2012-10-12 Thread piero crisci
The password is correct  it contaings numbers, caps and symbols. I would 
like to set also the others attribute of IS_LONG like number=1 , special=1, 
etc.
The string i posted above was just for a simple try.
It seems like the password is bad rapresented in the form of the 
appadmin--> db.auth_user. 
Here it is as the password is represented in the field of DB. Mysql 
pbkdf2(1000,20,sha512)$8d8a8c6c0124ecb5$1063c7b41a67b4bf11efbbe21e30087ccd7b6d51
Thanks for help

Il giorno venerdì 12 ottobre 2012 20:13:19 UTC+2, Richard ha scritto:
>
> Piero is your password respecting your IS_STRONG min length?
>
> Also, if the only thing you want to enforce with IS_STRONG is the minimum 
> length of the user password, you can enforce it with CRYPT :
>
> requires = CRYPT(min_length=auth.settings.password_min_length,
>   error_message=T('too short')
>
> Or
>
> requires = CRYPT(min_length=8,
>   error_message=T('too short')
>
>
> Richard
>
> On Fri, Oct 12, 2012 at 1:21 PM, piero crisci 
> 
> > wrote:
>
>> Dear Richard i did what you said.
>> But even with appadmin, if i change the user.info using db.auth_user 
>> when i submit the information i get the rise of the error_message set in 
>> the IS_STRONG control.
>> If i remove the string in the db.py
>> db.auth_user.password.requires= [*IS_STRONG(min=8), 
>> CRYPT(auth.settings.hmac_key)*]
>> I can remove the pending in the registration key but i lose IS_STRONG 
>> control for the users password.
>> For now i set this string:
>> db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_key, 
>> min_length=8, error_message = 'Lunghezza minima richiesta 8 caratteri')
>>
>> In this way i can have at least control the password length, but for 
>> being compliance with the policy requested i should use the IS_STRONG checks
>> How can i solve this problem?
>> Thanks againg
>>
>> Il giorno venerdì 12 ottobre 2012 19:00:13 UTC+2, Richard ha scritto:
>>>
>>> You can use the appadmin for these tasks :
>>>
>>> http://DOMAINOR127.0.0.1:80/**YOURAPPNAME/appadmin<http://DOMAINOR127.0.0.1:80/YOURAPPNAME/appadmin>
>>>
>>> Then you will have a list of all your tables that you can access by 
>>> clicking over their name. You should understand rapidly how it's working.
>>>
>>> Ask other questions here if you need more help about that.
>>>
>>> Richard
>>>
>>>
>>> On Fri, Oct 12, 2012 at 11:04 AM, piero crisci wrote:
>>>
>>>> I tryed to find others with the same iusse problem without understand 
>>>> how to solve the problems :(
>>>>
>>>> I set in the db.py the follow table
>>>>
>>>> ##**##
>>>> db.define_table('auth_user',
>>>> Field('username', type='string',
>>>>   label=T('Username')),
>>>> Field('first_name', type='string',
>>>>   label=T('First Name')),
>>>> Field('last_name', type='string',
>>>>   label=T('Last Name')),
>>>> Field('email', type='string',
>>>>   label=T('Email')),
>>>> Field('password', type='password',length=512,
>>>>   readable=False,
>>>>   label=T('Password')),
>>>> Field('created_on','datetime',**default=request.now,
>>>>   label=T('Created On'),writable=False,readable=**False),
>>>> Field('modified_on','datetime'**,default=request.now,
>>>>   label=T('Modified On'),writable=False,readable=**False,
>>>>   update=request.now),
>>>> Field('registration_key',**default='',
>>>>   writable=False,readable=False)**,
>>>> Field('reset_password_key',**default='',
>>>>   writable=False,readable=False)**,
>>>> Field('registration_id',**default='',
>>>>   writable=False,readable=False)**,
>>>> format='%(username)s',
>>>> migrate=settings.migrate)
>>>>
>>>>
>>>> db.auth_user.first_name.**requires = IS_NOT_EMPTY(error_message=**
>>>> auth.messages.is_empty)
>>>> db.auth_user.last_name.**requires = IS_NOT_E

Re: [web2py] IS_STRONG and CRYPT

2012-10-12 Thread piero crisci
Dear Richard i did what you said.
But even with appadmin, if i change the user.info using db.auth_user when i 
submit the information i get the rise of the error_message set in the 
IS_STRONG control.
If i remove the string in the db.py
db.auth_user.password.requires= [*IS_STRONG(min=8), 
CRYPT(auth.settings.hmac_key)*]
I can remove the pending in the registration key but i lose IS_STRONG 
control for the users password.
For now i set this string:
db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_key, 
min_length=8, error_message = 'Lunghezza minima richiesta 8 caratteri')

In this way i can have at least control the password length, but for being 
compliance with the policy requested i should use the IS_STRONG checks
How can i solve this problem?
Thanks againg

Il giorno venerdì 12 ottobre 2012 19:00:13 UTC+2, Richard ha scritto:
>
> You can use the appadmin for these tasks :
>
> http://DOMAINOR127.0.0.1:80/YOURAPPNAME/appadmin
>
> Then you will have a list of all your tables that you can access by 
> clicking over their name. You should understand rapidly how it's working.
>
> Ask other questions here if you need more help about that.
>
> Richard
>
> On Fri, Oct 12, 2012 at 11:04 AM, piero crisci 
> 
> > wrote:
>
>> I tryed to find others with the same iusse problem without understand how 
>> to solve the problems :(
>>
>> I set in the db.py the follow table
>>
>> 
>> db.define_table('auth_user',
>> Field('username', type='string',
>>   label=T('Username')),
>> Field('first_name', type='string',
>>   label=T('First Name')),
>> Field('last_name', type='string',
>>   label=T('Last Name')),
>> Field('email', type='string',
>>   label=T('Email')),
>> Field('password', type='password',length=512,
>>   readable=False,
>>   label=T('Password')),
>> Field('created_on','datetime',default=request.now,
>>   label=T('Created On'),writable=False,readable=False),
>> Field('modified_on','datetime',default=request.now,
>>   label=T('Modified On'),writable=False,readable=False,
>>   update=request.now),
>> Field('registration_key',default='',
>>   writable=False,readable=False),
>> Field('reset_password_key',default='',
>>   writable=False,readable=False),
>> Field('registration_id',default='',
>>   writable=False,readable=False),
>> format='%(username)s',
>> migrate=settings.migrate)
>>
>>
>> db.auth_user.first_name.requires = 
>> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
>> db.auth_user.last_name.requires = 
>> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
>> #db.auth_user.password.requires = [ IS_STRONG(min=8, 
>> number=1,special=1,error_message = "La password deve contenere almeno 8 
>> Caratteri, un Numero, un Carattere Speciale, un carattere Maiuscolo"), 
>> CRYPT(key=auth.settings.hmac_key)]
>> db.auth_user.password.requires= [*IS_STRONG(min=8), 
>> CRYPT(auth.settings.hmac_key)*]
>>
>> db.auth_user.username.requires = IS_NOT_IN_DB(db, db.auth_user.username, 
>> error_message = 'Username già censita')
>> db.auth_user.email.requires = 
>> (IS_EMAIL(error_message=auth.messages.invalid_email),
>>IS_NOT_IN_DB(db, 
>> db.auth_user.email,error_message = 'Email già censita'))
>> auth.define_tables(migrate = settings.migrate)
>>
>> I set in the default.py this def for manage the user changes .
>>
>> @auth.requires_login()
>> @auth.requires_membership('risorse_umane' or 'admin')
>> def anagrafica_utenti_db_manage():
>> form = SQLFORM.smartgrid(db.auth_user,onupdate=auth.archive)
>> return locals()
>>
>> When i try to modify the name or the surname the framework rise the 
>> IS_STRONG control even if i don't touch the password string.
>> I am new with web2py and i want just to know if i need to create a form 
>> to make the user changes or i can fix this problem using the smartgrid.
>> I also set the "Requires approval" for the new registration. How can i 
>> delete the "Pending" in the registration key ? (I can t do it right now 
>> because of the IS_STRONG control.
>> Thanks for help
>> And sorry for bother you
>>
>> -- 
>>  
>>  
>>  
>>
>
>

-- 





[web2py] IS_STRONG and CRYPT

2012-10-12 Thread piero crisci
I tryed to find others with the same iusse problem without understand how 
to solve the problems :(

I set in the db.py the follow table


db.define_table('auth_user',
Field('username', type='string',
  label=T('Username')),
Field('first_name', type='string',
  label=T('First Name')),
Field('last_name', type='string',
  label=T('Last Name')),
Field('email', type='string',
  label=T('Email')),
Field('password', type='password',length=512,
  readable=False,
  label=T('Password')),
Field('created_on','datetime',default=request.now,
  label=T('Created On'),writable=False,readable=False),
Field('modified_on','datetime',default=request.now,
  label=T('Modified On'),writable=False,readable=False,
  update=request.now),
Field('registration_key',default='',
  writable=False,readable=False),
Field('reset_password_key',default='',
  writable=False,readable=False),
Field('registration_id',default='',
  writable=False,readable=False),
format='%(username)s',
migrate=settings.migrate)


db.auth_user.first_name.requires = 
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
db.auth_user.last_name.requires = 
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
#db.auth_user.password.requires = [ IS_STRONG(min=8, 
number=1,special=1,error_message = "La password deve contenere almeno 8 
Caratteri, un Numero, un Carattere Speciale, un carattere Maiuscolo"), 
CRYPT(key=auth.settings.hmac_key)]
db.auth_user.password.requires= [*IS_STRONG(min=8), 
CRYPT(auth.settings.hmac_key)*]

db.auth_user.username.requires = IS_NOT_IN_DB(db, db.auth_user.username, 
error_message = 'Username già censita')
db.auth_user.email.requires = 
(IS_EMAIL(error_message=auth.messages.invalid_email),
   IS_NOT_IN_DB(db, 
db.auth_user.email,error_message = 'Email già censita'))
auth.define_tables(migrate = settings.migrate)

I set in the default.py this def for manage the user changes .

@auth.requires_login()
@auth.requires_membership('risorse_umane' or 'admin')
def anagrafica_utenti_db_manage():
form = SQLFORM.smartgrid(db.auth_user,onupdate=auth.archive)
return locals()

When i try to modify the name or the surname the framework rise the 
IS_STRONG control even if i don't touch the password string.
I am new with web2py and i want just to know if i need to create a form to 
make the user changes or i can fix this problem using the smartgrid.
I also set the "Requires approval" for the new registration. How can i 
delete the "Pending" in the registration key ? (I can t do it right now 
because of the IS_STRONG control.
Thanks for help
And sorry for bother you

-- 





[web2py] Email notification for new subscribers

2012-10-11 Thread piero crisci
Hello 
I am trying to realize a little web-app for my society. For the Access 
Control List i set this policy:

auth.settings.registration_requires_verification = True
auth.settings.registration_requires_approval = True
auth.settings.reset_password_requires_verification = True

I was wondering if was possible also to set an e-mail notification to the 
admin or to users of a specified group.
In this way, with the notification, every new registration can be checked 
faster.
Is there a policy to set that can do this notification or i need to define 
a new function in some library?.


-- 





[web2py] Re: How show a menù for user logged in and of a specified group

2012-10-08 Thread piero crisci
Thank you  i will do as you guys said. Thank for help! 

Il giorno venerdì 5 ottobre 2012 15:47:40 UTC+2, villas ha scritto:
>
> Just change your models/menu.py to have a conditional section which will 
> add a section to response.menu,  perhaps comething like this:
>
> if auth.has_membership('admin'):
> response.menu += [
> (T('Admin'),False,'',[
> (T('Test1'),False,URL('default','admin_test1'
> )),
> (T('Test2'),False,URL('default','admin_test2'
> )),
> ]
>
>
>
> On Friday, October 5, 2012 1:17:56 PM UTC+1, piero crisci wrote:
>>
>> Hello i am new to web2py and i am really skilled.
>> I am trying to improve my tests but i can t find a solution for this 
>> problem.
>> I wanto to buil a menù with 2 macro categories:
>> - Pages with Pubblic Navigation for user logged in
>> - Pages for user included in an auth.groups called ( Admin)
>>
>> How can i manage to show the only first category for the normal user 
>> without showing the second category?
>> Thank for help!
>>
>>

-- 





[web2py] How show a menù for user logged in and of a specified group

2012-10-05 Thread piero crisci
Hello i am new to web2py and i am really skilled.
I am trying to improve my tests but i can t find a solution for this 
problem.
I wanto to buil a menù with 2 macro categories:
- Pages with Pubblic Navigation for user logged in
- Pages for user included in an auth.groups called ( Admin)

How can i manage to show the only first category for the normal user 
without showing the second category?
Thank for help!

-- 





[web2py] SQL FORM validation with 3 unique field

2012-06-15 Thread piero crisci
Hello i am new to web2py i create a table in mysql db that need to have 3 
unique field:

   - ID_USER  
   - ID_GROUP 
   - ID_USER_ORGANIZATION

ID_USER and ID_GROUP are Unique keys of the table GROUPS
ID_USER is a Unique Keys of table USERS
ID_USER , ID_GROUP, ID_ORGANIZATION are Unique Keys for the table 
ORGANIZATION

I was trying to create a validation form with SQLFORM  using IS_NOT_IN_DB 
fuction but i dint' find a solution, i found lot of solution for 2 field 
check but not for 3. 

For the SQLFORM of the table GROUPS i didnt' got problems infact i wrote:

db.groups.id_group.requires = IS_NOT_IN_DB (db(db.users.id_user== 
request.vars.id_user),db.groups.id_group.)

Can someone help me posting just an example that i can try for the 
validation of the value of the ORGANIZATIONE TABLE?

Thank you