diff --git a/CHANGELOG b/CHANGELOG
index bd410367ed..00b92b66ee 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,5 @@
+* Remove Sha field
+* Add password widget
* Add Len to PYSON
* Use bcrypt to hash password if possible
* Use a sequence of ids, values to set fields
diff --git a/doc/ref/models/fields.rst b/doc/ref/models/fields.rst
index 702c60d051..62af938749 100644
--- a/doc/ref/models/fields.rst
+++ b/doc/ref/models/fields.rst
@@ -257,15 +257,6 @@ A single line string field.
ComboboxEntry in the client.
The set of field names could be filled by using the decorator :meth:`depends`.
-Sha
----
-
-.. class:: Sha(string[, \**options])
-
-A string field which value will be stored with a `secure hash algorithm`_.
-
-.. _`secure hash algorithm`: http://en.wikipedia.org/wiki/Secure_Hash_Algorithm
-
Text
----
diff --git a/trytond/ir/ui/form.rnc b/trytond/ir/ui/form.rnc
index 2c58352ec9..03c23fc373 100644
--- a/trytond/ir/ui/form.rnc
+++ b/trytond/ir/ui/form.rnc
@@ -48,7 +48,7 @@ attlist.field &=
| "integer"
| "selection"
| "char"
- | "sha"
+ | "password"
| "float_time"
| "boolean"
| "reference"
diff --git a/trytond/ir/ui/form.rng b/trytond/ir/ui/form.rng
index cb0d1aec0d..306de5ef0d 100644
--- a/trytond/ir/ui/form.rng
+++ b/trytond/ir/ui/form.rng
@@ -147,7 +147,7 @@
integer
selection
char
- sha
+ password
float_time
boolean
reference
diff --git a/trytond/res/view/user_form.xml b/trytond/res/view/user_form.xml
index 7a12cc70c7..629ff8291f 100644
--- a/trytond/res/view/user_form.xml
+++ b/trytond/res/view/user_form.xml
@@ -11,7 +11,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/trytond/res/view/user_form_preferences.xml b/trytond/res/view/user_form_preferences.xml
index 386d400709..42bbd25aff 100644
--- a/trytond/res/view/user_form_preferences.xml
+++ b/trytond/res/view/user_form_preferences.xml
@@ -9,7 +9,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/trytond/tests/__init__.py b/trytond/tests/__init__.py
index 3ce4543117..92ecf154f7 100644
--- a/trytond/tests/__init__.py
+++ b/trytond/tests/__init__.py
@@ -39,9 +39,6 @@ def register():
TextRequired,
TextSize,
TextTranslate,
- Sha,
- ShaDefault,
- ShaRequired,
Date,
DateDefault,
DateRequired,
@@ -108,7 +105,6 @@ def register():
ImportDataNumericRequired,
ImportDataChar,
ImportDataText,
- ImportDataSha,
ImportDataDate,
ImportDataDateTime,
ImportDataSelection,
diff --git a/trytond/tests/export_data.py b/trytond/tests/export_data.py
index 8c9f3c635b..5f61332cef 100644
--- a/trytond/tests/export_data.py
+++ b/trytond/tests/export_data.py
@@ -25,7 +25,6 @@ class ExportData(ModelSQL):
numeric = fields.Numeric('Numeric')
char = fields.Char('Char')
text = fields.Text('Text')
- sha = fields.Sha('Sha')
date = fields.Date('Date')
datetime = fields.DateTime('DateTime')
selection = fields.Selection([
diff --git a/trytond/tests/import_data.py b/trytond/tests/import_data.py
index 870bc21fe1..ecc7a94716 100644
--- a/trytond/tests/import_data.py
+++ b/trytond/tests/import_data.py
@@ -7,7 +7,7 @@ __all__ = [
'ImportDataBoolean', 'ImportDataInteger', 'ImportDataIntegerRequired',
'ImportDataFloat', 'ImportDataFloatRequired',
'ImportDataNumeric', 'ImportDataNumericRequired',
- 'ImportDataChar', 'ImportDataText', 'ImportDataSha',
+ 'ImportDataChar', 'ImportDataText',
'ImportDataDate', 'ImportDataDateTime', 'ImportDataSelection',
'ImportDataMany2OneTarget', 'ImportDataMany2One',
'ImportDataMany2ManyTarget', 'ImportDataMany2Many',
@@ -71,12 +71,6 @@ class ImportDataText(ModelSQL):
text = fields.Text('Text')
-class ImportDataSha(ModelSQL):
- "Import Data Sha"
- __name__ = 'test.import_data.sha'
- sha = fields.Sha('Sha')
-
-
class ImportDataDate(ModelSQL):
"Import Data Date"
__name__ = 'test.import_data.date'
diff --git a/trytond/tests/test.py b/trytond/tests/test.py
index e95810ad33..d8637fd1a0 100644
--- a/trytond/tests/test.py
+++ b/trytond/tests/test.py
@@ -13,7 +13,6 @@ __all__ = [
'Numeric', 'NumericDefault', 'NumericRequired', 'NumericDigits',
'Char', 'CharDefault', 'CharRequired', 'CharSize', 'CharTranslate',
'Text', 'TextDefault', 'TextRequired', 'TextSize', 'TextTranslate',
- 'Sha', 'ShaDefault', 'ShaRequired',
'Date', 'DateDefault', 'DateRequired',
'DateTime', 'DateTimeDefault', 'DateTimeRequired', 'DateTimeFormat',
'Time', 'TimeDefault', 'TimeRequired', 'TimeFormat',
@@ -226,31 +225,6 @@ class TextTranslate(ModelSQL):
required=False, translate=True)
-class Sha(ModelSQL):
- 'Sha'
- __name__ = 'test.sha'
- sha = fields.Sha(string='Sha', help='Test sha',
- required=False)
-
-
-class ShaDefault(ModelSQL):
- 'Sha Default'
- __name__ = 'test.sha_default'
- sha = fields.Sha(string='Sha', help='Test sha',
- required=False)
-
- @staticmethod
- def default_sha():
- return 'Sha'
-
-
-class ShaRequired(ModelSQL):
- 'Sha Required'
- __name__ = 'test.sha_required'
- sha = fields.Sha(string='Sha', help='Test sha',
- required=True)
-
-
class Date(ModelSQL):
'Date'
__name__ = 'test.date'
diff --git a/trytond/tests/test_exportdata.py b/trytond/tests/test_exportdata.py
index 3e3adbe1cc..989d2d2867 100644
--- a/trytond/tests/test_exportdata.py
+++ b/trytond/tests/test_exportdata.py
@@ -162,19 +162,6 @@ class ExportDataTestCase(unittest.TestCase):
transaction.cursor.rollback()
- def test0070sha(self):
- 'Test sha'
- with Transaction().start(DB_NAME, USER,
- context=CONTEXT) as transaction:
- export1, = self.export_data.create([{
- 'sha': 'Test',
- }])
- self.assertEqual(
- self.export_data.export_data([export1], ['sha']),
- [['640ab2bae07bedc4c163f679a746f7ab7fb5d1fa']])
-
- transaction.cursor.rollback()
-
def test0080date(self):
'Test date'
with Transaction().start(DB_NAME, USER,
diff --git a/trytond/tests/test_fields.py b/trytond/tests/test_fields.py
index 833185cf90..975adde1bb 100644
--- a/trytond/tests/test_fields.py
+++ b/trytond/tests/test_fields.py
@@ -52,10 +52,6 @@ class FieldsTestCase(unittest.TestCase):
self.text_size = POOL.get('test.text_size')
self.text_translate = POOL.get('test.text_translate')
- self.sha = POOL.get('test.sha')
- self.sha_default = POOL.get('test.sha_default')
- self.sha_required = POOL.get('test.sha_required')
-
self.date = POOL.get('test.date')
self.date_default = POOL.get('test.date_default')
self.date_required = POOL.get('test.date_required')
@@ -1304,196 +1300,6 @@ class FieldsTestCase(unittest.TestCase):
transaction.cursor.rollback()
- def test0070sha(self):
- 'Test Sha'
- with Transaction().start(DB_NAME, USER,
- context=CONTEXT) as transaction:
- sha1, = self.sha.create([{
- 'sha': 'Test',
- }])
- self.assert_(sha1)
- self.assertEqual(sha1.sha,
- '640ab2bae07bedc4c163f679a746f7ab7fb5d1fa')
-
- sha = self.sha.search([
- ('sha', '=', 'Test'),
- ])
- self.assertEqual(sha, [sha1])
-
- sha = self.sha.search([
- ('sha', '=', 'Foo'),
- ])
- self.assertEqual(sha, [])
-
- sha = self.sha.search([
- ('sha', '=', None),
- ])
- self.assertEqual(sha, [])
-
- sha = self.sha.search([
- ('sha', '!=', 'Test'),
- ])
- self.assertEqual(sha, [])
-
- sha = self.sha.search([
- ('sha', '!=', 'Foo'),
- ])
- self.assert_(sha, [sha1])
-
- sha = self.sha.search([
- ('sha', '!=', None),
- ])
- self.assertEqual(sha, [sha1])
-
- sha = self.sha.search([
- ('sha', 'in', ['Test']),
- ])
- self.assertEqual(sha, [sha1])
-
- sha = self.sha.search([
- ('sha', 'in', ['Foo']),
- ])
- self.assertEqual(sha, [])
-
- sha = self.sha.search([
- ('sha', 'in', [None]),
- ])
- self.assertEqual(sha, [])
-
- sha = self.sha.search([
- ('sha', 'in', []),
- ])
- self.assertEqual(sha, [])
-
- sha = self.sha.search([
- ('sha', 'not in', ['Test']),
- ])
- self.assertEqual(sha, [])
-
- sha = self.sha.search([
- ('sha', 'not in', ['Foo']),
- ])
- self.assertEqual(sha, [sha1])
-
- sha = self.sha.search([
- ('sha', 'not in', [None]),
- ])
- self.assertEqual(sha, [sha1])
-
- sha = self.sha.search([
- ('sha', 'not in', []),
- ])
- self.assertEqual(sha, [sha1])
-
- sha = self.sha.search([
- ('sha', 'like', 'Test'),
- ])
- self.assertEqual(sha, [sha1])
-
- sha = self.sha.search([
- ('sha', 'like', 'Foo'),
- ])
- self.assertEqual(sha, [])
-
- sha = self.sha.search([
- ('sha', 'ilike', 'Test'),
- ])
- self.assertEqual(sha, [sha1])
-
- sha = self.sha.search([
- ('sha', 'ilike', 'foo'),
- ])
- self.assertEqual(sha, [])
-
- sha = self.sha.search([
- ('sha', 'not like', 'Test'),
- ])
- self.assertEqual(sha, [])
-
- sha = self.sha.search([
- ('sha', 'not like', 'Foo'),
- ])
- self.assertEqual(sha, [sha1])
-
- sha = self.sha.search([
- ('sha', 'not ilike', 'foo'),
- ])
- self.assertEqual(sha, [sha1])
-
- sha2, = self.sha.create([{
- 'sha': None,
- }])
- self.assert_(sha2)
- self.assertEqual(sha2.sha, None)
-
- sha = self.sha.search([
- ('sha', '=', None),
- ])
- self.assertEqual(sha, [sha2])
-
- sha = self.sha.search([
- ('sha', 'in', [None, 'Test']),
- ])
- self.assertEqual(sha, [sha1, sha2])
-
- sha = self.sha.search([
- ('sha', 'not in', [None, 'Test']),
- ])
- self.assertEqual(sha, [])
-
- sha3, = self.sha.create([{}])
- self.assert_(sha3)
- self.assertEqual(sha3.sha, None)
-
- sha4, = self.sha_default.create([{}])
- self.assert_(sha4)
- self.assertEqual(sha4.sha,
- 'ba79baeb9f10896a46ae74715271b7f586e74640')
-
- self.sha.write([sha1], {
- 'sha': None,
- })
- self.assertEqual(sha1.sha, None)
-
- self.sha.write([sha2], {
- 'sha': 'Test',
- })
- self.assertEqual(sha2.sha,
- '640ab2bae07bedc4c163f679a746f7ab7fb5d1fa')
-
- self.assertRaises(Exception, self.sha_required.create, [{}])
- transaction.cursor.rollback()
-
- sha5, = self.sha_required.create([{
- 'sha': 'Test',
- }])
- self.assert_(sha5)
-
- sha6, = self.sha.create([{
- 'sha': u'é',
- }])
- self.assert_(sha6)
- self.assertEqual(sha6.sha,
- u'bf15be717ac1b080b4f1c456692825891ff5073d')
-
- sha = self.sha.search([
- ('sha', '=', u'é'),
- ])
- self.assertEqual(sha, [sha6])
-
- self.sha.write([sha6], {
- 'sha': 'é',
- })
- self.assertEqual(sha6.sha,
- u'bf15be717ac1b080b4f1c456692825891ff5073d')
-
- sha = self.sha.search([
- ('sha', '=', 'é'),
- ])
- self.assertEqual(sha, [sha6])
-
- transaction.cursor.rollback()
-
def test0080date(self):
'Test Date'
with Transaction().start(DB_NAME, USER,
diff --git a/trytond/tests/test_importdata.py b/trytond/tests/test_importdata.py
index 0a731b3475..baf8f952c4 100644
--- a/trytond/tests/test_importdata.py
+++ b/trytond/tests/test_importdata.py
@@ -21,7 +21,6 @@ class ImportDataTestCase(unittest.TestCase):
self.numeric_required = POOL.get('test.import_data.numeric_required')
self.char = POOL.get('test.import_data.char')
self.text = POOL.get('test.import_data.text')
- self.sha = POOL.get('test.import_data.sha')
self.date = POOL.get('test.import_data.date')
self.datetime = POOL.get('test.import_data.datetime')
self.selection = POOL.get('test.import_data.selection')
@@ -267,21 +266,6 @@ class ImportDataTestCase(unittest.TestCase):
transaction.cursor.rollback()
- def test0070sha(self):
- 'Test sha'
- with Transaction().start(DB_NAME, USER,
- context=CONTEXT) as transaction:
- self.assertEqual(self.sha.import_data(['sha'],
- [['test']]), (1, 0, 0, 0))
-
- self.assertEqual(self.sha.import_data(['sha'],
- [['']]), (1, 0, 0, 0))
-
- self.assertEqual(self.sha.import_data(['sha'],
- [['test'], ['foo']]), (2, 0, 0, 0))
-
- transaction.cursor.rollback()
-
def test0080date(self):
'Test date'
with Transaction().start(DB_NAME, USER,