-
Notifications
You must be signed in to change notification settings - Fork 7
fisclimate#1348: Add column attributes #30
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
base: master
Are you sure you want to change the base?
Conversation
…han initialization parameters) as the primary configuration method
Codecov Report
@@ Coverage Diff @@
## master #30 +/- ##
==========================================
- Coverage 89.2% 85.13% -4.08%
==========================================
Files 23 17 -6
Lines 3576 3498 -78
Branches 324 319 -5
==========================================
- Hits 3190 2978 -212
- Misses 327 465 +138
+ Partials 59 55 -4
Continue to review full report at Codecov.
|
guruofgentoo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this looks like a good way to clean up some attribute assignment issues, this is indeed a breaking change and would require a fair number of changes across multiple projects.
If we wanted to proceed with this update, we would need to work with some of the existing grids to see if it would be possible to have this improvement without breaking existing code. It seems like it wouldn't be difficult to inspect a column to see which initialization style it has.
|
Overall, I like where this API change takes us. But the backwards incompatibility is too high a cost with the PR as written. That being said, it's rather easy to support both methods and, optionally, deprecate the current method. class Example(object):
can_sort=True
def __init__(self, can_sort = _None):
self.can_sort = self.can_sort if can_sort is _None else can_sortObviously, if you want to deprecate the existing functionality, then a bit more work needs to be done, but it could easily be wrapped in a function built for that purpose. @tjlevel12 I like the initiative you have taken hear to clean things up. We want to keep improving our code base as time permits us to do so. In the future, before you spend time on a large architectural change like this, especially if it breaks backwards compatibility, please talk with Matt or me to make sure we like where you are planning on heading with things. I'd hate to see you put a lot of effort into something like this and then have it rejected for a reason we would have known about ahead of time. |
5d42130 to
97cc369
Compare
This PR cleans up the Column attributes a bit.
Currently, Column attributes are configured via initialization parameters, which results in Columns being created and configured similarly to the following:
This method works, but it's not clear what configuration options are being changed and when. Have we customized the default
can_sortvalue, or isFalsethe default value inColumn?By switching to a system based on class attributes, Column configuration becomes much simpler:
Here we can clearly see that we are customizing the
can_sortandlink_labelattributes.It should be noted that this is likely a breaking change. Applications using the webgrid library will likely need to be updated to use the new class attributes instead of the initialization parameters. The version number has been bumped a minor revision to help indicate this change.