﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22551	Oracle backend using bytes in isoformat	fatal10110@…	nobody	"Hi , seems like we have some micro bug here, using oracle + django-celery :


{{{
 File ""-/site-packages/django/db/backends/oracle/base.py"", line 449, in year_lookup_bounds_for_datetime_field
    return [b.isoformat(b' ') for b in bounds]

  File ""-/site-packages/django/db/backends/oracle/base.py"", line 449, in <listcomp>
    return [b.isoformat(b' ') for b in bounds]

TypeError: isoformat() argument 1 must be a unicode character, not bytes
}}}

The reason of the excetion is ""date_hierarchy"" in admin part of django-celery


{{{
date_hierarchy = 'tstamp'
}}}


But it should work , beacause in models all is fine


{{{
tstamp = models.DateTimeField(_('event received at'), db_index=True)
}}}

From django documentation: "" Set date_hierarchy to the name of a DateField or '''DateTimeField''' in your model, and the change list page will include a date-based drilldown navigation by that field.""

The code in oracle/base.py


{{{
def year_lookup_bounds_for_datetime_field(self, value):
        # The default implementation uses datetime objects for the bounds.
        # This must be overridden here, to use a formatted date (string) as
        # 'second' instead -- cx_Oracle chops the fraction-of-second part
        # off of datetime objects, leaving almost an entire second out of
        # the year under the default implementation.
        bounds = super(DatabaseOperations, self).year_lookup_bounds_for_datetime_field(value)
        if settings.USE_TZ:
            bounds = [b.astimezone(timezone.utc).replace(tzinfo=None) for b in bounds]
        return [b.isoformat(b' ') for b in bounds]

}}}

Example from python documentantion of how to use the isoformat() method: 


{{{
datetime(2002, 12, 25, tzinfo=TZ()).isoformat(' ')
}}}


They are not using '''b''' to convert the seperator to bytes..

Should I remove the b or it's important ? 

Thanks."	Bug	closed	Database layer (models, ORM)	1.6	Normal	fixed	oracle isoformat dates		Unreviewed	0	0	0	0	1	0
