Re: [web2py] Re: Group wont create

2014-04-17 Thread Anthony
If you are in a shell, you need to call db.commit() to commit any changes 
to the database (this is not necessary in app code because that is handled 
automatically during a normal HTTP request).

Anthony

On Thursday, April 17, 2014 5:30:35 PM UTC-4, Eduardo Cruz wrote:

> from the console, it seems that if you have signature=True on auth it does 
> not create groups when you are not logged in, if I make an user it works.
>
>
> On 17 April 2014 17:16, Anthony  wrote:
>
>> Where/how are you calling auth.add_group?
>>
>>
>> On Thursday, April 17, 2014 4:08:27 PM UTC-4, Eduardo Cruz wrote:
>>>
>>> Hey!
>>> When I try to create a new group with auth.add_group('Administrators', 
>>> 'Administrators of the system') it return the id of the new group but the 
>>> group is not created on the database.
>>> but when I create an user and web2py create their group it got the next 
>>> id, so I supposed that add_group is creating the group and the deleting it 
>>> afterwards.
>>> is there some reason why this is happening?
>>>
>>  -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/u1Nx2HubkxA/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Eduardo Cruz
> (829)-775-4605 | educr...@gmail.com 
>  

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


Re: [web2py] Re: Group wont create

2014-04-17 Thread Eduardo Cruz
from the console, it seems that if you have signature=True on auth it does
not create groups when you are not logged in, if I make an user it works.


On 17 April 2014 17:16, Anthony  wrote:

> Where/how are you calling auth.add_group?
>
>
> On Thursday, April 17, 2014 4:08:27 PM UTC-4, Eduardo Cruz wrote:
>>
>> Hey!
>> When I try to create a new group with auth.add_group('Administrators',
>> 'Administrators of the system') it return the id of the new group but the
>> group is not created on the database.
>> but when I create an user and web2py create their group it got the next
>> id, so I supposed that add_group is creating the group and the deleting it
>> afterwards.
>> is there some reason why this is happening?
>>
>  --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/u1Nx2HubkxA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Eduardo Cruz
(829)-775-4605 | educr...@gmail.com

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


[web2py] Re: Group wont create

2014-04-17 Thread Anthony
Where/how are you calling auth.add_group?

On Thursday, April 17, 2014 4:08:27 PM UTC-4, Eduardo Cruz wrote:
>
> Hey!
> When I try to create a new group with auth.add_group('Administrators', 
> 'Administrators of the system') it return the id of the new group but the 
> group is not created on the database.
> but when I create an user and web2py create their group it got the next 
> id, so I supposed that add_group is creating the group and the deleting it 
> afterwards.
> is there some reason why this is happening?
>

-- 
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: Hosting separate web2py application and PHP application on same apache fedora server

2014-04-17 Thread sonu kumar
Thanks a lot..
now it is working..

On Wednesday, 16 April 2014 19:09:20 UTC-7, LightDot wrote:
>
> Browser could not find... means exactly that. That might not be an apache 
> error at all...
>
> If your domain / subdomain names are correct, than you're missing DNS 
> entries for either caspdb or cleav subdomains. They might work locally if 
> you've put them in /etc/hosts, but they most certainly won't resolve over 
> the internet.
>
> Before worrying about how your PHP is set up, you need to get to the point 
> when your index.php is either executed or you see the text contents...
>
> That being said, this is not really connected with web2py in any way.
>
>
> On Thursday, April 17, 2014 2:57:11 AM UTC+2, sonu kumar wrote:
>>
>> When I open my catdb application on web it says browser could not find...
>> there is one php.conf file in /etc/httpd/conf.d/
>>
>> my php application is totally independent of web2py application...
>>
>> On Wednesday, 16 April 2014 17:45:35 UTC-7, LightDot wrote:
>>>
>>> So what is the error you get? Apache should either complain at server 
>>> restart or you should be able to see at least some error description when 
>>> you attempt to open the page.
>>>
>>> Also, I assume you have PHP configured outside of this vhost and enabled 
>>> server-wide? Are you using mod_fcgid or..?
>>>
>>>
>>> On Thursday, April 17, 2014 2:36:48 AM UTC+2, sonu kumar wrote:

 I just corrected all typos and deleted "Deny from all" and also added

 ErrorLog /data/www/html/caspdb/error_log

 but still not working as well as nothing is written in error_log file


 On Wednesday, 16 April 2014 17:04:58 UTC-7, LightDot wrote:
>
> First thing that jumps at me is the "Deny from all" directive in your 
> PHP vhost... The other things I notice are the typos: you have catdb 
> subdomain, catpdb document root and caspdb directory. At least one of 
> those 
> is a clear typo.
>
> Apache logs are quite helpful with these stuff.
>
> Regards
>
> On Thursday, April 17, 2014 1:02:12 AM UTC+2, sonu kumar wrote:
>>
>> I am running one web2py application on fedora webserver. Now I would 
>> like to run one PHP application on this same server, but I am not able 
>> to 
>> configure its httpd.conf file.
>>
>> At the moment my web2py application setting in httpd.conf file is 
>> below in black and red is for my PHP application but not able to access 
>> PHP 
>> application from web but web2py application running fine:
>>
>> NameVirtualHost *:80
>> NameVirtualHost *:443
>>
>> 
>>ServerName catdb.sanfordburnham.org
>>DocumentRoot /data/www/html/catpdb
>>
>>
>> AllowOverride None
>> Order Allow,Deny
>> Deny from all
>> DirectoryIndex index.php
>>   
>>
>> 
>>
>>
>> 
>>   ServerName cleav.sanfordburnham.org
>>   WSGIDaemonProcess web2py user=apache group=apache processes=1 
>> threads=1
>>   WSGIProcessGroup web2py
>>   WSGIScriptAlias / /opt/web-apps/web2py/wsgihandler.py
>>   WSGIPassAuthorization On
>>
>>   
>> AllowOverride None
>> Order Allow,Deny
>> Deny from all
>> 
>>   Allow from all
>> 
>>   
>>
>>   AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) 
>> /opt/web-apps/web2py/applications/$1/static/$2
>>
>>   
>> Options -Indexes
>> Order Allow,Deny
>> Allow from all
>>   
>>
>>   
>> Deny from all
>>   
>>
>>   
>> Deny from all
>>   
>>
>>   CustomLog /var/log/httpd/access_log common
>>   ErrorLog /var/log/httpd/error_log
>> 
>>
>> 
>>   ServerName cleav.sanfordburnham.org
>>   SSLEngine on
>>   SSLCertificateFile /etc/httpd/ssl/self_signed.cert
>>   SSLCertificateKeyFile /etc/httpd/ssl/self_signed.key
>>
>>   WSGIProcessGroup web2py
>>   WSGIScriptAlias / /opt/web-apps/web2py/wsgihandler.py
>>   WSGIPassAuthorization On
>>
>>   
>> AllowOverride None
>> Order Allow,Deny
>> Deny from all
>> 
>>   Allow from all
>> 
>>   
>>
>>   AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) 
>> /opt/web-apps/web2py/applications/$1/static/$2
>>
>>   
>> Options -Indexes
>> ExpiresActive On
>> ExpiresDefault "access plus 1 hour"
>> Order Allow,Deny
>> Allow from all
>>   
>>
>>   CustomLog /var/log/httpd/access_log common
>>   ErrorLog /var/log/httpd/error_log
>> 
>>
>>

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

[web2py] Group wont create

2014-04-17 Thread Eduardo Cruz
Hey!
When I try to create a new group with auth.add_group('Administrators', 
'Administrators of the system') it return the id of the new group but the 
group is not created on the database.
but when I create an user and web2py create their group it got the next id, 
so I supposed that add_group is creating the group and the deleting it 
afterwards.
is there some reason why this is happening?

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


Re: [web2py] Re: How to create a user progmatically?

2014-04-17 Thread Eduardo Cruz
Thanks :)

On Thursday, April 17, 2014 1:57:57 PM UTC-4, Anthony wrote:
>
> password=db.auth_user.password.validate('mypassword')[0]
>
> Anthony
>
>
> On Thursday, April 17, 2014 11:58:23 AM UTC-4, Eduardo Cruz wrote:
>
>> Thanks but how can I crypt the password?
>>
>>
>> On 17 April 2014 11:47, Anthony > wrote:
>>
>>> There is
>>>
>>> auth.get_or_create_user(keys=dict(first_name='Eduardo', ...), login=
>>> False)
>>>
>>> Anthony
>>>
>>>
>>> On Thursday, April 17, 2014 11:25:07 AM UTC-4, Eduardo Cruz wrote:
>>>
 How can I create a user progmatically? I'm trying to make a custom form 
 for login/register/etc

>>>  -- 
>>> 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 a topic in the 
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/web2py/sLCxZmK7tmQ/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+un...@googlegroups.com .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Eduardo Cruz
>> (829)-775-4605 | educ...@gmail.com  
>>  
>

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


[web2py] Re: Best way to implement SQL select query

2014-04-17 Thread Niphlod
you can use "contains" for 'text' fields if you want it turned to a "LIKE 
'%whatever%' query, or as a "find me where 'whatever' is" in a 
'list:string' field.
at this point a bit of code wouldn't hurt :D
 
