Query('foo').bar results in errors
msiemens opened this issue · 2 comments
msiemens commented
Source:
>>> from tinydb import Query
>>> Query('foo').bar
Stack trace:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\tinydb\queries.py", line 113, in __getattr__
return Query(self._path + [item])
TypeError: cannot concatenate 'str' and 'list' objects
TypeError: Can't convert 'list' object to str implicitly
Discovered by @mikeckennedy when creating https://github.com/mikeckennedy/tinydb-sample-blog. We should really change the API here so people don't use it by accident in a way that breaks their programs.
eugene-eeo commented
Make the constructor's signature *arg
?
msiemens commented
I've now solved this by removing the Query
constructor parameter altogether. The parameter was never intended to be used by the user anyway so this should be the most elegant solution.