Merge 0.1.28
authorThierry Florac <tflorac@ulthar.net>
Mon, 20 Jul 2020 14:37:23 +0200
changeset 214 48f7bcd85a8c
parent 212 724e87e15ade (current diff)
parent 213 a58f2ff82bfd (diff)
child 215 759c9ddac39e
Merge
.hgtags
buildout.cfg
--- a/.installed.cfg	Wed Dec 04 11:31:41 2019 +0100
+++ b/.installed.cfg	Mon Jul 20 14:37:23 2020 +0200
@@ -8,12 +8,13 @@
 	/home/tflorac/Dropbox/src/PyAMS/pyams_form/develop-eggs/pyams-utils.egg-link
 	/home/tflorac/Dropbox/src/PyAMS/pyams_form/develop-eggs/pyams-file.egg-link
 	/home/tflorac/Dropbox/src/PyAMS/pyams_form/develop-eggs/pyams-skin.egg-link
+	/home/tflorac/Dropbox/src/PyAMS/pyams_form/develop-eggs/myams.egg-link
 	/home/tflorac/Dropbox/src/PyAMS/pyams_form/develop-eggs/pyams-i18n.egg-link
 parts = package i18n pyflakes pylint test
 
 [package]
 __buildout_installed__ = 
-__buildout_signature__ = zc.recipe.egg-1f0c6653b21ed3c3b90d505728e7e148 zc.buildout-1f0c6653b21ed3c3b90d505728e7e148 setuptools-1f0c6653b21ed3c3b90d505728e7e148
+__buildout_signature__ = zc.recipe.egg-eb0713bd019bc06003287e3522498b7d zc.buildout-eb0713bd019bc06003287e3522498b7d setuptools-eb0713bd019bc06003287e3522498b7d
 _b = /home/tflorac/Dropbox/src/PyAMS/pyams_form/bin
 _d = /home/tflorac/Dropbox/src/PyAMS/pyams_form/develop-eggs
 _e = /home/tflorac/Dropbox/src/PyAMS/pyams_form/eggs
@@ -21,14 +22,14 @@
 develop-eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_form/develop-eggs
 eggs = pyams_form
 eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_form/eggs
-find-links = http://download.ztfy.org/pyams
+find-links = http://download.ztfy.org/eggs
 recipe = zc.recipe.egg
 
 [i18n]
 __buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/pybabel
 	/home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/polint
 	/home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/pot-create
-__buildout_signature__ = zc.recipe.egg-1f0c6653b21ed3c3b90d505728e7e148 zc.buildout-1f0c6653b21ed3c3b90d505728e7e148 setuptools-1f0c6653b21ed3c3b90d505728e7e148
+__buildout_signature__ = zc.recipe.egg-eb0713bd019bc06003287e3522498b7d zc.buildout-eb0713bd019bc06003287e3522498b7d setuptools-eb0713bd019bc06003287e3522498b7d
 _b = /home/tflorac/Dropbox/src/PyAMS/pyams_form/bin
 _d = /home/tflorac/Dropbox/src/PyAMS/pyams_form/develop-eggs
 _e = /home/tflorac/Dropbox/src/PyAMS/pyams_form/eggs
@@ -37,13 +38,13 @@
 eggs = babel
 	lingua
 eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_form/eggs
-find-links = http://download.ztfy.org/pyams
+find-links = http://download.ztfy.org/eggs
 recipe = zc.recipe.egg
 
 [pyflakes]
 __buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/pyflakes
 	/home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/pyflakes
-__buildout_signature__ = zc.recipe.egg-1f0c6653b21ed3c3b90d505728e7e148 zc.buildout-1f0c6653b21ed3c3b90d505728e7e148 setuptools-1f0c6653b21ed3c3b90d505728e7e148
+__buildout_signature__ = zc.recipe.egg-eb0713bd019bc06003287e3522498b7d zc.buildout-eb0713bd019bc06003287e3522498b7d setuptools-eb0713bd019bc06003287e3522498b7d
 _b = /home/tflorac/Dropbox/src/PyAMS/pyams_form/bin
 _d = /home/tflorac/Dropbox/src/PyAMS/pyams_form/develop-eggs
 _e = /home/tflorac/Dropbox/src/PyAMS/pyams_form/eggs
@@ -52,18 +53,18 @@
 eggs = pyflakes
 eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_form/eggs
 entry-points = pyflakes=pyflakes.scripts.pyflakes:main
-find-links = http://download.ztfy.org/pyams
+find-links = http://download.ztfy.org/eggs
 initialization = if not sys.argv[1:]: sys.argv[1:] = ["src"]
 recipe = zc.recipe.egg
 scripts = pyflakes
 
 [pylint]
-__buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/epylint
+__buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/pyreverse
+	/home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/pylint
+	/home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/epylint
 	/home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/symilar
-	/home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/pyreverse
 	/home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/pylint
-	/home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/pylint
-__buildout_signature__ = zc.recipe.egg-1f0c6653b21ed3c3b90d505728e7e148 zc.buildout-1f0c6653b21ed3c3b90d505728e7e148 setuptools-1f0c6653b21ed3c3b90d505728e7e148
+__buildout_signature__ = zc.recipe.egg-eb0713bd019bc06003287e3522498b7d zc.buildout-eb0713bd019bc06003287e3522498b7d setuptools-eb0713bd019bc06003287e3522498b7d
 _b = /home/tflorac/Dropbox/src/PyAMS/pyams_form/bin
 _d = /home/tflorac/Dropbox/src/PyAMS/pyams_form/develop-eggs
 _e = /home/tflorac/Dropbox/src/PyAMS/pyams_form/eggs
@@ -74,13 +75,13 @@
 	pylint
 eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_form/eggs
 entry-points = pylint=pylint.lint:Run
-find-links = http://download.ztfy.org/pyams
+find-links = http://download.ztfy.org/eggs
 recipe = zc.recipe.egg
 
 [test]
 __buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_form/parts/test
 	/home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/test
-__buildout_signature__ = six-1f0c6653b21ed3c3b90d505728e7e148 zc.recipe.egg-1f0c6653b21ed3c3b90d505728e7e148 zc.recipe.testrunner-1f0c6653b21ed3c3b90d505728e7e148 zc.buildout-1f0c6653b21ed3c3b90d505728e7e148 zope.exceptions-1f0c6653b21ed3c3b90d505728e7e148 zope.interface-1f0c6653b21ed3c3b90d505728e7e148 zope.testrunner-1f0c6653b21ed3c3b90d505728e7e148 setuptools-1f0c6653b21ed3c3b90d505728e7e148
+__buildout_signature__ = six-eb0713bd019bc06003287e3522498b7d zc.recipe.egg-eb0713bd019bc06003287e3522498b7d zc.recipe.testrunner-eb0713bd019bc06003287e3522498b7d zc.buildout-eb0713bd019bc06003287e3522498b7d zope.exceptions-eb0713bd019bc06003287e3522498b7d zope.interface-eb0713bd019bc06003287e3522498b7d zope.testrunner-eb0713bd019bc06003287e3522498b7d setuptools-eb0713bd019bc06003287e3522498b7d
 _b = /home/tflorac/Dropbox/src/PyAMS/pyams_form/bin
 _d = /home/tflorac/Dropbox/src/PyAMS/pyams_form/develop-eggs
 _e = /home/tflorac/Dropbox/src/PyAMS/pyams_form/eggs
@@ -88,7 +89,7 @@
 develop-eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_form/develop-eggs
 eggs = pyams_form [test]
 eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_form/eggs
-find-links = http://download.ztfy.org/pyams
+find-links = http://download.ztfy.org/eggs
 location = /home/tflorac/Dropbox/src/PyAMS/pyams_form/parts/test
 recipe = zc.recipe.testrunner
 script = /home/tflorac/Dropbox/src/PyAMS/pyams_form/bin/test
--- a/buildout.cfg	Wed Dec 04 11:31:41 2019 +0100
+++ b/buildout.cfg	Mon Jul 20 14:37:23 2020 +0200
@@ -12,6 +12,7 @@
 develop =
     .
     ../ext/lingua
+    ../myams
     ../pyams_catalog
     ../pyams_file
     ../pyams_i18n
@@ -63,4 +64,4 @@
 eggs = pyams_form [test]
 
 [versions]
-pyams_form = 0.1.27
+pyams_form = 0.1.28
--- a/docs/HISTORY.txt	Wed Dec 04 11:31:41 2019 +0100
+++ b/docs/HISTORY.txt	Mon Jul 20 14:37:23 2020 +0200
@@ -1,6 +1,10 @@
 History
 =======
 
+0.1.28
+------
+ - added adapter lookup while creating search form
+
 0.1.27
 ------
  - code cleanup
