Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with activate-account: InternalError: UPDATE can not be performed in Read-Only-Transaction #11

Open
mbehrle opened this issue Nov 4, 2015 · 0 comments

Comments

@mbehrle
Copy link
Contributor

mbehrle commented Nov 4, 2015

On a 3.4 installation with
Flask==0.10.1
Flask-Babel==0.9
Flask-Login==0.2.11
Flask-WTF==0.12

I get the following error on account activation:

127.0.0.1 - - [04/Nov/2015 13:04:35] "GET /de-de/activate-account/10/MTA.Qodg91ri2pb0vLfwcRAmz2vzJbk.CRt-LA._U7gjq4qeg1IBSOVISsJky132uQ?__debugger__=yes&cmd=source&frm=140259930773008&s=ZWtDwIPnlZJb03ASwkAt HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/home/mathiasb/.virtualenvs/hmi34_2/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/mathiasb/.virtualenvs/hmi34_2/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/mathiasb/.virtualenvs/hmi34_2/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/mathiasb/.virtualenvs/hmi34_2/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/mathiasb/.virtualenvs/hmi34_2/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/mathiasb/.virtualenvs/hmi34_2/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/mathiasb/.virtualenvs/hmi34_2/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/mathiasb/projects/hmi34_2/nereid/nereid/application.py", line 460, in dispatch_request
    req, language=language, active_id=active_id
  File "/home/mathiasb/projects/hmi34_2/nereid/nereid/application.py", line 510, in _dispatch_request
    result = meth(i, **req.view_args)
  File "/home/mathiasb/projects/hmi34_2/nereid/trytond_nereid/user.py", line 572, in activate
    self.save()
  File "/home/mathiasb/projects/hmi34_2/trytond/trytond/model/modelstorage.py", line 1411, in save
    self.write([self], save_values)
  File "/home/mathiasb/projects/hmi34_2/nereid/trytond_nereid/user.py", line 868, in write
    nereid_users, cls._convert_values(values), *args
  File "/home/mathiasb/projects/hmi34_2/trytond/trytond/model/modelsql.py", line 799, in write
    where=red_sql))
  File "/home/mathiasb/projects/hmi34_2/trytond/trytond/backend/postgresql/database.py", line 315, in execute
    return self.cursor.execute(sql, params)
InternalError: FEHLER:  UPDATE kann nicht in einer Read-Only-Transaktion ausgeführt werden

The problem arises from missing kwargs in
https://github.com/fulfilio/nereid/blob/develop/nereid/routing.py#L46
while being set in
https://github.com/fulfilio/nereid/blob/3.4/nereid/helpers.py#L457

Researching the issue leads to
pallets/werkzeug#645
and
pallets/werkzeug#675
as well as
pallets/werkzeug#677

Removing def empty(self): in routing py and using

    def get_empty_kwargs(self):
        """
        Provides kwargs for instantiating empty copy with empty()

        Use this method to provide custom keyword arguments to the subclass of
        ``Rule`` when calling ``some_rule.empty()``.  Helpful when the subclass
        has custom keyword arguments that are needed at instantiation.

        Must return a ``dict`` that will be provided as kwargs to the new
        instance of ``Rule``, following the initial ``self.rule`` value which
        is always provided as the first, required positional argument.
        """
        kwargs = super(Rule, self).get_empty_kwargs()
        kwargs['readonly'] = False
        return kwargs

indeed propagates the setting and activation succeeds. So probably get_empty_kwargs should be used on instancianting rule.empty()
https://github.com/fulfilio/nereid/blob/3.4/trytond_nereid/website.py#L400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant