diff --git a/CHANGES.txt b/CHANGES.txt index 1b9f61c..4ae6402 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -3,6 +3,8 @@ Products.ZMySQLDA change log 4.8 (unreleased) ---------------- +- ZMI refresh for Zope 4 with svg icons + (`#20 `_) 4.7 (2020-05-04) diff --git a/Products/ZMySQLDA/__init__.py b/Products/ZMySQLDA/__init__.py index f9049d2..522162a 100644 --- a/Products/ZMySQLDA/__init__.py +++ b/Products/ZMySQLDA/__init__.py @@ -25,10 +25,10 @@ def initialize(context): permission=add_zmysql_database_connections, constructors=(DA.manage_addZMySQLConnectionForm, DA.manage_addZMySQLConnection), - icon='www/da.gif') + icon='www/da.svg') misc_ = {} for icon in ('table', 'view', 'stable', 'what', 'field', 'text', 'bin', 'int', 'float', 'date', 'time', 'datetime'): - misc_[icon] = ImageFile(os.path.join('www', '%s.gif') % icon, globals()) + misc_[icon] = ImageFile(os.path.join('www', '%s.svg') % icon, globals()) diff --git a/Products/ZMySQLDA/tests/base.py b/Products/ZMySQLDA/tests/base.py index 8d5a632..2e5b5da 100644 --- a/Products/ZMySQLDA/tests/base.py +++ b/Products/ZMySQLDA/tests/base.py @@ -98,6 +98,7 @@ def setUp(cls): @classmethod def testSetUp(cls): from Products.ZMySQLDA import DA + # Clean out the test table before every test if have_test_database(): dbconn = real_connect() diff --git a/Products/ZMySQLDA/tests/test_db.py b/Products/ZMySQLDA/tests/test_db.py index 7770d50..66a978f 100644 --- a/Products/ZMySQLDA/tests/test_db.py +++ b/Products/ZMySQLDA/tests/test_db.py @@ -45,8 +45,8 @@ def test_DateTime_or_None(self): class DBPoolTests(unittest.TestCase): def _makeOne(self, *args, **kw): - from Products.ZMySQLDA.db import DBPool from Products.ZMySQLDA.db import DB + from Products.ZMySQLDA.db import DBPool return DBPool(DB, **kw) def test_instantiate_defaults(self): @@ -111,8 +111,8 @@ def test_name(self): class PatchedDBPoolTests(PatchedConnectionTestsBase): def _makeOne(self, *args, **kw): - from Products.ZMySQLDA.db import DBPool from Products.ZMySQLDA.db import DB + from Products.ZMySQLDA.db import DBPool return DBPool(DB, **kw) def test_variables(self): diff --git a/Products/ZMySQLDA/www/bin.svg b/Products/ZMySQLDA/www/bin.svg new file mode 100644 index 0000000..39597fc --- /dev/null +++ b/Products/ZMySQLDA/www/bin.svg @@ -0,0 +1,6 @@ + + diff --git a/Products/ZMySQLDA/www/browse.dtml b/Products/ZMySQLDA/www/browse.dtml index 08f643a..11125ad 100644 --- a/Products/ZMySQLDA/www/browse.dtml +++ b/Products/ZMySQLDA/www/browse.dtml @@ -6,12 +6,17 @@
- - &dtml-type; - () - + + &dtml-type; +    +
+ + diff --git a/Products/ZMySQLDA/www/connectionAdd.dtml b/Products/ZMySQLDA/www/connectionAdd.dtml index 6fb91c9..cbaf22e 100644 --- a/Products/ZMySQLDA/www/connectionAdd.dtml +++ b/Products/ZMySQLDA/www/connectionAdd.dtml @@ -2,175 +2,185 @@
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Id - -
Title - -
- Database Connection String - 1 - -
Connect immediately - - Open the database connection after instantiation. -
Unicode results - - Should database query results be decoded to Unicode? -
- Character set 2 - - -
Automatically create database - - - Create database from connection string if it does not exist yet. - -
- Connect timeout - - - in seconds -

-
- -
1 Connection Strings
-
-

- The connection string used for Z MySQL Database Connection - is of the form: -

-          [*lock] [+/-][database][@host[:port]] [user [password [unix_socket]]]
-      
- or typically: -
-          database user password
-      
- to use a MySQL server on localhost via the standard UNIX socket. - Only specify host if the server is on a remote system. You can - use a non-standard port, if necessary. Hint: To use a non-standard - port on the local system, use 127.0.0.1 for the host instead of - localhost. -

-

- Either a database or a host or both must be specified. - If the UNIX socket is in a non-standard location, you can specify - the full path to it after the password. -

-

- A '-' in front of the database tells ZMySQLDA to not use Zope's - Transaction Manager, even if the server supports transactions. A - '+' in front of the database tells ZMySQLDA that it must use - transactions; an exception will be raised if they are not - supported by the server. If neither '-' or '+' are present, then - transactions will be enabled if the server supports them. If you - are using non-transaction safe tables (TSTs) on a server that - supports TSTs, use '-'. If you require transactions, use '+'. If - you aren't sure, don't use either. -

-

- *lock at the begining of the connection string means to - pseudo-transactional. When the transaction begins, it will acquire - a lock on the server named lock (i.e. MYLOCK). When the - transaction commits, the lock will be released. If the transaction - is aborted and restarted, which can happen due to a ConflictError, - you'll get an error in the logs, and inconsistent data. In this - respect, it's equivalent to transactions turned off. -

-

- Transactions are highly recommended. Using a named lock in - conjunctions with transactions is probably pointless. -

-
+ + +
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + Open the database connection after instantiation. +
+
+ +
+ +
+ + Should database query results be decoded to Unicode? +
+
+ +
+ +
+ +
+
+ +
+ +
+ + Create database from connection string if it does not exist yet. +
+
+ +
+ +
+ + in seconds +
+
+ +
+ +
+
-
2 Character set
-
-

- The character set the database adapter will use to communicate with - the database. You should choose a character set matching the Zope - application character set, which defaulted to Latin-1 for - Zope 2 and now defaults to UTF-8 for Zope 4. -

- -

- The database will expect all incoming - data to be encoded in this character set, and query results from the - database will be encoded in the same character set unless you check - Unicode results. -

- -

- Not set will emulate previous releases' behavior on Python 2, which - used Latin-1 (ISO 8859-1), but if Unicode results is selected, the - connection character set switches to UTF-8 and strings in query results - are decoded to Unicode. On Python 3, Not set always defaults to - UTF-8. -

- -

- For Python 2, you can force the character set to Latin-1 or UTF-8, - regardless of the Unicode results setting. This is useful - when your application wants to use UTF-8, but cannot deal with unicode - return values. -

- -

- Python 3 only supports the UTF-8 options! -

+
+
+
1 + Database Connection String +
+
+ The connection string used for Z MySQL Database Connection is of the form: +
+ [*lock] [+/-][database][@host[:port]] [user [password [unix_socket]]] +
+ or typically: +
+ database user password +
+ to use a MySQL server on localhost via the standard UNIX socket. + Only specify host if the server is on a remote system. You can + use a non-standard port, if necessary. Hint: To use a non-standard + port on the local system, use 127.0.0.1 for the host instead of + localhost. +
+
+ Either a database or a host or both must be specified. + If the UNIX socket is in a non-standard location, you can specify + the full path to it after the password. +
+
+ A '-' in front of the database tells ZMySQLDA to not use Zope's + Transaction Manager, even if the server supports transactions. A + '+' in front of the database tells ZMySQLDA that it must use + transactions; an exception will be raised if they are not + supported by the server. If neither '-' or '+' are present, then + transactions will be enabled if the server supports them. If you + are using non-transaction safe tables (TSTs) on a server that + supports TSTs, use '-'. If you require transactions, use '+'. If + you aren't sure, don't use either. +
+
+ *lock at the begining of the connection string means to + pseudo-transactional. When the transaction begins, it will acquire + a lock on the server named lock (i.e. MYLOCK). When the + transaction commits, the lock will be released. If the transaction + is aborted and restarted, which can happen due to a ConflictError, + you'll get an error in the logs, and inconsistent data. In this + respect, it's equivalent to transactions turned off. +
+
+ Transactions are highly recommended. Using a named lock in + conjunctions with transactions is probably pointless. +
+ +
2 + Connection character set +
+
+ The character set the database adapter will use to communicate with + the database. You should choose a character set matching the Zope + application character set, which defaulted to Latin-1 for + Zope 2 and now defaults to UTF-8 for Zope 4. +
+
+ The database will expect all incoming data to be encoded in this + character set, and query results from the database will be encoded + in the same character set unless you check Unicode results. +
+
+ Not set will emulate previous releases' behavior on Python 2, + which used Latin-1 (ISO 8859-1), but if Unicode results is + selected, the connection character set switches to UTF-8 and strings in + query results are decoded to Unicode. On Python 3, Not set + always defaults to UTF-8. +
+
+ For Python 2, you can force the character set to Latin-1 or UTF-8, + regardless of the Unicode results setting. This is useful + when your application wants to use UTF-8, but cannot deal with unicode + return values. +
+
+ Hint: Python 3 only supports the UTF-8 options!
+
diff --git a/Products/ZMySQLDA/www/connectionEdit.dtml b/Products/ZMySQLDA/www/connectionEdit.dtml index cc0f64c..2df6f45 100644 --- a/Products/ZMySQLDA/www/connectionEdit.dtml +++ b/Products/ZMySQLDA/www/connectionEdit.dtml @@ -1,169 +1,182 @@ +
- - - - - - -
- The database connection is - - OPEN - - CLOSED - . -   +
+ +
+
+
- -

Edit

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Id
Title - -
- Database Connection String 1 - - -
Connect immediately - -
Unicode results - - - -
- Connection character set 2 - - -
Automatically create database - - - -
- Connect timeout - - - - - in seconds -

-
- -
1 Database Connection String
-
-

- Information about how to format the connection string can be found - in the - documentation. -

+ + +
+ +
+ +
+ +
+
+ + + + + +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + + +
+
+ +
+ +
+ +
+
+ +
+ +
+ + + +
+
+ +
+ +
+ + + + in seconds +
+
+ +
+ +
+ +
+ +
+ +
+
1 + Database Connection String +
+
+ Information about how to format the connection string can be found + in the + documentation.
-
2 Connection character set
-
-

- The character set the database adapter will use to communicate with - the database. You should choose a character set matching the Zope - application character set, which defaulted to Latin-1 for - Zope 2 and now defaults to UTF-8 for Zope 4. -

- -

- The database will expect all incoming - data to be encoded in this character set, and query results from the - database will be encoded in the same character set unless you check - Unicode results. -

- -

- Not set will emulate previous releases' behavior on Python 2, which - used Latin-1 (ISO 8859-1), but if Unicode results is selected, the - connection character set switches to UTF-8 and strings in query results - are decoded to Unicode. On Python 3, Not set always defaults to - UTF-8. -

- -

- For Python 2, you can force the character set to Latin-1 or UTF-8, - regardless of the Unicode results setting. This is useful - when your application wants to use UTF-8, but cannot deal with unicode - return values. -

- -

- Python 3 only supports the UTF-8 options! -

- +
2 + Connection character set +
+
+ The character set the database adapter will use to communicate with + the database. You should choose a character set matching the Zope + application character set, which defaulted to Latin-1 for + Zope 2 and now defaults to UTF-8 for Zope 4. +
+
+ The database will expect all incoming data to be encoded in this + character set, and query results from the database will be encoded + in the same character set unless you check Unicode results. +
+
+ Not set will emulate previous releases' behavior on Python 2, + which used Latin-1 (ISO 8859-1), but if Unicode results is + selected, the connection character set switches to UTF-8 and strings in + query results are decoded to Unicode. On Python 3, Not set + always defaults to UTF-8. +
+
+ For Python 2, you can force the character set to Latin-1 or UTF-8, + regardless of the Unicode results setting. This is useful + when your application wants to use UTF-8, but cannot deal with unicode + return values. +
+
+ Hint: Python 3 only supports the UTF-8 options!
+
diff --git a/Products/ZMySQLDA/www/da.svg b/Products/ZMySQLDA/www/da.svg new file mode 100644 index 0000000..39cf609 --- /dev/null +++ b/Products/ZMySQLDA/www/da.svg @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/Products/ZMySQLDA/www/date.svg b/Products/ZMySQLDA/www/date.svg new file mode 100644 index 0000000..cb9de08 --- /dev/null +++ b/Products/ZMySQLDA/www/date.svg @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/Products/ZMySQLDA/www/datetime.svg b/Products/ZMySQLDA/www/datetime.svg new file mode 100644 index 0000000..0cccae5 --- /dev/null +++ b/Products/ZMySQLDA/www/datetime.svg @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/Products/ZMySQLDA/www/field.svg b/Products/ZMySQLDA/www/field.svg new file mode 100644 index 0000000..84cf164 --- /dev/null +++ b/Products/ZMySQLDA/www/field.svg @@ -0,0 +1,7 @@ + + diff --git a/Products/ZMySQLDA/www/float.svg b/Products/ZMySQLDA/www/float.svg new file mode 100644 index 0000000..69cb454 --- /dev/null +++ b/Products/ZMySQLDA/www/float.svg @@ -0,0 +1,7 @@ + + diff --git a/Products/ZMySQLDA/www/int.svg b/Products/ZMySQLDA/www/int.svg new file mode 100644 index 0000000..3442365 --- /dev/null +++ b/Products/ZMySQLDA/www/int.svg @@ -0,0 +1,6 @@ + + diff --git a/Products/ZMySQLDA/www/stable.svg b/Products/ZMySQLDA/www/stable.svg new file mode 100644 index 0000000..509bc44 --- /dev/null +++ b/Products/ZMySQLDA/www/stable.svg @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/Products/ZMySQLDA/www/table.svg b/Products/ZMySQLDA/www/table.svg new file mode 100644 index 0000000..eb20594 --- /dev/null +++ b/Products/ZMySQLDA/www/table.svg @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/Products/ZMySQLDA/www/text.svg b/Products/ZMySQLDA/www/text.svg new file mode 100644 index 0000000..6af3f3b --- /dev/null +++ b/Products/ZMySQLDA/www/text.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/Products/ZMySQLDA/www/time.svg b/Products/ZMySQLDA/www/time.svg new file mode 100644 index 0000000..05e4dca --- /dev/null +++ b/Products/ZMySQLDA/www/time.svg @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/Products/ZMySQLDA/www/view.svg b/Products/ZMySQLDA/www/view.svg new file mode 100644 index 0000000..9e4efba --- /dev/null +++ b/Products/ZMySQLDA/www/view.svg @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/Products/ZMySQLDA/www/what.svg b/Products/ZMySQLDA/www/what.svg new file mode 100644 index 0000000..c4922d8 --- /dev/null +++ b/Products/ZMySQLDA/www/what.svg @@ -0,0 +1,5 @@ + + diff --git a/buildout.cfg b/buildout.cfg index f7ce1bb..f30df14 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -6,7 +6,6 @@ develop = . parts = test docs - scripts [test] @@ -22,9 +21,3 @@ eggs = Products.ZMySQLDA[docs] scripts = sphinx-build - - -[scripts] -recipe = zc.recipe.egg -eggs = - tox diff --git a/setup.cfg b/setup.cfg index 84f84d2..f229756 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,8 +16,6 @@ known_zope = AccessControl, Acquisition, App, OFS, Products, Shared, Zope2 default_section = ZOPE line_length = 79 lines_after_imports = 2 -not_skip = - __init__.py [flake8] no-accept-encodings = True diff --git a/setup.py b/setup.py index f42d630..c580c12 100644 --- a/setup.py +++ b/setup.py @@ -66,8 +66,9 @@ def read(*rnames): install_requires=[ 'setuptools', 'six', - 'mysqlclient', 'Products.ZSQLMethods', + 'mysqlclient < 2;python_version < "3"', + 'mysqlclient;python_version >= "3"', ], extras_require={ 'docs': ['Sphinx', 'repoze.sphinx.autointerface'], diff --git a/tox.ini b/tox.ini index c81e529..75d263f 100644 --- a/tox.ini +++ b/tox.ini @@ -53,9 +53,9 @@ basepython = python3.6 commands_pre = mkdir -p {toxinidir}/parts/flake8 commands = - isort --check-only --diff --recursive {toxinidir}/Products setup.py - - flake8 --format=html Products tests setup.py - flake8 Products tests setup.py + isort --check-only --diff {toxinidir}/Products setup.py + - flake8 --format=html Products setup.py + flake8 Products setup.py deps = isort flake8 @@ -66,7 +66,6 @@ deps = flake8-debugger flake8-deprecated flake8-todo - flake8-isort mccabe flake8-blind-except flake8-commas