@@ -38,7 +42,7 @@
  - updated Select2 widgets templates in display mode
  - added translation to radio buttons display template
  - added simple "add_error" method to IForm interface to be able to add an error easilly to
-    an existing form
+   an existing form
 
 0.1.23.1
 --------
--- a/setup.py	Wed Dec 04 11:31:41 2019 +0100
+++ b/setup.py	Mon Jul 20 14:37:23 2020 +0200
@@ -24,7 +24,7 @@
 README = os.path.join(DOCS, 'README.txt')
 HISTORY = os.path.join(DOCS, 'HISTORY.txt')
 
-version = '0.1.27'
+version = '0.1.28'
 long_description = open(README).read() + '\n\n' + open(HISTORY).read()
 
 tests_require = []
@@ -49,7 +49,8 @@
       package_dir={'': 'src'},
       namespace_packages=[],
       include_package_data=True,
-      package_data={'': ['*.zcml', '*.txt', '*.pt', '*.pot', '*.po', '*.mo', '*.png', '*.gif', '*.jpeg', '*.jpg', '*.css', '*.js']},
+      package_data={'': ['*.zcml', '*.txt', '*.pt', '*.pot', '*.po', '*.mo',
+                         '*.png', '*.gif', '*.jpeg', '*.jpg', '*.css', '*.js']},
       zip_safe=False,
       # uncomment this to be able to run tests with setup.py
       test_suite="pyams_form.tests.test_utilsdocs.test_suite",
--- a/src/pyams_form.egg-info/PKG-INFO	Wed Dec 04 11:31:41 2019 +0100
+++ b/src/pyams_form.egg-info/PKG-INFO	Mon Jul 20 14:37:23 2020 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: pyams-form
-Version: 0.1.27
+Version: 0.1.28
 Summary: PyAMS base form interfaces and classes
 Home-page: http://hg.ztfy.org/pyams/pyams_form
 Author: Thierry Florac
@@ -57,6 +57,10 @@
         History
         =======
         
+        0.1.28
+        ------
+         - added adapter lookup while creating search form
+        
         0.1.27
         ------
          - code cleanup
@@ -94,7 +98,7 @@
          - updated Select2 widgets templates in display mode
          - added translation to radio buttons display template
          - added simple "add_error" method to IForm interface to be able to add an error easilly to
-            an existing form
+           an existing form
         
         0.1.23.1
         --------
--- a/src/pyams_form/interfaces/form.py	Wed Dec 04 11:31:41 2019 +0100
+++ b/src/pyams_form/interfaces/form.py	Mon Jul 20 14:37:23 2020 +0200
@@ -372,6 +372,14 @@
         """Get search results"""
 
 
+class ISearchFormFactory(Interface):
+    """Search form factory"""
+
+
+class ISearchFormResultsFactory(Interface):
+    """Search form results factory"""
+
+
 #
 # Form viewlets
 #
--- a/src/pyams_form/search.py	Wed Dec 04 11:31:41 2019 +0100
+++ b/src/pyams_form/search.py	Mon Jul 20 14:37:23 2020 +0200
@@ -15,6 +15,7 @@
 This module provides a few helpers which can be used in search forms.
 """
 
+from pyramid.decorator import reify
 from pyramid.response import Response
 from z3c.form import button, field
 from z3c.table.interfaces import IValues
@@ -22,7 +23,7 @@
 from zope.schema import TextLine
 
 from pyams_form.form import AddForm
-from pyams_form.interfaces.form import ISearchForm, IWidgetForm
+from pyams_form.interfaces.form import ISearchForm, ISearchFormFactory, IWidgetForm
 from pyams_form.schema import ResetButton
 from pyams_skin.interfaces import IContentSearch, IInnerPage, ISearchPage
 from pyams_skin.layer import IPyAMSLayer
@@ -94,12 +95,18 @@
     """Base search view"""
 
     search_form_factory = SearchForm
-    search_form = None
+
+    @reify
+    def search_form(self):
+        form = self.request.registry.queryMultiAdapter((self.context, self.request, self),
+                                                       ISearchFormFactory)
+        if form is None:
+            form = self.search_form_factory(self.context, self.request)
+        return form
 
     def update(self):
         """Update search view"""
         # pylint: disable=no-member
-        self.search_form = self.search_form_factory(self.context, self.request)
         self.search_form.update()