evereux / flicket

Simple ticket system using python flask
MIT License
128 stars 58 forks source link

TypeError: Form.validate() got an unexpected keyword argument 'extra_validators' #76

Closed lw3dtr closed 5 months ago

lw3dtr commented 5 months ago

Error that i get whem i am triying to loging on a nwe instalation enviroment linuxmint last version , python3.10 Flask-WTF-1.2.1

File "/home/bruno/.local/lib/python3.10/site-packages/flask/app.py", line 2213, in call

return self.wsgi_app(environ, start_response)

File "/home/bruno/.local/lib/python3.10/site-packages/flask/app.py", line 2193, in wsgi_app

response = self.handle_exception(e)

File "/home/bruno/.local/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app

response = self.full_dispatch_request()

File "/home/bruno/.local/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request

rv = self.handle_user_exception(e)

File "/home/bruno/.local/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request

rv = self.dispatch_request()

File "/home/bruno/.local/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request

return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)

File "/home/bruno/Flask/flicket-master/application/flicket/views/login.py", line 103, in login

if form.validate_on_submit():

File "/home/bruno/.local/lib/python3.10/site-packages/flask_wtf/form.py", line 86, in validate_on_submit

return self.is_submitted() and self.validate(extra_validators=extra_validators)

TypeError: Form.validate() got an unexpected keyword argument 'extra_validators'
evereux commented 5 months ago

It's working fine for me on Linux Mint and Python 3.10.

Set up a virtual environment per the installation instructions and install the requirements in requirements.txt.

If you're still having a problem show me the output of pip freeze.

lw3dtr commented 5 months ago

HI , i just upgrade wtforms , manually to a version more actualized , and this error go away , but i found a new problem when i try to save the config of system mail:

InterfaceError

sqlalchemy.exc.InterfaceError: (sqlite3.InterfaceError) Error binding parameter 7 - probably unsupported type. [SQL: UPDATE flicket_config SET mail_server=?, mail_use_tls=?, mail_use_ssl=?, mail_username=?, mail_password=?, mail_default_sender=?, mail_ascii_attachments=?, posts_per_page=?, allowed_extensions=?, application_title=?, auth_domain=? WHERE flicket_config.id = ?] [parameters: ('', 0, 0, 'xxxxxxxxxxxxx', 'xxxxxxxxxx', '', 0, (50,), ('txt, log, pdf, png, jpg, jpeg, gif, msg, doc, docx, ppt, pptx, xls, xlsx',), ('Flicket',), '', 1)] (Background on this error at: https://sqlalche.me/e/20/rvf5)

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context

self.dialect.do_execute(

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute

cursor.execute(statement, parameters)

The above exception was the direct cause of the following exception: File "/home/bruno/.local/lib/python3.10/site-packages/flask/app.py", line 2213, in call

return self.wsgi_app(environ, start_response)

File "/home/bruno/.local/lib/python3.10/site-packages/flask/app.py", line 2193, in wsgi_app

response = self.handle_exception(e)

File "/home/bruno/.local/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app

response = self.full_dispatch_request()

File "/home/bruno/.local/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request

rv = self.handle_user_exception(e)

File "/home/bruno/.local/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request

rv = self.dispatch_request()

File "/home/bruno/.local/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request

return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)

File "/home/bruno/.local/lib/python3.10/site-packages/flask_login/utils.py", line 290, in decorated_view

return current_app.ensure_sync(func)(*args, **kwargs)

File "/usr/lib/python3/dist-packages/flask_principal.py", line 199, in _decorated

rv = f(*args, **kw)

File "/home/bruno/Flask/flicket-master/application/flicket_admin/views/view_config.py", line 62, in config

db.session.commit()

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/orm/scoping.py", line 598, in commit

return self._proxied.commit()

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1969, in commit

trans.commit(_to_root=True)

File "", line 2, in commit File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go

ret_value = fn(self, *arg, **kw)

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1256, in commit

self._prepare_impl()

File "", line 2, in _prepare_impl File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go

ret_value = fn(self, *arg, **kw)

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1231, in _prepare_impl

self.session.flush()

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4312, in flush

self._flush(objects)

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4447, in _flush

with util.safe_reraise():

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 146, in exit

raise exc_value.with_traceback(exc_tb)

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4408, in _flush

flush_context.execute()

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute

rec.execute(self)

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute

util.preloaded.orm_persistence.save_obj(

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/orm/persistence.py", line 85, in save_obj

_emit_update_statements(

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/orm/persistence.py", line 909, in _emit_update_statements

c = connection.execute(

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1416, in execute

return meth(

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 516, in _execute_on_connection

return connection._execute_clauseelement(

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1639, in _execute_clauseelement

ret = self._execute_context(

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1848, in _execute_context

return self._exec_single_context(

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1988, in _exec_single_context

self._handle_dbapi_exception(

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2343, in _handle_dbapi_exception

raise sqlalchemy_exception.with_traceback(exc_info[2]) from e

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1969, in _exec_single_context

self.dialect.do_execute(

File "/home/bruno/.local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 922, in do_execute

cursor.execute(statement, parameters)

evereux commented 5 months ago

Set up a virtual environment per the installation instructions and install the requirements in requirements.txt.

If you're still having a problem show me the output of pip freeze.

In your flicket folder:

sudo apt install python3.10-venv

python3 -m venv venv

activate the virualenv

source venv/bin/activate

install the requirements

pip install -r requirements.txt

Then run flask.

Learn about pythons virtual environments. Really simple once you've done it once or twice. It's the single most common thing that trip people up with this. Installing all kinds of python packages of various versions globally and then wondering why X application won't work.

evereux commented 5 months ago

ps if you then still have a problem show me a screenshot of what you're submitting.

evereux commented 5 months ago

My apologies here ... it seems there is indeed a bug when using the SQLite database. I'll look into this ...

evereux commented 5 months ago

The problem was the file application/flicket_admin/views/view_config.py. A few of the form field lines had commas at the end turning the data into a tuple. For some reason MySQL and PostGres figured out my stupidity and handled it correctly.

Anyways, latest version fixes this. Sorry for any trouble!

lw3dtr commented 5 months ago

Thanks for your help !!

Bruno

El dom, 28 abr 2024 a las 11:26, evereux @.***>) escribió:

The problem was the file application/flicket_admin/views/view_config.py. A few of the form field lines had commas at the end turning the data into a tuple. For some reason MySQL and PostGres figured out my stupidity and handled it correctly.

Anyways, latest version fixes this. Sorry for any trouble!

— Reply to this email directly, view it on GitHub https://github.com/evereux/flicket/issues/76#issuecomment-2081504240, or unsubscribe https://github.com/notifications/unsubscribe-auth/BIDSBYH4GAXDZCVEZIPNOJTY7UBJ7AVCNFSM6AAAAABG3RSVZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBRGUYDIMRUGA . You are receiving this because you authored the thread.Message ID: @.***>