Summarize data

Please, check my code!
I forgot to include some kind of readme.st. To test custom command:
python manage.py summarize [date YYYY-MM-DD] [--nodeletion]
If you pass no parameters it summarizes current date minus 15 days (single day and no a 15-days period)
But less pythonic ;)
http://docs.python-guide.org/en/latest/writing/style/#returning-values

On Tue, Oct 7, 2014 at 12:48 AM, Daniel Gonzalez Gasull <
notifications@github.com> wrote:

> In okapiweb/management/commands/summarize.py:
>
> > +        make_option('--nodelete',
> > +                    action='store_true',
> > +                    dest='nodelete',
> > +                    default=False,
> > +                    help='Preserve processed data'),
> > +    )
> > +
> > +    def check_date(self, processed_date="", format_string=DEFAULT_DATE_FORMAT):
> > +        """Helper to check if a date is valid"""
> > +
> > +        output = True
> > +        try:
> > +            datetime.strptime(processed_date, format_string)
> > +        except ValueError:
> > +            output = False
> > +        return output
>
> More straightforward:
>
> try:
>     datetime.strptime(processed_date, format_string)
> except ValueError:
>     return False
> return True
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/redbeacon/okapi-web/pull/23/files#r18491148>.
>



-- 
Alejandro Garcia
Software Engineer at RedBeacon.com