-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alberto Paro
committed
Apr 21, 2010
0 parents
commit b99f805
Showing
23 changed files
with
1,039 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.pyc | ||
*~ | ||
.hg* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Waldemar Kornewald | ||
Alberto Paro (Setuptools) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include MANIFEST.in | ||
include README.rst | ||
include AUTHORS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
djangotoolbox | ||
------------- | ||
|
||
Utility functions for django-nonrel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
__author__ = 'Waldemar Kornewald' | ||
|
||
VERSION = (0, 1, 0) | ||
|
||
def get_version(): | ||
version = '%s.%s' % (VERSION[0], VERSION[1]) | ||
if VERSION[2]: | ||
version = '%s.%s' % (version, VERSION[2]) | ||
return version | ||
|
||
__version__ = get_version() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import datetime | ||
from django.db.backends import BaseDatabaseFeatures, BaseDatabaseOperations, \ | ||
BaseDatabaseWrapper, BaseDatabaseClient, BaseDatabaseValidation, \ | ||
BaseDatabaseIntrospection | ||
|
||
from .creation import NonrelDatabaseCreation | ||
|
||
class NonrelDatabaseFeatures(BaseDatabaseFeatures): | ||
distinguishes_insert_from_update = False | ||
supports_deleting_related_objects = False | ||
supports_multi_table_inheritance = False | ||
|
||
class NonrelDatabaseOperations(BaseDatabaseOperations): | ||
def quote_name(self, name): | ||
return name | ||
|
||
def value_to_db_date(self, value): | ||
# value is a date here, no need to check it | ||
return value | ||
|
||
def value_to_db_datetime(self, value): | ||
# value is a datetime here, no need to check it | ||
return value | ||
|
||
def value_to_db_time(self, value): | ||
# value is a time here, no need to check it | ||
return value | ||
|
||
def prep_for_like_query(self, value): | ||
return value | ||
|
||
def check_aggregate_support(self, aggregate): | ||
# TODO: Only COUNT(*) should be supported, by default. | ||
# Raise NotImplementedError in all other cases. | ||
pass | ||
|
||
def year_lookup_bounds(self, value): | ||
return [datetime.datetime(value, 1, 1, 0, 0, 0, 0), | ||
datetime.datetime(value+1, 1, 1, 0, 0, 0, 0)] | ||
|
||
class NonrelDatabaseClient(BaseDatabaseClient): | ||
pass | ||
|
||
class NonrelDatabaseValidation(BaseDatabaseValidation): | ||
pass | ||
|
||
class NonrelDatabaseIntrospection(BaseDatabaseIntrospection): | ||
def table_names(self): | ||
"""Returns a list of names of all tables that exist in the database.""" | ||
return self.django_table_names() | ||
|
||
class FakeCursor(object): | ||
def __getattribute__(self, name): | ||
raise NotImplementedError('Cursors not supported') | ||
|
||
def __setattr__(self, name, value): | ||
raise NotImplementedError('Cursors not supported') | ||
|
||
class NonrelDatabaseWrapper(BaseDatabaseWrapper): | ||
def _cursor(self): | ||
return FakeCursor() |
Oops, something went wrong.