[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 = d

[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] Re: Hiding a field

2010-01-15 Thread kbochert
15, 12:13 pm, kbochert 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 > > >

[web2py] Re: Hiding a field

2010-01-15 Thread kbochert
in the form? Karl On Jan 15, 9:46 am, mdipierro wrote: > What is the traceback? Is this an OperationalError 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

[web2py] Re: Hiding a field

2010-01-15 Thread kbochert
lay. Karl On Jan 15, 9:18 am, mdipierro 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 wrote: > > > Is it possible to use SQLFOR

[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 fill

[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 = 'c

[web2py:38316] Re: On Login failure

2010-01-04 Thread kbochert
> > python web2py.py > > On Jan 4, 5:07 am, kbochert wrote: > > > I'm assuming that by 'trunk' you mean the top mercurial version. > > I downloaded it (via TortoiseHg' . Now what? > > My file explorer (PowerDesk) blinks every 2 sec when it sh

[web2py:38294] Re: On Login failure

2010-01-04 Thread kbochert
P.S. I just remembered the cause of the explorer blinking. It happens when my ancient file explorer tries to display too many icon overlays. Karl On Jan 4, 3:07 am, kbochert wrote: > I'm assuming that by 'trunk' you mean the top mercurial version. > I downloaded it (via T

[web2py:38293] Re: On Login failure

2010-01-04 Thread kbochert
gt; Can you please give it a try and let us know? > > Massimo > > On Jan 3, 1:53 am, kbochert 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

[web2py:38241] Re: On Login failure

2010-01-02 Thread kbochert
m seldom right about these things. Karl On Jan 1, 9:25 am, mdipierro wrote: > auth.settings.controller='myctl' > > On Jan 1, 8:01 am, kbochert wrote: > > > I'm trying to use my custom login page. > > > In models\db.py I put > > >         a

[web2py:38158] On Login failure

2010-01-01 Thread kbochert
I'm trying to use my custom login page. In models\db.py I put auth.settings.login_url = "/myapp/myctl/user/login" When I go to a protected page, I get the expected login page 'myapp \myctl\user\login' . If I enter a user email and a bad password, I get sent to the page 'myapp\default\use

[web2py:37876] Re: Creating a password

2009-12-26 Thread kbochert
] is the first and only validator > (CTRYPT()) > 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 &

[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 wrote: > password=db.auth_user.password.requires('yourpassword')[0] > > On Dec 26, 7:46 am, kbochert wrote: > > > Traceback (most recent call last): >

[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 wrote: > It does work. Just a moment of update panic on my part. > > On Dec 26, 5:32 am, kbochert wrote: > > > Just loaded it. > > Has somethin

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

[web2py:37852] Re: Creating a password

2009-12-26 Thread kbochert
3 until I get 1.74.4 working Karl On Dec 25, 12:54 pm, mdipierro wrote: > Silly me. Too much food. > > password=db.auth_user.requires('yourpassword')[0] > > On Dec 25, 1:12 pm, kbochert wrote: > > > No Luck. > > Causes a missing key error. (db doe

[web2py:37850] Re: 400 error

2009-12-26 Thread kbochert
> Massimo > > On Dec 25, 1:13 pm, kbochert wrote: > > > Version 1.72.3 > > > Karl > > > On Dec 25, 7:16 am, mdipierro wrote: > > > > Which  web2py version? > > > > On Dec 25, 3:38 am, kbochert wrote: > > > > > Nope. > >

[web2py:37836] Re: 400 error

2009-12-25 Thread kbochert
Version 1.72.3 Karl On Dec 25, 7:16 am, mdipierro wrote: > Which  web2py version? > > On Dec 25, 3:38 am, kbochert wrote: > > > Nope. > > > In routes.py I have: > > routes_onerror = [ > >     ('myapp/400' , '/myapp/error/index'),

[web2py:37835] Re: Creating a password

2009-12-25 Thread kbochert
> > 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

[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 = auth.settings.hmac_

[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}} which renders as: request.vars.requested_uri-- None What

[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:37303] Re: Excess whitespace in html

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

[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:37294] Re: Excess whitespace in html

2009-12-15 Thread kbochert
On Dec 15, 3:23 pm, mdipierro 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 being indentation sensiti

[web2py:37292] Re: Excess whitespace in html

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

[web2py:37284] Re: Excess whitespace in html

2009-12-15 Thread kbochert
ith my style. karl On Dec 15, 12:55 pm, Jonathan Lundell 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 >

[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 an

[web2py:37197] Excess whitespace in html

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

[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 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 and no > controller

[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 Grou

[web2py:36072] Re: Routes

2009-11-27 Thread kbochert
On Nov 26, 11:05 am, kbochert wrote: > On Nov 26, 10:36 am, mdipierro 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

[web2py:36061] Re: Routes

2009-11-26 Thread kbochert
On Nov 26, 10:36 am, mdipierro 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 > wrote: > > > routes.py is read when web2py starts - be sure to re-start whatever > >

[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 so