[web2py] image upload

2010-01-19 Thread kbochert
Model: db.define_table('product', Field('title', 'string', length=64), Field('image', 'upload'), ) Controller: def edit_product_0(): form = SQLFORM(db.product, _id='product_table') if form.accepts(request.vars, session, keepvalues=True, dbio=False): form.vars.id =

[web2py] Hiding a field

2010-01-15 Thread kbochert
Is it possible to use SQLFORM to generate forms which show different fields? I.E. I have a model: db.define_table('client', Field('uid', auth_user), Field('name', 'string'), migrate = 'client.table' ) I want a page which the client uses that hides the 'uid' field, which gets

[web2py] Re: Hiding a field

2010-01-15 Thread kbochert
On Jan 15, 9:18 am, mdipierro mdipie...@cs.depaul.edu wrote: You can change db.client.uid.readbale=True or False where you need it, for example in the action before form=. Massimo On Jan 15, 11:08 am, kbochert kboch...@copper.net wrote: Is it possible to use SQLFORM to generate forms which

[web2py] Re: Hiding a field

2010-01-15 Thread kbochert
or  RuntimeError. It is possible that the database does not like the field name 'uid'. I do not think this is a web2py error. On Jan 15, 11:35 am, kbochert kboch...@copper.net wrote: No good. It hides the field correctly but again after:     form.vars.uid = 2 # set the uid explicitly

[web2py] Re: Hiding a field

2010-01-15 Thread kbochert
: On Jan 15, 12:13 pm, kbochert kboch...@copper.net wrote: Error traceback Traceback (most recent call last):   File gluon/restricted.py, line 173, in restricted   File E:/web2py/applications/mug/controllers/admin.py, line 325, in module   File E:/web2py/applications/mug/models/db.py

[web2py] Re: migration reboot

2010-01-15 Thread kbochert
How about: 1. Save the database with db.export_to_csv_file(open('somefile.csv', 'wb')) -- The csv file should only contain columns defined in the current database. I have not checked this - seems reasonable. 2. Erase the entire contents of applications\myapp\databases -- This includes the

[web2py] Feature request?

2010-01-09 Thread kbochert
Problem: I have database tables for customers, members, etc that look like db.define_table('customer', Field('user_id', db.auth_user), address('bill'),#inherit address fields address('ship'),#inherit address fields phone, #inherit phone fields migrate =

[web2py:38293] Re: On Login failure

2010-01-04 Thread kbochert
us know? Massimo On Jan 3, 1:53 am, kbochert kboch...@copper.net wrote: Ok, that works. Now I correctly get to my logon page at /myapp/admin/user/login?_next=/myapp/admin/home instead of default\index.  But if that logon fails, I get redirected to /myapp/admin/user/login which

[web2py:38241] Re: On Login failure

2010-01-02 Thread kbochert
these things. Karl On Jan 1, 9:25 am, mdipierro mdipie...@cs.depaul.edu wrote: auth.settings.controller='myctl' On Jan 1, 8:01 am, kbochert kboch...@copper.net wrote: I'm trying to use my custom login page. In models\db.py I put         auth.settings.login_url = /myapp/myctl/user/login

[web2py:37852] Re: Creating a password

2009-12-26 Thread kbochert
, 12:54 pm, mdipierro mdipie...@cs.depaul.edu wrote: Silly me. Too much food. password=db.auth_user.requires('yourpassword')[0] On Dec 25, 1:12 pm, kbochert kboch...@copper.net wrote: No Luck. Causes a missing key error. (db does not have a 'auth_table') Maybe this is new since 1.72.3

[web2py:37854] Re: 400 error

2009-12-26 Thread kbochert
It does work. Just a moment of update panic on my part. On Dec 26, 5:32 am, kbochert kboch...@copper.net wrote: Just loaded it. Has something changed with routes.py?? The web2py directory does not have a routes.py, and when I add mine it does not appear to have any effect. Karl On Dec 25

[web2py:37855] Re: 400 error

2009-12-26 Thread kbochert
Pardon the multiple posts. 1.74.4 and requested_uri work as expected Happy Holidays Karl On Dec 26, 6:24 am, kbochert kboch...@copper.net wrote: It does work. Just a moment of update panic on my part. On Dec 26, 5:32 am, kbochert kboch...@copper.net wrote: Just loaded it. Has something

[web2py:37870] Re: Creating a password

2009-12-26 Thread kbochert
) that looked like many concatenated url's, each with an error ticket attached Karl On Dec 26, 7:39 am, mdipierro mdipie...@cs.depaul.edu wrote: password=db.auth_user.password.requires('yourpassword')[0] On Dec 26, 7:46 am, kbochert kboch...@copper.net wrote: Traceback (most recent call last):   File

[web2py:37876] Re: Creating a password

2009-12-26 Thread kbochert
()) db.auth_user.password.requires[0]('...') calls the validator and return (hashed_password,None) db.auth_user.password.requires[0]('...')[0] is the properly hashed password whatever the CRYPT parameters are On Dec 26, 4:25 pm, kbochert kboch...@copper.net wrote: Sigh-- With that line  I

[web2py:37828] Re: 400 error

2009-12-25 Thread kbochert
Nope. In routes.py I have: routes_onerror = [ ('myapp/400' , '/myapp/error/index'), ] which correctly catches the error In \myapp\views\error\index.html I have request.vars.requested_uri-- {{=request.vars.requested_uri}}br which renders as: request.vars.requested_uri-- None

[web2py:37829] Creating a password

