Giter Site home page Giter Site logo

Comments (5)

svetlyak40wt avatar svetlyak40wt commented on July 26, 2024

Please, provide a patch with unittest.

from django-fields.

DXist avatar DXist commented on July 26, 2024

I didn't manage to pass django_fields tests. Output from manage.py test django_fields:

ERROR: test_date_encryption (example.django_fields.tests.DateEncryptTests)

Traceback (most recent call last):
File "/home/srk/Devel/git/django-fields/src/example/../example/django_fields/tests.py", line 149, in test_date_encryption
obj.save()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 460, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 543, in save_base
for f in meta.local_fields if not isinstance(f, AutoField)]
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 28, in inner
return func(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 28, in inner
return func(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 28, in inner
return func(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 28, in inner
return func(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/init.py", line 276, in get_db_prep_save
return self.get_db_prep_value(value, connection=connection, prepared=False)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 53, in inner
return func(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 53, in inner
return func(_args, *_kwargs)
File "/home/srk/Devel/git/django-fields/src/example/django_fields/fields.py", line 153, in get_db_prep_value
return super(BaseEncryptedDateField, self).get_db_prep_value(date_text, connection, prepared)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 53, in inner
return func(_args, *_kwargs)
TypeError: get_db_prep_value() got multiple values for keyword argument 'connection'

ERROR: test_date_time_encryption (example.django_fields.tests.DateEncryptTests)

Traceback (most recent call last):
File "/home/srk/Devel/git/django-fields/src/example/../example/django_fields/tests.py", line 161, in test_date_time_encryption
obj.save()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 460, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 543, in save_base
for f in meta.local_fields if not isinstance(f, AutoField)]
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 28, in inner
return func(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 28, in inner
return func(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 28, in inner
return func(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 28, in inner
return func(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/init.py", line 276, in get_db_prep_save
return self.get_db_prep_value(value, connection=connection, prepared=False)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 53, in inner
return func(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 53, in inner
return func(_args, *_kwargs)
File "/home/srk/Devel/git/django-fields/src/example/django_fields/fields.py", line 153, in get_db_prep_value
return super(BaseEncryptedDateField, self).get_db_prep_value(date_text, connection, prepared)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/subclassing.py", line 53, in inner
return func(_args, *_kwargs)
TypeError: get_db_prep_value() got multiple values for keyword argument 'connection'


Ran 22 tests in 0.122s

I use Django 1.3.1

from django-fields.

DXist avatar DXist commented on July 26, 2024

The problem was in my code

from django-fields.

svetlyak40wt avatar svetlyak40wt commented on July 26, 2024

Hi.

@DXist why did you reopened this issue?

from django-fields.

DXist avatar DXist commented on July 26, 2024

Hi! I figured out that south introspects wrong value for max_length (see #20). It should honour initial max_length value (maximum length of unencrypted data) that is saved in unencrypted_length field attribute. The resulting max_length value is changed to hold encrypted data with padding so it shouldn't be introspected.

The pull request contains an introspection rule to fix this problem for EncryptedCharField and subclasses.

from django-fields.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.