-
-
Notifications
You must be signed in to change notification settings - Fork 102
fix problem with long Url.pattern from model_bakery and admin #133
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #133 +/- ##
==========================================
+ Coverage 87.21% 88.99% +1.77%
==========================================
Files 12 13 +1
Lines 305 327 +22
Branches 29 30 +1
==========================================
+ Hits 266 291 +25
+ Misses 28 26 -2
+ Partials 11 10 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more 📢 Have feedback on the report? Share it here. |
dd8610f
to
608711f
Compare
Thank you for this! At this time, fixing #124 is a more urgent issue. I believe that will need to get resolved first. I also note there's no test - which we probably want - but not having written one is understandable given the project's current state. |
I've created #136 to improve test and development infrastructure. I will also document the test flow |
I haven't merged anything yet, but as-is (5.0 at 77b980c), here's how tests can be ran: env PYTHONPATH=. DJANGO_SETTINGS_MODULE=tests.settings django-admin test robots -v2 |
d884281
to
1bf659b
Compare
I have added test for this Issue and few other Url model tests. Although the test would raise |
@PetrDlouhy Sorry for the delay. Are you still interested in this PR? Can you rebase this? |
a22acf2
to
d143e0b
Compare
for more information, see https://pre-commit.ci
@tony I rebased this. |
src/robots/models.py
Outdated
@@ -21,6 +22,8 @@ class Url(models.Model): | |||
" (*) as a wildcard and a dollar sign ($) to " | |||
"match the end of the URL, e.g., '/*.jpg$'." | |||
), | |||
default="", |
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.
Q: Is this default=""
necessary?
I am not sure, but couldn't this lock tables / cause potential downtimes on production sites?
@tony I don't rememeber why I added the |
@PetrDlouhy First, thank you for your time. In regards to the description in the PR and in #132. Correct me if I'm mistaken below! To summarize this PR: it adds a validator to solve a compatibility issue arising with a third party django package: Does this problem still effect you? e.g. Do you still run model_bakery and django-robots and run into this error? Sorry time has passed since then. If this issue still happens for you: Is the PR still need needed now that FYI: I haven't used model bakery FYI, so things are not obvious to me. Thank you! |
@tony I don't think this is an issue only for The problem is, that if you write 255 characters into the The problem with And yes, I am still using |
@PetrDlouhy I am grateful for the pull request, thank you. Sorry for the delay! I am concerned about merging in something that'd potentially have unintended side effects for users. QuestionsWhile the underlying change makes sense to me, no other user has brought up a concern yet since #132 was made. To help reframe this toward django / robots usage in general:
Second opinion?Can you please seek a second opinion from someone on Jazzband? The reason why is they would have an opinion that could bring insight and balance out mine. Thank you again!Let me know what you think on both of the above! |
@tony The migration is created by Django and is only required because the model state changes but doesn't make any real data change in the DB. I really don't understand your concerns. What exactly could go wrong with this change? What are the unintended side effects? My use case is that I am using django-admin-smoke-tests for testing if everything works OK in the admin environment. The problem couldn't be fixed in Please go to the Robots URL admin, click on "Add URL" button and fill in long string like |
And yes, model validators are exactly the right tool for this in Django. If the model is not able to accept 255 characters, there should be validator that ensure that users will not put 255 characters there. |
This looks sensible to me! Pardon the delay. Let's give this a shot! Merged via 6dbeb31. P.S. Why the delay? When maintaining, I have to take responsibility for what is merged in: If this affects downstream users in a way that wasn't anticipated, that can inconvenience them. The reason why is an earlier issue happened with migrations in #124. |
@tony Thank you very much. |
@PetrDlouhy Thanks! Look forward to you look into this further! You may be in a good position to if you still have |
@tony I realized, that the tests are not passing because of the removed |
fix #132
MaxLengthValidator
has problem, that it doesn't allow/
with 254 other characters (which is generated when saved previously with long pattern). But I suppose it is very minor problem not worth adding more complexity to the code.