2009-12-25 Thread kbochert
When I startup web2py without a database, it creates it. When this happens I wish to 'pre-load' some data for testing. How do I create a user with a password? I'm putting code in db.py like: if not db().select(db.auth_user.ALL): #database is empty import hashlib key =

[web2py:37835] Re: Creating a password

2009-12-25 Thread kbochert
: replace password=hmac.new(key, 'jh', hashlib.sha512).hexdigest() with password=db.auth_table.requires('yourpassword')[0] I think the problem is that if you use hashlib.sha512 you have to add 'sha512:' in front of the hexdigest. look into CRYPT for details. On Dec 25, 4:31 am, kbochert kboch

[web2py:37836] Re: 400 error

2009-12-25 Thread kbochert
Version 1.72.3 Karl On Dec 25, 7:16 am, mdipierro mdipie...@cs.depaul.edu wrote: Which  web2py version? On Dec 25, 3:38 am, kbochert kboch...@copper.net wrote: Nope. In routes.py I have: routes_onerror = [     ('myapp/400' , '/myapp/error/index'),     ] which correctly catches

[web2py:37737] 400 error

2009-12-23 Thread kbochert
When I request a URL - host/myapp/non_existant_fct a 400 error is generated. routes_onerror sends it to my custom error page. How does my custom page find out the URL that generated the 400 error? Karl -- You received this message because you are subscribed to the Google Groups web2py-users

[web2py:37235] Re: Excess whitespace in html

2009-12-15 Thread kbochert
Jonathon wrote: 2x seems like an awful lot, since a newline is only one byte. Are you sure? The output typically has multiple leading spaces on those blank lines, presumably driven by the indenting of the original html. DenesL wrote: Do you want you view or your final output to be legible and

[web2py:37284] Re: Excess whitespace in html

2009-12-15 Thread kbochert
, Jonathan Lundell jlund...@pobox.com wrote: On Dec 15, 2009, at 12:08 PM, Alex Fanjul wrote: Hello Kbochert, it seems you found out a way to make cleaner output, do you get it working automatically? (ie. with out manual action for output clean process) I'm thinking in alway pass

[web2py:37292] Re: Excess whitespace in html

2009-12-15 Thread kbochert
On Dec 15, 3:24 pm, Thadeus Burgess thade...@thadeusb.com wrote: It messes up my pre tags. However this helps in cleaning up bad html generated from WYSIWYG editors. -Thadeus Works fine for my pre's. Just have to keep in mind the difference between pre abc def /pre which works

[web2py:37294] Re: Excess whitespace in html

2009-12-15 Thread kbochert
On Dec 15, 3:23 pm, mdipierro mdipie...@cs.depaul.edu wrote: You may also want to look into scripts/cleanhtml.py and scripts/ cleancss.py. The only problem is that it breaks flash. So flash passes through the renderer, AND is sensitive to blank lines ?! And people complain about Python

[web2py:37298] Dynamic CSS

2009-12-15 Thread kbochert
Just a thought--- Is it possible to serve a css file through the template system? It might be very useful to be able to use css like: {{ # define the colors }} {{primary_color = 0xff3366}} body { color: {{=primary_color}} ; background-color: {{= response.users_background}} ; ... }

[web2py:37303] Re: Excess whitespace in html

2009-12-15 Thread kbochert
Amazingly enough, the following snippet appears to filter excess lines while leaving pre blocks unchanged!! import re def remove_line(mo): s = mo.group() if s.startswith('pre'): return s return '\n' def filter(d): if not isinstance(d,dict): d = d() pat =

[web2py:37197] Excess whitespace in html

2009-12-14 Thread kbochert
In a view, I have a paginator with code that looks like: div id='paginator' {{if ARGS.currentpage == 1:}} span class=pagerdisabled/span {{else:}} a href=./{{=ARGS.currentpage - 1}}Prev/a {{pass}} {{for i in range(1,ARGS.pagecnt+1):}} {{if

[web2py:37096] Re: Omit default controller for for any action

2009-12-12 Thread kbochert
I added a slice at web2pyslices.com showing how I 'solved' this problem. see 'cleaner urls with routes.py' Karl On Nov 29, 6:58 am, mdipierro mdipie...@cs.depaul.edu wrote: If I understand you want that /f is mapped into /app/default/f for every f in default.py if there is no app called f

[web2py:36164] File names

2009-11-29 Thread kbochert
While trying to use multiple models files, I tried to use a file named db-mymodel.py It was totally ignored by web2py until I changed the name to db_mymodel.py Is this something to do with windows/linux file naming? Karl -- You received this message because you are subscribed to the Google

[web2py:36072] Re: Routes

2009-11-27 Thread kbochert
On Nov 26, 11:05 am, kbochert kboch...@copper.net wrote: On Nov 26, 10:36 am, mdipierro mdipie...@cs.depaul.edu wrote: technically you can reload routes without restarting. From the admin web based shell from gluon.rewrite improt * load() On Nov 26, 12:02 pm, Yarko Tymciurak

[web2py:36049] Routes

2009-11-26 Thread kbochert
As a new user to web2py, I am trying to get routes.py to work. Nothing I put into web2py/routes.py has any effect. example: routes_in=( ('^127\.0\.0\.1:.*', '/examples/default/index'), ) Moreover , clear errors in the routes.py have no effect. i.e. x = 6/0; @! Am I overlooking

[web2py:36061] Re: Routes

2009-11-26 Thread kbochert
On Nov 26, 10:36 am, mdipierro mdipie...@cs.depaul.edu wrote: technically you can reload routes without restarting. From the admin web based shell from gluon.rewrite improt * load() On Nov 26, 12:02 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: routes.py is read when web2py