{ "info": { "author": "Robert Niedereiter", "author_email": "rnix@squarewave.at", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Zope2", "License :: OSI Approved :: Zope Public License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "=====================\ncornerstone.ui.result\n=====================\n\nOverview\n========\n\nThis module provides rendering results. The intention was to not write\nstupid view logic again and again.\n \nThe structure of the results is defined via ZCML. To finally make the framework\nrender the result you have to subclass some baseimplementations of the\nframework providing rendering informations such like batch vocabs,\nresult slices, etc.\n \nAt the moment the the framework provides batching and slices, in future it will\nbe extended with features for defining result sorting mechanisms,\nnested batches, and more detailed slice definitions.\n \nYou can find a first example on how to implement results at:\nhttps://svn.plone.org/svn/collective/Directory\n \nEach defined result is internal registered as ViewletManager, and will be\nrendered by calling a contentprovider out of a page template f.e.::\n \n \n\n\nThe result definition in zcml looks like this::\n\n \n\n \n \n \n \n \n \n \n\n \n\n \n\nConsider that if you want to render the same batch twice, f.e. above and below\nthe slice, you only have to define the batch definitions once and can add it\na second time simply by defining the batch domain.\n\n\nA result can have the following attributes:\n-------------------------------------------\n\n- for=\"*\" (the interface the result is bound to)\n \n- class=\".env.TestResult\" (the class providing the results itself)\n \n- permission=\"zope.Public\" (the permission to view the result)\n \n- name='testresult' (the name under which the result can be called as\n contentprovider)\n \n- slicesize=\"20\" (the size of the result slice, optional)\n \n- threshold=\"20\" (the threshold how many results are required to display\n batches, optional)\n\n\nA Batch can have the following attributes:\n------------------------------------------\n\n- domain=\"testbatch\" (the domain of this batch. this is used to differ the\n batch from perhaps other rendered batches on the same page)\n \n- vocab=\".env.TestBatchVocab\" (the class providing the batch vocab)\n \n- template=\"templates/batch.pt\" (the template used to render the batch,\n optional)\n \n- firstpagelink=\"True\" (flag wether to display the firstpagelink or not,\n optional)\n \n- lastpagelink=\"True\" (flag wether to display the lastpagelink or not,\n optional)\n \n- prevpagelink=\"True\" (flag wether to display the prevpagelink or not,\n optional)\n \n- nextpagelink=\"True\" (flag wether to display the nextpagelink or not,\n optional)\n \n- batchrange=\"30\" (the batchrange. defines how many pages are displayed,\n f.e. \"<< < ... 5 6 7 8 ... > >>\", optional)\n \n- masters=\"anotherbatchdomain\" (Batch(es) the defined batch depends on, the\n value must be the domain of the batch(es) you want to consider)\n \n- title=\"The Title\" (An optional title to label the batch)\n \n- forcedisplay=\"True\" (An optional flag wether to force batch displaying\n or not)\n \n- querywhitelist=\"sort\" (Query Params to be considered when generating\n urls. This is needed if you have to use some additional params in the\n slice)\n\n\nThe slice definitions are treated as viewlet definitions and therefor follow\n----------------------------------------------------------------------------\nthe viewlet definition rules:\n-----------------------------\n\n- class=\".browser.directory.DirectoryListingSlice\"\n \n- name=\"directoryslice\"\n \n- template=\"templates/directory_listing.pt\"\n \n- allowed_interface=\"Products.Directory.browser.interfaces.IDirectoryListing\"\n\n \nThe example pointed above implements an alphabatched directory listing and\n--------------------------------------------------------------------------\nsubclasses therfor this objects:\n--------------------------------\n\n- cornerstone.ui.result.result.ResultBase\n\n- cornerstone.ui.result.batch.AlphaBatchVocabBase\n\n- cornerstone.ui.result.slice.AlphaBatchedSliceBase\n\n\nThe result class::\n\n class DirectoryListingResult(ResultBase):\n \n name = 'directory.directorylisting'\n \n @property\n def results(self):\n return self._getEntries({\n 'meta_type': 'DirectoryEntry',\n 'path': '/'.join(self.context.getPhysicalPath()),\n })\n \n def _getEntries(self, query):\n catalog = getToolByName(self.context, 'membrane_tool')\n brains = catalog(**query)\n entries = []\n for brain in brains:\n entry = dict()\n entry['name'] = brain.Title\n entry['email'] = brain.getEmail\n entry['url'] = brain.getURL()\n entry['review_state'] = brain.review_state\n entries.append(entry)\n return entries\n\n\nConsider:\n\n\n- since there is no senceful way to determine the name under which a\n specific ViewletManager is registered out of itself you must provide\n the name attribute.\n \n- further you have to provide the results. in the example above it is a\n list of dictionaries. of course this is the format (list of dicts) the\n framework can handle well at the moment. in future there will be also\n base implementations be able to handle catalog brains.\n \n- the result implementing class is used by the other needed classes to\n extract the batch informations and the slice informations\n\n\nThe batch vocab class::\n\n # pages definitions will be looked up by an adapter in future\n pages = [\n 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',\n 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',\n ]\n\n class DirectoryBatchVocab(AlphaBatchVocabBase):\n \n @property\n def vocab(self):\n visibles = self.getVisiblesFromDictList('name')\n return self.generateVocab(visibles, pages)\n\n\nConsider:\n\n\n- The base class AlphaBatchVocabBase can handle results which are a list\n of dicts and does most of the work for you. As written earlier there\n should be also a base implementation for handling brain based result\n lists.\n \n- the page list is needed to calculate an alphabatch\n (it is not necessary for numeric batches) and must be available in the\n class defining the batch vocab and the result slice itself, see below.\n This should be looked up by an interface in future\n\n\nThe slice class::\n\n class DirectoryListingSlice(AlphaBatchedSliceBase):\n \n @property\n def entries(self):\n key = 'name'\n batchname = 'directorybatch'\n self.pages = pages\n self.sortResults(key)\n current = self.determineCurrentPage(batchname, key)\n return self.generateCurrentSlice(current, key)\n\n\nEnable KSS:\n-----------\n\nKSS is enabled by defult when applying the extension profile. \n \nTo enable kss for anonymous users too, you have to change the condition of\n``kukit.js`` in the portal_javascripts resource registry.\n\n\nConsider:\n\n\n- In this subclass the same rules for results applies as for the batch\n vocab base class.\n \n- you have to provide the batchname this slice is used for\n \n- the pages global is here used too. see statement why framework is alpha\n state.\n\n\nCredits:\n========\n\n- This library is an outcome of the UN ILO Better Work project.\n \n- Written by Robert Niederreiter ,\n Squarewave Computing, Austia - Blue Dynamics Alliance\n \n- Thaks to Jens Klein for help at research and\n design ideas\n \n- Thanks to Radim Novotny for bugfixes and testing\n \n- Thanks to Lukas Zdych for the batchrange\n implementation and testing\n\n\nChanges\n=======\n\n1.1.4 (svn)\n-----------\n\n * fix numeric slice default page\n (rnix, 2010-06-16)\n\n1.1.3\n-----\n\n * make alpha batch non-ascii aware\n (rnix, 2010-06-15)\n\n1.1.2\n-----\n\n * make value of request param unicode aware in batch.py\n (rnix, 2010-04-13)\n\n1.1.1\n-----\n \n * Write url query data to self.request.form instead of self.request in KSS\n view\n (rnix, 2009-03-25)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": "", "license": "License :: OSI Approved :: Zope Public License", "maintainer": null, "maintainer_email": null, "name": "cornerstone.ui.result", "package_url": "https://pypi.org/project/cornerstone.ui.result/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/cornerstone.ui.result/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/cornerstone.ui.result/1.1.4/", "requires_dist": null, "requires_python": null, "summary": "library providing a result rendering engine", "version": "1.1.4" }, "last_serial": 788455, "releases": { "1.0-beta1": [ { "comment_text": "", "digests": { "md5": "cb8b70712f6472145835e4a903a39d3b", "sha256": "3f288d6f71a4afa8b0f6579d104d1184bc044dc6673bd0c7ff5075fa1ee8fd3c" }, "downloads": -1, "filename": "cornerstone.ui.result-1.0-beta1.tar.gz", "has_sig": false, "md5_digest": "cb8b70712f6472145835e4a903a39d3b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17871, "upload_time": "2008-03-11T08:21:26", "url": "https://files.pythonhosted.org/packages/50/e5/7c7e5c2d3d5992383d42752ac1139a4dd40472b52f760a2d9d36c23f2710/cornerstone.ui.result-1.0-beta1.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "1d458d884438895804a4850566028ad6", "sha256": "479eb76284655c4402c1406ee3bf661fffa7a5353d63d60ca0b6450fb732ef8c" }, "downloads": -1, "filename": "cornerstone.ui.result-1.1.1.tar.gz", "has_sig": false, "md5_digest": "1d458d884438895804a4850566028ad6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18357, "upload_time": "2009-07-09T16:06:49", "url": "https://files.pythonhosted.org/packages/25/b7/ccd4b0f750f85f09860fdd08d43434ea0ecafd5028e0cc534ab5f23923a8/cornerstone.ui.result-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "5729072e54434d25e56a648516cab9c2", "sha256": "b72696af1f0f8a3bddbf43645867e8753e161d22f7ae4b4da52b590a310a29a7" }, "downloads": -1, "filename": "cornerstone.ui.result-1.1.2.tar.gz", "has_sig": false, "md5_digest": "5729072e54434d25e56a648516cab9c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18367, "upload_time": "2010-04-13T14:35:00", "url": "https://files.pythonhosted.org/packages/b3/62/08c144b46b4f42dc5b7e6e3d519f055d9810415dccfc3096d9281bbbb2b8/cornerstone.ui.result-1.1.2.tar.gz" } ], "1.1.3": [ { "comment_text": "", "digests": { "md5": "e30c0deee5ca51a48473ef026797c41f", "sha256": "a96446e1c9beee307099ad24e379617891a663b1bce86d93b98ef3bf52388bf0" }, "downloads": -1, "filename": "cornerstone.ui.result-1.1.3.tar.gz", "has_sig": false, "md5_digest": "e30c0deee5ca51a48473ef026797c41f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18451, "upload_time": "2010-06-16T09:30:04", "url": "https://files.pythonhosted.org/packages/c3/64/fff258e4d0e244259740ec661fefd178ccb77a488f270dcb52a575064be9/cornerstone.ui.result-1.1.3.tar.gz" } ], "1.1.4": [ { "comment_text": "", "digests": { "md5": "b6b7162e363388aa3398a226c22b67a3", "sha256": "cd3d6e6daa0cf8561a0075095113e0071c314d72fe34476fc43383851b860340" }, "downloads": -1, "filename": "cornerstone.ui.result-1.1.4.tar.gz", "has_sig": false, "md5_digest": "b6b7162e363388aa3398a226c22b67a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18504, "upload_time": "2010-06-16T18:05:46", "url": "https://files.pythonhosted.org/packages/64/5a/07137da3d04fed1860316f742bd9c3f2c2ecec58f42e1344a7b1c20cd98b/cornerstone.ui.result-1.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b6b7162e363388aa3398a226c22b67a3", "sha256": "cd3d6e6daa0cf8561a0075095113e0071c314d72fe34476fc43383851b860340" }, "downloads": -1, "filename": "cornerstone.ui.result-1.1.4.tar.gz", "has_sig": false, "md5_digest": "b6b7162e363388aa3398a226c22b67a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18504, "upload_time": "2010-06-16T18:05:46", "url": "https://files.pythonhosted.org/packages/64/5a/07137da3d04fed1860316f742bd9c3f2c2ecec58f42e1344a7b1c20cd98b/cornerstone.ui.result-1.1.4.tar.gz" } ] }