[web2py] Re: sqlform.grid default search value

2014-09-07 Thread Oli
try this little app: 
https://w2p.pythonanywhere.com/defaultSearch/default/index

no search:https://w2p.pythonanywhere.com/defaultSearch/default/index

with search:  
https://w2p.pythonanywhere.com/defaultSearch/default/index?keywords=Bill



Am Freitag, 5. September 2014 15:13:58 UTC+2 schrieb Douglas Campbell:

 I had tried that, but I can not get a route to work that would 
 automatically redirect me to ?keywords=something

 I tried adding it to routes.py but it just ignores everything after the 
 '?'. Any tips for getting a route to work that redirects me to the keyword 
 URL? 


 On Friday, September 5, 2014 7:08:39 AM UTC-5, Oli wrote:

 yes, for example if you have a sqlform.grid you can define the search as 
 keyword in the URL.
  
  
 https://SERVER/application/controller/function?keywords=table.field+starts+with+%22A%22
  

 Am Donnerstag, 4. September 2014 23:37:53 UTC+2 schrieb Douglas Campbell:

 Is it possible to have a default search value in an sqlform.grid? I do 
 not see the option in the docs and have not figured out a work around.

 What I truly want to do is have the page JUST load the search bar and 
 not the database results. Then once a search term is entered it shows the 
 results in the sqlform.grid. I was going to just have a default search 
 value when the page loads like Enter_your_search_term_here that would 
 return no results from the database.

 Thanks, 




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


[web2py] Re: Deployment of Web2py Framework on Linux redhat version 6 then configure with apache

2014-09-07 Thread Oli
have a look to the book: 
http://web2py.com/books/default/chapter/29/09/access-control?search=apache

Am Samstag, 6. September 2014 07:23:55 UTC+2 schrieb Kamal Mohemed:

 Hi to everyone,

 I downloaded web2py frame work and run on the web2py default server it is 
 working fine, but we want that should be run with apache server with some 
 different url how to do that?

 Thanks
 Kamal
 Research scientist
 NRSC, ISRO



-- 
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] Sass support example for web2py.

2014-09-07 Thread Encompass solutions
I use templates from wrapbootstrap a lot.  3 times a month even.
Sadly however, it's getting harder and harder to use those templates with 
web2py due to no support be it built-in or not, for SASS, LESS, and others 
getting much more popular.
How can I make it so I code my css in SASS but to the client it is given in 
css?
I propose built in support.  It could be enabled, and then auto import the 
.sass files and convert them to the view accordingly.
Perhaps it should be a part of the pipeline. So we can create object that 
run before the view is rendered.  Perhaps in the view? (Though that sounds 
bad.)

BR,
Jason Brower

-- 
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] extra_fields can't showed in auth_user db.

2014-09-07 Thread olivier hubert
I use the web2py version 2.9.8.
I create a simple new app test_auth

In Models I add my_tables.py with the contents below.

# -*- coding: utf-8 -*-

#Add authentication to the app.
from gluon.tools import Auth

auth = Auth(db, hmac_key=Auth.get_or_create_key())


*#Add some fields in auth_user table to have a complete user 
profile.*auth.settings.extra_fields['auth_user']= [
Field http://127.0.0.1:8000/examples/global/vars/Field('phone_number', 
'string'),
Field http://127.0.0.1:8000/examples/global/vars/Field('address', 'text'),
Field http://127.0.0.1:8000/examples/global/vars/Field('city', 'string'),
Field http://127.0.0.1:8000/examples/global/vars/Field('zip', 'string'),
Field http://127.0.0.1:8000/examples/global/vars/Field('phone', 'string'),
Field http://127.0.0.1:8000/examples/global/vars/Field('birthday', 
'date', requires = IS_DATE 
http://127.0.0.1:8000/examples/global/vars/IS_DATE(format=('%d-%m-%Y')))]
auth.define_tables(username=True, signature=True)

I open the page http://127.0.0.1:8000/test_auth/default/user/register

The form doesn't show my extra field.

After a successful user registration, I open the db admin to see the record in 
the table auth_user, but I can't see my extra fields.

I already try session cleanup, free cookies, create a new app, ... see and try 
some tricks from this forum or stack overflow. I probably miss something but I 
can't see what.

-- 
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: Appadmin redirect after upgrading to 2.9.7

2014-09-07 Thread olivier hubert
I encounter exactly the same issue if you try to open the db administration 
page in a app.

Le dimanche 7 septembre 2014 01:19:31 UTC+2, Luciano Laporta Podazza a 
écrit :

 Same issue :(, as mentioned before, tried testing default apps and my app 
 and it redirects to admin page.


 On Sat, Sep 6, 2014 at 8:14 PM, Luciano Laporta Podazza 
 luciano...@gmail.com javascript: wrote:

 Right now! :), I'll get back to you with results.

 Cheers.


 On Sat, Sep 6, 2014 at 8:11 PM, Massimo Di Pierro massimo@gmail.com 
 javascript: wrote:

 Possible fix in trunk. Can you help test it?


 On Saturday, 6 September 2014 06:56:54 UTC-5, Niphlod wrote:

 ok. it hasn't anything to do with the more security change. It has to 
 do with the new session storage behaviour. Filing an issue right now, 
 shouldn't be hard to fix

 On Saturday, September 6, 2014 1:23:00 AM UTC+2, Dragan Matic wrote:

 +1 Here. It does the same thing to me, 2.9.7 appadmin redirects to 
 web2py admin. 2.9.6 is working correctly. 

 On Friday, September 5, 2014 10:06:24 PM UTC+2, Niphlod wrote:

 because the only change we made was making the access to appadmin 
 more secure when web2py is behind a proxy.

 However, if you get redirected to admin it shouldn't matter, as the 
 change would affect you accessing admin also.
 Seeing the code of appadmin.py (assuming is the latest from 2.9.7) 
 the redirection is made on line 54. Look at those conditions and add a 
 few 
 log (or print) statements to pinpoint the root cause.

 On Friday, September 5, 2014 10:00:01 PM UTC+2, Luciano Laporta 
 Podazza wrote:

 Hi Niphlod,

 No, I'm working locally and no proxies at all. Why you ask?


 On Fri, Sep 5, 2014 at 4:58 PM, Niphlod nip...@gmail.com wrote:

 are you behind a proxy ?


 On Friday, September 5, 2014 9:34:12 PM UTC+2, Luciano Laporta 
 Podazza wrote:

 Hello,

 I was developing an application with web2py 
 2.9.5-trunk+timestamp.2014.03.29.21.54.41 and appadmin worked 
 fine until I upgraded to latest 2.9.7.

 Now when I access appadmin for ANY app(welcome, examples, my app, 
 etc) it redirects to admin and nothing happens.

 Tried cleaning everything, even deleting the entire database and 
 starting from scratch and nothing happened.

 Any ideas about this?. Thanks in advance.

  -- 
 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/9kXd30hW3j0/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.




 -- 
 Atte
 Luciano Laporta Podazza
  
  -- 
 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/9kXd30hW3j0/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 Atte
 Luciano Laporta Podazza
  



 -- 
 Atte
 Luciano Laporta Podazza
  

-- 
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] What is the final answer of default/second.html in Documentation (Postbacks/Internationalization)?

2014-09-07 Thread terencenwk
Regarding to Postbacks in Documentation:
http://web2py.com/books/default/chapter/29/03/overview#Postbacks

(1) What is the final answer of default/second.html if the the default 
controller finally changed to:

def first():
form = SQLFORM.factory(Field('visitor_name', requires=IS_NOT_EMPTY()))
if form.process().accepted:
name = form.vars.visitor_name
redirect(URL('second',vars=dict(name=name)))
return dict(form=form)

def second():
name = request.vars.name or redirect(URL('first'))
return dict(name=name)

(2) How to use T Operator in above example?  Because there is an error if I 
add:
label='what is your name?'
in above example.

-- 
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 setup scripts for windows

2014-09-07 Thread daniel . jarolim
I have notes on running web2py with IIS because nothing out there, 
including in recipes works. Specifically these notes are for 64 bit rather 
than 32 bit and using isapi_wsgi rather than fastcgi. (ISAPI is faster). 
Here they are pretty much verbatim. It looks messy but is actually very 
simple, I have too many explanatory notes.

Install Python 2.7 
   
   - download 2.x from https://www.python.org does not work with 3.x
   - python-2.7.8.amd64.msi (install for all users, add python.exe to path)

Install pywin32(required for isapi_wsgi)

   - download 64 bit from https://sourceforge.net/projects/pywin32/
   - pywin32-219.win-amd64-py2.7.exe

Install isapi_wsgi 
   
   - download source distribution (isapi_wsgi-0.4.2.zip) from 
   https://code.google.com/p/isapi-wsgi/
   - Extract isapi_wsgi to temp folder
   - cd isapi_wsgi-0.4.2.2
   - python setup.py install

