{ "info": { "author": "Souheil Chelfouh", "author_email": "trollfot@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Zope3", "Intended Audience :: Developers", "Programming Language :: Python", "Programming Language :: Zope", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "=============\nmegrok.layout\n=============\n\n.. NOTE::\n megrok.layout has been promoted to grokcore.layout and will be a part of the\n Grok from the upcomming Grok release on. The grokcore.layout package can\n already be included in your own projects in the meantime. This means this\n package most likely will not see any further updates.\n\nThe `megrok.layout` package provides a simple way to write view\ncomponents which can be included into a defined layout. It turns\naround two main components : the Page and the Layout.\n\nLayout\n======\n\nThe layout is a component allowing you to design your site. Often,\nit's the common structure shared between all the pages. Technically,\nit is a class based on the view components interface, providing a\n'render' and 'update' method.\n\nLet's implement a simple Layout:\n\n >>> from megrok.layout import Layout\n >>> from zope.interface import Interface\n >>> import grokcore.component as grok\n\n >>> class MyLayout(Layout):\n ... grok.name('mylayout')\n ... grok.context(Interface)\n ...\n ... def render(self):\n ... return u\"a simple layout\"\n\nWe grok our component:\n\n >>> grok_component('MyLayout', MyLayout)\n True\n\nWe check it has been correctly registered:\n\n >>> from megrok.layout import ILayout\n >>> from zope.component import getMultiAdapter\n >>> from zope.publisher.browser import TestRequest\n\n >>> layout = getMultiAdapter((TestRequest(), Interface), ILayout)\n >>> isinstance(layout, MyLayout)\n True\n >>> layout.render()\n u'a simple layout'\n\nNow let's see how to use this Layout in a specific context using a Page.\n\nPage\n====\n\nThe page is the specific code that you want to control. It is based on\nthe grokcore.View browser page implementation and therefore provides a\n``render`` and ``update`` method. The ``render`` method will simply\nreturn the specific HTML code generated by the template or the\n``render`` method code while ``__call__`` will lookup for a Layout\ncomponent and renders itself inside it.\n\nFirst, we'll create 2 models that will serve as exemples.\n\n >>> class Aurochs(grok.Context):\n ... description = u'Looks like a bull'\n\n >>> class Mammoth(grok.Context):\n ... description = u'Looks like an elephant'\n\nLet's create now a page that will display their description.\n\n >>> from megrok.layout import Page\n >>> class AnimalDisplay(Page):\n ... grok.name('display')\n ... \t grok.context(Interface)\n ...\n ... def render(self):\n ... return self.context.description\n\nGrokking our Page will let us use it.\n\n >>> grok_component('AnimalDisplay', AnimalDisplay)\n True\n >>> wooly = Mammoth()\n >>> page = getMultiAdapter((wooly, TestRequest()), name='display')\n >>> page.content()\n u'Looks like an elephant'\n >>> page()\n u'a simple layout'\n\nAs we can see, the page is using the layout, on the __call__ to\nrender. Of course, this example Layout doesn't provide any interesting\nfeature. Let's create something more interesting, by using our page\nwith the help of the 'content' method:\n\n >>> class MammothLayout(Layout):\n ... grok.context(Mammoth)\n ...\n ...\t def render(self):\n ...\t return u'Header. Page: %s. Footer' % self.view.content()\n\n >>> grok_component('MammothLayout', MammothLayout)\n True\n >>> page()\n u'Header. Page: Looks like an elephant. Footer'\n\nForms & Errorpages\n==================\n\nBaseclasses for Form views (Form, AddForm, EditForm and DisplayForm) and Error\nviews (NotFoundPage, ExceptionPage, UnauthorizedPage) are available which are\nall aware of Layout components like Page is.\n\n\nChangelog\n=========\n\n.. NOTE::\n megrok.layout has been promoted to grokcore.layout and will be a part of the\n Grok from the upcomming Grok release on. The grokcore.layout package can\n already be included in your own projects in the meantime. This means this\n package most likely will not see any further updates.\n\n1.3 (2011-01-12)\n----------------\n\n- Compatibility with grokcore.view 2.3.\n\n1.2.0 (2010-12-16)\n------------------\n\n- Update to use the new TemplateGrokker from grokcore.view.\n\n1.1.0 (2010-03-03)\n------------------\n\n- ``z3c.flashmessage`` has been dropped in favor of\n ``grokcore.message``. This new package takes in charge the\n registration of the utilities and retains the existing API. The\n back-compatibility is assured.\n\n1.0.2 (2010-02-26)\n------------------\n\n- The existence test for the `application_url` site-lookup was\n wrongly using a \"if not\" statement. In a case of a container, the object\n is evaluated to False if it's empty. We now use a proper \"if .. is\n None\". [trollfot]\n\n1.0.1 (2010-02-25)\n------------------\n\n- Forms now inherit from `UtilityView` and therefore get the\n `application_url` and `flash` methods. Tests have been added to\n garanty the behavior. [trollfot]\n\n1.0 (2010-02-25)\n----------------\n\n- The dependencies have been heavily cleaned up. All zope.app packages\n have been removed. We are now running with minimal dependencies and\n using the latest ZTK. This release will probably *not* run on\n `Grok 1.0`. You will need `Grok 1.1rc1` to be able to use\n it. [trollfot]\n\n- Added a component called UtilityView that provides two useful\n methods : application_url, flash. These methods are almost a copy of\n what can be found in the `Grok` package. The application_url is\n using a simple getSite hook to get the root of the application. This\n might be irrelevant for some applications and can be overriden.\n [trollfot]\n\n- Added a module called 'messages' that contains the flash messages\n utilities. This module is *NOT* grokked and must be grokked\n manually. This prevents conflicts with grokui.admin's own\n definitions of the very same components. It also allows you to\n override the `flash` method to use something else than\n z3c.flashmessage and then not be bothered by useless utilities. The\n flash messages utilities can be registered by including the\n ``messages.zcml`` file in your own project or package ZCML file.\n [trollfot]\n\n0.9 (2009-09-26)\n----------------\n\n- Add default templates to form which doesn't contain an html and body\n tag.\n [sylvain]\n\n- Add an AddForm, EditForm and DisplayForm, all aware of the layout\n component.\n [sylvain]\n\n0.8 (2009-09-17)\n----------------\n\n- Remove the CodePage, since CodeView have been removed from\n grokcore.view.\n [sylvain]\n\n0.7 (2009-09-15)\n----------------\n\n- Add a CodePage to be compatible with the last version of\n grokcore.view (higher than 1.9). This breaks compatibility with\n previous release. You need to change any Page using a render method\n to a CodePage.\n [sylvain]\n\n- The content property on a Page is no longer a property, but a method\n as it's hidding exceptions. You might need to update your code to\n reflect that change as well.\n [sylvain]\n\n- Fix MANIFEST.in.\n [sylvain]\n\n0.6 (2009-09-14)\n----------------\n\n- switch the arguments order in calling the layout\n [cklinger, sylvain]\n\n- add the CHANGES.txt\n [cklinger]\n\n0.5 (2009-07-24)\n----------------\n\n- remove the grok dependency\n [cklinger trollfot]", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/megrok.layout", "keywords": "grok layout zope3 pagelet theming", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "megrok.layout", "package_url": "https://pypi.org/project/megrok.layout/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/megrok.layout/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/megrok.layout" }, "release_url": "https://pypi.org/project/megrok.layout/1.3/", "requires_dist": null, "requires_python": null, "summary": "A layout component package for zope3 and Grok.", "version": "1.3" }, "last_serial": 794643, "releases": { "0.3": [ { "comment_text": "", "digests": { "md5": "b37b75a14081fab0847112d62776126b", "sha256": "43070a654fafedc932842ae5e60c7d99a73d3d1990b2fa2386ad394ab2b742a9" }, "downloads": -1, "filename": "megrok.layout-0.3.tar.gz", "has_sig": false, "md5_digest": "b37b75a14081fab0847112d62776126b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9834, "upload_time": "2009-06-09T15:00:17", "url": "https://files.pythonhosted.org/packages/33/5f/c62a29081f9bb776050d5a7e81d152d6977e0b9b44dab759e7ce17124114/megrok.layout-0.3.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "e4a224f4853084416c9693555cc757bc", "sha256": "c276158bc8cbd6c78ee593b728ce6bb76aa765922d7a4cd5cfaec19703c4de56" }, "downloads": -1, "filename": "megrok.layout-0.5.tar.gz", "has_sig": false, "md5_digest": "e4a224f4853084416c9693555cc757bc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7377, "upload_time": "2009-07-24T11:35:34", "url": "https://files.pythonhosted.org/packages/e2/95/29a14fac01bf3e41786eb95fa31200958b04516696f72ae33399ee94756e/megrok.layout-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "4424eef08e3b0ded0236efbd5137e81a", "sha256": "952cd9382afa201224d9fe140aa2a1f3f7372bc0dc013b50efacbfae6d216d0e" }, "downloads": -1, "filename": "megrok.layout-0.6.tar.gz", "has_sig": false, "md5_digest": "4424eef08e3b0ded0236efbd5137e81a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9690, "upload_time": "2009-09-14T16:06:12", "url": "https://files.pythonhosted.org/packages/52/90/97a69030b61365b5151dd9231cc3c78531a975e41cb9bc23bb6a464b6589/megrok.layout-0.6.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "d9503c325bfdd0acc8bd490eaa73f61f", "sha256": "59eb8ef0413dab205139783c56f38f67a820c56905f627dfc1d3b1a9830a34b5" }, "downloads": -1, "filename": "megrok.layout-0.7.tar.gz", "has_sig": false, "md5_digest": "d9503c325bfdd0acc8bd490eaa73f61f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10392, "upload_time": "2009-09-15T14:15:18", "url": "https://files.pythonhosted.org/packages/c8/f0/a1742b3eb8ffc3cf6ec781b45d44151d12b2f39eb00ff4ea9923c94d8fa1/megrok.layout-0.7.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "ed15e09e7d01a3c102045379782ecfd4", "sha256": "1211352508b874a8c80a3634a23158fc21f54ee51d05f6633a39ce27bc7d23d1" }, "downloads": -1, "filename": "megrok.layout-0.8.tar.gz", "has_sig": false, "md5_digest": "ed15e09e7d01a3c102045379782ecfd4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10256, "upload_time": "2009-09-17T12:29:53", "url": "https://files.pythonhosted.org/packages/05/e8/cf9b9c551a05cc2dcafeb637a50b2e50e23b14573b4e820e71cdd0710347/megrok.layout-0.8.tar.gz" } ], "0.9": [ { "comment_text": "", "digests": { "md5": "97b87ea0fde2cc9c35f6459cbfb6fd54", "sha256": "969480664a420d421b6496d6152384d00b08d12c387454235380134ca432ffd3" }, "downloads": -1, "filename": "megrok.layout-0.9.tar.gz", "has_sig": false, "md5_digest": "97b87ea0fde2cc9c35f6459cbfb6fd54", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11924, "upload_time": "2009-09-26T17:55:44", "url": "https://files.pythonhosted.org/packages/50/1b/9cd1d4693734f28f97db60d91b98613e1792c22e8944d5704ed66d0a1571/megrok.layout-0.9.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "1f903f1573fd688d30b76cc0957ea83d", "sha256": "742a0b9705acd3893aa7d75dd86baba9624da3578a25e1a7ef34d8583b7709a0" }, "downloads": -1, "filename": "megrok.layout-1.0.tar.gz", "has_sig": false, "md5_digest": "1f903f1573fd688d30b76cc0957ea83d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14174, "upload_time": "2010-02-25T19:04:37", "url": "https://files.pythonhosted.org/packages/90/66/644518e2845ba1e9b852c9a5c3835f9c53deb5801123d37b00509623ea2c/megrok.layout-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "9820ed5ccba3c0550881405faf874cad", "sha256": "0db0391c0cd0447a4401161dfa90f2a4ef523879b1decf8855af0d1b5c7cc3b9" }, "downloads": -1, "filename": "megrok.layout-1.0.1.tar.gz", "has_sig": false, "md5_digest": "9820ed5ccba3c0550881405faf874cad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14420, "upload_time": "2010-02-25T19:27:38", "url": "https://files.pythonhosted.org/packages/29/f2/648876fc5692b66b622c5fb9fe86b88c9283c62a8822aa7800842a26ab95/megrok.layout-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "2a42c84726275a6ce17e3e15863726d0", "sha256": "8dabcce2c9425680597d8f6c800d870848137332fceb2cee62d5e86cb6f74982" }, "downloads": -1, "filename": "megrok.layout-1.0.2.tar.gz", "has_sig": false, "md5_digest": "2a42c84726275a6ce17e3e15863726d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14680, "upload_time": "2010-02-26T14:58:20", "url": "https://files.pythonhosted.org/packages/97/cc/d2afdc97357649a26d8d7e802a58dc97305fbba1a728dcbc27c0eca740bd/megrok.layout-1.0.2.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "548f9b63fb29abb75a3652b397d1b6b7", "sha256": "b383ff6de948a196ac3a9eaf21a36d9523e06bb126a863186e3dd841c7dce383" }, "downloads": -1, "filename": "megrok.layout-1.1.0.tar.gz", "has_sig": false, "md5_digest": "548f9b63fb29abb75a3652b397d1b6b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14702, "upload_time": "2010-03-03T22:36:33", "url": "https://files.pythonhosted.org/packages/2d/13/9f463772a0bda511fb86361831dbfed429bb31d78afd285b20ddf4e48bcd/megrok.layout-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "2ce37af46f4257fa319143aa4dbc04eb", "sha256": "5373c40b4633f32c13985699407d12c2b596bbdb99a304d4a0c321d7b3e10719" }, "downloads": -1, "filename": "megrok.layout-1.2.0.tar.gz", "has_sig": false, "md5_digest": "2ce37af46f4257fa319143aa4dbc04eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16122, "upload_time": "2010-12-16T10:57:04", "url": "https://files.pythonhosted.org/packages/3d/72/c958e5b451ac0921f60a8c3d89813b23db57be37b9a56c51af182a0fcd39/megrok.layout-1.2.0.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "adb6db928573b15f100559bef15e9843", "sha256": "0e4dc09d97688dd5d7cc04f39c41743bd660ad5fa93493f212c938a5a371259b" }, "downloads": -1, "filename": "megrok.layout-1.3.tar.gz", "has_sig": false, "md5_digest": "adb6db928573b15f100559bef15e9843", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16396, "upload_time": "2011-01-12T16:31:03", "url": "https://files.pythonhosted.org/packages/32/71/9d0f1286f67144352728af0593db8089fff7146245ce2dd1ee704a934435/megrok.layout-1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "adb6db928573b15f100559bef15e9843", "sha256": "0e4dc09d97688dd5d7cc04f39c41743bd660ad5fa93493f212c938a5a371259b" }, "downloads": -1, "filename": "megrok.layout-1.3.tar.gz", "has_sig": false, "md5_digest": "adb6db928573b15f100559bef15e9843", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16396, "upload_time": "2011-01-12T16:31:03", "url": "https://files.pythonhosted.org/packages/32/71/9d0f1286f67144352728af0593db8089fff7146245ce2dd1ee704a934435/megrok.layout-1.3.tar.gz" } ] }