Django

Code

Show
Ignore:
Timestamp:
07/01/07 00:55:01 (1 year ago)
Author:
mtredinnick
Message:

unicode: Merged changes from trunk up to [5579].

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/unicode

    • Property svnmerge-integrated changed from /django/trunk:1-5530 to /django/trunk:1-5579
  • django/branches/unicode/django/db/models/fields/__init__.py

    r5531 r5580  
    176176    def get_db_prep_lookup(self, lookup_type, value): 
    177177        "Returns field's value prepared for database lookup." 
    178         if lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte', 'month', 'day', 'search'): 
     178        if lookup_type in ('exact', 'regex', 'iregex', 'gt', 'gte', 'lt', 'lte', 'month', 'day', 'search'): 
    179179            return [value] 
    180180        elif lookup_type in ('range', 'in'): 
     
    802802 
    803803class IPAddressField(Field): 
     804    empty_strings_allowed = False 
    804805    def __init__(self, *args, **kwargs): 
    805806        kwargs['maxlength'] = 15 
  • django/branches/unicode/django/db/models/query.py

    r5531 r5580  
     1from django.conf import settings 
    12from django.db import backend, connection, transaction 
    23from django.db.models.fields import DateField, FieldDoesNotExist 
     
    2425    'startswith', 'istartswith', 'endswith', 'iendswith', 
    2526    'range', 'year', 'month', 'day', 'isnull', 'search', 
     27    'regex', 'iregex', 
    2628) 
    2729 
     
    799801    elif lookup_type == 'search': 
    800802        return backend.get_fulltext_search_sql(table_prefix + field_name) 
     803    elif lookup_type in ('regex', 'iregex'): 
     804        if settings.DATABASE_ENGINE == 'oracle': 
     805            if lookup_type == 'regex': 
     806                match_option = 'c' 
     807            else: 
     808                match_option = 'i' 
     809            return "REGEXP_LIKE(%s%s, %s, '%s')" % (table_prefix, field_name, cast_sql, match_option) 
     810        else: 
     811            raise NotImplementedError 
    801812    raise TypeError, "Got invalid lookup_type: %s" % repr(lookup_type) 
    802813