Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

AttributeError: readonly attribute when using query scope #414

Open
mehrenreich opened this issue Apr 25, 2023 · 0 comments
Open

AttributeError: readonly attribute when using query scope #414

mehrenreich opened this issue Apr 25, 2023 · 0 comments

Comments

@mehrenreich
Copy link

mehrenreich commented Apr 25, 2023

When trying to run this code:

from orator import Model
from orator.orm import scope
from datetime import datetime


class Token(Model):
    @scope
    def valid(self, query):
        return query.where("valid_until > %s" % datetime.today())

t = Token()
print(t.valid().get())

I got this error message:

Traceback (most recent call last):
  File "[...]/src/sih_data/db/database.py", line 4, in <module>
    from sih_data.db.models.token import *
  File "[...]/src/sih_data/db/models/token.py", line 6, in <module>
    class Token(Model):
  File "[...]/src/sih_data/db/models/token.py", line 8, in Token
    def valid(self, query):
  File "[...]/.pyenv/versions/3.10.8/lib/python3.10/site-packages/orator/orm/utils.py", line 129, in __init__
    update_wrapper(self, method)
  File "[...]/.pyenv/versions/3.10.8/lib/python3.10/functools.py", line 61, in update_wrapper
    wrapper.__wrapped__ = wrapped
AttributeError: readonly attribute
  • Python version: 3.10.8
  • Orator version: 0.9.9
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant