Django

Code

Changeset 5035

Show
Ignore:
Timestamp:
04/19/07 16:03:56 (2 years ago)
Author:
bouldersprinters
Message:

boulder-oracle-sprint: Removed Oracle-specific code from DateField?.get_db_prep_save and DateTimeField?.get_db_prep_save. Casting to a datetime object is no longer necessary here, because the cursor wrapper automatically sets ansi date and timestamp formats.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/boulder-oracle-sprint/django/db/models/fields/__init__.py

    r5027 r5035  
    496496    def get_db_prep_save(self, value): 
    497497        # Casts dates into string format for entry into database. 
    498         if settings.DATABASE_ENGINE == 'oracle': 
    499             # cx_Oracle needs a conversion to datetime.datetime instead. 
    500             if isinstance(value, datetime.date): 
    501                 value = datetime.datetime.combine(value, datetime.time()) 
    502         elif value is not None: 
     498        if value is not None: 
    503499            value = value.strftime('%Y-%m-%d') 
    504500        return Field.get_db_prep_save(self, value) 
     
    542538            if settings.DATABASE_ENGINE in ('mysql', 'oracle') and hasattr(value, 'microsecond'): 
    543539                value = value.replace(microsecond=0) 
    544             # cx_Oracle wants the raw datetime instead of a string. 
    545             if settings.DATABASE_ENGINE != 'oracle': 
    546                 value = str(value) 
    547540        return Field.get_db_prep_save(self, value) 
    548541