On Thursday, April 17, 2014 5:07:38 PM UTC+2, Rob Goldsmith wrote:
>
> Thanks Joe - changing the query to *belongs *did the trick although the 
> query is still very slow when the list is long - but I'm not sure if that's 
> primarily because I'm using sqlite at this stage?
>
> Niphlod - f_postcode is of type text and result is a list of strings (e.g. 
> ['W1 2TR', 'SW1 5AB' ...] 
>
> On Wednesday, 16 April 2014 13:39:02 UTC+1, Rob Goldsmith wrote:
>>
>> I tried posting this earlier, but it doesn't seem to have appeared yet - 
>> so apologies if this comes up twice.
>>
>> I am writing a web2py application which accepts a UK postcode then 
>> provides information about nearby postcodes. I have tried two methods, both 
>> of which work fine when the number of nearby postcodes is relatively few 
>> (less than a hundred).
>>
>> Method 1 uses the *contains *method as follows
>>
>> query &= db.t_properties.f_postcode.contains(result)
>>
>> where *result *is the list of nearby postcodes
>>
>> Method 2 does the query first and then uses *exclude* to eliminate the 
>> unwanted rows as follows
>>
>> rows.exclude(lambda row: row.f_postcode not in result) 
>>
>> However, when the list of postcodes is larger (>about 100), both methods 
>> are failing. Method 1 appears to fail because of inherent limitations of 
>> sqlite (https://sqlite.org/limits.html - SQLITE_LIMIT_VARIABLE_NUMBER - 
>> albeit that refers to a limit of 999 rather than 99). Method 2 fails with 
>> the message:
>>
>>  maximum recursion depth exceeded in cmp
>>
>> Now, I'm pretty sure that I can solve it by moving to MySQL or another db 
>> but I'm pretty sure that I'm not doing the query in the optimal way. Can 
>> anyone give any advice as to the correct / most efficient way to accomplish 
>> this?
>>
>> thanks 
>> Rob.
>>
>>

-- 
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: errors with input form

2014-04-17 Thread Niphlod
do you by any chance use a page where /a/c/f?numtofind=32193129 is allowed 
? if yes, you got yourself played cutting and pasting without thinking too 
much :D

what you should inspect is not request.vars.numtofind but 
form.vars.numtofind.

request.vars.numtofind will hold ANY value submitted as a query string 
(?numtofind=23112312) AND submitted with the form .

that's why there is request.get_vars and request.post_vars  
request.vars is a union of the two. 

On Thursday, April 17, 2014 5:24:13 PM UTC+2, LoveWeb2py wrote:
>
> I created a search function where users can type in a set of numbers and 
> search for them using:
>
> form=FORM('What is your n umber', INPUT(_name='numtofind', 
> INPUT(_type='submit'))
>
> if form.accepts(request,session):
>   numtofind = request.vars.numtofind
>
> Let's say a users number is "12345"
>
> a normal request should look like "User has requested '12345'.
>
> Sometimes though they get the white screen with an error, so I started 
> monitoring their input. Somehow the input gets turned into a list.
>
> Its as if they already had a session stored and they go to submit again 
> and the search becomes a list like this ['12345','12345678'] where 
> '12345678' is their new search.
>
> Any thoughts on how I could fix 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.


[web2py] Re: Encrypting/decrypting db values

2014-04-17 Thread Niphlod
there are plenty of libraries more focused on the encryption. As any other 
thing where math, ciphers and security is involved, there is no magic 
bullet.

On Thursday, April 17, 2014 7:19:22 PM UTC+2, Kiran Subbaraman wrote:
>
> Just checked and noticed that the encrypt/decrypt are not in gluon.utils. 
> Definitely would like to see them part of web2py, instead of having to 
> include this code in my application.
> Any plans?
>
> On Wednesday, June 26, 2013 1:53:32 AM UTC+5:30, Massimo Di Pierro wrote:
>>
>> Should we include decrypt(key,data) and encrypt(key,data) in gluon.utils?
>>
>> On Tuesday, 25 June 2013 13:42:29 UTC-5, Niphlod wrote:
>>>
>>> sorry, cut&paste error.
>>>
>>>
>>>
>>> import gluon.contrib.aes as AES
>>> import threading 
>>> import os
>>> import base64
>>>
>>> def fast_urandom16(urandom=[], locker=threading.RLock()):
>>> """
>>> this is 4x faster than calling os.urandom(16) and prevents
>>> the "too many files open" issue with concurrent access to 
>>> os.urandom()
>>> """
>>> try:
>>> return urandom.pop()
>>> except IndexError:
>>> try:
>>> locker.acquire()
>>> ur = os.urandom(16 * 1024)
>>> urandom += [ur[i:i + 16] for i in xrange(16, 1024 * 16, 16)]
>>> return ur[0:16]
>>> finally:
>>> locker.release()
>>> 
>>> def pad(s, n=32, padchar=' '):
>>> return s + (32 - len(s) % 32) * padchar
>>>
>>> def AES_new(key, IV=None):
>>> """ Returns an AES cipher object and random IV if None specified """
>>> if IV is None:
>>> IV = fast_urandom16()
>>>
>>> return AES.new(key, AES.MODE_CBC, IV), IV
>>>
>>> def w2p_encrypt(data):
>>> key = 'asdsaddasdasdas'
>>> key = pad(key[:32])
>>> cipher, IV = AES_new(key)
>>> encrypted_data = IV + cipher.encrypt(pad(data))
>>> return base64.urlsafe_b64encode(encrypted_data)
>>>
>>> def w2p_decrypt(data):
>>> key = 'asdsaddasdasdas'
>>> key = pad(key[:32])
>>> data = base64.urlsafe_b64decode(data)
>>> IV, data = data[:16], data[16:]
>>> cipher, _ = AES_new(key, IV=IV)
>>> data = cipher.decrypt(data)
>>> data = data.rstrip(' ')
>>> return data
>>>
>>> db.define_table('t_test',
>>> Field('f_field')
>>> )
>>>
>>> db.t_test.f_field.filter_in = lambda value : w2p_encrypt(value)
>>> db.t_test.f_field.filter_out = lambda value : w2p_decrypt(value)
>>>
>>>
>>>

-- 
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: Newbie print question

2014-04-17 Thread Dave S


On Thursday, April 17, 2014 8:48:17 AM UTC-7, jimbo wrote:
>
> Cheers Anthony, will have a go at that. Can I just comment out or remove 
> those lines. Thanks Jimmy.
>

Been there, done that, got the turtleneck:


   :-)

/dps
 

>
> On Thursday, 17 April 2014 11:25:14 UTC+1, jimbo wrote:
>>
>> Right, I have made a simple database which works well and looks nice on 
>> screen. That is in 'edit' everything looks as it should, everything in nice 
>> neat boxes and that is how I would like it to print.
>>
>> However when I print the page a lot of other stuff appears which I gather 
>> are link details, a Google lead me to believe that this is caused by some 
>> code in the css of web2py. I have looked through the css but can't see 
>> which bit I could alter/remove.
>>
>>
>> Any ideas, explained simply please?
>>
>> Thanks, Jimmy
>>
>

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


[web2py] Re: How can I open a page on a new tab?

2014-04-17 Thread Dave S


On Thursday, April 17, 2014 8:26:58 AM UTC-7, Oli wrote:
>
>  
> URL('Link for a new tab', _class="btn" , _title=T("in a new tab"), 
> _href=URL("default","yourcontroller",args=[row.id]), *_target='_blank'*)
>

I may be missing something, but this looks like it makes a button that when 
pressed goes direct to a new tab.  I think csavorgn wanted to process the 
form normally, using the button to submit it, but to have a new tab (or 
popup?) for the post-processing destination.  Am I off track here?

/dps

 

>
> Am Donnerstag, 17. April 2014 09:41:35 UTC+2 schrieb csavorgn:
>
>> Hi,
>> I'm using a SQLFORM.factory to let the user enter some data and I added a 
>> button using
>>
>> buttons=[INPUT(_type="submit",_value="Go!")]
>>
>> When "Go!" is pressed a new page is opened using the following code:
>>
>> if form.process().accepted:
>> redirect(URL("default","go", vars=dict(name=form.vars.name)))
>>
>> Is there a way to open the page ".../default/go?name=carlo#" in a new tab?
>> Thanks
>> Carlo
>>
>

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


Re: [web2py] Re: How to create a user progmatically?

2014-04-17 Thread Anthony
password=db.auth_user.password.validate('mypassword')[0]

Anthony


On Thursday, April 17, 2014 11:58:23 AM UTC-4, Eduardo Cruz wrote:

> Thanks but how can I crypt the password?
>
>
> On 17 April 2014 11:47, Anthony  wrote:
>
>> There is
>>
>> auth.get_or_create_user(keys=dict(first_name='Eduardo', ...), login=False
>> )
>>
>> Anthony
>>
>>
>> On Thursday, April 17, 2014 11:25:07 AM UTC-4, Eduardo Cruz wrote:
>>
>>> How can I create a user progmatically? I'm trying to make a custom form 
>>> for login/register/etc
>>>
>>  -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/sLCxZmK7tmQ/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Eduardo Cruz
> (829)-775-4605 | educr...@gmail.com 
>  

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


[web2py] Re: Newbie print question

2014-04-17 Thread Anthony
Yes, you can just comment/remove those lines.

On Thursday, April 17, 2014 11:48:17 AM UTC-4, jimbo wrote:
>
> Cheers Anthony, will have a go at that. Can I just comment out or remove 
> those lines. Thanks Jimmy.
>
> On Thursday, 17 April 2014 11:25:14 UTC+1, jimbo wrote:
>>
>> Right, I have made a simple database which works well and looks nice on 
>> screen. That is in 'edit' everything looks as it should, everything in nice 
>> neat boxes and that is how I would like it to print.
>>
>> However when I print the page a lot of other stuff appears which I gather 
>> are link details, a Google lead me to believe that this is caused by some 
>> code in the css of web2py. I have looked through the css but can't see 
>> which bit I could alter/remove.
>>
>>
>> Any ideas, explained simply please?
>>
>> Thanks, Jimmy
>>
>

-- 
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: Encrypting/decrypting db values

2014-04-17 Thread Kiran Subbaraman
Just checked and noticed that the encrypt/decrypt are not in gluon.utils. 
Definitely would like to see them part of web2py, instead of having to 
include this code in my application.
Any plans?

On Wednesday, June 26, 2013 1:53:32 AM UTC+5:30, Massimo Di Pierro wrote:
>
> Should we include decrypt(key,data) and encrypt(key,data) in gluon.utils?
>
> On Tuesday, 25 June 2013 13:42:29 UTC-5, Niphlod wrote:
>>
>> sorry, cut&paste error.
>>
>>
>>
>> import gluon.contrib.aes as AES
>> import threading 
>> import os
>> import base64
>>
>> def fast_urandom16(urandom=[], locker=threading.RLock()):
>> """
>> this is 4x faster than calling os.urandom(16) and prevents
>> the "too many files open" issue with concurrent access to 
>> os.urandom()
>> """
>> try:
>> return urandom.pop()
>> except IndexError:
>> try:
>> locker.acquire()
>> ur = os.urandom(16 * 1024)
>> urandom += [ur[i:i + 16] for i in xrange(16, 1024 * 16, 16)]
>> return ur[0:16]
>> finally:
>> locker.release()
>> 
>> def pad(s, n=32, padchar=' '):
>> return s + (32 - len(s) % 32) * padchar
>>
>> def AES_new(key, IV=None):
>> """ Returns an AES cipher object and random IV if None specified """
>> if IV is None:
>> IV = fast_urandom16()
>>
>> return AES.new(key, AES.MODE_CBC, IV), IV
>>
>> def w2p_encrypt(data):
>> key = 'asdsaddasdasdas'
>> key = pad(key[:32])
>> cipher, IV = AES_new(key)
>> encrypted_data = IV + cipher.encrypt(pad(data))
>> return base64.urlsafe_b64encode(encrypted_data)
>>
>> def w2p_decrypt(data):
>> key = 'asdsaddasdasdas'
>> key = pad(key[:32])
>> data = base64.urlsafe_b64decode(data)
>> IV, data = data[:16], data[16:]
>> cipher, _ = AES_new(key, IV=IV)
>> data = cipher.decrypt(data)
>> data = data.rstrip(' ')
>> return data
>>
>> db.define_table('t_test',
>> Field('f_field')
>> )
>>
>> db.t_test.f_field.filter_in = lambda value : w2p_encrypt(value)
>> db.t_test.f_field.filter_out = lambda value : w2p_decrypt(value)
>>
>>
>>

-- 
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: Encrypting/decrypting db values

2014-04-17 Thread Kiran Subbaraman
I just tried this, and it works as expected. Thanks for this useful piece 
of code Niphlod. 
Just a bunch of 'gotchas', which I thought might help someone else trying 
this code:

   - I had existing data in the table, which was in plain text format. When 
   I introduced this code I encountered errors like "..Incorrect padding...". 
   Went ahead and commented out the filter* assignments, exported the plain 
   text data. Un-commented the filter* assignments, and imported the data. 
   - My data has long / integer / numeric fields, and I noticed errors in 
   the pad() method. Works well for non-numeric fields - primarily string 
   fields. 
   - Also removed NULL/None values from the dataset. 
   

On Wednesday, June 26, 2013 12:12:29 AM UTC+5:30, Niphlod wrote:
>
> sorry, cut&paste error.
>
>
>
> import gluon.contrib.aes as AES
> import threading 
> import os
> import base64
>
> def fast_urandom16(urandom=[], locker=threading.RLock()):
> """
> this is 4x faster than calling os.urandom(16) and prevents
> the "too many files open" issue with concurrent access to os.urandom()
> """
> try:
> return urandom.pop()
> except IndexError:
> try:
> locker.acquire()
> ur = os.urandom(16 * 1024)
> urandom += [ur[i:i + 16] for i in xrange(16, 1024 * 16, 16)]
> return ur[0:16]
> finally:
> locker.release()
> 
> def pad(s, n=32, padchar=' '):
> return s + (32 - len(s) % 32) * padchar
>
> def AES_new(key, IV=None):
> """ Returns an AES cipher object and random IV if None specified """
> if IV is None:
> IV = fast_urandom16()
>
> return AES.new(key, AES.MODE_CBC, IV), IV
>
> def w2p_encrypt(data):
> key = 'asdsaddasdasdas'
> key = pad(key[:32])
> cipher, IV = AES_new(key)
> encrypted_data = IV + cipher.encrypt(pad(data))
> return base64.urlsafe_b64encode(encrypted_data)
>
> def w2p_decrypt(data):
> key = 'asdsaddasdasdas'
> key = pad(key[:32])
> data = base64.urlsafe_b64decode(data)
> IV, data = data[:16], data[16:]
> cipher, _ = AES_new(key, IV=IV)
> data = cipher.decrypt(data)
> data = data.rstrip(' ')
> return data
>
> db.define_table('t_test',
> Field('f_field')
> )
>
> db.t_test.f_field.filter_in = lambda value : w2p_encrypt(value)
> db.t_test.f_field.filter_out = lambda value : w2p_decrypt(value)
>
>
>

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


Re: [web2py] Re: How to create a user progmatically?

2014-04-17 Thread Eduardo Cruz
Thanks but how can I crypt the password?


On 17 April 2014 11:47, Anthony  wrote:

> There is
>
> auth.get_or_create_user(keys=dict(first_name='Eduardo', ...), login=False)
>
> Anthony
>
>
> On Thursday, April 17, 2014 11:25:07 AM UTC-4, Eduardo Cruz wrote:
>
>> How can I create a user progmatically? I'm trying to make a custom form
>> for login/register/etc
>>
>  --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/sLCxZmK7tmQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Eduardo Cruz
(829)-775-4605 | educr...@gmail.com

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


Re: [web2py] Nginx/passenger/web2py -> 504 Gateway Timeout?

2014-04-17 Thread LightDot
First thing, try ditching the symlink and copy the wsgihandler.py directly 
to passenger_wsgi.py. There might be a security measure in place, 
preventing symlinks.

The next thing I'd try is seeing if the paths within the passenger_wsgi.py 
get proper values, but this might be a long shot.

Since you say you're on a shared host, I assume you can't see how your web 
server and passenger configuration files actually look like? That would 
help.


On Thursday, April 17, 2014 1:57:40 PM UTC+2, Krzysztof Socha wrote:
>
> Yes - this is what I did. And yes - it seams to be a configuration 
> issue... It is just that I have no clue where to look :( 
>
> On Wednesday, April 16, 2014 12:59:36 PM UTC+2, LightDot wrote:
>>
>> So, I would say this is a configuration issue... But I'm not sure what's 
>> the problem. @Krzysztof, when you say you've put all web2py files within 
>> the folder, expected by passenger, did you omit the top web2py 
>> directory? The structure should be simply:
>>
>> top_passenger_dir/
>>   applications
>>   deposit
>>   gluon
>>   ...etc...
>>   passenger_wsgi.py
>>   web2py.py
>>
>> Regards
>>
>> On Tuesday, April 15, 2014 6:17:17 PM UTC+2, Richard wrote:
>>>
>>> I make it works with Phusion long time ago, and then get convinced after 
>>> reading a blog post that this were a bad idea, since at that time phusion 
>>> was not following the same rule as other linux in matter of service 
>>> managment, so I resign. I remember having read and work hard, since there 
>>> were no single one-stop place to make it works... The phusion doc, was the 
>>> better place + blog post and tuto.
>>>
>>> Sorry I couldn't help more... But I would again suggest you to walkaway 
>>> of phusion if you can somehow. My understanding is this project is not 
>>> enough or wasn't (1,5 years ago) to work in production. I was required to 
>>> compile Nginx to include phusion module because it is not include by 
>>> default, to me just that is enough to not consider it prod ready...
>>>
>>> Richard
>>>
>>>
>>> On Tue, Apr 15, 2014 at 3:34 AM, Krzysztof Socha wrote:
>>>
 Thanks... But I kinda cannot... The hosting I am using is providing 
 nginx + phusion passenger... and it works with a simple script, as I have 
 shown. Unfortunately, it looks like the web2py handler never returns 
 anything and the request time-outs... I do not even know where to look to 
 understand what happens... Any suggestions?

 Krzysztof.


 On Monday, April 14, 2014 3:58:16 PM UTC+2, Richard wrote:
>
> Use unicorn!!
>
> Phusion is more work...
>
> You can have a look in contrib there is a scrip that help deploy 
> redmine beside web2py with unicorn, so you can derive something for you 
> need from it. It works with 12.04.
>
> Richard
>
>
>  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google 
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to web2py+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>

-- 
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: Newbie print question

2014-04-17 Thread jimbo
Cheers Anthony, will have a go at that. Can I just comment out or remove 
those lines. Thanks Jimmy.

On Thursday, 17 April 2014 11:25:14 UTC+1, jimbo wrote:
>
> Right, I have made a simple database which works well and looks nice on 
> screen. That is in 'edit' everything looks as it should, everything in nice 
> neat boxes and that is how I would like it to print.
>
> However when I print the page a lot of other stuff appears which I gather 
> are link details, a Google lead me to believe that this is caused by some 
> code in the css of web2py. I have looked through the css but can't see 
> which bit I could alter/remove.
>
>
> Any ideas, explained simply please?
>
> Thanks, Jimmy
>

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

2014-04-17 Thread John Fraser
How would one go about making certain fields readable (visible) to the 
search, view, edit, etc, but hidden from the actual grid.  Below is my code 
that accomplishes the hiding the fields from the main grid, but struggling 
with making them readable to the search:

@auth.requires_login()
def index():
response.title = 'Computer Inventory'
db.inventory.id.readable = False
if 'view' in request.args or 'new' in request.args or 'edit' in 
request.args or '_export_type' in request.vars:
db.inventory.gb_ram.readable = True
db.inventory.hd_size.readable = True
db.inventory.video_card.readable = True
db.inventory.os_key.readable = True
db.inventory.serial_service_code.readable = True
else:
db.inventory.gb_ram.readable = False
db.inventory.hd_size.readable = False
db.inventory.video_card.readable = False
db.inventory.os_key.readable = False
db.inventory.serial_service_code.readable = False
if '_export_type' not in request.vars:
db.inventory.cpu_status.represent = lambda cpu_status, row: \
SPAN(row.cpu_status,
 _style='text-transform: uppercase; font-weight: bold; 
padding:5px; color: %s; background-color: %s' %
 ('black' if row.cpu_status == 'Staged' else 'white','red' 
if row.cpu_status == 'Repair' else 'gold'
 if row.cpu_status == 'Staged' else 'green' if 
row.cpu_status == 'In Use' else 'black'))
grid = SQLFORM.grid(db.inventory, csv=True, 
maxtextlengths={'inventory.notes': 65})
return locals()


Thanks in advance!  Any help appreciated.

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


[web2py] Re: How to create a user progmatically?

2014-04-17 Thread Anthony
There is

auth.get_or_create_user(keys=dict(first_name='Eduardo', ...), login=False)

Anthony

On Thursday, April 17, 2014 11:25:07 AM UTC-4, Eduardo Cruz wrote:

> How can I create a user progmatically? I'm trying to make a custom form 
> for login/register/etc
>

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


[web2py] Re: How can I open a page on a new tab?

2014-04-17 Thread Oli
 
URL('Link for a new tab', _class="btn" , _title=T("in a new tab"), 
_href=URL("default","yourcontroller",args=[row.id]), *_target='_blank'*)

Am Donnerstag, 17. April 2014 09:41:35 UTC+2 schrieb csavorgn:

> Hi,
> I'm using a SQLFORM.factory to let the user enter some data and I added a 
> button using
>
> buttons=[INPUT(_type="submit",_value="Go!")]
>
> When "Go!" is pressed a new page is opened using the following code:
>
> if form.process().accepted:
> redirect(URL("default","go", vars=dict(name=form.vars.name)))
>
> Is there a way to open the page ".../default/go?name=carlo#" in a new tab?
> Thanks
> Carlo
>

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


[web2py] How to create a user progmatically?

2014-04-17 Thread Eduardo Cruz
How can I create a user progmatically? I'm trying to make a custom form for 
login/register/etc

-- 
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] errors with input form

2014-04-17 Thread LoveWeb2py
I created a search function where users can type in a set of numbers and 
search for them using:

form=FORM('What is your n umber', INPUT(_name='numtofind', 
INPUT(_type='submit'))

if form.accepts(request,session):
  numtofind = request.vars.numtofind

Let's say a users number is "12345"

a normal request should look like "User has requested '12345'.

Sometimes though they get the white screen with an error, so I started 
monitoring their input. Somehow the input gets turned into a list.

Its as if they already had a session stored and they go to submit again and 
the search becomes a list like this ['12345','12345678'] where '12345678' 
is their new search.

Any thoughts on how I could fix 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.


[web2py] Re: Best way to implement SQL select query

2014-04-17 Thread Rob Goldsmith
Thanks Joe - changing the query to *belongs *did the trick although the 
query is still very slow when the list is long - but I'm not sure if that's 
primarily because I'm using sqlite at this stage?

Niphlod - f_postcode is of type text and result is a list of strings (e.g. 
['W1 2TR', 'SW1 5AB' ...] 

On Wednesday, 16 April 2014 13:39:02 UTC+1, Rob Goldsmith wrote:
>
> I tried posting this earlier, but it doesn't seem to have appeared yet - 
> so apologies if this comes up twice.
>
> I am writing a web2py application which accepts a UK postcode then 
> provides information about nearby postcodes. I have tried two methods, both 
> of which work fine when the number of nearby postcodes is relatively few 
> (less than a hundred).
>
> Method 1 uses the *contains *method as follows
>
> query &= db.t_properties.f_postcode.contains(result)
>
> where *result *is the list of nearby postcodes
>
> Method 2 does the query first and then uses *exclude* to eliminate the 
> unwanted rows as follows
>
> rows.exclude(lambda row: row.f_postcode not in result) 
>
> However, when the list of postcodes is larger (>about 100), both methods 
> are failing. Method 1 appears to fail because of inherent limitations of 
> sqlite (https://sqlite.org/limits.html - SQLITE_LIMIT_VARIABLE_NUMBER - 
> albeit that refers to a limit of 999 rather than 99). Method 2 fails with 
> the message:
>
>  maximum recursion depth exceeded in cmp
>
> Now, I'm pretty sure that I can solve it by moving to MySQL or another db 
> but I'm pretty sure that I'm not doing the query in the optimal way. Can 
> anyone give any advice as to the correct / most efficient way to accomplish 
> this?
>
> thanks 
> Rob.
>
>

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


[web2py] How can I open a page on a new tab?

2014-04-17 Thread csavorgn
Hi,
I'm using a SQLFORM.factory to let the user enter some data and I added a 
button using

buttons=[INPUT(_type="submit",_value="Go!")]

When "Go!" is pressed a new page is opened using the following code:

if form.process().accepted:
redirect(URL("default","go", vars=dict(name=form.vars.name)))

Is there a way to open the page ".../default/go?name=carlo#" in a new tab?
Thanks
Carlo

-- 
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: Newbie print question

2014-04-17 Thread Anthony
Bootstrap includes some "@media print" CSS rules, one of which displays the 
href of links right after the link (this is in bootstrap.min.css). See 
http://drupal.stackexchange.com/questions/59900/how-to-get-rid-of-added-urls-when-printing-a-bootstrap-themed-page.
 
If you'd like, you can go to http://getbootstrap.com/customize/ and 
generate a custom Bootstrap file that excludes the print media styles.

Anthony

On Thursday, April 17, 2014 6:25:14 AM UTC-4, jimbo wrote:

> Right, I have made a simple database which works well and looks nice on 
> screen. That is in 'edit' everything looks as it should, everything in nice 
> neat boxes and that is how I would like it to print.
>
> However when I print the page a lot of other stuff appears which I gather 
> are link details, a Google lead me to believe that this is caused by some 
> code in the css of web2py. I have looked through the css but can't see 
> which bit I could alter/remove.
>
>
> Any ideas, explained simply please?
>
> Thanks, Jimmy
>

-- 
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] Nginx/passenger/web2py -> 504 Gateway Timeout?

2014-04-17 Thread Krzysztof Socha
Yes - this is what I did. And yes - it seams to be a configuration issue... 
It is just that I have no clue where to look :( 

On Wednesday, April 16, 2014 12:59:36 PM UTC+2, LightDot wrote:
>
> So, I would say this is a configuration issue... But I'm not sure what's 
> the problem. @Krzysztof, when you say you've put all web2py files within 
> the folder, expected by passenger, did you omit the top web2py directory? 
> The structure should be simply:
>
> top_passenger_dir/
>   applications
>   deposit
>   gluon
>   ...etc...
>   passenger_wsgi.py
>   web2py.py
>
> Regards
>
> On Tuesday, April 15, 2014 6:17:17 PM UTC+2, Richard wrote:
>>
>> I make it works with Phusion long time ago, and then get convinced after 
>> reading a blog post that this were a bad idea, since at that time phusion 
>> was not following the same rule as other linux in matter of service 
>> managment, so I resign. I remember having read and work hard, since there 
>> were no single one-stop place to make it works... The phusion doc, was the 
>> better place + blog post and tuto.
>>
>> Sorry I couldn't help more... But I would again suggest you to walkaway 
>> of phusion if you can somehow. My understanding is this project is not 
>> enough or wasn't (1,5 years ago) to work in production. I was required to 
>> compile Nginx to include phusion module because it is not include by 
>> default, to me just that is enough to not consider it prod ready...
>>
>> Richard
>>
>>
>> On Tue, Apr 15, 2014 at 3:34 AM, Krzysztof Socha wrote:
>>
>>> Thanks... But I kinda cannot... The hosting I am using is providing 
>>> nginx + phusion passenger... and it works with a simple script, as I have 
>>> shown. Unfortunately, it looks like the web2py handler never returns 
>>> anything and the request time-outs... I do not even know where to look to 
>>> understand what happens... Any suggestions?
>>>
>>> Krzysztof.
>>>
>>>
>>> On Monday, April 14, 2014 3:58:16 PM UTC+2, Richard wrote:

 Use unicorn!!

 Phusion is more work...

 You can have a look in contrib there is a scrip that help deploy 
 redmine beside web2py with unicorn, so you can derive something for you 
 need from it. It works with 12.04.

 Richard


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

-- 
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] Form + combined

2014-04-17 Thread Lucas Schreiber
hey,
i have a Problem and i don't know how to solve it. I want a form with an 
Input "text" field ( let's call it "amount') and an   part 
(let's call it 'area'). And, finally, a "submit" button. All this shall 
work as follow:

You enter a number in "amount", choose an "area" and press "submit". Once 
done, an db table records your "amount" and "area". 

But the Options of the "area" are depending on a db table, giving out like 
for example 5 records, 
[code]
area_db = db(db.area.area_value == 1).select(db.area.ALL)
[/code]
[code]

{{x=0}}
{{y=0}}
{{for row in area_db:}} 
{{r = area_db[y].area_value
  t = area_db[y].area_name
 y = y+1
 x= x+1}}{{=t}}{{pass}}
[/code]

How can i Combine it with an form, so i can enter an amount and submit this 
for further use?
Thanks, 
Regards

-- 
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] Is MongoDB support still experimental ?

2014-04-17 Thread Mandar Vaze
I have been seeing questions about web2py+mongo as old as 2009
I think Mongo support became official in 2.3.2 (may be earlier ?)
but the documentation still continues to say "experimental"

I will soon start a development for a product that requires MongoDB
Considering our existing product is already been developed using web2py - 
web2py is an obvious choice for the new development as well.
But once you go with web2py - switching to another framework may not be 
trivial (We'll be more and more locked in with web2py magic/DAL etc.)

So the question to this list :

   1. How many people are using web2py+Mongo for production ?
   2. What parts should be considered "experimental" ? Why ?
   3. What should I "keep an eye on/watch out for" when using web2py + mongo
   
(Partial answer for #2 above based on my experience)
I started playing with web2py+mongo some time ago. Our product is a 
document management system (lots of "upload" fields with meta data 
associated w/ them)
I realized that when using MongoDBAdapter default location for uploads 
folder is not set (I submitted a patch for the documentation recently, and 
Massimo as graciously merged my pull request)
This took some debugging to figure it out - but nothing that would be 
considered "deal breaker"

-Mandar




-- 
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: Change the download text from "file" to something else?

2014-04-17 Thread António Ramos
HIHIHI, its like Port Wine, the older the better...

Updating ASAP!!!



2014-04-17 11:00 GMT+01:00 Niphlod :

> then it's just 'file'.
> And come on, 2.0.9 is more than a year old!
>
>
> On Thursday, April 17, 2014 11:07:04 AM UTC+2, Ramos wrote:
>
>> I´m using 2.0.9 on windows.
>>
>>
>>
>>
>> 2014-04-16 21:36 GMT+01:00 Niphlod :
>>
>>> what version are you using ?
>>> with latest stable (2.9.5), I just confirmed that the string pops up
>>> quite fine.
>>>
>>>
>>>
>>>
>>>
>>> Can you pack an app to reproduce ?
>>>
>>>
>>> On Wednesday, April 16, 2014 4:23:06 PM UTC+2, Ramos wrote:

 a litle more info i use sqlform

 form=SQLFORM(db.trabalhador,row.id,
 showid=False,
 submit_button="Gravar",
 fields=formfields,
 table_name='trabalhador',
 formstyle = 'table2cols',
 upload=URL('download'),
 readonly=readonly
 )

  to create the form and in my view i have only {{=form}}

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

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


[web2py] Re: Newbie print question

2014-04-17 Thread jimbo
Sorry, the page displays on screen fine, it is when I send it to the 
printer that the extra 'garbage' appears.

Thanks.

On Thursday, 17 April 2014 11:57:48 UTC+1, LightDot wrote:
>
> I think there is a bit of vocabulary mismatch happening here. I assume 
> you, by "print", mean displaying generated html in the browser?
>
> In that case, please be more specific about what exactly you want removed 
> or altered. Show us your code or a screenshot and state *exactly* what's 
> the issue.
>
> Regards
>
> On Thursday, April 17, 2014 12:25:14 PM UTC+2, jimbo wrote:
>>
>> Right, I have made a simple database which works well and looks nice on 
>> screen. That is in 'edit' everything looks as it should, everything in nice 
>> neat boxes and that is how I would like it to print.
>>
>> However when I print the page a lot of other stuff appears which I gather 
>> are link details, a Google lead me to believe that this is caused by some 
>> code in the css of web2py. I have looked through the css but can't see 
>> which bit I could alter/remove.
>>
>>
>> Any ideas, explained simply please?
>>
>> Thanks, Jimmy
>>
>

-- 
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: Newbie print question

2014-04-17 Thread LightDot
I think there is a bit of vocabulary mismatch happening here. I assume you, 
by "print", mean displaying generated html in the browser?

In that case, please be more specific about what exactly you want removed 
or altered. Show us your code or a screenshot and state *exactly* what's 
the issue.

Regards

On Thursday, April 17, 2014 12:25:14 PM UTC+2, jimbo wrote:
>
> Right, I have made a simple database which works well and looks nice on 
> screen. That is in 'edit' everything looks as it should, everything in nice 
> neat boxes and that is how I would like it to print.
>
> However when I print the page a lot of other stuff appears which I gather 
> are link details, a Google lead me to believe that this is caused by some 
> code in the css of web2py. I have looked through the css but can't see 
> which bit I could alter/remove.
>
>
> Any ideas, explained simply please?
>
> Thanks, Jimmy
>

-- 
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] Newbie print question

2014-04-17 Thread jimbo
Right, I have made a simple database which works well and looks nice on 
screen. That is in 'edit' everything looks as it should, everything in nice 
neat boxes and that is how I would like it to print.

However when I print the page a lot of other stuff appears which I gather 
are link details, a Google lead me to believe that this is caused by some 
code in the css of web2py. I have looked through the css but can't see 
which bit I could alter/remove.


Any ideas, explained simply please?

Thanks, Jimmy

-- 
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: Change the download text from "file" to something else?

2014-04-17 Thread Niphlod
then it's just 'file'. 
And come on, 2.0.9 is more than a year old!

On Thursday, April 17, 2014 11:07:04 AM UTC+2, Ramos wrote:
>
> I´m using 2.0.9 on windows.
>
>
>
>
> 2014-04-16 21:36 GMT+01:00 Niphlod >:
>
>> what version are you using ?
>> with latest stable (2.9.5), I just confirmed that the string pops up 
>> quite fine.
>>
>>
>>
>>
>>
>> Can you pack an app to reproduce ?
>>
>>
>> On Wednesday, April 16, 2014 4:23:06 PM UTC+2, Ramos wrote:
>>>
>>> a litle more info i use sqlform
>>>
>>> form=SQLFORM(db.trabalhador,row.id,
>>> showid=False,
>>> submit_button="Gravar",
>>> fields=formfields,
>>> table_name='trabalhador',
>>> formstyle = 'table2cols',
>>> upload=URL('download'),
>>> readonly=readonly
>>> )
>>>
>>>  to create the form and in my view i have only {{=form}}
>>>
>>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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: 'auth.settings.register_verify_password = True' does not generate password confirmation field

2014-04-17 Thread Leonel Câmara
I would just use the form from auth.register() which already has it and use 
form.custom to make my custom form in the view.

-- 
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: Change the download text from "file" to something else?

2014-04-17 Thread António Ramos
I´m using 2.0.9 on windows.




2014-04-16 21:36 GMT+01:00 Niphlod :

> what version are you using ?
> with latest stable (2.9.5), I just confirmed that the string pops up quite
> fine.
>
>
>
>
>
> Can you pack an app to reproduce ?
>
>
> On Wednesday, April 16, 2014 4:23:06 PM UTC+2, Ramos wrote:
>>
>> a litle more info i use sqlform
>>
>> form=SQLFORM(db.trabalhador,row.id,
>> showid=False,
>> submit_button="Gravar",
>> fields=formfields,
>> table_name='trabalhador',
>> formstyle = 'table2cols',
>> upload=URL('download'),
>> readonly=readonly
>> )
>>
>>  to create the form and in my view i have only {{=form}}
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Impersonate in Layers...

2014-04-17 Thread Joe Barnhart
I find I need the "impersonate" feature for a website I'm building -- it is 
the perfect solution to supporting users who forget how to work the website 
or need help setting up their profile information.  In fact, I have a group 
called "support" who I am tasking with this chore and I want them to be 
able impersonate any of the users.

EXCEPT, of course, me.  I have a group for the people who run and control 
every aspect of the website, and only my partner and I have logons at this 
level.  I don't want any "support" group members to be able to impersonate 
my "root" group.  I may add a "manager" group at some point who should also 
not be accessible to the support staff.  I guess I should also prevent 
support staff from impersonating each other as well.  I'm no killjoy, but I 
want to prevent "pranking" and epic April Fools jokes between my support 
reps before they even get started.

And I, of course, as "root" want to be able to impersonate anybody on my 
site.  The only difference between me and the NSA is that my employees 
won't have to wonder or guess if I'm looking over their shoulder -- I'll 
tell them straight up!  (just kidding.  NSA also has a larger budget and 
cooler toys.  there are actually several differences)

I can see how I can add an "impersonate" group, and add it to either the 
auth_user table or specific rows, but that doesn't give me the layers I'm 
looking for.  That is:

support --> impersonate users
managers --> impersonate support, users
root --> impersonate all of the above

Have I missed something obvious?

-- Joe "benevolent dictator" B.

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