Example #1
0
    def test_default_date(self):
        with self.settings(RESTCLIENTS_SWS_DAO_CLASS=FDAO_SWS):
            date = get_default_date()
            self.assertEquals(date.year, 2013)
            self.assertEquals(date.month, 4)
            self.assertEquals(date.day, 15)

        with self.settings(RESTCLIENTS_SWS_DAO_CLASS=LDAO_SWS):
            now = datetime.now()
            date = get_default_date()
            self.assertEquals(date.year, now.year)
            self.assertEquals(date.month, now.month)
            self.assertEquals(date.day, now.day)
Example #2
0
    def test_default_date(self):
        with self.settings(RESTCLIENTS_SWS_DAO_CLASS=FDAO_SWS):
            date = get_default_date()
            self.assertEquals(date.year, 2013)
            self.assertEquals(date.month, 4)
            self.assertEquals(date.day, 15)

        with self.settings(RESTCLIENTS_SWS_DAO_CLASS=LDAO_SWS):
            now = datetime.now()
            date = get_default_date()
            self.assertEquals(date.year, now.year)
            self.assertEquals(date.month, now.month)
            self.assertEquals(date.day, now.day)
Example #3
0
def add_date_term_info(request, context):
    actual_now = get_default_date()
    used_now = get_comparison_date(request)

    context["actual_now_date"] = str(actual_now)
    context["effective_now_date"] = str(used_now)
    context["is_using_mock_data"] = is_using_file_dao()

    try:
        actual_term = get_term_by_date(actual_now)
        context["actual_now_term_year"] = actual_term.year
        context["actual_now_term_quarter"] = actual_term.quarter
    except Exception as ex:
        pass

    try:
        used_term = get_term_by_date(used_now)
        context["effective_now_term_year"] = used_term.year
        context["effective_now_term_quarter"] = used_term.quarter
    except Exception as ex:
        pass
Example #4
0
def add_session_context(request, context):
    if "myuw_override_date" in request.session:
        context["myuw_override_date"] = request.session["myuw_override_date"]

    for val in DATE_KEYS:
        if val in request.session:
            if request.session[val] is True:
                context["%s_true" % val] = True
            else:
                context["%s_false" % val] = True
        else:
            context["%s_unset" % val] = True

    now_request = RequestFactory().get("/")
    now_request.session = {}
    context["values_used"] = get_card_visibilty_date_values(request)

    now = datetime.now()
    default = get_default_date()

    used_date = datetime(default.year, default.month, default.day, now.hour,
                         now.minute, now.second)
    context["values_now"] = get_values_by_date(used_date, now_request)
Example #5
0
def add_session_context(request, context):
    if "myuw_override_date" in request.session:
        context["myuw_override_date"] = request.session["myuw_override_date"]

    for val in DATE_KEYS:
        if val in request.session:
            if request.session[val] is True:
                context["%s_true" % val] = True
            else:
                context["%s_false" % val] = True
        else:
            context["%s_unset" % val] = True

    now_request = RequestFactory().get("/")
    now_request.session = {}
    context["values_used"] = get_card_visibilty_date_values(request)

    now = datetime.now()
    default = get_default_date()

    used_date = datetime(default.year, default.month, default.day, now.hour,
                         now.minute, now.second)
    context["values_now"] = get_values_by_date(used_date, now_request)