Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-473

[Python] django_cubrid can not be a engine for django 1.5

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Python-Aprium
    • Fix Version/s: None
    • Component/s: Python Driver
    • Labels:
    • Environment:

      Linux 64

      Description

      [Python] django_cubrid can not be a engine for django 1.5

      Test Environment:

      python:  2.7.3
      django: 1.5
      cubrid: 9.1.0.0205
      cubrid python: 9.1.0.001
      

      After deploy the django web server, there are some errors when select the tuples:
      1. When execute install sql, it success, and the database also has the created table.

      [bom@NC-PL-QA-012 ~]$ python manage.py sqlall messages
      BEGIN;
      CREATE TABLE `messages_message` (
          `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
          `name` varchar(30) NOT NULL,
          `email` varchar(75) NOT NULL,
          `homepage` varchar(200) NOT NULL,
          `title` varchar(200) NOT NULL,
          `content` varchar(500) NOT NULL,
          `time` datetime NOT NULL,
          `ip` varchar(20) NOT NULL
      )
      ;
      COMMIT;
      [bom@NC-PL-QA-012 ~]$python manage.py syncdb
      

      2. When executing "python manage.py shell" command, there are some errors:
      >>> from messages.models import Message
      expected:

      >>> Message.objects.all()
       [] 
      

      actual:

      >>> Message.objects.all()
      Traceback (most recent call last):
        File "<console>", line 1, in <module>
        File "/home/bom/tools/python273/lib/python2.7/site-packages/django/db/models/query.py", line 77, in __repr__
          data = list(self[:REPR_OUTPUT_SIZE + 1])
        File "/home/bom/tools/python273/lib/python2.7/site-packages/django/db/models/query.py", line 116, in _result_iter
          upper = len(self._result_cache)
      TypeError: object of type 'NoneType' has no len()
      

      Then insert a tuple successfully, and csql can select this tuple:

      >>>m = Message(name='Hily',
      email='hily@test.com',
      homepage='http://hily.me/',
      title='My first message',
      content='This is my first message.',
      ip='192.168.1.5')
      
      >>>m.save()
      

      When I want to get a value, error occurs:

      >>> m = Message.objects.get(name='Hily')
      Traceback (most recent call last):
        File "<console>", line 1, in <module>
        File "/home/bom/tools/python273/lib/python2.7/site-packages/django/db/models/manager.py", line 143, in get
          return self.get_query_set().get(*args, **kwargs)
        File "/home/bom/tools/python273/lib/python2.7/site-packages/django/db/models/query.py", line 394, in get
          num = len(clone)
        File "/home/bom/tools/python273/lib/python2.7/site-packages/django/db/models/query.py", line 90, in __len__
          self._result_cache = list(self.iterator())
        File "/home/bom/tools/python273/lib/python2.7/site-packages/django/db/models/query.py", line 301, in iterator
          for row in compiler.results_iter():
        File "/home/bom/tools/python273/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 775, in results_iter
          for rows in self.execute_sql(MULTI):
        File "/home/bom/tools/python273/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 830, in execute_sql
          sql, params = self.as_sql()
        File "/home/bom/tools/python273/lib/python2.7/site-packages/django_cubrid/compiler.py", line 43, in as_sql
          grouping, gb_params = self.get_grouping()
      TypeError: get_grouping() takes exactly 2 arguments (1 given)
      

      The django 1.4.2 is not existed this issue

        Activity

        Hide
        jinhu 李金虎 added a comment -

        (1)The as_sql() was defined in django/modules/sql/compiler.py, and the get_grouping() is called in as_sql().
        The django_cubrid/compiler.py redefines the as_sql() in which get_grouping() is called.
        The argument list in get_grouping() has changed between Django-1.4 and 1.5.
        It's not need to redefine the as_sql() in django_cubrid.

        (2)The var CACHE_BACKEND in create_test_db() is not available in Django-1.5.
        The create_test_db() in django_cubrid has almost the same processes as that defined in Django. So, it's not need to redefine create_test_db() in django_cubrid.

        Fixed in RB-9.1.0, revision: 1578
        Merge into RB-8.4.1, revision: 1579
        Merge into RB-8.4.3, revision: 1580
        Merge into RB-8.4.4, revision: 1581
        Merge into trunk, revision: 1582

        Show
        jinhu 李金虎 added a comment - (1)The as_sql() was defined in django/modules/sql/compiler.py, and the get_grouping() is called in as_sql(). The django_cubrid/compiler.py redefines the as_sql() in which get_grouping() is called. The argument list in get_grouping() has changed between Django-1.4 and 1.5. It's not need to redefine the as_sql() in django_cubrid. (2)The var CACHE_BACKEND in create_test_db() is not available in Django-1.5. The create_test_db() in django_cubrid has almost the same processes as that defined in Django. So, it's not need to redefine create_test_db() in django_cubrid. Fixed in RB-9.1.0, revision: 1578 Merge into RB-8.4.1, revision: 1579 Merge into RB-8.4.3, revision: 1580 Merge into RB-8.4.4, revision: 1581 Merge into trunk, revision: 1582
        Hide
        cn14130 欧明宝[Bom Owen] added a comment -

        Test Environment:

        python:  2.7.3
        django: 1.5, 1.4.2
        cubrid: 9.1.0.0205
        cubrid python: 9.1.0.001
        

        Test Result: pass

        Show
        cn14130 欧明宝[Bom Owen] added a comment - Test Environment: python: 2.7.3 django: 1.5, 1.4.2 cubrid: 9.1.0.0205 cubrid python: 9.1.0.001 Test Result: pass

          People

          • Assignee:
            jinhu 李金虎
            Reporter:
            cn14130 欧明宝[Bom Owen]
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: