-
Notifications
You must be signed in to change notification settings - Fork 12
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
sqlalchemy todict
intbitset conversion fails on infinite sets
#16
Comments
|
The question here is: why we are converting in |
@dset0x you have answered yourself - because you are requesting a |
A dictionary can hold this object just like any other:
Iterables should too. |
|
There is still a question: Why do you need to store an intbitset with This structure does not have any Python equivalent except of an infinite generator. |
I wish to express infinity, therefore I store a dump of an expression of that (in the same format that I store non-infinity), instead of another magic value. This keeps my TypeDecorator above clean. I only afterwards interpret what infinity means for my logic. I do not necessarily iterate over it.
I don't understand what JSON has to do with a method that is called when |
(a) use the model directly |
I wanted a dictionary of the entire object, like SQLAlchemy normally hands over.
Again, I am not serializing anything (But yes, I want this field in my dictionary).
Since there is no reason to do these conversions, then this is the solution that will prevent future pain. I suspect however, that removing this code will break edge cases in all kinds of hard-to-find code, especially since The use-cases are not obvious to me even in inveniosoftware/invenio@1ee2c0c, where this code seems to originate. Perhaps someone can come up with a better plan to revert this. |
* WebMessage: First module ported to Flask/Jinja2/WTForms/SQLAlchemy. Introduced tests for database independency using Flask-Test and SQLAlchemy. It includes example of dynamic menu loading latest messages and showing unread message counter. * WebSearch: Initial implementation of new search UI using facets and search box autocompletion for several fields. The implementation is still using old Invenio search API and record formating. New AJAX tabs were introduced for record pages. They are using new javascript history API and there is a correct fallback link when the javascript is turned off. * WebComment: Creates demo comments tree and review overview for record tabs. * WebAccess: Reimplements some SQL queries in SQLAlchemy. * WebStyle: Creates unified general page header and footer. There is also new page look and feel using Twitter-Bootstrap user interface. * WebSession: Implements simple login method using Flask.
@jirikuncar indeed re-reading all this issue and the referred original code, seems like that the So in your opinion can |
We can amend it as anyway the |
Given an infinite
intbitset
,and this SQLAlchemy type,
calling
dict()
on an instance that contains it, raises this exception:intbitset
behaves reasonably here, but this conversion was not asked for. Why are these conversions forced intodict
?The text was updated successfully, but these errors were encountered: