def date_proc(func):
@wraps(func)<EOL>def wrapped(request, *args, **kwargs):<EOL><INDENT>if '<STR_LIT:date>' in request.GET and request.GET['<STR_LIT:date>'] == '<STR_LIT>':<EOL><INDENT>raise Http404("<STR_LIT>")<EOL><DEDENT>elif '<STR_LIT:date>' not in request.GET:<EOL><INDENT>date = datetime.today()<EOL>return func(request, date)<EOL><DEDENT>else:<EOL><INDENT>date = tuple(int(intValue) for intValue in request.GET['<STR_LIT:date>'].split('<STR_LIT:->'))<EOL>if len(date) == <NUM_LIT:3>:<EOL><INDENT>date = datetime(*date)<EOL><DEDENT>elif len(date) == <NUM_LIT:2>:<EOL><INDENT>date = datetime(*date, day = <NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>date = datetime(*date, month = <NUM_LIT:1>, day = <NUM_LIT:1>)<EOL><DEDENT>return func(request, date)<EOL><DEDENT><DEDENT>return wrapped<EOL>
An decorator checking whether date parameter is passing in or not. If not, default date value is all PTT data.
            Else, return PTT data with right date.
    Args:
            func: function you want to decorate.
            request: WSGI request parameter getten from django.

    Returns:
            date:
                    a datetime variable, you can only give year, year + month or year + month + day, three type.
                    The missing part would be assigned default value 1 (for month is Jan, for day is 1).