PositiveIntegerValue class must be > 0

Anonymous avatarAnonymous created an issue

Why in .../django-livesettings/livesettings/values.py there is PositiveIntegerValue (as I think it's values must be > 0) class with min_value = 0

class PositiveIntegerValue(IntegerValue):

class field(forms.IntegerField): def init(self, *args, kwargs): ... kwargs['min_value'] = 0 ...

I think that this class must named NotNegativeIntegerValue. But class PositiveIntegerValue must be:

class PositiveIntegerValue(IntegerValue):

class field(forms.IntegerField): def init(self, *args, kwargs): ... kwargs['min_value'] = 1 ...

Is it my bad english or can I give patch with classes?

Comments (2)

  1. Hynek Cernoch

    You are right, however...

    "PositiveIntegerValue" is a nicer name than "NonNegativeIntegerValue", though inaccurate. Zero values are frequently expected in existing applications and probably also in user's code. The min_value=1 is less frequently useful than zero.Therefore the best possible fix is a better documentation. You can easily create a "ReallyPositiveIntegerValue".

    Your issue was motivation for bigger improving the package and the documentation, hower for you I modified a little: 57608412

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.