Skip to content
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

Possible error in content/summary validation? #5

Open
will-chang6 opened this issue Aug 17, 2023 · 0 comments
Open

Possible error in content/summary validation? #5

will-chang6 opened this issue Aug 17, 2023 · 0 comments
Labels
se curriculum Issue for lessons in the Software Engineering program

Comments

@will-chang6
Copy link

Canvas Link

https://learning.flatironschool.com/courses/6463/assignments/250503?module_item_id=591896

Concern

Wouldn't len(content) <= 250 and len(summary) >= 250 raise an error if string is equal to 250 characters? The solution error message is "String must be greater/lesser than or equal to 250 characters long"
If I am misunderstanding something, please let me know!

@validates('content', 'summary')
def validate_length(self, key, string):
if( key == 'content'):
if len(string) <= 250:
raise ValueError("Post content must be greater than or equal 250 characters long.")
if( key == 'summary'):
if len(string) >= 250:
raise ValueError("Post summary must be less than or equal to 250 characters long.")
return string

Additional Context

No response

Suggested Changes

No response

@will-chang6 will-chang6 added the se curriculum Issue for lessons in the Software Engineering program label Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
se curriculum Issue for lessons in the Software Engineering program
Projects
None yet
Development

No branches or pull requests

1 participant