librelist archives

« back to archive

Large-app-how-to: TypeError: __init__() takes exactly 1 argument (4 given)

Large-app-how-to: TypeError: __init__() takes exactly 1 argument (4 given)

From:
bruce bushby
Date:
2012-08-01 @ 20:13
Hi

I was wondering if anybody else got this error when following large
app tutorial?
https://github.com/mitsuhiko/flask/wiki/


127.0.0.1 - - [01/Aug/2012 20:00:24] "POST /users/register/ HTTP/1.0" 500 -
Traceback (most recent call last):
  File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
line 1701, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
line 1689, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
line 1687, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
line 1360, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
line 1358, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
line 1344, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/bruce/www/myapp/app/users/views.py", line 55, in register
    user = 
User(form.name.data,form.email.data,generate_password_hash(form.password.data))
TypeError: __init__() takes exactly 1 argument (4 given)
127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
/users/register/?__debugger__=yes&cmd=resource&f=style.css HTTP/1.0"
200 -
127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
/users/register/?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.0"
200 -
127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
/users/register/?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.0"
200 -
127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
/users/register/?__debugger__=yes&cmd=resource&f=console.png HTTP/1.0"
200 -
127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
/users/register/?__debugger__=yes&cmd=resource&f=source.png HTTP/1.0"
200 -
127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
/users/register/?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.0"
200 -
127.0.0.1 - - [01/Aug/2012 20:00:26] "GET /favicon.ico HTTP/1.0" 404 -
 * Detected change in '/home/bruce/www/myapp/app/users/views.py', reloading
 * Restarting with reloader



This is my "views.py"
/home/bruce/www/myapp/app/users/views.py:


from app import db
from app.users import constants as USER

class User(db.Model):

    __tablename__ = 'users_user'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), unique=True)
    email = db.Column(db.String(120), unique=True)
    password = db.Column(db.String(20))
    role = db.Column(db.SmallInteger, default=USER.USER)
    status = db.Column(db.SmallInteger, default=USER.NEW)

def __init__(self, name=None, email=None, password=None):
    self.name = name
    self.email = email
    self.password = password

def getStatus(self):
    return USER.STATUS[self.status]

def getRole(self):
    return USER.ROLE[self.role]

def __repr__(self):
    return '<User %r>' % (self.name)







Bruce

Re: [flask] Large-app-how-to: TypeError: __init__() takes exactly 1 argument (4 given)

From:
Smartboy
Date:
2012-08-02 @ 03:04
You need to indent your functions in order for them to be inside the class.
:)

On Wed, Aug 1, 2012 at 1:13 PM, bruce bushby <bruce.bushby@gmail.com> wrote:

> Hi
>
> I was wondering if anybody else got this error when following large
> app tutorial?
> https://github.com/mitsuhiko/flask/wiki/
>
>
> 127.0.0.1 - - [01/Aug/2012 20:00:24] "POST /users/register/ HTTP/1.0" 500 -
> Traceback (most recent call last):
>   File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1701, in __call__
>     return self.wsgi_app(environ, start_response)
>   File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1689, in wsgi_app
>     response = self.make_response(self.handle_exception(e))
>   File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1687, in wsgi_app
>     response = self.full_dispatch_request()
>   File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1360, in full_dispatch_request
>     rv = self.handle_user_exception(e)
>   File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1358, in full_dispatch_request
>     rv = self.dispatch_request()
>   File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1344, in dispatch_request
>     return self.view_functions[rule.endpoint](**req.view_args)
>   File "/home/bruce/www/myapp/app/users/views.py", line 55, in register
>     user =
> User(form.name.data,form.email.data,generate_password_hash(form.password.data))
> TypeError: __init__() takes exactly 1 argument (4 given)
> 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=style.css HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=console.png HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=source.png HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:26] "GET /favicon.ico HTTP/1.0" 404 -
>  * Detected change in '/home/bruce/www/myapp/app/users/views.py', reloading
>  * Restarting with reloader
>
>
>
> This is my "views.py"
> /home/bruce/www/myapp/app/users/views.py:
>
>
> from app import db
> from app.users import constants as USER
>
> class User(db.Model):
>
>     __tablename__ = 'users_user'
>
>     id = db.Column(db.Integer, primary_key=True)
>     name = db.Column(db.String(50), unique=True)
>     email = db.Column(db.String(120), unique=True)
>     password = db.Column(db.String(20))
>     role = db.Column(db.SmallInteger, default=USER.USER)
>     status = db.Column(db.SmallInteger, default=USER.NEW)
>
> def __init__(self, name=None, email=None, password=None):
>     self.name = name
>     self.email = email
>     self.password = password
>
> def getStatus(self):
>     return USER.STATUS[self.status]
>
> def getRole(self):
>     return USER.ROLE[self.role]
>
> def __repr__(self):
>     return '<User %r>' % (self.name)
>
>
>
>
>
>
>
> Bruce
>

Re: [flask] Large-app-how-to: TypeError: __init__() takes exactly 1 argument (4 given)

From:
Mark Steve Samson
Date:
2012-08-02 @ 03:28
User attributes are supposed to be keyword arguments. 

user = User(name=form.name.data, email=form.email.data, 
password=generate_password_hash(form.password.data)) 

-- 
Steve


On Thursday, August 2, 2012 at 4:13 AM, bruce bushby wrote:

> Hi
> 
> I was wondering if anybody else got this error when following large
> app tutorial?
> https://github.com/mitsuhiko/flask/wiki/
> 
> 
> 127.0.0.1 - - [01/Aug/2012 20:00:24] "POST /users/register/ HTTP/1.0" 500 -
> Traceback (most recent call last):
> File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1701, in __call__
> return self.wsgi_app(environ, start_response)
> File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1689, in wsgi_app
> response = self.make_response(self.handle_exception(e))
> File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1687, in wsgi_app
> response = self.full_dispatch_request()
> File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1360, in full_dispatch_request
> rv = self.handle_user_exception(e)
> File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1358, in full_dispatch_request
> rv = self.dispatch_request()
> File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1344, in dispatch_request
> return self.view_functions[rule.endpoint](**req.view_args)
> File "/home/bruce/www/myapp/app/users/views.py", line 55, in register
> user = 
User(form.name.data,form.email.data,generate_password_hash(form.password.data))
> TypeError: __init__() takes exactly 1 argument (4 given)
> 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=style.css HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=console.png HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=source.png HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:26] "GET /favicon.ico HTTP/1.0" 404 -
> * Detected change in '/home/bruce/www/myapp/app/users/views.py', reloading
> * Restarting with reloader
> 
> 
> 
> This is my "views.py"
> /home/bruce/www/myapp/app/users/views.py:
> 
> 
> from app import db
> from app.users import constants as USER
> 
> class User(db.Model):
> 
> __tablename__ = 'users_user'
> 
> id = db.Column(db.Integer, primary_key=True)
> name = db.Column(db.String(50), unique=True)
> email = db.Column(db.String(120), unique=True)
> password = db.Column(db.String(20))
> role = db.Column(db.SmallInteger, default=USER.USER)
> status = db.Column(db.SmallInteger, default=USER.NEW)
> 
> def __init__(self, name=None, email=None, password=None):
> self.name (http://self.name) = name
> self.email = email
> self.password = password
> 
> def getStatus(self):
> return USER.STATUS[self.status]
> 
> def getRole(self):
> return USER.ROLE[self.role]
> 
> def __repr__(self):
> return '<User %r>' % (self.name (http://self.name))
> 
> 
> 
> 
> 
> 
> 
> Bruce 

Re: [flask] Large-app-how-to: TypeError: __init__() takes exactly 1 argument (4 given)

From:
bruce bushby
Date:
2012-08-02 @ 07:40
Hi

Thanks for all the help, much appreciated!

Mark: HUGE thank you..I've been puling my hair out :)

Any way we can get the Large App wiki updated/corrected?


Bruce






On Thu, Aug 2, 2012 at 4:28 AM, Mark Steve Samson <hello@marksteve.com> wrote:
> User attributes are supposed to be keyword arguments.
>
> user = User(name=form.name.data, email=form.email.data,
> password=generate_password_hash(form.password.data))
>
> --
> Steve
>
> On Thursday, August 2, 2012 at 4:13 AM, bruce bushby wrote:
>
> Hi
>
> I was wondering if anybody else got this error when following large
> app tutorial?
> https://github.com/mitsuhiko/flask/wiki/
>
>
> 127.0.0.1 - - [01/Aug/2012 20:00:24] "POST /users/register/ HTTP/1.0" 500 -
> Traceback (most recent call last):
> File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1701, in __call__
> return self.wsgi_app(environ, start_response)
> File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1689, in wsgi_app
> response = self.make_response(self.handle_exception(e))
> File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1687, in wsgi_app
> response = self.full_dispatch_request()
> File "/home/bruce/www /venv/lib/python2.7/site-packages/flask/app.py",
> line 1360, in full_dispatch_request
> rv = self.handle_user_exception(e)
> File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1358, in full_dispatch_request
> rv = self.dispatch_request()
> File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> line 1344, in dispatch_request
> return self.view_functions[rule.endpoint](**req.view_args)
> File "/home/bruce/www/myapp/app/users/views.py", line 55, in register
> user =
> User(form.name.data,form.email.data,generate_password_hash(form.password.data))
> TypeError: __init__() takes exactly 1 argument (4 given)
> 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=style.css HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
> /users/regi ster/?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=console.png HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=source.png HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
> /users/register/?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.0"
> 200 -
> 127.0.0.1 - - [01/Aug/2012 20:00:26] "GET /favicon.ico HTTP/1.0" 404 -
> * Detected change in '/home/bruce/www/myapp/app/users/views.py', reloading
> * Restarting with reloader
>
>
>
> This is my "views.py"
> /home/bruce/www/myapp/app/users/views.py:
>
>
> from app import db
> from app.users import constants as USER
>
> class User(db.Model):
>
> __tablename__ = 'users_user'
>
> id = db.Column(db.Integer, primary_key=True)
> name = db.Column(db.String(50), unique=True)
> email = db.Column(db.String(120), unique=True)
> password = db.Column(db.String(20))
> role = db.Column(db.SmallInteger, default=USER.USER)
> status = db.Column(db.SmallInteger, default=USER.NEW)
>
> def __init__(self, name=None, email=None, password=None):
> self.name = name
> self.email = email
> self.password = password
>
> def getStatus(self):
> return USER.STATUS[self.status]
>
> def getRo le(self):
> return USER.ROLE[self.role]
>
> def __repr__(self):
> return '<User %r>' % (self.name)
>
>
>
>
>
>
>
> Bruce
>
>

Re: [flask] Large-app-how-to: TypeError: __init__() takes exactly 1 argument (4 given)

From:
Brice Leroy
Date:
2012-08-14 @ 20:13
I'll be adding unit-test soon... I've planing on doing it for a while but I
just recently reached an almost elegant solution to make it work with
recent Flask-SQLAlchemy+Flask-unittest and Fixtures.

Otherwise, it's a wiki bro, go ahead and fix it ;)

Brice

2012/8/2 bruce bushby <bruce.bushby@gmail.com>

> Hi
>
> Thanks for all the help, much appreciated!
>
> Mark: HUGE thank you..I've been puling my hair out :)
>
> Any way we can get the Large App wiki updated/corrected?
>
>
> Bruce
>
>
>
>
>
>
> On Thu, Aug 2, 2012 at 4:28 AM, Mark Steve Samson <hello@marksteve.com>
> wrote:
> > User attributes are supposed to be keyword arguments.
> >
> > user = User(name=form.name.data, email=form.email.data,
> > password=generate_password_hash(form.password.data))
> >
> > --
> > Steve
> >
> > On Thursday, August 2, 2012 at 4:13 AM, bruce bushby wrote:
> >
> > Hi
> >
> > I was wondering if anybody else got this error when following large
> > app tutorial?
> > https://github.com/mitsuhiko/flask/wiki/
> >
> >
> > 127.0.0.1 - - [01/Aug/2012 20:00:24] "POST /users/register/ HTTP/1.0"
> 500 -
> > Traceback (most recent call last):
> > File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> > line 1701, in __call__
> > return self.wsgi_app(environ, start_response)
> > File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> > line 1689, in wsgi_app
> > response = self.make_response(self.handle_exception(e))
> > File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> > line 1687, in wsgi_app
> > response = self.full_dispatch_request()
> > File "/home/bruce/www /venv/lib/python2.7/site-packages/flask/app.py",
> > line 1360, in full_dispatch_request
> > rv = self.handle_user_exception(e)
> > File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> > line 1358, in full_dispatch_request
> > rv = self.dispatch_request()
> > File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
> > line 1344, in dispatch_request
> > return self.view_functions[rule.endpoint](**req.view_args)
> > File "/home/bruce/www/myapp/app/users/views.py", line 55, in register
> > user =
> >
> User(form.name.data,form.email.data,generate_password_hash(form.password.data))
> > TypeError: __init__() takes exactly 1 argument (4 given)
> > 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
> > /users/register/?__debugger__=yes&cmd=resource&f=style.css HTTP/1.0"
> > 200 -
> > 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
> > /users/regi ster/?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.0"
> > 200 -
> > 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
> > /users/register/?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.0"
> > 200 -
> > 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
> > /users/register/?__debugger__=yes&cmd=resource&f=console.png HTTP/1.0"
> > 200 -
> > 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
> > /users/register/?__debugger__=yes&cmd=resource&f=source.png HTTP/1.0"
> > 200 -
> > 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
> > /users/register/?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.0"
> > 200 -
> > 127.0.0.1 - - [01/Aug/2012 20:00:26] "GET /favicon.ico HTTP/1.0" 404 -
> > * Detected change in '/home/bruce/www/myapp/app/users/views.py',
> reloading
> > * Restarting with reloader
> >
> >
> >
> > This is my "views.py"
> > /home/bruce/www/myapp/app/users/views.py:
> >
> >
> > from app import db
> > from app.users import constants as USER
> >
> > class User(db.Model):
> >
> > __tablename__ = 'users_user'
> >
> > id = db.Column(db.Integer, primary_key=True)
> > name = db.Column(db.String(50), unique=True)
> > email = db.Column(db.String(120), unique=True)
> > password = db.Column(db.String(20))
> > role = db.Column(db.SmallInteger, default=USER.USER)
> > status = db.Column(db.SmallInteger, default=USER.NEW)
> >
> > def __init__(self, name=None, email=None, password=None):
> > self.name = name
> > self.email = email
> > self.password = password
> >
> > def getStatus(self):
> > return USER.STATUS[self.status]
> >
> > def getRo le(self):
> > return USER.ROLE[self.role]
> >
> > def __repr__(self):
> > return '<User %r>' % (self.name)
> >
> >
> >
> >
> >
> >
> >
> > Bruce
> >
> >
>



-- 
blog: http://www.debrice.com
Time tracking tool: http://alpha.kaaloo.com
Django site generator: http://alpha.djangogenerator.com
linkedin: http://www.linkedin.com/in/bricepleroy

Re: [flask] Large-app-how-to: TypeError: __init__() takes exactly 1 argument (4 given)

From:
Kirill Klenov
Date:
2012-08-17 @ 05:49
As example Large App (with tests, scripts, migrations, admin,
localization): https://github.com/klen/Flask-Foundation


Kirill Klenov
web developer
______________________________________________________________________
horneds@gmail.com | http://klen.github.com
mobile: +7 906 772-36-20


2012/8/15 Brice Leroy <bbrriiccee@gmail.com>:
> I'll be adding unit-test soon... I've planing on doing it for a while but I
> just recently reached an almost elegant solution to make it work with recent
> Flask-SQLAlchemy+Flask-unittest and Fixtures.
>
> Otherwise, it's a wiki bro, go ahead and fix it ;)
>
> Brice
>
> 2012/8/2 bruce bushby <bruce.bushby@gmail.com>
>>
>> Hi
>>
>> Thanks for all the help, much appreciated!
>>
>> Mark: HUGE thank you..I've been puling my hair out :)
>>
>> Any way we can get the Large App wiki updated/corrected?
>>
>>
>> Bruce
>>
>>
>>
>>
>>
>>
>> On Thu, Aug 2, 2012 at 4:28 AM, Mark Steve Samson <hello@marksteve.com>
>> wrote:
>> > User attributes are supposed to be keyword arguments.
>> >
>> > user = User(name=form.name.data, email=form.email.data,
>> > password=generate_password_hash(form.password.data))
>> >
>> > --
>> > Steve
>> >
>> > On Thursday, August 2, 2012 at 4:13 AM, bruce bushby wrote:
>> >
>> > Hi
>> >
>> > I was wondering if anybody else got this error when following large
>> > app tutorial?
>> > https://github.com/mitsuhiko/flask/wiki/
>> >
>> >
>> > 127.0.0.1 - - [01/Aug/2012 20:00:24] "POST /users/register/ HTTP/1.0"
>> > 500 -
>> > Traceback (most recent call last):
>> > File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
>> > line 1701, in __call__
>> > return self.wsgi_app(environ, start_response)
>> > File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
>> > line 1689, in wsgi_app
>> > response = self.make_response(self.handle_exception(e))
>> > File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
>> > line 1687, in wsgi_app
>> > response = self.full_dispatch_request()
>> > File "/home/bruce/www /venv/lib/python2.7/site-packages/flask/app.py",
>> > line 1360, in full_dispatch_request
>> > rv = self.handle_user_exception(e)
>> > File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
>> > line 1358, in full_dispatch_request
>> > rv = self.dispatch_request()
>> > File "/home/bruce/www/venv/lib/python2.7/site-packages/flask/app.py",
>> > line 1344, in dispatch_request
>> > return self.view_functions[rule.endpoint](**req.view_args)
>> > File "/home/bruce/www/myapp/app/users/views.py", line 55, in register
>> > user =
>> >
>> > 
User(form.name.data,form.email.data,generate_password_hash(form.password.data))
>> > TypeError: __init__() takes exactly 1 argument (4 given)
>> > 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
>> > /users/register/?__debugger__=yes&cmd=resource&f=style.css HTTP/1.0"
>> > 200 -
>> > 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
>> > /users/regi ster/?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.0"
>> > 200 -
>> > 127.0.0.1 - - [01/Aug/2012 20:00:24] "GET
>> > /users/register/?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.0"
>> > 200 -
>> > 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
>> > /users/register/?__debugger__=yes&cmd=resource&f=console.png HTTP/1.0"
>> > 200 -
>> > 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
>> > /users/register/?__debugger__=yes&cmd=resource&f=source.png HTTP/1.0"
>> > 200 -
>> > 127.0.0.1 - - [01/Aug/2012 20:00:25] "GET
>> > /users/register/?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.0"
>> > 200 -
>> > 127.0.0.1 - - [01/Aug/2012 20:00:26] "GET /favicon.ico HTTP/1.0" 404 -
>> > * Detected change in '/home/bruce/www/myapp/app/users/views.py',
>> > reloading
>> > * Restarting with reloader
>> >
>> >
>> >
>> > This is my "views.py"
>> > /home/bruce/www/myapp/app/users/views.py:
>> >
>> >
>> > from app import db
>> > from app.users import constants as USER
>> >
>> > class User(db.Model):
>> >
>> > __tablename__ = 'users_user'
>> >
>> > id = db.Column(db.Integer, primary_key=True)
>> > name = db.Column(db.String(50), unique=True)
>> > email = db.Column(db.String(120), unique=True)
>> > password = db.Column(db.String(20))
>> > role = db.Column(db.SmallInteger, default=USER.USER)
>> > status = db.Column(db.SmallInteger, default=USER.NEW)
>> >
>> > def __init__(self, name=None, email=None, password=None):
>> > self.name = name
>> > self.email = email
>> > self.password = password
>> >
>> > def getStatus(self):
>> > return USER.STATUS[self.status]
>> >
>> > def getRo le(self):
>> > return USER.ROLE[self.role]
>> >
>> > def __repr__(self):
>> > return '<User %r>' % (self.name)
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > Bruce
>> >
>> >
>
>
>
>
> --
> blog: http://www.debrice.com
> Time tracking tool: http://alpha.kaaloo.com
> Django site generator: http://alpha.djangogenerator.com
> linkedin: http://www.linkedin.com/in/bricepleroy
>