Install Web2Py 
   
   - Download web2py src and extract to c: to get C:\web2py
   - run python web2py.py, enter pasword, and start service on port 80 at 
   least once to generate paramters_80.py with the admin password.
   
Configure isapi_wsgi and IIS for Web2Py 
   
   - Create isapi_MYAPP.py in c:\web2py (where MY is the virtual 
   application name in IIS) in C:\web2py to create website when run from 
   command line and to launch service when running from IIS. This is based on 
   file from https://code.google.com/p/isapi-wsgi/wiki/IntegrationWithDjango

Change MYAPP to / on the following line in the isapi_MYAPP.py file to host 
from root rather the virtual app MYAPP on default web site: vd = 
VirtualDirParameters(Name=MYAPP, to vd = VirtualDirParameters(Name=/,

import os, sys

path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
sys.path = [path]+[p for p in sys.path if not p==path]
import gluon.main
application=gluon.main.wsgibase

import isapi_wsgi
# The entry points for the ISAPI extension.
def __ExtensionFactory__():
return isapi_wsgi.ISAPISimpleHandler(application)

if __name__=='__main__':
# If run from the command-line, install ourselves.
# python isapi_web2py.py install --server=Sitename 
from isapi.install import *
params = ISAPIParameters()
# Setup the virtual directories - this is a list of directories our
# extension uses - in this case only 1.
# Each extension has a script map - this is the mapping of ISAPI
# extensions.
sm = [
ScriptMapParams(Extension=*, Flags=0)
]
vd = VirtualDirParameters(Name=MYAPP,
  Description = Web2Py in Python.,
  ScriptMaps = sm,
  ScriptMapUpdate = replace
  )
params.VirtualDirs = [vd]
HandleCommandLine(params)


   - Execute python isapi_MYAPP.py install [--server=Sitename] to setup the 
   isapi_wsgi handler in IIS
   - To ever remove, execute python isapi_MYAPP.py remove to remove the 
   handler and application from IIS


   - For IIS application MYAPP hosted from default website create routes.py 
   in C:\web2py so site can be accessed via IIS application MYAPP 
   http://localhost/MYAPP/ but for hosting from root skip routes.py

routers = dict(
BASE=dict(
path_prefix='MYAPP',
),
)





On Sunday, September 7, 2014 8:31:31 AM UTC+10, Tim Richardson wrote:

 Simonne, I wish to learn about IIS  fastcgi since I use web2py on windows 
 servers a bit. If you put some notes and the steps, I will write it up to a 
 draft guide. 

 On Saturday, 6 September 2014 00:57:46 UTC+10, Niphlod wrote:

 we should NOT use this script because:
 - uses apache
 - uses an old version of apache
 - installs python with a fixed version in a fixed path
 - installs a configuration file that is fixed and does not depict the 
 same configurations we have in linux scripts

 IMHO it's time to do a guide on how to use web2py with IIS and fastcgi 
 (to substitute the old one we have in the book that is scary as hell), that 
 from WS2008R2 onwards is pretty easy.
 Having a script on windows that installs also all requirements (and up to 
 date) is not easy because linux has package managers by default while 
 Windows doesn't.
 As most of the things, they're in the backlog of my brain and they'll 
 come out as soon as I get some free time.

 On Friday, September 5, 2014 8:01:45 AM UTC+2, Massimo Di Pierro wrote:

 Is your point that we should not use these script or that we should not 
 provide scripts for windows at all?
 In the first case, what would you change? In the second case, why not?



 On Wednesday, 3 September 2014 10:11:29 UTC-5, Niphlod wrote:

 hell no. I don't want 7-zip installed by web2py. and an old FIXED build 
 of apache. And a FIXED version of python. Without checks.
 And Apache. On Windows. 
 No, No, No, No to the setup scripts for windows archive.
 The configuration is fixed, old, and a poor duplicate of the ones we 
 still have in automated scripts.

 On Wednesday, September 3, 2014 3:29:04 PM UTC+2, 

[web2py] Edit the auth_user table and profile page

2014-09-07 Thread Ricardo Watanabe Bento
 

Hello there, I am new to web2py and learning by making a simple Social 
Network app, I got started with the image blog app found on github/appliances 
(https://github.com/mdipierro/web2py-appliances). First I added this table:

auth.settings.extra_fields['auth_user']= [

  Field('profile_picture','upload',required=True, notnull=True, requires=[
IS_IMAGE(), RESIZE(650, 650)]),

  Field('profile_thumbs','upload',readable=False, compute=lambda r: THUMB(r[
'profile_picture']))

]

in order to modify the auth_user table and add the profile_thumbs field, so 
the photo uploaded on profile_picture gets resized and posted on database. 


on the controller I am using this code:


 def profile():

tables = db().select(db.auth_user.ALL)

return dict(tables=tables)


and for the view:


{{for table in tables:}}

img src={{=URL('default', 'download', args=table.profile_picture)}} 
/ br /

{{pass}}


All the pictures on the db are displayed I would like to only have the 
picture for the user logged in.


I would like to ask if anybody could help or point me to the right 
direction to a tutorial where I can make a profile page to each user 
displaying their information such as first_name, last_name and 
profile_picture to begin with but sure I will need to expand that in later 
date. How could be the right procedure to do this? Should I use the 
auth_user data to have this page? 


Thank you very much, I think this problem might have been asked before but 
hope someone can help anyway :)

Regards

Ricardo Bento

-- 
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: Appadmin redirect after upgrading to 2.9.7

2014-09-07 Thread Massimo Di Pierro
This is now solved in 2.9.8

On Sunday, 7 September 2014 03:45:45 UTC-5, olivier hubert wrote:

 I encounter exactly the same issue if you try to open the db 
 administration page in a app.

 Le dimanche 7 septembre 2014 01:19:31 UTC+2, Luciano Laporta Podazza a 
 écrit :

 Same issue :(, as mentioned before, tried testing default apps and my app 
 and it redirects to admin page.


 On Sat, Sep 6, 2014 at 8:14 PM, Luciano Laporta Podazza 
 luciano...@gmail.com wrote:

 Right now! :), I'll get back to you with results.

 Cheers.


 On Sat, Sep 6, 2014 at 8:11 PM, Massimo Di Pierro massimo@gmail.com
  wrote:

 Possible fix in trunk. Can you help test it?


 On Saturday, 6 September 2014 06:56:54 UTC-5, Niphlod wrote:

 ok. it hasn't anything to do with the more security change. It has 
 to do with the new session storage behaviour. Filing an issue right now, 
 shouldn't be hard to fix

 On Saturday, September 6, 2014 1:23:00 AM UTC+2, Dragan Matic wrote:

 +1 Here. It does the same thing to me, 2.9.7 appadmin redirects to 
 web2py admin. 2.9.6 is working correctly. 

 On Friday, September 5, 2014 10:06:24 PM UTC+2, Niphlod wrote:

 because the only change we made was making the access to appadmin 
 more secure when web2py is behind a proxy.

 However, if you get redirected to admin it shouldn't matter, as the 
 change would affect you accessing admin also.
 Seeing the code of appadmin.py (assuming is the latest from 2.9.7) 
 the redirection is made on line 54. Look at those conditions and add a 
 few 
 log (or print) statements to pinpoint the root cause.

 On Friday, September 5, 2014 10:00:01 PM UTC+2, Luciano Laporta 
 Podazza wrote:

 Hi Niphlod,

 No, I'm working locally and no proxies at all. Why you ask?


 On Fri, Sep 5, 2014 at 4:58 PM, Niphlod nip...@gmail.com wrote:

 are you behind a proxy ?


 On Friday, September 5, 2014 9:34:12 PM UTC+2, Luciano Laporta 
 Podazza wrote:

 Hello,

 I was developing an application with web2py 
 2.9.5-trunk+timestamp.2014.03.29.21.54.41 and appadmin worked 
 fine until I upgraded to latest 2.9.7.

 Now when I access appadmin for ANY app(welcome, examples, my app, 
 etc) it redirects to admin and nothing happens.

 Tried cleaning everything, even deleting the entire database and 
 starting from scratch and nothing happened.

 Any ideas about this?. Thanks in advance.

  -- 
 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/9kXd30hW3j0/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.




 -- 
 Atte
 Luciano Laporta Podazza
  
  -- 
 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/9kXd30hW3j0/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.




 -- 
 Atte
 Luciano Laporta Podazza
  



 -- 
 Atte
 Luciano Laporta Podazza
  


-- 
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: Edit the auth_user table and profile page

2014-09-07 Thread Massimo Di Pierro


 def profile():

   return dict()

and for the view:

img src={{=URL('default', 'download', 
args=auth.user.profile_picture)}} /

On Sunday, 7 September 2014 04:30:08 UTC-5, Ricardo Watanabe Bento wrote:

 Hello there, I am new to web2py and learning by making a simple Social 
 Network app, I got started with the image blog app found on github/appliances 
 (https://github.com/mdipierro/web2py-appliances). First I added this 
 table:

 auth.settings.extra_fields['auth_user']= [

   Field('profile_picture','upload',required=True, notnull=True, requires=[
 IS_IMAGE(), RESIZE(650, 650)]),

   Field('profile_thumbs','upload',readable=False, compute=lambda r: THUMB(
 r['profile_picture']))

 ]

 in order to modify the auth_user table and add the profile_thumbs field, 
 so the photo uploaded on profile_picture gets resized and posted on 
 database. 


 on the controller I am using this code:


  def profile():

 tables = db().select(db.auth_user.ALL)

 return dict(tables=tables)


 and for the view:


 {{for table in tables:}}

 img src={{=URL('default', 'download', 
 args=table.profile_picture)}} / br /

 {{pass}}


 All the pictures on the db are displayed I would like to only have the 
 picture for the user logged in.


 I would like to ask if anybody could help or point me to the right 
 direction to a tutorial where I can make a profile page to each user 
 displaying their information such as first_name, last_name and 
 profile_picture to begin with but sure I will need to expand that in later 
 date. How could be the right procedure to do this? Should I use the 
 auth_user data to have this page? 


 Thank you very much, I think this problem might have been asked before but 
 hope someone can help anyway :)

 Regards

 Ricardo Bento


-- 
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: extra_fields can't showed in auth_user db.

2014-09-07 Thread Massimo Di Pierro
I cannot reproduce the problem. 

Mind that you do not need

auth = Auth(db, hmac_key=Auth.get_or_create_key())

should be

auth = Auth(db)



On Sunday, 7 September 2014 07:54:27 UTC-5, olivier hubert wrote:

 I use the web2py version 2.9.8.
 I create a simple new app test_auth

 In Models I add my_tables.py with the contents below.

 # -*- coding: utf-8 -*-

 #Add authentication to the app.
 from gluon.tools import Auth

 auth = Auth(db, hmac_key=Auth.get_or_create_key())


 *#Add some fields in auth_user table to have a complete user 
 profile.*auth.settings.extra_fields['auth_user']= [
 Field http://127.0.0.1:8000/examples/global/vars/Field('phone_number', 
 'string'),
 Field http://127.0.0.1:8000/examples/global/vars/Field('address', 
 'text'),
 Field http://127.0.0.1:8000/examples/global/vars/Field('city', 
 'string'),
 Field http://127.0.0.1:8000/examples/global/vars/Field('zip', 'string'),
 Field http://127.0.0.1:8000/examples/global/vars/Field('phone', 
 'string'),
 Field http://127.0.0.1:8000/examples/global/vars/Field('birthday', 
 'date', requires = IS_DATE 
 http://127.0.0.1:8000/examples/global/vars/IS_DATE(format=('%d-%m-%Y')))]
 auth.define_tables(username=True, signature=True)

 I open the page http://127.0.0.1:8000/test_auth/default/user/register

 The form doesn't show my extra field.

 After a successful user registration, I open the db admin to see the record 
 in the table auth_user, but I can't see my extra fields.

 I already try session cleanup, free cookies, create a new app, ... see and 
 try some tricks from this forum or stack overflow. I probably miss something 
 but I can't see what.



-- 
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 setup scripts for windows

2014-09-07 Thread Massimo Di Pierro
Thanks. This should go in the book.

On Sunday, 7 September 2014 05:48:48 UTC-5, daniel@gmail.com wrote:

 I have notes on running web2py with IIS because nothing out there, 
 including in recipes works. Specifically these notes are for 64 bit rather 
 than 32 bit and using isapi_wsgi rather than fastcgi. (ISAPI is faster). 
 Here they are pretty much verbatim. It looks messy but is actually very 
 simple, I have too many explanatory notes.

 Install Python 2.7 

- download 2.x from https://www.python.org does not work with 3.x
- python-2.7.8.amd64.msi (install for all users, add python.exe to 
path)

 Install pywin32(required for isapi_wsgi)

- download 64 bit from https://sourceforge.net/projects/pywin32/
- pywin32-219.win-amd64-py2.7.exe

 Install isapi_wsgi 

- download source distribution (isapi_wsgi-0.4.2.zip) from 
https://code.google.com/p/isapi-wsgi/
- Extract isapi_wsgi to temp folder
- cd isapi_wsgi-0.4.2.2
- python setup.py install

 Install Web2Py 

- Download web2py src and extract to c: to get C:\web2py
- run python web2py.py, enter pasword, and start service on port 80 at 
least once to generate paramters_80.py with the admin password.

 Configure isapi_wsgi and IIS for Web2Py 

- Create isapi_MYAPP.py in c:\web2py (where MY is the virtual 
application name in IIS) in C:\web2py to create website when run from 
command line and to launch service when running from IIS. This is based on 
file from 
https://code.google.com/p/isapi-wsgi/wiki/IntegrationWithDjango

 Change MYAPP to / on the following line in the isapi_MYAPP.py file to host 
 from root rather the virtual app MYAPP on default web site: vd = 
 VirtualDirParameters(Name=MYAPP, to vd = VirtualDirParameters(Name=/,

 import os, sys

 path = os.path.dirname(os.path.abspath(__file__))
 os.chdir(path)
 sys.path = [path]+[p for p in sys.path if not p==path]
 import gluon.main
 application=gluon.main.wsgibase

 import isapi_wsgi
 # The entry points for the ISAPI extension.
 def __ExtensionFactory__():
 return isapi_wsgi.ISAPISimpleHandler(application)

 if __name__=='__main__':
 # If run from the command-line, install ourselves.
 # python isapi_web2py.py install --server=Sitename 
 from isapi.install import *
 params = ISAPIParameters()
 # Setup the virtual directories - this is a list of directories our
 # extension uses - in this case only 1.
 # Each extension has a script map - this is the mapping of ISAPI
 # extensions.
 sm = [
 ScriptMapParams(Extension=*, Flags=0)
 ]
 vd = VirtualDirParameters(Name=MYAPP,
   Description = Web2Py in Python.,
   ScriptMaps = sm,
   ScriptMapUpdate = replace
   )
 params.VirtualDirs = [vd]
 HandleCommandLine(params)


- Execute python isapi_MYAPP.py install [--server=Sitename] to setup 
the isapi_wsgi handler in IIS
- To ever remove, execute python isapi_MYAPP.py remove to remove the 
handler and application from IIS


- For IIS application MYAPP hosted from default website create 
routes.py in C:\web2py so site can be accessed via IIS application MYAPP 
http://localhost/MYAPP/ but for hosting from root skip routes.py

 routers = dict(
 BASE=dict(
 path_prefix='MYAPP',
 ),
 )





 On Sunday, September 7, 2014 8:31:31 AM UTC+10, Tim Richardson wrote:

 Simonne, I wish to learn about IIS  fastcgi since I use web2py on 
 windows servers a bit. If you put some notes and the steps, I will write it 
 up to a draft guide. 

 On Saturday, 6 September 2014 00:57:46 UTC+10, Niphlod wrote:

 we should NOT use this script because:
 - uses apache
 - uses an old version of apache
 - installs python with a fixed version in a fixed path
 - installs a configuration file that is fixed and does not depict the 
 same configurations we have in linux scripts

 IMHO it's time to do a guide on how to use web2py with IIS and fastcgi 
 (to substitute the old one we have in the book that is scary as hell), that 
 from WS2008R2 onwards is pretty easy.
 Having a script on windows that installs also all requirements (and up 
 to date) is not easy because linux has package managers by default while 
 Windows doesn't.
 As most of the things, they're in the backlog of my brain and they'll 
 come out as soon as I get some free time.

 On Friday, September 5, 2014 8:01:45 AM UTC+2, Massimo Di Pierro wrote:

 Is your point that we should not use these script or that we should not 
 provide scripts for windows at all?
 In the first case, what would you change? In the second case, why not?



 On Wednesday, 3 September 2014 10:11:29 UTC-5, Niphlod wrote:

 hell no. I don't want 7-zip installed by web2py. and an old FIXED 
 build of apache. And a FIXED version of python. Without checks.
 And Apache. On Windows. 
 No, No, No, No to 

Re: [web2py] Sass support example for web2py.

2014-09-07 Thread António Ramos
check this

https://github.com/ramstein74/Coffee_Jade_Stylus_inside_web2py



2014-09-07 16:30 GMT+01:00 Encompass solutions encomp...@gmail.com:

 I use templates from wrapbootstrap a lot.  3 times a month even.
 Sadly however, it's getting harder and harder to use those templates with
 web2py due to no support be it built-in or not, for SASS, LESS, and others
 getting much more popular.
 How can I make it so I code my css in SASS but to the client it is given
 in css?
 I propose built in support.  It could be enabled, and then auto import the
 .sass files and convert them to the view accordingly.
 Perhaps it should be a part of the pipeline. So we can create object that
 run before the view is rendered.  Perhaps in the view? (Though that sounds
 bad.)
 
 BR,
 Jason Brower

 --
 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: web2py setup scripts for windows

2014-09-07 Thread Niphlod
uhm.. things are far more easier since python for visual studio 
https://pytools.codeplex.com/releases came in this year with wfastcgi.py 
 and it requires IIS 7.

assuming:
- python is on c:\python27\python.exe and you downloaded wfastcgi that 
installs itself on c:\python27\scripts
- your root is c:\inetpub\wwwroot

You download web2py and put it on wwwroot. You install the wfastcgi.py 
script.

You create a fastcgi app with fastcgi settings -- add application :
   -  full path c:\python27\python.exe 
   - arguments c:\python27\scripts\wfastcgi.py
   - environmental variables
- PYTHONPATH -- C:\inetpub\wwwroot
- WSGI_HANDLER -- gluon.main.wsgibase
You create a handler with handler mappings -- add module mapping :
   - request path * 
   - module fastcgimodule
   - executable c:\Python27\python.exe|C:\Python27\Scripts\wfastcgi.py 

Alternatively, you can run the following script in a shell

%windir%\system32\inetsrv\appcmd set config 
/section:system.webServer/fastCGI /+[fullPath='c:\Python27\python.exe', 
arguments='C:\Python27\Scripts\wfastcgi.py']

%windir%\system32\inetsrv\appcmd.exe set config 
-section:system.webServer/fastCgi /+[fullPath='C:\Python27\python.exe', 
arguments='C:\Python27\Scripts\wfastcgi.py'].environmentVariables.[name='PYTHONPATH',value='C:\inetpub\wwwroot']
 
/commit:apphost

%windir%\system32\inetsrv\appcmd.exe set config 
-section:system.webServer/fastCgi /+[fullPath='C:\Python27\python.exe', 
arguments='C:\Python27\Scripts\wfastcgi.py'].environmentVariables.[name='WSGI_HANDLER',value='gluon.main.wsgibase']
 
/commit:apphost

%windir%\system32\inetsrv\appcmd set config 
/section:system.webServer/handlers 
/+[name='Python_via_FastCGI',path='*',verb='*',modules='FastCgiModule',scriptProcessor='c:\Python27\python.exe|C:\Python27\Scripts\wfastcgi.py',resourceType='Unspecified']

To be fair, this works fine. Has still two issues : serves static with 
the fastcgi handler and requires web2py into the root (that is the 
standard web2py setup). Adding a routes.py with path_prefix and changing 
relative folders make it work into a subfolder.

-- 
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] Sass support example for web2py.

2014-09-07 Thread Niphlod
BTW: there's a reason why they're called PRE-processors. Because they are 
meant to refresh the dest just when the source is changed, not everytime 
they're served to the client (or they'll be called processors :-P).
use what ramos pointed at (that is basically a preconfigured gulp config 
(although no sass involved, but it's easy to add)) or a watchdog, or use 
your IDE facilities to recompile on save. It's definitely not a job for a 
web framework to recompile over and over and include every precompiler 
dependency in the distribution.

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

2014-09-07 Thread nick name
A nice web2py tutorial: 
https://impythonist.wordpress.com/2014/02/15/web2py-a-simpleclean-but-powerful-webframework-in-python/

Shamelessly copied to the DigitalOcean community board: 
https://www.digitalocean.com/community/tutorials/how-to-use-the-web2py-framework-to-quickly-build-your-python-app

-- 
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: a proposal for form improvement

2014-09-07 Thread Alex


this sounds very interesting, definitely a nice addition. Although I hope 
the current SQLFORM will not be deprecated. Usually I prefer to create my 
html forms server side. I use a function to extract all form elements so I 
can create my forms more flexible, maybe this is useful for others:

def get_form_fields(form):
formfields = dict()
for c in form.elements('input, select, textarea'):
name = c.attributes['_id']
formfields['c_' + name] = c  
for l in form.elements('label'):
name = l.attributes['_for']
formfields['l_' + name] = l 
return dict(form=form,**formfields)

in the view I can access each field (input/label) individually, e.g.

form
div{{=l_first_name}} {{c_first_name}}/div
div{{=l_last_name}} {{c_last_name}}/div
/form

Alex

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


[web2py] Re: a proposal for form improvement

2014-09-07 Thread Leonel Câmara
Alex did you just reinvent custom forms?

-- 
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 2.9.8 fixes the appadmin redirection problem!

2014-09-07 Thread Alex


thanks Massimo and all web2py devs for your great work!

Alex

Am Sonntag, 7. September 2014 07:06:06 UTC+2 schrieb Massimo Di Pierro:

 The problem was introduced in 2.9.7. So skip 2.9.7.


-- 
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: a proposal for form improvement

2014-09-07 Thread Anthony


 def get_form_fields(form):
 formfields = dict()
 for c in form.elements('input, select, textarea'):
 name = c.attributes['_id']
 formfields['c_' + name] = c  
 for l in form.elements('label'):
 name = l.attributes['_for']
 formfields['l_' + name] = l 
 return dict(form=form,**formfields)


Note, you don't need that function, as the widgets and labels (and 
comments) are in form.custom.widget.[fieldname], 
form.custom.label.[fieldname], and form.custom.comment.[fieldname]. You can 
also create custom HTML via a custom formstyle function.

See 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-forms.

Anthony

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


Re: [web2py] Re: Appadmin redirect after upgrading to 2.9.7

2014-09-07 Thread Luciano Laporta Podazza
Tested, works like a charm!.

Thanks!
On Sep 7, 2014 12:34 PM, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:

 This is now solved in 2.9.8

 On Sunday, 7 September 2014 03:45:45 UTC-5, olivier hubert wrote:

 I encounter exactly the same issue if you try to open the db
 administration page in a app.

 Le dimanche 7 septembre 2014 01:19:31 UTC+2, Luciano Laporta Podazza a
 écrit :

 Same issue :(, as mentioned before, tried testing default apps and my
 app and it redirects to admin page.


 On Sat, Sep 6, 2014 at 8:14 PM, Luciano Laporta Podazza 
 luciano...@gmail.com wrote:

 Right now! :), I'll get back to you with results.

 Cheers.


 On Sat, Sep 6, 2014 at 8:11 PM, Massimo Di Pierro 
 massimo@gmail.com wrote:

 Possible fix in trunk. Can you help test it?


 On Saturday, 6 September 2014 06:56:54 UTC-5, Niphlod wrote:

 ok. it hasn't anything to do with the more security change. It has
 to do with the new session storage behaviour. Filing an issue right now,
 shouldn't be hard to fix

 On Saturday, September 6, 2014 1:23:00 AM UTC+2, Dragan Matic wrote:

 +1 Here. It does the same thing to me, 2.9.7 appadmin redirects to
 web2py admin. 2.9.6 is working correctly.

 On Friday, September 5, 2014 10:06:24 PM UTC+2, Niphlod wrote:

 because the only change we made was making the access to appadmin
 more secure when web2py is behind a proxy.

 However, if you get redirected to admin it shouldn't matter, as the
 change would affect you accessing admin also.
 Seeing the code of appadmin.py (assuming is the latest from 2.9.7)
 the redirection is made on line 54. Look at those conditions and add a 
 few
 log (or print) statements to pinpoint the root cause.

 On Friday, September 5, 2014 10:00:01 PM UTC+2, Luciano Laporta
 Podazza wrote:

 Hi Niphlod,

 No, I'm working locally and no proxies at all. Why you ask?


 On Fri, Sep 5, 2014 at 4:58 PM, Niphlod nip...@gmail.com wrote:

 are you behind a proxy ?


 On Friday, September 5, 2014 9:34:12 PM UTC+2, Luciano Laporta
 Podazza wrote:

 Hello,

 I was developing an application with web2py
 2.9.5-trunk+timestamp.2014.03.29.21.54.41 and appadmin worked
 fine until I upgraded to latest 2.9.7.

 Now when I access appadmin for ANY app(welcome, examples, my
 app, etc) it redirects to admin and nothing happens.

 Tried cleaning everything, even deleting the entire database and
 starting from scratch and nothing happened.

 Any ideas about this?. Thanks in advance.

  --
 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/9kXd30hW3j0/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.




 --
 Atte
 Luciano Laporta Podazza

  --
 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/9kXd30hW3j0/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.




 --
 Atte
 Luciano Laporta Podazza




 --
 Atte
 Luciano Laporta Podazza

  --
 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/9kXd30hW3j0/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.


-- 
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] Sass support example for web2py.

2014-09-07 Thread Encompass solutions
I understand.  Gulp might be my ticket here.  Let me learn more about it.
BR,
Jason Brower


On Sunday, September 7, 2014 9:30:34 PM UTC+3, Niphlod wrote:

 BTW: there's a reason why they're called PRE-processors. Because they are 
 meant to refresh the dest just when the source is changed, not everytime 
 they're served to the client (or they'll be called processors :-P).
 use what ramos pointed at (that is basically a preconfigured gulp config 
 (although no sass involved, but it's easy to add)) or a watchdog, or use 
 your IDE facilities to recompile on save. It's definitely not a job for a 
 web framework to recompile over and over and include every precompiler 
 dependency in the distribution.


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