-
Notifications
You must be signed in to change notification settings - Fork 64
[django] Generalize uuid/key/receive_url logic (openwisp/openwisp-utils#40) #109
Conversation
There is a key field in key = KeyField(unique=False,
db_index=False,
help_text=_('key needed to update topology from nodes '),
verbose_name=_('key'),
blank=True) But now when I run Presumably, changing The easy fix is of course to ditch |
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.
In the repo there's a get_random_key
which you should be able to remove
Travis fails for python 2.7 because |
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.
Ok no worries for the failing build on python 2.7 because i'm waiting for PR #99 to be merged which will fix it (@pawelplsi that's one of the reasons I'm insisting with finishing that PR).
I have only one minor request see below.
name='key', | ||
field=openwisp_utils.base.KeyField(blank=True, default=openwisp_utils.utils.get_random_key, help_text='key needed to update topology from nodes ', max_length=64, validators=[django.core.validators.RegexValidator(re.compile('^[^\\s/\\.]+$'), code='invalid', message='This value must not contain spaces, dots or slashes.')], verbose_name='key'), | ||
), | ||
] |
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.
this migration file should not be needed now that you updated the old migration file, you can remove it
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.
@nemesisdesign I updated old migration file, so that it's old generator (which was in django_netjsongraph.utils
) wouldn't be needed, as I deleted it from there. But in the new migration I change the entire field type. So it seems to me, that we still need new migration file. I can of course update the old file once again to make it also KeyField
, but I think it's better the way it is.
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.
change the entire field in the old migration file
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.
Great progress! Please rebase your changes on the current master and see my comments below.
.travis.yml
Outdated
@@ -28,6 +28,9 @@ before_install: | |||
install: | |||
- pip install $DJANGO | |||
- if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install -U "djangorestframework<3.10"; fi | |||
# Temporary: remove when openwisp-utils#71 is merged | |||
- pip install "https://github.com/waleko/openwisp-utils/tarball/issues/40" --upgrade |
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.
I released openwisp-utils 0.4.1 which contains your patch openwisp/openwisp-utils#71.
You can now remove this temporary addition.
name='key', | ||
field=openwisp_utils.base.KeyField(blank=True, default=openwisp_utils.utils.get_random_key, help_text='key needed to update topology from nodes ', max_length=64, validators=[django.core.validators.RegexValidator(re.compile('^[^\\s/\\.]+$'), code='invalid', message='This value must not contain spaces, dots or slashes.')], verbose_name='key'), | ||
), | ||
] |
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.
change the entire field in the old migration file
requirements.txt
Outdated
@@ -2,6 +2,6 @@ django>=1.11,<2.3 | |||
djangorestframework>=3.3,<3.12 | |||
django-model-utils | |||
netdiff>=0.6.0,<0.7 | |||
openwisp-utils>=0.3,<0.4 | |||
openwisp-utils>=0.4,<0.5 |
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.
use 0.4.1
requirements-test.txt
Outdated
@@ -1,4 +1,4 @@ | |||
coveralls | |||
responses | |||
freezegun | |||
openwisp-utils[qa]>=0.3.0 | |||
openwisp-utils[qa]>=0.4.0 |
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.
use 0.4.1
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.
Great work, thank you! 👍
Removed the logics which were duplicated
in the others modules and redefined it here to enable reusability and ease debugging.
Related to openwisp/openwisp-utils#40