From reebalazs at codespeak.net Tue May 1 01:02:30 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Tue, 1 May 2007 01:02:30 +0200 (CEST) Subject: [KSS-checkins] r42507 - in kukit/kss.demo/trunk: . docs Message-ID: <20070430230230.B108E8069@code0.codespeak.net> Author: reebalazs Date: Tue May 1 01:02:29 2007 New Revision: 42507 Modified: kukit/kss.demo/trunk/docs/HISTORY.txt kukit/kss.demo/trunk/setup.py Log: Prepare for release Modified: kukit/kss.demo/trunk/docs/HISTORY.txt ============================================================================== --- kukit/kss.demo/trunk/docs/HISTORY.txt (original) +++ kukit/kss.demo/trunk/docs/HISTORY.txt Tue May 1 01:02:29 2007 @@ -6,6 +6,11 @@ - ... +kss.demo - 1.2-beta2 Released 2007-04-30 + + - Prepare for release + [ree] + kss.demo - 1.2-beta1 Released 2007-03-04 - Prepare for release Modified: kukit/kss.demo/trunk/setup.py ============================================================================== --- kukit/kss.demo/trunk/setup.py (original) +++ kukit/kss.demo/trunk/setup.py Tue May 1 01:02:29 2007 @@ -18,7 +18,7 @@ keywords='', author='KSS Project', author_email='kss-devel at codespeak.net', - url='http://kukit.org', + url='http://kssproject.org', license='GPL', packages=find_packages(exclude=['ez_setup']), namespace_packages=['kss'], From reebalazs at codespeak.net Tue May 1 01:04:11 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Tue, 1 May 2007 01:04:11 +0200 (CEST) Subject: [KSS-checkins] r42508 - kukit/kss.demo/tag/1.2-beta2 Message-ID: <20070430230411.71FEC8069@code0.codespeak.net> Author: reebalazs Date: Tue May 1 01:04:10 2007 New Revision: 42508 Added: kukit/kss.demo/tag/1.2-beta2/ - copied from r42507, kukit/kss.demo/trunk/ Log: Tagging release From reebalazs at codespeak.net Tue May 1 01:08:30 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Tue, 1 May 2007 01:08:30 +0200 (CEST) Subject: [KSS-checkins] r42509 - in kukit/kss.demo/tag/1.2-beta2: . kss/demo Message-ID: <20070430230830.176C58069@code0.codespeak.net> Author: reebalazs Date: Tue May 1 01:08:29 2007 New Revision: 42509 Removed: kukit/kss.demo/tag/1.2-beta2/setup.cfg Modified: kukit/kss.demo/tag/1.2-beta2/kss/demo/version.txt kukit/kss.demo/tag/1.2-beta2/setup.py Log: Setting release Modified: kukit/kss.demo/tag/1.2-beta2/kss/demo/version.txt ============================================================================== --- kukit/kss.demo/tag/1.2-beta2/kss/demo/version.txt (original) +++ kukit/kss.demo/tag/1.2-beta2/kss/demo/version.txt Tue May 1 01:08:29 2007 @@ -1 +1 @@ -1.2dev Unreleased +1.2-beta2 Released 2007-04-30 Deleted: /kukit/kss.demo/tag/1.2-beta2/setup.cfg ============================================================================== --- /kukit/kss.demo/tag/1.2-beta2/setup.cfg Tue May 1 01:08:29 2007 +++ (empty file) @@ -1,3 +0,0 @@ -[egg_info] -tag_build = dev -tag_svn_revision = true Modified: kukit/kss.demo/tag/1.2-beta2/setup.py ============================================================================== --- kukit/kss.demo/tag/1.2-beta2/setup.py (original) +++ kukit/kss.demo/tag/1.2-beta2/setup.py Tue May 1 01:08:29 2007 @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import sys, os -version = '1.2' +version = '1.2-beta2' setup(name='kss.demo', version=version, @@ -26,12 +26,11 @@ zip_safe=False, install_requires=[ # -*- Extra requirements: -*- - 'kss.core>=dev', + 'kss.core>=1.2-beta2', ], entry_points=""" # -*- Entry points: -*- """, dependency_links=[ - 'https://codespeak.net/svn/kukit/kss.core/trunk#egg=kss.core-dev', ], ) From reebalazs at codespeak.net Wed May 2 00:13:21 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 2 May 2007 00:13:21 +0200 (CEST) Subject: [KSS-checkins] r42563 - kukit/kss.concatresource Message-ID: <20070501221321.CD5D2807C@code0.codespeak.net> Author: reebalazs Date: Wed May 2 00:13:21 2007 New Revision: 42563 Added: kukit/kss.concatresource/ Log: Create package import From reebalazs at codespeak.net Wed May 2 00:13:31 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 2 May 2007 00:13:31 +0200 (CEST) Subject: [KSS-checkins] r42564 - kukit/kss.concatresource/trunk Message-ID: <20070501221331.ADEA2807E@code0.codespeak.net> Author: reebalazs Date: Wed May 2 00:13:31 2007 New Revision: 42564 Added: kukit/kss.concatresource/trunk/ Log: Create package import From reebalazs at codespeak.net Wed May 2 00:13:39 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 2 May 2007 00:13:39 +0200 (CEST) Subject: [KSS-checkins] r42565 - kukit/kss.concatresource/branch Message-ID: <20070501221339.78B6D807F@code0.codespeak.net> Author: reebalazs Date: Wed May 2 00:13:39 2007 New Revision: 42565 Added: kukit/kss.concatresource/branch/ Log: Create package import From reebalazs at codespeak.net Wed May 2 00:13:51 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 2 May 2007 00:13:51 +0200 (CEST) Subject: [KSS-checkins] r42566 - kukit/kss.concatresource/tag Message-ID: <20070501221351.471448080@code0.codespeak.net> Author: reebalazs Date: Wed May 2 00:13:51 2007 New Revision: 42566 Added: kukit/kss.concatresource/tag/ Log: Create package import From reebalazs at codespeak.net Wed May 2 00:30:41 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 2 May 2007 00:30:41 +0200 (CEST) Subject: [KSS-checkins] r42567 - in kukit/kss.concatresource/trunk: . docs kss Message-ID: <20070501223041.E6001807C@code0.codespeak.net> Author: reebalazs Date: Wed May 2 00:30:41 2007 New Revision: 42567 Added: kukit/kss.concatresource/trunk/README.txt kukit/kss.concatresource/trunk/docs/ kukit/kss.concatresource/trunk/docs/HISTORY.txt kukit/kss.concatresource/trunk/docs/INSTALL.txt kukit/kss.concatresource/trunk/docs/LICENSE.GPL kukit/kss.concatresource/trunk/docs/LICENSE.txt kukit/kss.concatresource/trunk/kss/ kukit/kss.concatresource/trunk/setup.cfg kukit/kss.concatresource/trunk/setup.py Log: Initial structure Added: kukit/kss.concatresource/trunk/README.txt ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/README.txt Wed May 2 00:30:41 2007 @@ -0,0 +1,10 @@ +kss.concatresource Package Readme +================================= + +Overview +-------- + +concatresource + +XXX + Added: kukit/kss.concatresource/trunk/docs/HISTORY.txt ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/docs/HISTORY.txt Wed May 2 00:30:41 2007 @@ -0,0 +1,11 @@ +Changelog for kss.concatresource + + (name of developer listed in brackets) + +kss.demo - 1.2dev Unreleased + + - ... + + - Initial package structure. + [ree] + Added: kukit/kss.concatresource/trunk/docs/INSTALL.txt ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/docs/INSTALL.txt Wed May 2 00:30:41 2007 @@ -0,0 +1,16 @@ +kss.demo Installation +===================== + + * When you're reading this you have probably already run + ``easy_install kss.demo``. Find out how to install setuptools + (and EasyInstall) here: + http://peak.telecommunity.com/DevCenter/EasyInstall + + * Copy the files ``kss/concatresource/kss.concatresource-configure.zcml`` and + ``kss/concatresource/kss.concatresource-meta.zcml`` in the + ``/path/to/instance/etc/package-includes`` directory. + + * On Zope 2.8, the package-includes directory is not created by + default, so you also have to create it. + + Added: kukit/kss.concatresource/trunk/docs/LICENSE.GPL ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/docs/LICENSE.GPL Wed May 2 00:30:41 2007 @@ -0,0 +1,222 @@ + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS Added: kukit/kss.concatresource/trunk/docs/LICENSE.txt ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/docs/LICENSE.txt Wed May 2 00:30:41 2007 @@ -0,0 +1,15 @@ + kss.concatresource is copyright Balazs Ree and KSS Project contributors + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307 USA. Added: kukit/kss.concatresource/trunk/setup.cfg ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/setup.cfg Wed May 2 00:30:41 2007 @@ -0,0 +1,3 @@ +[egg_info] +tag_build = dev +tag_svn_revision = true Added: kukit/kss.concatresource/trunk/setup.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/setup.py Wed May 2 00:30:41 2007 @@ -0,0 +1,35 @@ +from setuptools import setup, find_packages + +version = '1.2' + +setup(name='concatresource', + version=version, + description="concatresource creates concatenated and packed resources", + long_description="""\ +""", + # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers + classifiers=[ + "Framework :: Zope2", + "Framework :: Zope3", + "Programming Language :: Python", + "Topic :: Software Development :: Libraries :: Python Modules", + ], + keywords='', + author='KSS Project Contributors', + author_email='kss-devel at codespeak.net', + url='http://kssproject.org', + license='GPL', + packages=find_packages(exclude=['ez_setup']), + namespace_packages=['kss'], + include_package_data=True, + zip_safe=False, + install_requires=[ + # -*- Extra requirements: -*- + ], + entry_points=""" + # -*- Entry points: -*- + """, + dependency_links=[ + 'https://codespeak.net/svn/kukit/kss.concatresource/trunk#egg=kss.concatresource-dev', + ], + ) From reebalazs at codespeak.net Wed May 2 00:45:34 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 2 May 2007 00:45:34 +0200 (CEST) Subject: [KSS-checkins] r42568 - in kukit/kss.concatresource/trunk/kss/concatresource: . compression compression/thirdparty test Message-ID: <20070501224534.D1B76807F@code0.codespeak.net> Author: reebalazs Date: Wed May 2 00:45:34 2007 New Revision: 42568 Added: kukit/kss.concatresource/trunk/kss/concatresource/ kukit/kss.concatresource/trunk/kss/concatresource/README kukit/kss.concatresource/trunk/kss/concatresource/__init__.py kukit/kss.concatresource/trunk/kss/concatresource/cachingadapter.py kukit/kss.concatresource/trunk/kss/concatresource/compression/ kukit/kss.concatresource/trunk/kss/concatresource/compression/__init__.py kukit/kss.concatresource/trunk/kss/concatresource/compression/css.py kukit/kss.concatresource/trunk/kss/concatresource/compression/javascript.py kukit/kss.concatresource/trunk/kss/concatresource/compression/thirdparty/ kukit/kss.concatresource/trunk/kss/concatresource/compression/thirdparty/LICENSE kukit/kss.concatresource/trunk/kss/concatresource/compression/thirdparty/__init__.py kukit/kss.concatresource/trunk/kss/concatresource/compression/thirdparty/packer.py kukit/kss.concatresource/trunk/kss/concatresource/concatfileresource.py kukit/kss.concatresource/trunk/kss/concatresource/concatresource-configure.zcml kukit/kss.concatresource/trunk/kss/concatresource/concatresource-meta.zcml kukit/kss.concatresource/trunk/kss/concatresource/configure.zcml kukit/kss.concatresource/trunk/kss/concatresource/directives.py kukit/kss.concatresource/trunk/kss/concatresource/fields.py kukit/kss.concatresource/trunk/kss/concatresource/fileresource.py kukit/kss.concatresource/trunk/kss/concatresource/interfaces.py kukit/kss.concatresource/trunk/kss/concatresource/meta.py kukit/kss.concatresource/trunk/kss/concatresource/meta.zcml kukit/kss.concatresource/trunk/kss/concatresource/resource.py kukit/kss.concatresource/trunk/kss/concatresource/test/ kukit/kss.concatresource/trunk/kss/concatresource/test/README kukit/kss.concatresource/trunk/kss/concatresource/test/__init__.py kukit/kss.concatresource/trunk/kss/concatresource/test/configure.zcml kukit/kss.concatresource/trunk/kss/concatresource/test/test1.js kukit/kss.concatresource/trunk/kss/concatresource/test/test2.js Log: Import module Added: kukit/kss.concatresource/trunk/kss/concatresource/README ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/README Wed May 2 00:45:34 2007 @@ -0,0 +1,137 @@ + +Objectives +---------- + +I made this utility for the works in the jsonserver integration and +AZAX/kukit. This was meant to be a temporary, lightweight solution but it +has long term merits too. I needed this because I wanted a solution that +works right now, works on zope3 and zope 2.8 even (so zc.resourcelibraries +was not a choice), does not depend on Plone (so ResourceRegistries is out +too). + +The interesting point of the utility is: instead of building registries to +emit include tags in the HTML, it simply makes one resource that needs to +be imported in a single line:: + + + +Also: + +- it compresses the JS or CSS files with Florian Schulze's compressor + from ResourceRegistries + +- it contains an utility interface that another component can implement + to dynamically extend the list of files (like I did with AZAX). So the + "registry" is not really implemented but can be plugged in. + +- it is tested (although not much) to work with Zope 2.8, 2.9, 3.1, 3.2 + +Meanwhile I implemented the cache headers for the resources correctly +here, the current implementation of caching is broken in Five and I +believe in Z3 resources as well; beware that I considered the original +Zope3 code only and did not look at additional utilities. According to my +observation: in Z3 the original resources attempt to handle the cache +headers correctly but never really check if the file gets changed on the +filesystem (only on restart). If this is really a problem and not just I +believe, then it is fixed in my code. (Read more in the Caching part.) + +More information on this issue: + +http://article.gmane.org/gmane.comp.web.zope.z3base.general/53 + +Compression +----------- + +You can use more levels of compressions with the compress_level attribute. + + + +Some explanation: + +- compression is only implemented for JavaScript and CSS + +- The default level is "safe", this is useable with all scripts + +- The "full" level gives even better compression by taking out all newlines + and mangling private variable names, but some preparation must be made + in the scripts for that (like putting a ; after }-s I think, and + also maybe more). + +- Specifying "none" will leave your resource uncompressed. This + can be useful for debugging. + +Caching control +--------------- + +You have some possibility to control how caching of resources are done. + + + +The attribute "lmt_checking_period" controls how often the file +modification dates are checked from the filesystem. By default this is +60.0, this means that once the file modification is checked, it will not be +checked before the next 60 seconds elapses. In other words, if you change +the files on the filesystem, it will cause a maximum of this long delay +until the changes propagate to the rendered resources. For debugging this +can be set to 0 to allow immediate changes, however in production this +setup would cause the files often looked up in the filesystem, which, +especially with badly implemented filesystems can cause a problem. This +feature is already an enhancement to the original Zope 3 resource +implementation where, unless running in debug mode, changes in the resource +files will require a restart to become visible in the result. + +The attribute "caching", when set to "memory", will result that the cooked +resource will be cached in memory and looked up from them as long as the +files are unchanged. This, especially with compress options, can cause a +speedup in rendering the resources. However, in normal operation this is +not necessary at all, since if caching is set up properly, the browser and +the upstream cache asks via the "If-Modified-Since" headers if the resource +has been changed recently, and the resource itself is queried only when +needed, independently of the setup of this option. While debugging, +however, when browser caching is forced to switch off, without this option +the resource would be cooked each time the browser reloads the dependent +page, so in this case setting "caching" to "memory" causes a significant +speedup in these cases. In production however, is not only unnecessary but +also causes an additional memory consumption. + +Debug setup +----------- + +To summarize with an example, the following settings are advisable while +debugging: + + + +Release notes +------------- + +In Zope 2.9.2 there is Five 1.3.3 included. This contains a bug that +the resources will never be looked up from the +application root. + +To fix this, you need to update Five to version 1.3.5, or update Zope +to version >= 2.9.3. + + Added: kukit/kss.concatresource/trunk/kss/concatresource/__init__.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/__init__.py Wed May 2 00:45:34 2007 @@ -0,0 +1,11 @@ +'''\ +Product init +''' +# alias myself to python import root, directly +try: + import sys + if not 'concatresource' in sys.modules: + # only 1st import is aliased. + sys.modules['concatresource'] = sys.modules[globals()['__name__']] +except ImportError: + pass Added: kukit/kss.concatresource/trunk/kss/concatresource/cachingadapter.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/cachingadapter.py Wed May 2 00:45:34 2007 @@ -0,0 +1,65 @@ +from time import time +from interfaces import ICachedResource +from zope.interface import implements + +try: + from zope.datetime import rfc1123_date +except ImportError: + # Zope < 2.10 + from zope.app.datetimeutils import rfc1123_date + + +class CachedResource(object): + 'Adapts a ContextFile to a cached resource' + implements(ICachedResource) + + def __init__(self, context): + self.context = context + self.lmt_last_checked = 0 + self.data_last_fetched = 0 + + def _fetchdata(self): + try: + result = self._contents + ##print "*****Resource from cached" + except AttributeError: + result = self._contents = self.context.getContents() + self.data_last_fetched = time() + ##print "*****Resource kooked" + return result + + def _deldata(self): + del self._contents + + def purgeData(self): + 'Force file contents to be reloaded' + ##print "***** PURGE", self.context.__name__ + try: + self._deldata() + except AttributeError: + pass + + # Once fetched, data is cached in the object until + # explicitely deleted. + data = property(lambda self: self._fetchdata()['data'], None, _deldata) + content_type = property(lambda self: self._fetchdata()['content_type'], None, _deldata) + + # Last modified time is calculated on demand + # but never more often then lmt_check_period + def _fetchlm(self): + now = time() + if now - self.lmt_last_checked > self.lmt_check_period: + self.lmt_last_checked = now + lmt = float(self.context.getLastMod()) or now + lmh = rfc1123_date(lmt) + d = self._last_mod = dict(lmt = lmt, lmh = lmh) + ##print "***** LMT reread", d + else: + d = self._last_mod + return d + + lmt = property(lambda self: self._fetchlm()['lmt']) + lmh = property(lambda self: self._fetchlm()['lmh']) + + caching = property(lambda self: self.context.caching) + lmt_check_period = property(lambda self: self.context.lmt_check_period) Added: kukit/kss.concatresource/trunk/kss/concatresource/compression/__init__.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/compression/__init__.py Wed May 2 00:45:34 2007 @@ -0,0 +1,20 @@ +'''\ +Preprocess resource files by applying compression on them +''' + +__all__ = ('compress', ) + +from javascript import compress as compress_javascript +from css import compress as compress_css + +compress_methods = { + 'application/x-javascript': compress_javascript, + 'text/css': compress_css, + } + +default_compress_method = lambda text: text + +def compress(data, content_type, compress_level): + 'Returns compressed text for a given content type' + method = compress_methods.get(content_type, default_compress_method) + return method(data, compress_level) Added: kukit/kss.concatresource/trunk/kss/concatresource/compression/css.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/compression/css.py Wed May 2 00:45:34 2007 @@ -0,0 +1,18 @@ +'''\ +The css compressor uses the 3rdparty packer module +that is taken from Plone's ResourceRegistries. +''' + +from thirdparty.packer import CSSPacker + +csspacker_safe = CSSPacker('safe') +csspacker_full = CSSPacker('full') + +def compress(data, compress_level): + if compress_level == "safe": + return csspacker_safe.pack(data) + elif compress_level == "full": + return csspacker_full.pack(data) + else: + # none + return data Added: kukit/kss.concatresource/trunk/kss/concatresource/compression/javascript.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/compression/javascript.py Wed May 2 00:45:34 2007 @@ -0,0 +1,17 @@ +'''\ +The javascript compressor uses the 3rdparty packer module +that is taken from Plone's ResourceRegistries.''' + +from thirdparty.packer import JavascriptPacker + +jspacker_safe = JavascriptPacker('safe') +jspacker_full = JavascriptPacker('full') + +def compress(data, compress_level): + if compress_level == "safe": + return jspacker_safe.pack(data) + elif compress_level == "full": + return jspacker_full.pack(data) + else: + # none + return data Added: kukit/kss.concatresource/trunk/kss/concatresource/compression/thirdparty/LICENSE ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/compression/thirdparty/LICENSE Wed May 2 00:45:34 2007 @@ -0,0 +1,25 @@ + +packer.py is released under the MIT license. + +# packer.py +# +# Copyright (c) 2006 Florian Schulze +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + Added: kukit/kss.concatresource/trunk/kss/concatresource/compression/thirdparty/__init__.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/compression/thirdparty/__init__.py Wed May 2 00:45:34 2007 @@ -0,0 +1,4 @@ +'''\ +Module init +''' + Added: kukit/kss.concatresource/trunk/kss/concatresource/compression/thirdparty/packer.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/compression/thirdparty/packer.py Wed May 2 00:45:34 2007 @@ -0,0 +1,921 @@ +# +# packer.py +# +# Copyright (c) 2006-2007 Florian Schulze +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +import re, unittest, textwrap + + +class KeywordMapper: + def __init__(self, regexp, encoder): + if isinstance(regexp, (str, unicode)): + self.regexp = re.compile(regexp) + else: + self.regexp = regexp + self.encoder = encoder + self.mapping = {} + + def analyseKeywords(self, input): + matches = self.regexp.findall(input) + + protected = {} + keyword_count = {} + index = 0 + for match in matches: + if match not in keyword_count: + keyword_count[match] = 0 + protected[self.encoder(index)] = index + index = index + 1 + keyword_count[match] = keyword_count[match] + 1 + + for match in matches: + if match in protected and keyword_count[match]: + keyword_count[match] = 0 + + protected = {} + for match in keyword_count: + if not keyword_count[match]: + protected[match] = None + + ## sorted_matches = [(c,len(v),v) for v,c in keyword_count.iteritems()] + # the above line implements the original behaviour, the code below + # removes keywords which have not enough weight to be encoded, in total + # this saves some bytes, because the total length of the generated + # codes is a bit smaller. This needs corresponding code in the + # fast_decode javascript function of the decoder, see comment there + sorted_matches = [] + for value, count in keyword_count.iteritems(): + weight = count * len(value) + if len(value) >= weight: + keyword_count[value] = 0 + sorted_matches.append((0, value)) + else: + sorted_matches.append((weight, value)) + sorted_matches.sort() + sorted_matches.reverse() + sorted_matches = [x[-1] for x in sorted_matches] + + index = 0 + mapping = {} + for match in sorted_matches: + if not keyword_count[match]: + if match not in protected: + mapping[match] = (-1, match) + continue + while 1: + encoded = self.encoder(index) + index = index + 1 + if encoded in protected: + mapping[encoded] = (index-1, encoded) + continue + else: + break + mapping[match] = (index-1, encoded) + + return mapping + + def analyse(self, input): + self.mapping = self.analyseKeywords(input) + + def getKeywords(self): + sorted = zip(self.mapping.itervalues(), self.mapping.iterkeys()) + sorted.sort() + keywords = [] + for (index, encoded), value in sorted: + if index >= 0: + if encoded != value: + keywords.append(value) + else: + keywords.append('') + return keywords + + def sub(self, input): + def repl(m): + return self.mapping.get(m.group(0), ('', m.group(0)))[1] + return self.regexp.sub(repl, input) + + +class JavascriptKeywordMapper(KeywordMapper): + def __init__(self, regexp=None, encoder=None): + if regexp is None: + self.regexp = re.compile(r'\w+') + elif isinstance(regexp, (str, unicode)): + self.regexp = re.compile(regexp) + else: + self.regexp = regexp + if encoder is None: + self.encoder = self._encode + else: + self.encoder = encoder + self.mapping = {} + + def _encode(self, charCode, + mapping="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"): + result = [] + quotient = charCode + while quotient or not len(result): + quotient, remainder = divmod(quotient, 62) + result.append(mapping[remainder]) + result.reverse() + return "".join(result) + + def getDecodeFunction(self, fast=True, name=None): + jspacker = JavascriptPacker('full') + + # fast boot function + fast_decoder = r""" + // does the browser support String.replace where the + // replacement value is a function? + if (!''.replace(/^/, String)) { + // decode all the values we need + // we have to add the dollar prefix, because $encoded can be + // any keyword in the decode function below. For example + // 'constructor' is an attribute of any object and it would + // return a false positive match in that case. + while ($count--) $decode["$"+$encode($count)] = $keywords[$count] || $encode($count); + // global replacement function + $keywords = [function($encoded){$result = $decode["$"+$encoded]; return $result!=undefined?$result:$encoded}]; + // generic match + $encode = function(){return'\\w+'}; + // reset the loop counter - we are now doing a global replace + $count = 1; + };""" + + if name is None: + # boot function + decoder = r""" + function($packed, $ascii, $count, $keywords, $encode, $decode) { + $encode = function($charCode) { + return ($charCode < $ascii ? "" : $encode(parseInt($charCode / $ascii))) + + (($charCode = $charCode % $ascii) > 35 ? String.fromCharCode($charCode + 29) : $charCode.toString(36)); + }; + // fastDecodePlaceholder + while ($count--) + if ($keywords[$count]) + $packed = $packed.replace(new RegExp("\\b" + $encode($count) + "\\b", "g"), $keywords[$count]); + return $packed; + }""" + + if fast: + decoder = decoder.replace('// fastDecodePlaceholder', fast_decoder) + + decoder = jspacker.pack(decoder) + + else: + decoder = r""" + var %s = function($ascii, $count, $keywords, $encode, $decode) { + $encode = function($charCode) { + return ($charCode < $ascii ? "" : $encode(parseInt($charCode / $ascii))) + + (($charCode = $charCode %% $ascii) > 35 ? String.fromCharCode($charCode + 29) : $charCode.toString(36)); + }; + // fastDecodePlaceholder + var decoder = function($packed, $ascii1, $count1, $keywords1, $encode1, $decode1) { + $count1 = $count; + while ($count1--) + if ($keywords[$count1]) + $packed = $packed.replace(new RegExp("\\b" + $encode($count1) + "\\b", "g"), $keywords[$count1]); + return $packed; + }; + return decoder; + }""" % name + + if fast: + decoder = decoder.replace('// fastDecodePlaceholder', fast_decoder) + + decoder = jspacker.pack(decoder) + + keywords = self.getKeywords() + decoder = "%s(62, %i, '%s'.split('|'), 0, {});" % (decoder, len(keywords), "|".join(keywords)) + + return decoder + + def getDecoder(self, input, keyword_var=None, decode_func=None): + if keyword_var is None: + keywords = self.getKeywords() + num_keywords = len(keywords) + keywords = "|".join(keywords) + keywords = "'%s'.split('|')" % keywords + else: + keywords = keyword_var + num_keywords = len(self.getKeywords()) + + if decode_func is None: + decode_func = self.getDecodeFunction() + + escaped_single = input.replace("\\","\\\\").replace("'","\\'").replace('\n','\\n') + escaped_double = input.replace("\\","\\\\").replace('"','\\"').replace('\n','\\n') + if len(escaped_single) < len(escaped_double): + script = "'%s'" % escaped_single + else: + script = '"%s"' % escaped_double + return "eval(%s(%s,62,%i,%s,0,{}))" % (decode_func, script, + num_keywords, + keywords) + + +class Packer: + def __init__(self): + self.patterns = [] + + def copy(self): + result = Packer() + result.patterns = self.patterns[:] + return result + + def _repl(self, match): + # store protected part + self.replacelist.append(match.group(1)) + # return escaped index + return "\x00%i" % len(self.replacelist) + + def pack(self, input): + # list of protected parts + self.replacelist = [] + # escape the escapechar + output = input.replace('\x00','\x00\x00') + for regexp, replacement, keyword_encoder in self.patterns: + if replacement is None: + if keyword_encoder is None: + # protect the matched parts + output = regexp.sub(self._repl, output) + else: + mapper = KeywordMapper(regexp=regexp, + encoder=keyword_encoder) + # get keywords + mapper.analyse(output) + # replace keywords + output = mapper.sub(output) + else: + # substitute + output = regexp.sub(replacement, output) + # restore protected parts + replacelist = list(enumerate(self.replacelist)) + replacelist.reverse() # from back to front, so 1 doesn't break 10 etc. + for index, replacement in replacelist: + # we use lambda in here, so the real string is used and no escaping + # is done on it + before = len(output) + regexp = re.compile('(? n, $$name -> na, $top1 -> t1, $top2 -> t2 + def _dollar_replacement(match): + length = len(match.group(2)) + start = length - max(length - len(match.group(3)), 0) + result = match.group(1)[start:start+length] + match.group(4) + return result + self.sub(r"""((\$+)([a-zA-Z\$_]+))(\d*)\b""", _dollar_replacement) + + self.keywordSub(r"""\b_[A-Za-z\d]\w*""", lambda i: "_%i" % i) + + # protect strings + # this is more correct, but needs more testing + # it has to be more accurate because of the more aggresive packing later + self.protect(r"""(?<=return|..case|.....[=\[|(,?:+])\s*((?P['"])(?:\\(?P=quote)|\\\n|.)*?(?P=quote))""", re.DOTALL) + else: + # protect strings + # these sometimes catch to much, but in safe mode this doesn't hurt + self.protect(r"""('(?:\\'|\\\n|.)*?')""") + self.protect(r'''("(?:\\"|\\\n|.)*?")''') + # protect regular expressions + self.protect(r"""\s+(\/[^\/\n\r\*][^\/\n\r]*\/g?i?)""") + self.protect(r"""([^\w\$\/'"*)\?:]\/[^\/\n\r\*][^\/\n\r]*\/g?i?)""") + # multiline comments + self.sub(r'/\*(?!@).*?\*/', '', re.DOTALL) + # one line comments + self.sub(r'\s*//.*$', '', re.MULTILINE) + # strip whitespace at the beginning and end of each line + self.sub(r'^[ \t\r\f\v]*(.*?)[ \t\r\f\v]*$', r'\1', re.MULTILINE) + # whitespace after some special chars but not + # before function declaration + self.sub(r'([{;\[(,=&|\?:<>%!/])\s+(?!function)', r'\1') + # after an equal sign a function definition is ok + self.sub(r'=\s+(?=function)', r'=') + if level == 'full': + # whitespace after some more special chars + self.sub(r'([};\):,])\s+', r'\1') + # whitespace before some special chars + self.sub(r'\s+([={},&|\?:\.()<>%!/\]])', r'\1') + # whitespace before plus chars if no other plus char before it + self.sub(r'(? b) { + do something + } else { + do something else + }; + }; + next_instr; + """, + """\ + function dummy(a,b){if(a>b){do something} else{do something else}};next_instr;""", + 'safe' + ), + ( + 'nestedCurlyBracketsWithSemicolons', + """\ + function dummy(a, b) { + if (a > b) { + do something + } else { + do something else + }; + }; + next_instr; + """, + """\ + function dummy(a,b){if(a>b){do something}else{do something else}};next_instr;""", + 'full' + ), +) + + +css_safe_compression_tests = ( + ( + 'commentCompression', + """ + /* this is a comment */ + #testElement { + property: value; /* another comment */ + } + /**********/ + /* this is a multi + line comment */ + #testElement { + /* yet another comment */ + property: value; + } + """, + """\ + /* */ + #testElement { + property: value; /* */ + } + /* */ + #testElement { + /* */ + property: value; + } + """ + ), + ( + 'newlineCompression', + """ + + + /* this is a comment */ + + #testElement { + property: value; /* another comment */ + } + + /* this is a multi + line comment */ + #testElement { + + /* yet another comment */ + property: value; + + } + + + """, + """\ + /* */ + #testElement { + property: value; /* */ + } + /* */ + #testElement { + /* */ + property: value; + } + """ + ), + # see http://www.dithered.com/css_filters/index.html + ( + 'commentHacks1', + """ + #testElement { + property/**/: value; + property/* */: value; + property /**/: value; + property: /**/value; + } + """, + """\ + #testElement { + property/**/: value; + property/* */: value; + property /**/: value; + property: /**/value; + } + """ + ), + ( + 'commentHacks2', + """ + selector/* */ { } + """, + """\ + selector/* */ { } + """ + ), + ( + 'commentHacks3', + """ + selector/* foobar */ { } + """, + """\ + selector/* */ { } + """ + ), + ( + 'commentHacks4', + """ + selector/**/ { } + """, + """\ + selector/**/ { } + """ + ), + ( + 'commentHacks5', + """ + /* \*/ + rules + /* */ + """, + """\ + /* \*/ + rules + /* */ + """ + ), + ( + 'commentHacks6', + """ + /* foobar \*/ + rules + /* */ + """, + """\ + /* \*/ + rules + /* */ + """ + ), + ( + 'commentHacks7', + """ + /*/*/ + rules + /* */ + """, + """\ + /*/*/ + rules + /* */ + """ + ), + ( + 'commentHacks8', + """ + /*/*//*/ + rules + /* */ + """, + """\ + /*/*//*/ + rules + /* */ + """ + ), + ( + 'stringProtection', + """ + /* test string protection */ + #selector, + #another { + content: 'foo; bar'; + } + """, + """\ + /* */ + #selector, + #another { + content: 'foo; bar'; + } + """ + ), +) + +css_full_compression_tests = ( + ( + 'commentCompression', + """ + /* this is a comment */ + #testElement { + property: value; /* another comment */ + } + /**********/ + /* this is a multi + line comment */ + #testElement { + /* yet another comment */ + property: value; + } + """, + """\ + #testElement{property:value;} + #testElement{property:value;} + """ + ), + ( + 'newlineCompression', + """ + + + /* this is a comment */ + + #testElement { + property: value; /* another comment */ + } + + /* this is a multi + line comment */ + #testElement { + + /* yet another comment */ + property: value; + + } + + + """, + """\ + #testElement{property:value;} + #testElement{property:value;} + """ + ), + # see http://www.dithered.com/css_filters/index.html + # in full compression all hacks get removed + ( + 'commentHacks1', + """ + #testElement { + property/**/: value; + property/* */: value; + property /**/: value; + property: /**/value; + } + """, + """\ + #testElement{property:value;property:value;property:value;property:value;} + """ + ), + ( + 'commentHacks2', + """ + selector/* */ { } + """, + """\ + selector{} + """ + ), + ( + 'commentHacks3', + """ + selector/* foobar */ { } + """, + """\ + selector{} + """ + ), + ( + 'commentHacks4', + """ + selector/**/ { } + """, + """\ + selector{} + """ + ), + ( + 'commentHacks5', + """ + /* \*/ + rules + /* */ + """, + """\ + rules + """ + ), + ( + 'commentHacks6', + """ + /* foobar \*/ + rules + /* */ + """, + """\ + rules + """ + ), + ( + 'commentHacks7', + """ + /*/*/ + rules + /* */ + """, + """\ + rules + """ + ), + ( + 'commentHacks8', + """ + /*/*//*/ + rules + /* */ + """, + """\ + rules + """ + ), + ( + 'stringProtection', + """ + /* test string protection and full compression */ + #selector, + #another { + content: 'foo; bar'; + } + """, + """\ + #selector,#another{content:'foo; bar';} + """ + ), +) + +class PackerTestCase(unittest.TestCase): + def __init__(self, name, input, output, packer): + unittest.TestCase.__init__(self) + self.name = name + self.input = input + self.output = output + self.packer = packer + + def __str__(self): + return self.name + + def runTest(self): + self.assertEqual(self.packer.pack(self.input), self.output) + + +def test_suite(): + suite = unittest.TestSuite() + + jspacker = { + 'safe': JavascriptPacker('safe'), + 'full': JavascriptPacker('full'), + } + csspacker = { + 'safe': CSSPacker('safe'), + 'full': CSSPacker('full'), + } + + for info in js_compression_tests: + name = info[0] + input = textwrap.dedent(info[1]) + output = textwrap.dedent(info[2]) + if (len(info) == 4): + compression = info[3].split(",") + else: + compression = ("safe", "full") + + for packer in compression: + suite.addTest(PackerTestCase("%s (%s)" % (name, packer), + input, output, + jspacker[packer])) + + packer = "safe" + for name, input, output in css_safe_compression_tests: + input = textwrap.dedent(input) + output = textwrap.dedent(output) + + suite.addTest(PackerTestCase("%s (%s)" % (name, packer), + input, output, + csspacker[packer])) + + packer = "full" + for name, input, output in css_full_compression_tests: + input = textwrap.dedent(input) + output = textwrap.dedent(output) + + suite.addTest(PackerTestCase("%s (%s)" % (name, packer), + input, output, + csspacker[packer])) + + return suite + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') Added: kukit/kss.concatresource/trunk/kss/concatresource/concatfileresource.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/concatfileresource.py Wed May 2 00:45:34 2007 @@ -0,0 +1,101 @@ +'''\ + +Support for concatenation and compression of resources + +We concatenate first and compress afterwards, giving a better +chance for the compressor to optimize +''' + +from zope.interface import implements +from interfaces import IContextFile +# we are aliased to Products, hence the following absolute import +from concatresource.interfaces import IConcatResourceAddon +from fileresource import File +from compression import compress +import time +import zope.component +try: + from zope.component.interfaces import ComponentLookupError +except ImportError: + # Zope < 2.10 + from zope.component.exceptions import ComponentLookupError + +class ConcatFiles(object): + '''A resource that concatenates files and compresses the result + + It is also possible to extend the statically given list via + a utility. + ''' + implements(IContextFile) + + def __init__(self, pathlist, name, compress_level, caching, lmt_check_period): + # Path is now a list. + assert isinstance(pathlist, (list, tuple)) + # check all files, just to raise error if don't exist + for path in pathlist: + file(path, 'rb').close() + # + self.pathlist_base = pathlist + self.__name__ = name + self.compress_level = compress_level + self.caching = caching + self.lmt_check_period = lmt_check_period + # markers for pathlist modification + self.pathlist = [] + self.fileslist_changed = None + self.fileslist = [] + + def getPathList(self): + 'Gets the extended pathlist' + # we allow the list to be extended via an utility + try: + registry = zope.component.getUtility(IConcatResourceAddon, self.__name__) + except ComponentLookupError: + extend = [] + else: + extend = registry.getAddonFiles() + pathlist = self.pathlist_base + extend + return pathlist + + def getFilesList(self): + 'Gets the list of files' + ## # XXX We have two choices: + ## # 1. We only calculate the list once, on startup + ## # that is, we suppose that the file resource is + ## # called up after the extension reg has been finished + ## # and that it never changes later. + ## # 2. but it also could be like this to allow changes later: + pathlist = self.getPathList() + if pathlist != self.pathlist: + ##if not self.pathlist: + ##pathlist = self.getPathList() + # mark pathlist modification + self.pathlist = pathlist + self.fileslist_changed = time.time() + fileslist = self.fileslist = [File(path, self.__name__) for path in pathlist] + else: + fileslist = self.fileslist + return fileslist + + def getLastMod(self): + # We take in consideration that the pathlist + # itself could have changed too. + return max([f.getLastMod() for f in self.getFilesList()] + + [self.fileslist_changed]) + + def getContents(self): + fileslist = self.getFilesList() + assert fileslist, 'Must contain at least one resource.' + result = fileslist[0].getContents() + content_type = result['content_type'] + data = [result['data']] + for subres in fileslist[1:]: + d = subres.getContents() + # all elements must have the same content type. + assert d['content_type'] == content_type + data.append(d['data']) + result['data'] = '\n'.join(data) + result['compress_level'] = self.compress_level + # Do compression on the result + result['data'] = compress(**result) + return result Added: kukit/kss.concatresource/trunk/kss/concatresource/concatresource-configure.zcml ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/concatresource-configure.zcml Wed May 2 00:45:34 2007 @@ -0,0 +1 @@ + Added: kukit/kss.concatresource/trunk/kss/concatresource/concatresource-meta.zcml ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/concatresource-meta.zcml Wed May 2 00:45:34 2007 @@ -0,0 +1,2 @@ + + \ No newline at end of file Added: kukit/kss.concatresource/trunk/kss/concatresource/configure.zcml ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/configure.zcml Wed May 2 00:45:34 2007 @@ -0,0 +1,12 @@ + + + + + + + + Added: kukit/kss.concatresource/trunk/kss/concatresource/directives.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/directives.py Wed May 2 00:45:34 2007 @@ -0,0 +1,62 @@ +from zope.interface import Interface +from zope.configuration.fields import GlobalObject, Tokens, Path, \ + PythonIdentifier, MessageID +from zope.schema import TextLine, Text, Id, Choice, Float +from fields import PathList +from zope.app.component.metadirectives import IBasicViewInformation +from zope.app.publisher.browser.metadirectives import IBasicResourceInformation + +try: + from zope.security.zcml import Permission +except ImportError: + # Zope < 2.10 + from zope.app.security.fields import Permission + + +class IConcatResourceDirective(IBasicResourceInformation): + """ + Defines a concatenated browser resource + """ + + name = TextLine( + title=u"The name of the resource", + description=u""" + This is the name used in resource urls. Resource urls are of + the form site/@@/resourcename, where site is the url of + "site", a folder with a service manager. + + We make resource urls site-relative (as opposed to + content-relative) so as not to defeat caches.""", + required=True + ) + + files = PathList( + title=u"Files", + description=u"A space separated list of resource files", + required=True + ) + + compress_level = Choice( + title=u"Compress level", + description=u"Level of compression applied, by default 'safe'.", + values=(u'none', u'safe', u'full'), + required=False, + ) + + caching = Choice( + title=u"Caching strategy", + description=u"Enables caching in memory for faster debugging, by default not enabled.", + values=(u'default', u'memory'), + required=False, + ) + + lmt_check_period = Float( + title=u"Last modification time checking", + description=u"""Sets a grace period in seconds, until which the last modification times + are never fetched again from the filesystem. In other words, the system will + react after this time for recent changes. For debugging, it is best + to set this to 0, for production it can be left to the default 60.0""", + required=False, + ) + + Added: kukit/kss.concatresource/trunk/kss/concatresource/fields.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/fields.py Wed May 2 00:45:34 2007 @@ -0,0 +1,19 @@ + +from zope.schema import Text +from zope.schema.interfaces import IFromUnicode +from zope.interface import implements +import os.path + +class PathList(Text): + + implements(IFromUnicode) + + def fromUnicode(self, u): + result = [] + for u in u.split(): + if os.path.isabs(u): + path = os.path.normpath(u) + else: + path = self.context.path(u) + result.append(path) + return result Added: kukit/kss.concatresource/trunk/kss/concatresource/fileresource.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/fileresource.py Wed May 2 00:45:34 2007 @@ -0,0 +1,48 @@ +'''\ +this is a fixture of zope app's fileresource + +It correctly handles cache expiration headers and rereads +files when needed only. +''' + +from zope.interface import implements +try: + from zope.contenttype import guess_content_type +except ImportError: # BBB: Zope < 2.10 + try: + # XXX ??? What zope version needs this? + from zope.app.contenttypes import guess_content_type + except ImportError: + from zope.app.content_types import guess_content_type + +import os +from interfaces import IContextFile + +class File(object): + implements(IContextFile) + + def __init__(self, path, name): + self.path = path + self.__name__ = name + + def getLastMod(self): + return os.path.getmtime(self.path) + + def getContents(self): + ##print "***** READ", self.path + f = open(self.path, 'rb') + data = f.read() + f.close() + content_type, enc = guess_content_type(self.path, data) + return dict(data = data, content_type = content_type) + +class Image(File): + """Image objects stored in external files.""" + + def getContents(self): + d = super(Image, self).getContens() + if d ['content_type'] in (None, 'application/octet-stream'): + ext = os.path.splitext(self.path)[1] + if ext: + d['content_type'] = 'image/%s' % ext[1:] + return d Added: kukit/kss.concatresource/trunk/kss/concatresource/interfaces.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/interfaces.py Wed May 2 00:45:34 2007 @@ -0,0 +1,41 @@ + +from zope.interface import Interface +from zope.schema import Bytes, TextLine, Float + +class IContextFile(Interface): + + def getLastMod(self): + 'Returns last modification time of the file' + + def getContents(): + 'Reads the data and content type of the file' + +class ICachedResource(Interface): + + data = Bytes(title = u'The content data of the file') + + content_type = TextLine(title = u'The mime content type of the file') + + lmt = Float(title = u'Last modification timestamp') + + lmh = Float(title = u'Last modification in human readable form') + + def purgeData(self): + 'Purges the cached data' + +class IConcatResourceAddon(Interface): + '''Utility to register addons + + This can be used to dynamically extend components for a given resource. + We don't provide implementation for this here, but other + components can implement this to provide dynamic add-ons. + + The name of the utility should be the name of the resource. + ''' + + def getAddonFiles(request): + '''Returns a list of addon files. + This will be concatenated to the end of the static list. + ''' + + Added: kukit/kss.concatresource/trunk/kss/concatresource/meta.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/meta.py Wed May 2 00:45:34 2007 @@ -0,0 +1,113 @@ + +import os +from zope.security.checker import CheckerPublic, NamesChecker +from zope.configuration.exceptions import ConfigurationError +from zope.publisher.interfaces.browser import IBrowserRequest +from zope.app.component.metaconfigure import handler +from zope.interface import Interface +from resource import ConcatResourceFactory + +try: + import Products.Five +except ImportError: + __five__ = False +else: + __five__ = True + from Products.Five.metaclass import makeClass + from Products.Five.security import getSecurityInfo, protectClass, protectName,\ + initializeClass + +try: + from zope.publisher.interfaces.browser import IDefaultBrowserLayer + _layer = IDefaultBrowserLayer + __pre_3_2__ = False +except ImportError: + from zope.app.servicenames import Presentation + _layer = 'default' + __pre_3_2__ = True + +try: + from zope.component import zcml + __pre_3_3__ = False +except: + __pre_3_3__ = True + +# z3 only +allowed_names = ('GET', 'HEAD', 'publishTraverse', 'browserDefault', + 'request', '__call__') + +# We keep this in order to allow an occasional merge to browser:resource +_factory_map = { + 'files': { + 'prefix': 'ConcatResource', + 'count': 0, + 'factory': ConcatResourceFactory + }, + } + +def concatresource(_context, name, files=None, compress_level='safe', + caching='default', lmt_check_period=60.0, + layer=_layer, permission='zope.Public'): + + if not files: + raise ConfigurationError( + "Must use a files" + " attribute for concatresource directives, with at least" + " one file contained." + ) + + res = files + res_type = 'files' + factory_info = _factory_map.get(res_type) + factory_info['count'] += 1 + res_factory = factory_info['factory'] + + if __five__: + checker = None + _class_name = '%s%s' % (factory_info['prefix'], factory_info['count']) + new_class = makeClass(_class_name, (res_factory.resource,), {}) + + _context.action( + discriminator = ('five:protectClass', new_class), + callable = protectClass, + args = (new_class, permission) + ) + _context.action( + discriminator = ('five:initialize:class', new_class), + callable = initializeClass, + args = (new_class,) + ) + + else: + new_class = res_factory.resource + + if permission == 'zope.Public': + permission = CheckerPublic + + checker = NamesChecker(allowed_names, permission) + + factory = res_factory(res, name, compress_level, caching, lmt_check_period, + resource_factory=new_class, checker=checker) + + if __pre_3_2__: + _context.action( + discriminator = ('resource', name, IBrowserRequest, layer), + callable = handler, + args = (Presentation, 'provideResource', + name, IBrowserRequest, factory, layer), + ) + else: + if __pre_3_3__: + _context.action( + discriminator = ('resource', name, IBrowserRequest, layer), + callable = handler, + args = ('provideAdapter', + (layer,), Interface, name, factory, _context.info), + ) + else: + _context.action( + discriminator = ('resource', name, IBrowserRequest, layer), + callable = handler, + args = ('registerAdapter', + factory, (layer,), Interface, name, _context.info), + ) Added: kukit/kss.concatresource/trunk/kss/concatresource/meta.zcml ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/meta.zcml Wed May 2 00:45:34 2007 @@ -0,0 +1,15 @@ + + + + + + + + + Added: kukit/kss.concatresource/trunk/kss/concatresource/resource.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/resource.py Wed May 2 00:45:34 2007 @@ -0,0 +1,155 @@ +from zope.publisher.interfaces.browser import IBrowserPublisher +from zope.interface import implements +from concatfileresource import ConcatFiles +from interfaces import ICachedResource +import cachingadapter # force adapter registration + +try: + from zope.publisher.browser import BrowserView + from zope.datetime import time as timeFromDateTimeString +except ImportError: + # Zope < 2.10 + from zope.app.publisher.browser import BrowserView + from zope.app.datetimeutils import time as timeFromDateTimeString + +try: + import Products.Five +except ImportError: + __five__ = False + from zope.app.publisher.browser.resource import Resource +else: + __five__ = True + try: + # Zope 2.8 / Five 1.0.2 + from Products.Five.resource import Resource + __five_pre_1_3_ = True + except ImportError: + # Zope 2.9 / Five 1.3 + from Products.Five.browser.resource import Resource + __five_pre_1_3__ = False + +class GenericResource(BrowserView, Resource): + """A publishable resource""" + + if __five__: + #implements(IBrowserPublisher) + + def __browser_default__(self, request): + return self, (request.REQUEST_METHOD,) + + else: + implements(IBrowserPublisher) + + def publishTraverse(self, request, name): + '''See interface IBrowserPublisher''' + raise LookupError(name) + + def browserDefault(self, request): + '''See interface IBrowserPublisher''' + return getattr(self, request.method), () + + # for unit tests + def _testData(self): + return self.context.data + + def chooseContext(self): + """Choose the appropriate context""" + return self.context + + def GET(self): + """Default document""" + + file = self.chooseContext() + request = self.request + response = request.response + + # Control in-memory caching + cache_in_memory = file.caching == 'memory' + if cache_in_memory: + last_mod = file.lmt + if last_mod > file.data_last_fetched: + # force delete file contents + file.purgeData() + + # HTTP If-Modified-Since header handling. This is duplicated + # from OFS.Image.Image - it really should be consolidated + # somewhere... + if __five__: + header = request.get_header('If-Modified-Since') + else: + header = request.getHeader('If-Modified-Since', None) + if header is not None: + header = header.split(';')[0] + # Some proxies seem to send invalid date strings for this + # header. If the date string is not valid, we ignore it + # rather than raise an error to be generally consistent + # with common servers such as Apache (which can usually + # understand the screwy date string as a lucky side effect + # of the way they parse it). + try: mod_since=long(timeFromDateTimeString(header)) + except: mod_since=None + if mod_since is not None: + if not cache_in_memory: + last_mod = file.lmt + if last_mod > 0 and int(last_mod) <= mod_since: + response.setStatus(304) + return '' + + response.setHeader('Content-Type', file.content_type) + response.setHeader('Last-Modified', file.lmh) + # Cache for one day + response.setHeader('Cache-Control', 'public,max-age=86400') + data = file.data + + if not cache_in_memory: + # force delete file contents + file.purgeData() + + return data + + def HEAD(self): + file = self.chooseContext() + response = self.request.response + response.setHeader('Content-Type', file.content_type) + response.setHeader('Last-Modified', file.lmh) + # Cache for one day + response.setHeader('Cache-Control', 'public,max-age=86400') + return '' + +class ResourceFactory(object): + + factory = None + resource = None + + def __init__(self, path, name, compress_level, caching, lmt_check_period, + resource_factory=None, checker=None): + self.__name = name + self.__path = path + self.__compress_level = compress_level + self.__caching = caching + self.__lmt_check_period = lmt_check_period + if resource_factory is not None: + self.resource = resource_factory + # z3 only + self.__checker = checker + + def __call__(self, request): + try: + rsrc = self.__rsrc + except AttributeError: + # Delayed creation. That assures that registry is set up by this time. + rsrc = self.__rsrc = ICachedResource(self.factory(self.__path, self.__name, + self.__compress_level, self.__caching, self.__lmt_check_period)) + resource = self.resource(rsrc, request) + # z3 only + resource.__name__ = self.__name + if self.__checker is not None: + # z3 only + resource.__Security_checker__ = self.__checker + return resource + +class ConcatResourceFactory(ResourceFactory): + """A factory for concat resources""" + + factory = ConcatFiles + resource = GenericResource Added: kukit/kss.concatresource/trunk/kss/concatresource/test/README ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/test/README Wed May 2 00:45:34 2007 @@ -0,0 +1,5 @@ + +I yet have to add tests that work transparently with zope3 and five. + +Till then, include the configure.zmcl in this directory from the root. + Added: kukit/kss.concatresource/trunk/kss/concatresource/test/__init__.py ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/test/__init__.py Wed May 2 00:45:34 2007 @@ -0,0 +1,4 @@ +'''\ +Module init +''' + Added: kukit/kss.concatresource/trunk/kss/concatresource/test/configure.zcml ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/test/configure.zcml Wed May 2 00:45:34 2007 @@ -0,0 +1,18 @@ + + + + + + + Added: kukit/kss.concatresource/trunk/kss/concatresource/test/test1.js ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/test/test1.js Wed May 2 00:45:34 2007 @@ -0,0 +1,13 @@ + +_PythonKw = function(kw) { + this.kw = kw; + } + +_PythonKw.prototype.toJSON = function() { + var pack = {"pythonKwMaRkEr": this.kw}; + return toJSON(pack); + } + +function PythonKw(kw) { + return new _PythonKw(kw); + } Added: kukit/kss.concatresource/trunk/kss/concatresource/test/test2.js ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/test/test2.js Wed May 2 00:45:34 2007 @@ -0,0 +1,10 @@ +/* A 2nd js file */ + +/* +* +* +* +*/ + +var someContents = "Some content here, too."; +var someMoreContents = "Some more content."; From reebalazs at codespeak.net Wed May 2 00:53:59 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 2 May 2007 00:53:59 +0200 (CEST) Subject: [KSS-checkins] r42569 - kukit/kss.concatresource/trunk/kss/concatresource Message-ID: <20070501225359.5488C807F@code0.codespeak.net> Author: reebalazs Date: Wed May 2 00:53:58 2007 New Revision: 42569 Added: kukit/kss.concatresource/trunk/kss/concatresource/kss.concatresource-configure.zcml - copied, changed from r42568, kukit/kss.concatresource/trunk/kss/concatresource/concatresource-configure.zcml kukit/kss.concatresource/trunk/kss/concatresource/kss.concatresource-meta.zcml - copied, changed from r42568, kukit/kss.concatresource/trunk/kss/concatresource/concatresource-meta.zcml kukit/kss.concatresource/trunk/kss/concatresource/version.txt Removed: kukit/kss.concatresource/trunk/kss/concatresource/README kukit/kss.concatresource/trunk/kss/concatresource/concatresource-configure.zcml kukit/kss.concatresource/trunk/kss/concatresource/concatresource-meta.zcml Log: Make package egg conform Deleted: /kukit/kss.concatresource/trunk/kss/concatresource/README ============================================================================== --- /kukit/kss.concatresource/trunk/kss/concatresource/README Wed May 2 00:53:58 2007 +++ (empty file) @@ -1,137 +0,0 @@ - -Objectives ----------- - -I made this utility for the works in the jsonserver integration and -AZAX/kukit. This was meant to be a temporary, lightweight solution but it -has long term merits too. I needed this because I wanted a solution that -works right now, works on zope3 and zope 2.8 even (so zc.resourcelibraries -was not a choice), does not depend on Plone (so ResourceRegistries is out -too). - -The interesting point of the utility is: instead of building registries to -emit include tags in the HTML, it simply makes one resource that needs to -be imported in a single line:: - - - -Also: - -- it compresses the JS or CSS files with Florian Schulze's compressor - from ResourceRegistries - -- it contains an utility interface that another component can implement - to dynamically extend the list of files (like I did with AZAX). So the - "registry" is not really implemented but can be plugged in. - -- it is tested (although not much) to work with Zope 2.8, 2.9, 3.1, 3.2 - -Meanwhile I implemented the cache headers for the resources correctly -here, the current implementation of caching is broken in Five and I -believe in Z3 resources as well; beware that I considered the original -Zope3 code only and did not look at additional utilities. According to my -observation: in Z3 the original resources attempt to handle the cache -headers correctly but never really check if the file gets changed on the -filesystem (only on restart). If this is really a problem and not just I -believe, then it is fixed in my code. (Read more in the Caching part.) - -More information on this issue: - -http://article.gmane.org/gmane.comp.web.zope.z3base.general/53 - -Compression ------------ - -You can use more levels of compressions with the compress_level attribute. - - - -Some explanation: - -- compression is only implemented for JavaScript and CSS - -- The default level is "safe", this is useable with all scripts - -- The "full" level gives even better compression by taking out all newlines - and mangling private variable names, but some preparation must be made - in the scripts for that (like putting a ; after }-s I think, and - also maybe more). - -- Specifying "none" will leave your resource uncompressed. This - can be useful for debugging. - -Caching control ---------------- - -You have some possibility to control how caching of resources are done. - - - -The attribute "lmt_checking_period" controls how often the file -modification dates are checked from the filesystem. By default this is -60.0, this means that once the file modification is checked, it will not be -checked before the next 60 seconds elapses. In other words, if you change -the files on the filesystem, it will cause a maximum of this long delay -until the changes propagate to the rendered resources. For debugging this -can be set to 0 to allow immediate changes, however in production this -setup would cause the files often looked up in the filesystem, which, -especially with badly implemented filesystems can cause a problem. This -feature is already an enhancement to the original Zope 3 resource -implementation where, unless running in debug mode, changes in the resource -files will require a restart to become visible in the result. - -The attribute "caching", when set to "memory", will result that the cooked -resource will be cached in memory and looked up from them as long as the -files are unchanged. This, especially with compress options, can cause a -speedup in rendering the resources. However, in normal operation this is -not necessary at all, since if caching is set up properly, the browser and -the upstream cache asks via the "If-Modified-Since" headers if the resource -has been changed recently, and the resource itself is queried only when -needed, independently of the setup of this option. While debugging, -however, when browser caching is forced to switch off, without this option -the resource would be cooked each time the browser reloads the dependent -page, so in this case setting "caching" to "memory" causes a significant -speedup in these cases. In production however, is not only unnecessary but -also causes an additional memory consumption. - -Debug setup ------------ - -To summarize with an example, the following settings are advisable while -debugging: - - - -Release notes -------------- - -In Zope 2.9.2 there is Five 1.3.3 included. This contains a bug that -the resources will never be looked up from the -application root. - -To fix this, you need to update Five to version 1.3.5, or update Zope -to version >= 2.9.3. - - Deleted: /kukit/kss.concatresource/trunk/kss/concatresource/concatresource-configure.zcml ============================================================================== --- /kukit/kss.concatresource/trunk/kss/concatresource/concatresource-configure.zcml Wed May 2 00:53:58 2007 +++ (empty file) @@ -1 +0,0 @@ - Deleted: /kukit/kss.concatresource/trunk/kss/concatresource/concatresource-meta.zcml ============================================================================== --- /kukit/kss.concatresource/trunk/kss/concatresource/concatresource-meta.zcml Wed May 2 00:53:58 2007 +++ (empty file) @@ -1,2 +0,0 @@ - - \ No newline at end of file Copied: kukit/kss.concatresource/trunk/kss/concatresource/kss.concatresource-configure.zcml (from r42568, kukit/kss.concatresource/trunk/kss/concatresource/concatresource-configure.zcml) ============================================================================== --- kukit/kss.concatresource/trunk/kss/concatresource/concatresource-configure.zcml (original) +++ kukit/kss.concatresource/trunk/kss/concatresource/kss.concatresource-configure.zcml Wed May 2 00:53:58 2007 @@ -1 +1 @@ - + Copied: kukit/kss.concatresource/trunk/kss/concatresource/kss.concatresource-meta.zcml (from r42568, kukit/kss.concatresource/trunk/kss/concatresource/concatresource-meta.zcml) ============================================================================== --- kukit/kss.concatresource/trunk/kss/concatresource/concatresource-meta.zcml (original) +++ kukit/kss.concatresource/trunk/kss/concatresource/kss.concatresource-meta.zcml Wed May 2 00:53:58 2007 @@ -1,2 +1 @@ - - \ No newline at end of file + Added: kukit/kss.concatresource/trunk/kss/concatresource/version.txt ============================================================================== --- (empty file) +++ kukit/kss.concatresource/trunk/kss/concatresource/version.txt Wed May 2 00:53:58 2007 @@ -0,0 +1 @@ +1.2dev Unreleased From nouri at codespeak.net Wed May 2 16:12:08 2007 From: nouri at codespeak.net (nouri at codespeak.net) Date: Wed, 2 May 2007 16:12:08 +0200 (CEST) Subject: [KSS-checkins] r42578 - in kukit/kss.core/trunk/kss/core: . pluginregistry Message-ID: <20070502141208.6A438807F@code0.codespeak.net> Author: nouri Date: Wed May 2 16:12:07 2007 New Revision: 42578 Modified: kukit/kss.core/trunk/kss/core/BeautifulSoup.py kukit/kss.core/trunk/kss/core/pluginregistry/selector_type.py Log: Fix NameErrors Modified: kukit/kss.core/trunk/kss/core/BeautifulSoup.py ============================================================================== --- kukit/kss.core/trunk/kss/core/BeautifulSoup.py (original) +++ kukit/kss.core/trunk/kss/core/BeautifulSoup.py Wed May 2 16:12:07 2007 @@ -857,7 +857,7 @@ """Convenience method that works with all 2.x versions of Python to determine whether or not something is stringlike.""" try: - return isinstance(s, unicode) or isintance(s, basestring) + return isinstance(s, unicode) or isinstance(s, basestring) except NameError: return isinstance(s, str) Modified: kukit/kss.core/trunk/kss/core/pluginregistry/selector_type.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/selector_type.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/selector_type.py Wed May 2 16:12:07 2007 @@ -1,5 +1,6 @@ from plugin import AzaxPlugin +from plugin import AzaxPluginError from interfaces import ISelectorType import zope.component as capi from zope.interface import implements From reebalazs at codespeak.net Wed May 2 18:17:12 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 2 May 2007 18:17:12 +0200 (CEST) Subject: [KSS-checkins] r42579 - kukit/kss.concatresource/trunk/docs Message-ID: <20070502161712.C4035807F@code0.codespeak.net> Author: reebalazs Date: Wed May 2 18:17:06 2007 New Revision: 42579 Added: kukit/kss.concatresource/trunk/docs/README.txt - copied unchanged from r42568, kukit/kss.concatresource/trunk/kss/concatresource/README Log: Add back the readme From reebalazs at codespeak.net Wed May 2 18:20:28 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 2 May 2007 18:20:28 +0200 (CEST) Subject: [KSS-checkins] r42580 - kukit/kss.core/branch/ree-stripout-comments Message-ID: <20070502162028.640408080@code0.codespeak.net> Author: reebalazs Date: Wed May 2 18:20:28 2007 New Revision: 42580 Added: kukit/kss.core/branch/ree-stripout-comments/ - copied from r42579, kukit/kss.core/branch/performance_improvement/ Log: Branch off From reebalazs at codespeak.net Wed May 2 18:21:47 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 2 May 2007 18:21:47 +0200 (CEST) Subject: [KSS-checkins] r42581 - kukit/kukit.js/branch/ree-stripout-comments Message-ID: <20070502162147.27687807F@code0.codespeak.net> Author: reebalazs Date: Wed May 2 18:21:46 2007 New Revision: 42581 Added: kukit/kukit.js/branch/ree-stripout-comments/ - copied from r42580, kukit/kukit.js/branch/performance_improvement/ Log: Branch off From reebalazs at codespeak.net Wed May 2 18:24:02 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 2 May 2007 18:24:02 +0200 (CEST) Subject: [KSS-checkins] r42582 - kukit/kss.concatresource/branch/ree-stripout-comments Message-ID: <20070502162402.C798A807F@code0.codespeak.net> Author: reebalazs Date: Wed May 2 18:24:02 2007 New Revision: 42582 Added: kukit/kss.concatresource/branch/ree-stripout-comments/ - copied from r42581, kukit/kss.concatresource/trunk/ Log: Branch off From reebalazs at codespeak.net Wed May 2 18:33:33 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 2 May 2007 18:33:33 +0200 (CEST) Subject: [KSS-checkins] r42583 - in kukit/kss.core/branch/ree-stripout-comments/kss/core: . pluginregistry Message-ID: <20070502163333.BAE778076@code0.codespeak.net> Author: reebalazs Date: Wed May 2 18:33:33 2007 New Revision: 42583 Modified: kukit/kss.core/branch/ree-stripout-comments/kss/core/ (props changed) kukit/kss.core/branch/ree-stripout-comments/kss/core/EXTERNALS.TXT kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/ (props changed) kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/EXTERNALS.TXT Log: Set externals for the new branch Modified: kukit/kss.core/branch/ree-stripout-comments/kss/core/EXTERNALS.TXT ============================================================================== --- kukit/kss.core/branch/ree-stripout-comments/kss/core/EXTERNALS.TXT (original) +++ kukit/kss.core/branch/ree-stripout-comments/kss/core/EXTERNALS.TXT Wed May 2 18:33:33 2007 @@ -5,4 +5,4 @@ # You can update your working dir by: # svn propset svn:externals -F EXTERNALS.TXT . # -kukit http://codespeak.net/svn/kukit/kukit.js/branch/performance_improvement +kukit http://codespeak.net/svn/kukit/kukit.js/branch/ree-stripout-comments Modified: kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/EXTERNALS.TXT ============================================================================== --- kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/EXTERNALS.TXT (original) +++ kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/EXTERNALS.TXT Wed May 2 18:33:33 2007 @@ -7,4 +7,4 @@ # # concatresource is now included like as batteries -_concatresource http://codespeak.net/svn/z3/jsonserver/branch/merge/concatresource +_concatresource https://codespeak.net/svn/kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource From reebalazs at codespeak.net Wed May 2 19:20:31 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 2 May 2007 19:20:31 +0200 (CEST) Subject: [KSS-checkins] r42587 - in kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource: . compression Message-ID: <20070502172031.550548081@code0.codespeak.net> Author: reebalazs Date: Wed May 2 19:20:30 2007 New Revision: 42587 Modified: kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/compression/javascript.py kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/directives.py Log: Added stripped, devel, safe-devel, full-devel directives. The standard compressions changed to come with ;;; stripout. Modified: kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/compression/javascript.py ============================================================================== --- kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/compression/javascript.py (original) +++ kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/compression/javascript.py Wed May 2 19:20:30 2007 @@ -7,11 +7,41 @@ jspacker_safe = JavascriptPacker('safe') jspacker_full = JavascriptPacker('full') +def stripout_comments(data): + 'Strips out ;;; lines from the data.' + result = [] + for line in data.splitlines(True): + if not line.lstrip().startswith(';;;'): + result.append(line) + return ''.join(result) + +def remove_markers(data): + 'Removes the ;;; markers but leaves the lines.' + result = [] + for line in data.splitlines(True): + if line.lstrip().startswith(';;;'): + line = line.lstrip()[3:] + result.append(line) + return ''.join(result) + def compress(data, compress_level): - if compress_level == "safe": + if compress_level == "devel": + return remove_markers(data) + elif compress_level == "stripped": + return stripout_comments(data) + elif compress_level == "safe": + data = stripout_comments(data) return jspacker_safe.pack(data) elif compress_level == "full": + data = stripout_comments(data) + return jspacker_full.pack(data) + elif compress_level == "safe-devel": + date = remove_markers(data) + return jspacker_safe.pack(data) + elif compress_level == "full-devel": + date = remove_markers(data) return jspacker_full.pack(data) else: # none + ##date = remove_markers(data) return data Modified: kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/directives.py ============================================================================== --- kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/directives.py (original) +++ kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/directives.py Wed May 2 19:20:30 2007 @@ -39,7 +39,7 @@ compress_level = Choice( title=u"Compress level", description=u"Level of compression applied, by default 'safe'.", - values=(u'none', u'safe', u'full'), + values=(u'none', u'safe', u'full', u'stripped', u'devel', u'safe-devel', u'full-devel'), required=False, ) From reebalazs at codespeak.net Thu May 3 08:18:25 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Thu, 3 May 2007 08:18:25 +0200 (CEST) Subject: [KSS-checkins] r42602 - kukit/kss.core/trunk/kss/core/pluginregistry Message-ID: <20070503061825.811E4807C@code0.codespeak.net> Author: reebalazs Date: Thu May 3 08:18:24 2007 New Revision: 42602 Modified: kukit/kss.core/trunk/kss/core/pluginregistry/ (props changed) kukit/kss.core/trunk/kss/core/pluginregistry/EXTERNALS.TXT Log: Switch to kss.concatresource trunk in externals Modified: kukit/kss.core/trunk/kss/core/pluginregistry/EXTERNALS.TXT ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/EXTERNALS.TXT (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/EXTERNALS.TXT Thu May 3 08:18:24 2007 @@ -7,4 +7,4 @@ # # concatresource is now included like as batteries -_concatresource http://codespeak.net/svn/z3/jsonserver/branch/merge/concatresource +_concatresource https://codespeak.net/svn/kukit/kss.concatresource/trunk/kss/concatresource From reebalazs at codespeak.net Thu May 3 08:21:30 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Thu, 3 May 2007 08:21:30 +0200 (CEST) Subject: [KSS-checkins] r42603 - kukit/kss.core/branch/performance_improvement/kss/core/pluginregistry Message-ID: <20070503062130.22763807C@code0.codespeak.net> Author: reebalazs Date: Thu May 3 08:21:29 2007 New Revision: 42603 Modified: kukit/kss.core/branch/performance_improvement/kss/core/pluginregistry/ (props changed) kukit/kss.core/branch/performance_improvement/kss/core/pluginregistry/EXTERNALS.TXT Log: Switch to kss.concatresource trunk in externals Modified: kukit/kss.core/branch/performance_improvement/kss/core/pluginregistry/EXTERNALS.TXT ============================================================================== --- kukit/kss.core/branch/performance_improvement/kss/core/pluginregistry/EXTERNALS.TXT (original) +++ kukit/kss.core/branch/performance_improvement/kss/core/pluginregistry/EXTERNALS.TXT Thu May 3 08:21:29 2007 @@ -7,4 +7,4 @@ # # concatresource is now included like as batteries -_concatresource http://codespeak.net/svn/z3/jsonserver/branch/merge/concatresource +_concatresource https://codespeak.net/svn/kukit/kss.concatresource/trunk/kss/concatresource From reebalazs at codespeak.net Thu May 3 08:31:34 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Thu, 3 May 2007 08:31:34 +0200 (CEST) Subject: [KSS-checkins] r42604 - kukit/kss.concatresource/trunk/kss/concatresource/compression Message-ID: <20070503063134.D9F64807C@code0.codespeak.net> Author: reebalazs Date: Thu May 3 08:31:34 2007 New Revision: 42604 Modified: kukit/kss.concatresource/trunk/kss/concatresource/compression/css.py kukit/kss.concatresource/trunk/kss/concatresource/compression/javascript.py Log: The packer needs to be created for each packing Modified: kukit/kss.concatresource/trunk/kss/concatresource/compression/css.py ============================================================================== --- kukit/kss.concatresource/trunk/kss/concatresource/compression/css.py (original) +++ kukit/kss.concatresource/trunk/kss/concatresource/compression/css.py Thu May 3 08:31:34 2007 @@ -4,14 +4,14 @@ ''' from thirdparty.packer import CSSPacker - -csspacker_safe = CSSPacker('safe') -csspacker_full = CSSPacker('full') +# Packer needs to be created for each packing def compress(data, compress_level): if compress_level == "safe": + csspacker_safe = CSSPacker('safe') return csspacker_safe.pack(data) elif compress_level == "full": + csspacker_full = CSSPacker('full') return csspacker_full.pack(data) else: # none Modified: kukit/kss.concatresource/trunk/kss/concatresource/compression/javascript.py ============================================================================== --- kukit/kss.concatresource/trunk/kss/concatresource/compression/javascript.py (original) +++ kukit/kss.concatresource/trunk/kss/concatresource/compression/javascript.py Thu May 3 08:31:34 2007 @@ -3,14 +3,14 @@ that is taken from Plone's ResourceRegistries.''' from thirdparty.packer import JavascriptPacker - -jspacker_safe = JavascriptPacker('safe') -jspacker_full = JavascriptPacker('full') +# Packer needs to be created for each packing def compress(data, compress_level): if compress_level == "safe": + jspacker_safe = JavascriptPacker('safe') return jspacker_safe.pack(data) elif compress_level == "full": + jspacker_full = JavascriptPacker('full') return jspacker_full.pack(data) else: # none From reebalazs at codespeak.net Thu May 3 08:39:38 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Thu, 3 May 2007 08:39:38 +0200 (CEST) Subject: [KSS-checkins] r42605 - kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/compression Message-ID: <20070503063938.301A2807C@code0.codespeak.net> Author: reebalazs Date: Thu May 3 08:39:37 2007 New Revision: 42605 Modified: kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/compression/css.py kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/compression/javascript.py Log: Merge -r42603:42604 from trunk: The packer needs to be created for each packing Modified: kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/compression/css.py ============================================================================== --- kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/compression/css.py (original) +++ kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/compression/css.py Thu May 3 08:39:37 2007 @@ -4,14 +4,14 @@ ''' from thirdparty.packer import CSSPacker - -csspacker_safe = CSSPacker('safe') -csspacker_full = CSSPacker('full') +# Packer needs to be created for each packing def compress(data, compress_level): if compress_level == "safe": + csspacker_safe = CSSPacker('safe') return csspacker_safe.pack(data) elif compress_level == "full": + csspacker_full = CSSPacker('full') return csspacker_full.pack(data) else: # none Modified: kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/compression/javascript.py ============================================================================== --- kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/compression/javascript.py (original) +++ kukit/kss.concatresource/branch/ree-stripout-comments/kss/concatresource/compression/javascript.py Thu May 3 08:39:37 2007 @@ -3,9 +3,7 @@ that is taken from Plone's ResourceRegistries.''' from thirdparty.packer import JavascriptPacker - -jspacker_safe = JavascriptPacker('safe') -jspacker_full = JavascriptPacker('full') +# Packer needs to be created for each packing def stripout_comments(data): 'Strips out ;;; lines from the data.' @@ -31,15 +29,19 @@ return stripout_comments(data) elif compress_level == "safe": data = stripout_comments(data) + jspacker_safe = JavascriptPacker('safe') return jspacker_safe.pack(data) elif compress_level == "full": data = stripout_comments(data) + jspacker_full = JavascriptPacker('full') return jspacker_full.pack(data) elif compress_level == "safe-devel": date = remove_markers(data) + jspacker_safe = JavascriptPacker('safe') return jspacker_safe.pack(data) elif compress_level == "full-devel": date = remove_markers(data) + jspacker_full = JavascriptPacker('full') return jspacker_full.pack(data) else: # none From reebalazs at codespeak.net Thu May 3 08:42:32 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Thu, 3 May 2007 08:42:32 +0200 (CEST) Subject: [KSS-checkins] r42606 - kukit/kss.concatresource/tag/initial-import Message-ID: <20070503064232.11B70807C@code0.codespeak.net> Author: reebalazs Date: Thu May 3 08:42:31 2007 New Revision: 42606 Added: kukit/kss.concatresource/tag/initial-import/ - copied from r42564, kukit/kss.concatresource/trunk/ Log: Marking initial import with a tag From reebalazs at codespeak.net Thu May 3 08:44:04 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Thu, 3 May 2007 08:44:04 +0200 (CEST) Subject: [KSS-checkins] r42607 - kukit/kss.concatresource/tag/initial-import/trunk Message-ID: <20070503064404.B2A0F807C@code0.codespeak.net> Author: reebalazs Date: Thu May 3 08:44:03 2007 New Revision: 42607 Added: kukit/kss.concatresource/tag/initial-import/trunk/ - copied from r42568, kukit/kss.concatresource/trunk/ Log: Marking initial import with a tag From reebalazs at codespeak.net Thu May 3 08:58:38 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Thu, 3 May 2007 08:58:38 +0200 (CEST) Subject: [KSS-checkins] r42608 - in kukit/kss.core/branch/ree-stripout-comments/kss/core: . pluginregistry Message-ID: <20070503065838.88BD4807C@code0.codespeak.net> Author: reebalazs Date: Thu May 3 08:58:37 2007 New Revision: 42608 Modified: kukit/kss.core/branch/ree-stripout-comments/kss/core/BeautifulSoup.py kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/selector_type.py Log: Merge -r42577:42578 from trunk: fix name errors in BeautifulSoup and in the selector types registry. Modified: kukit/kss.core/branch/ree-stripout-comments/kss/core/BeautifulSoup.py ============================================================================== --- kukit/kss.core/branch/ree-stripout-comments/kss/core/BeautifulSoup.py (original) +++ kukit/kss.core/branch/ree-stripout-comments/kss/core/BeautifulSoup.py Thu May 3 08:58:37 2007 @@ -857,7 +857,7 @@ """Convenience method that works with all 2.x versions of Python to determine whether or not something is stringlike.""" try: - return isinstance(s, unicode) or isintance(s, basestring) + return isinstance(s, unicode) or isinstance(s, basestring) except NameError: return isinstance(s, str) Modified: kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/selector_type.py ============================================================================== --- kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/selector_type.py (original) +++ kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/selector_type.py Thu May 3 08:58:37 2007 @@ -1,5 +1,6 @@ from plugin import AzaxPlugin +from plugin import AzaxPluginError from interfaces import ISelectorType import zope.component as capi from zope.interface import implements From reebalazs at codespeak.net Thu May 3 08:59:32 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Thu, 3 May 2007 08:59:32 +0200 (CEST) Subject: [KSS-checkins] r42609 - in kukit/kss.core/branch/performance_improvement/kss/core: . pluginregistry Message-ID: <20070503065932.CC8B28078@code0.codespeak.net> Author: reebalazs Date: Thu May 3 08:59:31 2007 New Revision: 42609 Modified: kukit/kss.core/branch/performance_improvement/kss/core/BeautifulSoup.py kukit/kss.core/branch/performance_improvement/kss/core/pluginregistry/selector_type.py Log: Merge -r42577:42578 from trunk: fix name errors in BeautifulSoup and in the selector types registry. Modified: kukit/kss.core/branch/performance_improvement/kss/core/BeautifulSoup.py ============================================================================== --- kukit/kss.core/branch/performance_improvement/kss/core/BeautifulSoup.py (original) +++ kukit/kss.core/branch/performance_improvement/kss/core/BeautifulSoup.py Thu May 3 08:59:31 2007 @@ -857,7 +857,7 @@ """Convenience method that works with all 2.x versions of Python to determine whether or not something is stringlike.""" try: - return isinstance(s, unicode) or isintance(s, basestring) + return isinstance(s, unicode) or isinstance(s, basestring) except NameError: return isinstance(s, str) Modified: kukit/kss.core/branch/performance_improvement/kss/core/pluginregistry/selector_type.py ============================================================================== --- kukit/kss.core/branch/performance_improvement/kss/core/pluginregistry/selector_type.py (original) +++ kukit/kss.core/branch/performance_improvement/kss/core/pluginregistry/selector_type.py Thu May 3 08:59:31 2007 @@ -1,5 +1,6 @@ from plugin import AzaxPlugin +from plugin import AzaxPluginError from interfaces import ISelectorType import zope.component as capi from zope.interface import implements From reebalazs at codespeak.net Thu May 3 14:13:46 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Thu, 3 May 2007 14:13:46 +0200 (CEST) Subject: [KSS-checkins] r42625 - kukit/azax/branch/1.1-performance_improvement Message-ID: <20070503121346.E7F1B8075@code0.codespeak.net> Author: reebalazs Date: Thu May 3 14:13:45 2007 New Revision: 42625 Added: kukit/azax/branch/1.1-performance_improvement/ - copied from r42624, kukit/azax/branch/1.1-ree-load-event-cleanup/ Log: Copy branch From reebalazs at codespeak.net Thu May 3 14:24:00 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Thu, 3 May 2007 14:24:00 +0200 (CEST) Subject: [KSS-checkins] r42626 - in kukit/azax/branch/1.1-performance_improvement: . pluginregistry Message-ID: <20070503122400.4BE628075@code0.codespeak.net> Author: reebalazs Date: Thu May 3 14:23:59 2007 New Revision: 42626 Modified: kukit/azax/branch/1.1-performance_improvement/ (props changed) kukit/azax/branch/1.1-performance_improvement/EXTERNALS.TXT kukit/azax/branch/1.1-performance_improvement/pluginregistry/ (props changed) kukit/azax/branch/1.1-performance_improvement/pluginregistry/EXTERNALS.TXT Log: Fix externals Modified: kukit/azax/branch/1.1-performance_improvement/EXTERNALS.TXT ============================================================================== --- kukit/azax/branch/1.1-performance_improvement/EXTERNALS.TXT (original) +++ kukit/azax/branch/1.1-performance_improvement/EXTERNALS.TXT Thu May 3 14:23:59 2007 @@ -5,5 +5,5 @@ # You can update your working dir by: # svn propset svn:externals -F EXTERNALS.TXT . # -kukit http://codespeak.net/svn/kukit/kukit.js/branch/ree-load-event-cleanup +kukit http://codespeak.net/svn/kukit/kukit.js/branch/performance_improvement configfeature http://codespeak.net/svn/z3/jsonserver/branch/merge/configfeature Modified: kukit/azax/branch/1.1-performance_improvement/pluginregistry/EXTERNALS.TXT ============================================================================== --- kukit/azax/branch/1.1-performance_improvement/pluginregistry/EXTERNALS.TXT (original) +++ kukit/azax/branch/1.1-performance_improvement/pluginregistry/EXTERNALS.TXT Thu May 3 14:23:59 2007 @@ -7,4 +7,4 @@ # # concatresource is now included like as batteries -_concatresource http://codespeak.net/svn/z3/jsonserver/branch/merge/concatresource +_concatresource http://codespeak.net/svn/kukit/kss.concatresource/trunk/kss/concatresource From reebalazs at codespeak.net Sun May 6 09:15:21 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Sun, 6 May 2007 09:15:21 +0200 (CEST) Subject: [KSS-checkins] r42726 - kukit/kukit.js/branch/ree-stripout-comments/kukit Message-ID: <20070506071521.0BACB807C@code0.codespeak.net> Author: reebalazs Date: Sun May 6 09:15:21 2007 New Revision: 42726 Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/kssparser.js Log: replace '\' in the parser to '\x5c', obviously confuses the full packer Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/kssparser.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/kssparser.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/kssparser.js Sun May 6 09:15:21 2007 @@ -36,7 +36,7 @@ kukit.kssp.colon = kukit.tk.mkToken('colon', ":"); kukit.kssp.quote = kukit.tk.mkToken('quote', "'"); kukit.kssp.dquote = kukit.tk.mkToken('dquote', '"'); -kukit.kssp.backslash = kukit.tk.mkToken('backslash', '\\'); +kukit.kssp.backslash = kukit.tk.mkToken('backslash', '\x5c'); kukit.kssp.comma = kukit.tk.mkToken('comma', ","); kukit.kssp.equals = kukit.tk.mkToken('equals', "="); @@ -409,7 +409,7 @@ */ kukit.kssp.String = kukit.tk.mkParser('string', { "'": 'this.emitAndReturn(new kukit.kssp.quote(this.src))', - "\\": 'new kukit.kssp.Backslashed(this.src, kukit.kssp.backslash)' + '\x5c': 'new kukit.kssp.Backslashed(this.src, kukit.kssp.backslash)' }); kukit.kssp.String.prototype.process = function() { // collect up the value of the string, omitting the quotes @@ -424,7 +424,7 @@ */ kukit.kssp.String2 = kukit.tk.mkParser('string', { '"': 'this.emitAndReturn(new kukit.kssp.dquote(this.src))', - "\\": 'new kukit.kssp.Backslashed(this.src, kukit.kssp.backslash)' + '\x5c': 'new kukit.kssp.Backslashed(this.src, kukit.kssp.backslash)' }); kukit.kssp.String2.prototype.process = kukit.kssp.String.prototype.process; From reebalazs at codespeak.net Sun May 6 09:46:59 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Sun, 6 May 2007 09:46:59 +0200 (CEST) Subject: [KSS-checkins] r42728 - kukit/kukit.js/branch/ree-stripout-comments/kukit Message-ID: <20070506074659.6FC33807C@code0.codespeak.net> Author: reebalazs Date: Sun May 6 09:46:59 2007 New Revision: 42728 Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js kukit/kukit.js/branch/ree-stripout-comments/kukit/plugin.js Log: Fix semicolons to enable full packing Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js Sun May 6 09:46:59 2007 @@ -522,7 +522,7 @@ kukit.er.BinderInfo.prototype.processBindingEvents = function () { // We came to the end of the binding phase. Now we process all our binding // events, This will do the actual binding on the browser side. - this.binding.processBindingEvents(this.binderinstance) + this.binding.processBindingEvents(this.binderinstance); // Now we to add these to the new ones. this.binding.propagateTo(this.bound); // Delete them from the registry, to protect against accidents. Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/plugin.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/plugin.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/plugin.js Sun May 6 09:46:59 2007 @@ -370,7 +370,7 @@ kukit.engine.bindScheduler.addPost(func_to_bind, 'Execute iload event for iframe ' + iloadoper.node.name); }; new kukit.dom.EmbeddedContentLoadedScheduler(iloadoper.node.id, f, iloadoper.parms.autodetect); - } + }; kukit.engine.bindScheduler.addPost(g, 'Schedule iload event for iframe ' + iloadoper.node.name); } else { kukit.logDebug('EventRule #' + iloadoper.eventrule.getNr() + ' mergeid ' + iloadoper.eventrule.kss_selector.mergeid + ' event selected normal postponed execution.'); From reebalazs at codespeak.net Sun May 6 11:21:49 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Sun, 6 May 2007 11:21:49 +0200 (CEST) Subject: [KSS-checkins] r42734 - kukit/kukit.js/branch/ree-stripout-comments/kukit Message-ID: <20070506092149.411D9807F@code0.codespeak.net> Author: reebalazs Date: Sun May 6 11:21:48 2007 New Revision: 42734 Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/actionreg.js kukit/kukit.js/branch/ree-stripout-comments/kukit/commandprocessor.js kukit/kukit.js/branch/ree-stripout-comments/kukit/commandreg.js kukit/kukit.js/branch/ree-stripout-comments/kukit/dom.js kukit/kukit.js/branch/ree-stripout-comments/kukit/errors.js kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js kukit/kukit.js/branch/ree-stripout-comments/kukit/forms.js kukit/kukit.js/branch/ree-stripout-comments/kukit/kssparser.js kukit/kukit.js/branch/ree-stripout-comments/kukit/kukit.js kukit/kukit.js/branch/ree-stripout-comments/kukit/oper.js kukit/kukit.js/branch/ree-stripout-comments/kukit/plugin.js kukit/kukit.js/branch/ree-stripout-comments/kukit/providerreg.js kukit/kukit.js/branch/ree-stripout-comments/kukit/requestmanager.js kukit/kukit.js/branch/ree-stripout-comments/kukit/resourcedata.js kukit/kukit.js/branch/ree-stripout-comments/kukit/selectorreg.js kukit/kukit.js/branch/ree-stripout-comments/kukit/serveraction.js kukit/kukit.js/branch/ree-stripout-comments/kukit/tokenizer.js kukit/kukit.js/branch/ree-stripout-comments/kukit/utils.js Log: First commentification of the full source Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/actionreg.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/actionreg.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/actionreg.js Sun May 6 11:21:48 2007 @@ -32,12 +32,12 @@ }; kukit.ar.ActionRegistry.prototype.register = function(name, func) { - if (typeof(func) == 'undefined') { - throw 'func argument is mandatory when registering an action (ActionRegistry.register).'; - } + ;;; if (typeof(func) == 'undefined') { + ;;; throw 'func argument is mandatory when registering an action (ActionRegistry.register).'; + ;;; } if (this.content[name]) { // Do not allow redefinition - kukit.logError('Error : action "' + name + '" already registered.'); + ;;; kukit.logError('Error : action "' + name + '" already registered.'); return; } this.content[name] = func; @@ -52,7 +52,8 @@ var func = this.content[name]; if (! func) { // not found - throw 'Error : undefined local action "' + name + '"'; + ;;; throw 'Error : undefined local action "' + name + '"'; + throw 'E'; //kukit.logError('Error : undefined action ' + name); } return func; @@ -65,7 +66,7 @@ kukit.ar.actionRegistry = {}; kukit.ar.actionRegistry.register = function(name, func) { - kukit.logWarning('Deprecated kukit.ar.actionRegistry.register, use kukit.actionsGlobalRegistry.register instead! (' + name + ')'); + ;;; kukit.logWarning('Deprecated kukit.ar.actionRegistry.register, use kukit.actionsGlobalRegistry.register instead! (' + name + ')'); kukit.actionsGlobalRegistry.register(name, func); }; Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/commandprocessor.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/commandprocessor.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/commandprocessor.js Sun May 6 11:21:48 2007 @@ -30,8 +30,8 @@ }; kukit.cp.CommandProcessor.prototype.parseCommands = function(commands, transport) { - kukit.log('Parse commands'); - kukit.logDebug('Number of commands: ' + commands.length); + ;;; kukit.log('Parse commands'); + ;;; kukit.logDebug('Number of commands: ' + commands.length); for (var y=0;y < commands.length;y++) { var command = commands[y]; this.parseCommand(command, transport); @@ -41,7 +41,8 @@ // we make sure we execute none of them. var lastcommand = this.commands[this.commands.length-1]; if (lastcommand.name == 'error') { - throw new kukit.err.ExplicitError(lastcommand); + ;;; throw new kukit.err.ExplicitError(lastcommand); + throw 'E'; } } }; @@ -110,16 +111,16 @@ var commands = this.commands; for (var y=0;y < commands.length;y++) { var command = commands[y]; - try { + ;;; try { command.execute(oper); - } catch (e) { - if (e.name == 'RuleMergeError' || e.name == 'EventBindError') { - throw(e); - } else { - // augment the error message - throw new kukit.err.CommandExecutionError(e, command); - } - } + ;;; } catch (e) { + ;;; if (e.name == 'RuleMergeError' || e.name == 'EventBindError') { + ;;; throw(e); + ;;; } else { + ;;; // augment the error message + ;;; throw new kukit.err.CommandExecutionError(e, command); + ;;; } + ;;; } } kukit.engine.finishSetupEventsCollection(); }; Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/commandreg.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/commandreg.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/commandreg.js Sun May 6 11:21:48 2007 @@ -57,7 +57,7 @@ kukit.cr.CommandRegistry.prototype.register = function(name, klass) { if (this.commands[name]) { // Do not allow redefinition - kukit.logError('ValueError : command "' + name + '" is already registered.'); + ;;; kukit.logError('ValueError : command "' + name + '" is already registered.'); return; } this.commands[name] = klass; @@ -65,10 +65,10 @@ kukit.cr.CommandRegistry.prototype.get = function(name) { var klass = this.commands[name]; - if (! klass) { - // not found - kukit.logError('ValueError : no command registered under name : ' + name); - } + ;;; if (! klass) { + ;;; // not found + ;;; kukit.logError('ValueError : no command registered under name : ' + name); + ;;; } return klass; }; @@ -79,7 +79,7 @@ kukit.cr.commandRegistry = {}; kukit.cr.commandRegistry.registerFromAction = function(srcname, factory, name) { - kukit.logWarning('Deprecated kukit.cr.commandRegistry.registerFromAction, use kukit.commandsGlobalRegistry.registerFromAction instead! (' + srcname + ')'); + ;;; kukit.logWarning('Deprecated kukit.cr.commandRegistry.registerFromAction, use kukit.commandsGlobalRegistry.registerFromAction instead! (' + srcname + ')'); kukit.commandsGlobalRegistry.registerFromAction(srcname, factory, name); }; @@ -108,20 +108,20 @@ kukit.cr._Command_execute_selector = function(oper) { var selfunc = kukit.selectorTypesGlobalRegistry.get(this.selectorType); var nodes = selfunc(this.selector, null, oper.orignode); - var printtype; - if (this.selectorType) { - printtype = this.selectorType; - } else { - printtype = 'default (' + kukit.selectorTypesGlobalRegistry.defaultSelectorType + ')'; - } - kukit.logDebug('Selector type: ' + printtype + ', selector : "' + this.selector + '", selected nodes:' + nodes.length); - if (!nodes || nodes.length == 0) { - kukit.logWarning('Selector found no nodes'); - } + ;;; var printtype; + ;;; if (this.selectorType) { + ;;; printtype = this.selectorType; + ;;; } else { + ;;; printtype = 'default (' + kukit.selectorTypesGlobalRegistry.defaultSelectorType + ')'; + ;;; } + ;;; kukit.logDebug('Selector type: ' + printtype + ', selector : "' + this.selector + '", selected nodes:' + nodes.length); + ;;; if (!nodes || nodes.length == 0) { + ;;; kukit.logWarning('Selector found no nodes'); + ;;; } for (var i=0;i < nodes.length;i++) { oper.node = nodes[i]; //XXX error handling for wrong command name - kukit.logDebug('Command Name: ' + this.name); + ;;; kukit.logDebug('Command Name: ' + this.name); this.executeOnSingleNode(oper); } }; Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/dom.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/dom.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/dom.js Sun May 6 11:21:48 2007 @@ -137,10 +137,10 @@ kukit.dom._cssQuery = function(selector, in_nodes) { var USE_BASE2 = (typeof(base2) != 'undefined'); if (USE_BASE2) { - kukit.log('Using cssQuery from base2'); + ;;; kukit.log('Using cssQuery from base2'); kukit.dom._cssQuery = kukit.dom._cssQuery_base2 } else { - kukit.log('Using original cssQuery'); + ;;; kukit.log('Using original cssQuery'); kukit.dom._cssQuery = kukit.dom._cssQuery_orig } return kukit.dom._cssQuery(selector, in_nodes); @@ -174,8 +174,8 @@ tagName = node.tagName.toLowerCase(); if ((tagName == 'input') || (tagName == 'select') || (tagName == 'textarea')) { node.focus(); - } else { - kukit.logWarning('Focus on node that cannot have focus !'); + ;;; } else { + ;;; kukit.logWarning('Focus on node that cannot have focus !'); } }; @@ -371,14 +371,14 @@ kukit.dom.EmbeddedContentLoadedScheduler.prototype.check = function() { - kukit.logDebug('Is iframe loaded ?'); + ;;; kukit.logDebug('Is iframe loaded ?'); var doc = kukit.dom.getIframeDocument(this.framename); // quit if the init function has already been called // XXX I believe we want to call the function too, then if (doc._embeddedContentLoadedInitDone) { - kukit.logWarning('Iframe already initialized, but we execute the action enyway, as requested.'); + ;;; kukit.logWarning('Iframe already initialized, but we execute the action enyway, as requested.'); this.counter.restart = false; } @@ -415,7 +415,7 @@ } if ( ! this.counter.restart) { - kukit.logDebug('Yes, iframe is loaded.'); + ;;; kukit.logDebug('Yes, iframe is loaded.'); doc._embeddedContentLoadedInitDone = true; this.func(); } Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/errors.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/errors.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/errors.js Sun May 6 11:21:48 2007 @@ -74,56 +74,56 @@ return exc; }; -// this should be thrown with the error command as parameter -kukit.err.ExplicitError = kukit.err.exceptionFactory('ExplicitError'); -kukit.err.ExplicitError.prototype.__superinit__ = kukit.err.ExplicitError.prototype.__init__; -kukit.err.ExplicitError.prototype.__init__ = function(name, errorcommand) { - var message = 'Explicit error'; - var kw = this.__superinit__(name, message); - kw.errorcommand = errorcommand; - return kw; -}; - -kukit.err.ResponseParsingError = kukit.err.exceptionFactory('ResponseParsingError'); - -kukit.err.CommandExecutionError = kukit.err.exceptionFactory('CommandExecutionError'); -kukit.err.CommandExecutionError.prototype.__superinit__ = kukit.err.CommandExecutionError.prototype.__init__; -kukit.err.CommandExecutionError.prototype.__init__ = function(name, e, command) { - var kw = this.__superinit__(name, ''); - kw.message = 'Command "' + command.name + '": ' + e.toString(); - return kw; -}; +;;; // this should be thrown with the error command as parameter +;;; kukit.err.ExplicitError = kukit.err.exceptionFactory('ExplicitError'); +;;; kukit.err.ExplicitError.prototype.__superinit__ = kukit.err.ExplicitError.prototype.__init__; +;;; kukit.err.ExplicitError.prototype.__init__ = function(name, errorcommand) { +;;; var message = 'Explicit error'; +;;; var kw = this.__superinit__(name, message); +;;; kw.errorcommand = errorcommand; +;;; return kw; +;;; }; + +;;; kukit.err.ResponseParsingError = kukit.err.exceptionFactory('ResponseParsingError'); + +;;; kukit.err.CommandExecutionError = kukit.err.exceptionFactory('CommandExecutionError'); +;;; kukit.err.CommandExecutionError.prototype.__superinit__ = kukit.err.CommandExecutionError.prototype.__init__; +;;; kukit.err.CommandExecutionError.prototype.__init__ = function(name, e, command) { +;;; var kw = this.__superinit__(name, ''); +;;; kw.message = 'Command "' + command.name + '": ' + e.toString(); +;;; return kw; +;;; }; kukit.err.rd = {}; -kukit.err.rd.RuleMergeError = kukit.err.exceptionFactory('RuleMergeError'); +;;; kukit.err.rd.RuleMergeError = kukit.err.exceptionFactory('RuleMergeError'); -kukit.err.rd.KssSelectorError = kukit.err.exceptionFactory('KssSelectorError'); +;;; kukit.err.rd.KssSelectorError = kukit.err.exceptionFactory('KssSelectorError'); -kukit.err.rd.EventBindError = kukit.err.exceptionFactory('EventBindError'); -kukit.err.rd.EventBindError.prototype.__superinit__ = kukit.err.rd.EventBindError.prototype.__init__; -kukit.err.rd.EventBindError.prototype.__init__ = function(name, message, eventname, eventnamespace) { - var kw = this.__superinit__(name, message); - kw.eventname = eventname; - kw.eventnamespace = eventnamespace; - kw.message = kw.message + ' when binding event name "' + eventname + '" on namespace "' + eventnamespace + '"'; - return kw; -}; +;;; kukit.err.rd.EventBindError = kukit.err.exceptionFactory('EventBindError'); +;;; kukit.err.rd.EventBindError.prototype.__superinit__ = kukit.err.rd.EventBindError.prototype.__init__; +;;; kukit.err.rd.EventBindError.prototype.__init__ = function(name, message, eventname, eventnamespace) { +;;; var kw = this.__superinit__(name, message); +;;; kw.eventname = eventname; +;;; kw.eventnamespace = eventnamespace; +;;; kw.message = kw.message + ' when binding event name "' + eventname + '" on namespace "' + eventnamespace + '"'; +;;; return kw; +;;; }; kukit.err.tk = {}; -kukit.err.tk.ParsingError = kukit.err.exceptionFactory('ParsingError'); -kukit.err.tk.ParsingError.prototype.__superinit__ = kukit.err.tk.ParsingError.prototype.__init__; -kukit.err.tk.ParsingError.prototype.__init__ = function(name, message, cursor) { - var kw = this.__superinit__(name, message); - if (cursor) { - kw.errpos = cursor.pos; - kw.errrow = cursor.row; - kw.errcol = cursor.col; - kw.message = kw.message + ' at row ' + kw.errrow + ', column ' + kw.errcol; - } else { - kw.errpos = null; - kw.errrow = null; - kw.errcol = null; - } - return kw; -}; +;;; kukit.err.tk.ParsingError = kukit.err.exceptionFactory('ParsingError'); +;;; kukit.err.tk.ParsingError.prototype.__superinit__ = kukit.err.tk.ParsingError.prototype.__init__; +;;; kukit.err.tk.ParsingError.prototype.__init__ = function(name, message, cursor) { +;;; var kw = this.__superinit__(name, message); +;;; if (cursor) { +;;; kw.errpos = cursor.pos; +;;; kw.errrow = cursor.row; +;;; kw.errcol = cursor.col; +;;; kw.message = kw.message + ' at row ' + kw.errrow + ', column ' + kw.errcol; +;;; } else { +;;; kw.errpos = null; +;;; kw.errrow = null; +;;; kw.errcol = null; +;;; } +;;; return kw; +;;; }; Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js Sun May 6 11:21:48 2007 @@ -48,11 +48,12 @@ kukit.er.EventRegistry.prototype.registerBinder = function(classname, func) { if (typeof(func) == 'undefined') { - throw 'func argument is mandatory when registering an event binder (EventRegistry.registerBinder).'; + ;;; throw 'func argument is mandatory when registering an event binder (EventRegistry.registerBinder).'; + throw 'E'; } if (this.classes[classname]) { // Do not allow redefinition - kukit.logError('Error : event class "' + classname + '" already registered.'); + ;;; kukit.logError('Error : event class "' + classname + '" already registered.'); return; } @@ -70,7 +71,8 @@ var func = this.classes[classname]; if (! func) { // not found - throw 'Error : undefined event setup type ' + classname; + ;;; throw 'Error : undefined event setup type ' + classname; + throw 'E'; } return func; }; @@ -80,7 +82,8 @@ kukit.er.EventRegistry.prototype._register = function(namespace, eventname, klass, bindmethodname, defaultactionmethodname, itername) { if (typeof(defaultactionmethodname) == 'undefined') { - throw 'some arguments are not passed when calling EventRegistry.register'; + ;;; throw 'some arguments are not passed when calling EventRegistry.register'; + throw 'E'; } // Find out the class name. (Not specified now.) var classname = klass.prototype.__classname__; @@ -92,7 +95,8 @@ klass.prototype.__classname__ = classname; } if (!eventname) { - throw 'eventname argument cannot be empty when registering an event (EventRegistry.register)'; + ;;; throw 'eventname argument cannot be empty when registering an event (EventRegistry.register)'; + throw 'E'; } var key = this._getKey(namespace, eventname); var entry = this.content[key]; @@ -100,16 +104,22 @@ if (key[0] == '-') { key = key.substring(1); } - throw 'In EventRegistry.register double registration of key "' + key + '"'; + ;;; throw 'In EventRegistry.register double registration of key "' + key + '"'; + throw 'E'; } // check bindmethodname and defaultactionmethodname - if (bindmethodname && ! klass.prototype[bindmethodname]) - throw 'In EventRegistry.register bind method "' + bindmethodname + '" is undefined for event "' + eventname + '" namespace "' + namespace + '"'; - if (defaultactionmethodname && ! klass.prototype[defaultactionmethodname]) - throw 'In EventRegistry.register default action method "' + defaultactionmethodname + '" is undefined for event "' + eventname + '" namespace "' + namespace + '"'; + if (bindmethodname && ! klass.prototype[bindmethodname]) { + ;;; throw 'In EventRegistry.register bind method "' + bindmethodname + '" is undefined for event "' + eventname + '" namespace "' + namespace + '"'; + throw 'E'; + } + if (defaultactionmethodname && ! klass.prototype[defaultactionmethodname]) { + ;;; throw 'In EventRegistry.register default action method "' + defaultactionmethodname + '" is undefined for event "' + eventname + '" namespace "' + namespace + '"'; + throw 'E'; + } // check the iterator. if (! kukit.er.getBindIterator(itername)) { - throw 'In EventRegistry.register unknown bind iterator "' + itername + '"'; + ;;; throw 'In EventRegistry.register unknown bind iterator "' + itername + '"'; + throw 'E'; } // register it this.content[key] = { @@ -157,7 +167,8 @@ if (namespace == null) { namespace = ''; } else if (namespace.split('-') > 1) { - throw 'In EventRegistry.register namespace cannot contain -'; + ;;; throw 'In EventRegistry.register namespace cannot contain -'; + throw 'E'; } return namespace + '-' + eventname; }; @@ -174,9 +185,11 @@ if (typeof(entry) == 'undefined') { if (key[0] == '-') { key = key.substring(1); - throw 'Error : undefined global event key ' + key + ' (or maybe namespace is missing?)'; + ;;; throw 'Error : undefined global event key ' + key + ' (or maybe namespace is missing?)'; + throw 'E'; } else { - throw 'Error : undefined event key ' + key; + ;;; throw 'Error : undefined event key ' + key; + throw 'E'; } } return entry; @@ -290,7 +303,7 @@ // XXX this case should go away, as we should check this already from binding time // and signal the appropriate error. // Also note that behaviour roles will only be allowed for "non-binding" events. - kukit.logError('Behaviour rule for continuation event "' + name + '" will be ignored, because we found an explicit rule.'); + ;;; kukit.logError('Behaviour rule for continuation event "' + name + '" will be ignored, because we found an explicit rule.'); } } // If parameters are specified in the call, use them. @@ -301,7 +314,7 @@ } // (if eventrule is null here, we can yet have the default method, so go on.) this._EventBinder_triggerevent(name, oper); - kukit.logDebug('Continuation event "' + name + '" executed on same node.'); + ;;; kukit.logDebug('Continuation event "' + name + '" executed on same node.'); }; kukit.er.EventBinder__continue_event_allnodes__ = function(name, parms) { @@ -325,7 +338,7 @@ this._EventBinder_triggerevent(name, newoper); executed += 1; } - kukit.logDebug('Event "' + name + '" executed on ' + executed + ' nodes.'); + ;;; kukit.logDebug('Event "' + name + '" executed on ' + executed + ' nodes.'); }; kukit.er.EventBinder_makeFuncToBind = function(name, node) { @@ -344,7 +357,7 @@ kukit.er.LateBinder.prototype.executeActions = function() { if (! this.bound) { - kukit.log('Attempt of late binding for event ' + this.name + ', node ' + this.node.nodeName); + ;;; kukit.log('Attempt of late binding for event ' + this.name + ', node ' + this.node.nodeName); if (kukit.hasFirebug) { kukit.log(this.node); } @@ -356,9 +369,9 @@ this.bound = function() { this.binderinstance._EventBinder_triggerevent(this.name, oper); }; - kukit.log('node bound'); + ;;; kukit.log('node bound'); } else { - kukit.logWarning('no node bound'); + ;;; kukit.logWarning('no node bound'); this.bound = function() {}; } } @@ -375,12 +388,13 @@ } else { // In case there is no event rule, just call the default event action. var namespace = this.__event_namespace__; - kukit.logDebug('Calling implicit event "' + name + '" on namespace "' + namespace + '"'); + ;;; kukit.logDebug('Calling implicit event "' + name + '" on namespace "' + namespace + '"'); var success = oper.executeDefaultAction(name, true); if (! success) { // instead of the standard message give more specific reason: // either way we should have executed something... - throw 'Could not trigger event name "' + name + '" on namespace "' + namespace + '", because there is neither an explicit kss rule, nor a default method'; + ;;; throw 'Could not trigger event name "' + name + '" on namespace "' + namespace + '", because there is neither an explicit kss rule, nor a default method'; + throw 'E'; } } }; @@ -392,7 +406,8 @@ // (called from oper) var method = this[methodname]; if (! method) { - throw 'Could not trigger event name "' + name + '" on namespace "' + namespace + '", because the method "' + methodname + '" does not exist.'; + ;;; throw 'Could not trigger event name "' + name + '" on namespace "' + namespace + '", because the method "' + methodname + '" does not exist.'; + throw 'E'; } // call it oper.binderinstance = this; @@ -424,7 +439,7 @@ var binderinfo = this.info[id]; if (typeof(binderinfo) == 'undefined') { // Create a new event. - kukit.logDebug('instantiating event id=' + id + ', classname=' + classname + ', namespace=' + namespace); + ;;; kukit.logDebug('instantiating event id=' + id + ', classname=' + classname + ', namespace=' + namespace); binderinstance = new (kukit.eventsGlobalRegistry.getBinder(classname))(); binderinfo = this.info[id] = new kukit.er.BinderInfo(binderinstance); @@ -437,8 +452,8 @@ //binderinstance.__bound_rules__ = []; } else if (binderinfo.getBinderInstance().__binder_classname__ != classname) { // just paranoia - throw 'Conflicting class for event id "' + id + '", "' + binderinfo.getBinderInstance().__binder_classname__ - + '" != "' + classname + '"'; + ;;; throw 'Conflicting class for event id "' + id + '", "' + binderinfo.getBinderInstance().__binder_classname__ + '" != "' + classname + '"'; + throw 'E'; } return binderinfo; }; @@ -447,7 +462,8 @@ // Get an event. var binderinfo = this.info[id]; if (typeof(binderinfo) == 'undefined') { - throw 'Event with id "' + id + '" not found.'; + ;;; throw 'Event with id "' + id + '" not found.'; + throw 'E'; } return binderinfo; }; @@ -459,7 +475,8 @@ var id = kukit.rd.makeId(namespace, classname); var binderinfo = this.info[id]; if (typeof(binderinfo) == 'undefined') { - throw 'Singleton event with namespace "' + namespace + '" and (event) name "' + name + '" not found.'; + ;;; throw 'Singleton event with namespace "' + namespace + '" and (event) name "' + name + '" not found.'; + throw 'E'; } return binderinfo; }; @@ -573,7 +590,8 @@ // Create an empty list. rules_per_name = info[name] = {}; } else if (typeof(rules_per_name[nodehash]) != 'undefined') { - throw 'Mismatch in bind registry, ' + name + ' already bound to node in this instance.'; + ;;; throw 'Mismatch in bind registry, ' + name + ' already bound to node in this instance.'; + throw 'E'; } return rules_per_name; }; @@ -617,14 +635,14 @@ // Get the oper that is bound to a given eventname to a node in this binderinstance // returns null, if there is no such oper. var rules_per_name = this.infopername[name]; - if (typeof(rules_per_name) == 'undefined') { - return null; - } + ;;; if (typeof(rules_per_name) == 'undefined') { + ;;; return null; + ;;; } var nodehash = kukit.rd.hashnode(node); var oper = rules_per_name[nodehash]; - if (typeof(oper) == 'undefined') { - return null; - } + ;;; if (typeof(oper) == 'undefined') { + ;;; return null; + ;;; } // Return it return oper; }; @@ -663,7 +681,8 @@ try { method.call(binderinstance, p1, p2, p3, p4, p5, p6); } catch(e) { - throw new kukit.err.rd.EventBindError('Error during binding, reason: [' + e + ']', eventset.names, eventset.namespace); + ;;; throw new kukit.err.rd.EventBindError('Error during binding, reason: [' + e + ']', eventset.names, eventset.namespace); + throw 'E'; } }; Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/forms.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/forms.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/forms.js Sun May 6 11:21:48 2007 @@ -121,7 +121,7 @@ kukit.fo.CurrentFormLocator.prototype.getForm = function() { var form = this.queryForm(); if (!form) { - kukit.logWarning("No form found"); + ;;; kukit.logWarning("No form found"); return null; } return form; @@ -195,13 +195,13 @@ var element = form[name]; if (element) { var value = kukit.fo.getValueOfFormElement(element); - if (value == null) { - kukit.logWarning('Form element not harvested: '+element.tagName); - } else { - kukit.logDebug("Form element ("+element.tagName+"): name="+element.name+", value="+value); - } - } else { - kukit.logWarning('Form element '+ name + '" not found in form.'); + ;;; if (value != null) { + ;;; kukit.logDebug("Form element ("+element.tagName+"): name="+element.name+", value="+value); + ;;; // } else { + ;;; // kukit.logWarning('Form element not harvested: '+element.tagName); + ;;; } + ;;; } else { + ;;; kukit.logWarning('Form element '+ name + '" not found in form.'); } return value; }; @@ -216,11 +216,11 @@ for (var y=0; y // var splitkey = key.split('-'); + /* + ;;; */ if (splitkey.length < 2 || splitkey.length > 4) { this.emitError( 'kss param key must be like xxx-yyy or nnn-xxx-yyy or evt-xxx-yyy or evt-nnn-xxx-yyy"' + key + '"'); } + ;;; /* + */ var name = splitkey[0]; if (name == 'evt') { // evt--: // evt---: + /* + ;;; */ if (splitkey.length < 3) { this.emitError( 'kss param key must be like xxx-yyy or nnn-xxx-yyy or evt-xxx-yyy or evt-nnn-xxx-yyy"' + key + '"'); } + ;;; /* + */ var enamespace; var ename; var ekey; @@ -188,6 +201,8 @@ // so that we can check it stays the same within the block. this.evt_name = ename; this.evt_namespace = enamespace; + /* + ;;; */ } else { if (ename != this.evt_name || enamespace != this.evt_namespace) { // Do not allow deviation from the previous event names. @@ -198,6 +213,8 @@ if (value.isMethod != false) { this.emitError('evt-[nnn-]xxx-yyy: parameter producers are not allowed as value, key "' + key + '"'); + ;;; /* + */ } // set it this.evt_parms[ekey] = value.txt; @@ -207,6 +224,8 @@ // action-client: - // action-cancel: // action-cancel: - + /* + ;;; */ if (splitkey.length != 2) { this.emitError( 'action-xxx must not have more "-" in it, key "' + @@ -216,18 +235,28 @@ this.emitError('action-xxx: parameter producers are not allowed as value, key "' + key + '"'); } + ;;; /* + */ var atab = {'server': 'S', 'client': 'C', 'cancel': 'X'}; var actionType = atab[splitkey[1]]; + /* + ;;; */ if (! actionType) { this.emitError('action-xxx: key must be action-server or action-client or action-cancel, key "' + key + '"'); } + ;;; /* + */ // force value to be or - var splitvalue = value.txt.split('-'); + /* + ;;; */ if (splitvalue.length > 2) { this.emitError('action-xxx: value must be or -, key "' + key + '"'); } + ;;; /* + */ // set it var action = this.actions.getOrCreateAction(value.txt); if (actionType != 'X' || action.type == null) { @@ -263,10 +292,14 @@ case 'error': { // -error: // default-error: + /* + ;;; */ if (value.isMethod != false) { this.emitError('xxx-error: parameter producers are not allowed as value, key "' + key + '"'); } + ;;; /* + */ action.setError(value.txt); // also create the action for the error itself. var err_action = this.actions.getOrCreateAction(value.txt); @@ -294,7 +327,8 @@ // Check also sets the parameter provider on the value. value.check(registry); } catch(e) { - throw new kukit.err.tk.ParsingError('Error in value: ' + e, this.src.makeMarker(this.startpos)); + ;;; throw new kukit.err.tk.ParsingError('Error in value: ' + e, this.src.makeMarker(this.startpos)); + throw "E"; } } break; } @@ -322,7 +356,8 @@ if (this.ifToken(cursor, kukit.kssp.String)) { // The previous txt must be all whitespace. if (txt) { - this.emitError('Excess characters before the string in property value'); + ;;; this.emitError('Excess characters before the string in property value'); + this.emitError(''); } // the next one must be a string. this.expectToken(cursor, kukit.kssp.String); @@ -330,7 +365,8 @@ } else if (this.ifToken(cursor, kukit.kssp.MethodArgs)) { // see if not empty and has no spaces in it if (! txt || txt.indexOf(' ') != -1) { - this.emitError('Method property value must have a one-word method name'); + ;;; this.emitError('Method property value must have a one-word method name'); + this.emitError(''); } // the next one must be the params this.expectToken(cursor, kukit.kssp.MethodArgs); @@ -338,7 +374,8 @@ } else { // not a string or method: check if we allowed multiword. if (! this.multiword_allowed && txt.indexOf(' ') != -1) { - this.emitError('Property value must be one word'); + ;;; this.emitError('Property value must be one word'); + this.emitError(''); } this.produceTxt(txt); } @@ -347,7 +384,8 @@ this.digestTxt(cursor, kukit.tk.Fraction, kukit.kssp.Comment); // we have to be at the end and have no text after if (cursor.next < this.result.length || cursor.txt) { - this.emitError('Excess characters after the property value'); + ;;; this.emitError('Excess characters after the property value'); + this.emitError(''); } } this.result = []; @@ -438,7 +476,8 @@ var src = this.src; var length = src.text.length; if (length < src.pos + 1) { - this.emitError('Missing character after backslash'); + ;;; this.emitError('Missing character after backslash'); + this.emitError(''); } else { this.result.push(new kukit.tk.Fraction(src, src.pos+1)); this.src.pos += 1; @@ -476,7 +515,8 @@ } else { // Just a value, must be one word then. if (value.indexOf(' ') != -1) { - this.emitError('Argument value must be one word or a string'); + ;;; this.emitError('Argument value must be one word or a string'); + this.emitError(''); } } this.args.push(value); @@ -517,7 +557,8 @@ tokenindex -= 1; } else { // Error. - this.emitError('Kss event selector must end with an event qualifier :event or :event(id)'); + ;;; this.emitError('Kss event selector must end with an event qualifier :event or :event(id)'); + this.emitError(''); } } break; case kukit.kssp.Comment.prototype.symbol: { @@ -534,7 +575,8 @@ || this.result[tokenindex+2].symbol != kukit.kssp.PropValueInPseudo.prototype.symbol || this.result[tokenindex+1].symbol != kukit.kssp.colon.prototype.symbol || this.result[tokenindex].symbol != kukit.tk.Fraction.prototype.symbol) { - this.emitError('Kss event selector must end with an event qualifier :event or :event(id)'); + ;;; this.emitError('Kss event selector must end with an event qualifier :event or :event(id)'); + this.emitError(''); } // See that the last fraction does not end with space. var lasttoken = this.result[tokenindex]; @@ -542,13 +584,16 @@ var pseudotoken = this.result[tokenindex+2]; var txt = lasttoken.txt; if (txt.match(/[\r\n\t ]$/) != null) { - this.emitError('In kss event selector no space can be before the colon'); + ;;; this.emitError('In kss event selector no space can be before the colon'); + this.emitError(''); } if (! pseudotoken.value.methodname) { - this.emitError('Kss event selector must have a one-word name after the colon'); + ;;; this.emitError('Kss event selector must have a one-word name after the colon'); + this.emitError(''); } if (pseudotoken.value.args.length > 1) { - this.emitError('Kss pseudo value must not have more then one parameters'); + ;;; this.emitError('Kss pseudo value must not have more then one parameters'); + this.emitError(''); } css = this.src.text.substring(this.startpos, commatoken.startpos); //print ('>>' + css + ':' + pseudotoken.value.methodname); @@ -572,22 +617,23 @@ var splitname = name.split('-'); var namespace = null; if (splitname.length > 2) { - this.emitError('Kss event selector must be name or namespace-name but no more dashes, "' + name + '"'); + ;;; this.emitError('Kss event selector must be name or namespace-name but no more dashes, "' + name + '"'); + this.emitError(''); } else if (splitname.length == 2) { name = splitname[1]; namespace = splitname[0]; } // Protect the error for better logging - try { + ;;; try { this.kssSelector = new kukit.rd.KssSelector(isEvent, css, name, namespace, id); - } catch(e) { - if (e.name == 'KssSelectorError') { - // Log the message - this.emitError(e.toString()); - } else { - throw e; - } - } + ;;; } catch(e) { + ;;; if (e.name == 'KssSelectorError') { + ;;; // Log the message + ;;; this.emitError(e.toString()); + ;;; } else { + ;;; throw e; + ;;; } + ;;; } this.txt = ''; this.result = []; }; @@ -619,12 +665,12 @@ for (var i=0; i= 0) { // Convert keyCode to dict @@ -292,23 +294,25 @@ return; } if (iload) { - oper.completeParms(['autodetect'], {'initial': 'true', 'insert': 'true'}, 'iload event binding'); + ;;; oper.componentname = 'iload event binding'; + oper.completeParms(['autodetect'], {'initial': 'true', 'insert': 'true'}); // autodetect=false changes the iload autosense method to one that requires the iframe set // the _kssReadyForLoadEvent attribute on the document. Setting this attribute is explicitely required // if autodetect is off, since otherwise in this case we would never notice if the document has arrived. oper.evalBool('autodetect', 'iload event binding'); } else { - oper.completeParms([], {'initial': 'true', 'insert': 'true'}, 'load event binding'); + ;;; oper.componentname = 'load event binding'; + oper.completeParms([], {'initial': 'true', 'insert': 'true'}); } - oper.evalBool('initial', 'load/iload event binding'); - oper.evalBool('insert', 'load/iload event binding'); + oper.evalBool('initial'); + oper.evalBool('insert'); var phase = oper.node._kukitmark; if (phase == 1 && ! oper.parms.initial) { - kukit.logDebug('EventRule #' + oper.eventrule.getNr() + ' mergeid ' + oper.eventrule.kss_selector.mergeid + ' event ignored, oninitial=false.'); + ;;; kukit.logDebug('EventRule #' + oper.eventrule.getNr() + ' mergeid ' + oper.eventrule.kss_selector.mergeid + ' event ignored, oninitial=false.'); return; } if (phase == 2 && ! oper.parms.insert) { - kukit.logDebug('EventRule #' + oper.eventrule.getNr() + ' mergeid ' + oper.eventrule.kss_selector.mergeid + ' event ignored, oninsert=false.'); + ;;; kukit.logDebug('EventRule #' + oper.eventrule.getNr() + ' mergeid ' + oper.eventrule.kss_selector.mergeid + ' event ignored, oninsert=false.'); return; } return oper; @@ -338,27 +342,31 @@ loadoper = null; // with the legacy loads we suppose autodetect=false iloadoper.parms.autodetect = false; - kukit.logWarning('Deprecated the use of "load" event for iframes. It will behave differently in the future. Use the "iload" event (maybe with evt-iload-autodetect: false) instead!'); + ;;; kukit.logWarning('Deprecated the use of "load" event for iframes. It will behave differently in the future. Use the "iload" event (maybe with evt-iload-autodetect: false) instead!'); } } else { // Not an iframe. So iload is not usable. if (iloadoper) { - throw 'iload event can only be bound on an iframe node.'; + ;;; throw 'iload event can only be bound on an iframe node.'; + throw 'E'; } } // Now, bind the events. if (loadoper) { - kukit.logDebug('EventRule #' + loadoper.eventrule.getNr() + ' mergeid ' + loadoper.eventrule.kss_selector.mergeid + ' event selected normal postponed execution.'); + ;;; kukit.logDebug('EventRule #' + loadoper.eventrule.getNr() + ' mergeid ' + loadoper.eventrule.kss_selector.mergeid + ' event selected normal postponed execution.'); // for any other node than iframe, or even for iframe in phase1, we need to execute immediately. var func_to_bind = loadoper.makeExecuteActionsHook(); - kukit.engine.bindScheduler.addPost(func_to_bind, 'Execute load event for node ' + loadoper.node.tagName.toLowerCase()); + ;;; kukit.engine.bindScheduler.addPost(func_to_bind, 'Execute load event for node ' + loadoper.node.tagName.toLowerCase()); + ;;; /* + kukit.engine.bindScheduler.addPost(func_to_bind, ''); + ;;; */ } if (iloadoper) { var phase = iloadoper.node._kukitmark; // For phase 2 we need to execute posponed, for phase1 immediately. // XXX it would be better not need this and do always postponed. if (phase == 2 || (phase == 1 && kukit.engine.initializedOnDOMLoad)) { - kukit.logDebug('EventRule #' + iloadoper.eventrule.getNr() + ' mergeid ' + iloadoper.eventrule.kss_selector.mergeid + ' event selected delayed execution (when iframe loaded)'); + ;;; kukit.logDebug('EventRule #' + iloadoper.eventrule.getNr() + ' mergeid ' + iloadoper.eventrule.kss_selector.mergeid + ' event selected delayed execution (when iframe loaded)'); // We want the event execute once the iframe is loaded. // In a somewhat tricky way, we start the scheduler only from the normal delayed execution. This will enable that in // case we had a load event on the same node, it could modify the name and id parameters and we only start @@ -367,15 +375,24 @@ var g = function() { var f = function() { var func_to_bind = iloadoper.makeExecuteActionsHook(); - kukit.engine.bindScheduler.addPost(func_to_bind, 'Execute iload event for iframe ' + iloadoper.node.name); + ;;; kukit.engine.bindScheduler.addPost(func_to_bind, 'Execute iload event for iframe ' + iloadoper.node.name); + ;;; /* + kukit.engine.bindScheduler.addPost(func_to_bind, ''); + ;;; */ }; new kukit.dom.EmbeddedContentLoadedScheduler(iloadoper.node.id, f, iloadoper.parms.autodetect); }; - kukit.engine.bindScheduler.addPost(g, 'Schedule iload event for iframe ' + iloadoper.node.name); + ;;; kukit.engine.bindScheduler.addPost(g, 'Schedule iload event for iframe ' + iloadoper.node.name); + ;;; /* + kukit.engine.bindScheduler.addPost(g, ''); + ;;; */ } else { - kukit.logDebug('EventRule #' + iloadoper.eventrule.getNr() + ' mergeid ' + iloadoper.eventrule.kss_selector.mergeid + ' event selected normal postponed execution.'); + ;;; kukit.logDebug('EventRule #' + iloadoper.eventrule.getNr() + ' mergeid ' + iloadoper.eventrule.kss_selector.mergeid + ' event selected normal postponed execution.'); var func_to_bind = iloadoper.makeExecuteActionsHook(); - kukit.engine.bindScheduler.addPost(func_to_bind, 'Execute iload event for iframe ' + iloadoper.node.name); + ;;; kukit.engine.bindScheduler.addPost(func_to_bind, 'Execute iload event for iframe ' + iloadoper.node.name); + ;;; /* + kukit.engine.bindScheduler.addPost(func_to_bind, ''); + ;;; */ } } }; @@ -400,8 +417,9 @@ }; kukit.pl.SpinnerEventBinder.prototype.__bind__ = function(name, func_to_bind, oper) { - oper.completeParms([], {'laziness': 0}, 'spinner event binding'); - oper.evalInt('laziness', 'spinner event binding'); + ;;; oper.componentname = 'spinner event binding'; + oper.completeParms([], {'laziness': 0}); + oper.evalInt('laziness'); // Register the function with the global queue manager var state_to_bind = (name == 'spinneron'); var self = this; @@ -444,50 +462,50 @@ kukit.commandsGlobalRegistry.registerFromAction('error', kukit.cr.makeGlobalCommand); kukit.actionsGlobalRegistry.register("logDebug", function (oper) { - oper.completeParms([], {'message': 'LogDebug action'}, 'logDebug action'); - var node = oper.node; - var nodeName = ''; - if (node != null) { - nodeName = node.nodeName; - } - var message = oper.parms.message; - if (oper.eventrule) { - message = message + ', event=' + oper.eventrule.kss_selector.name + ', rule=#' + oper.eventrule.getNr() + ', node=' + nodeName; - } - kukit.logDebug(message); - if (kukit.hasFirebug) { - kukit.logDebug(oper.node); - } +;;; oper.completeParms([], {'message': 'LogDebug action'}, 'logDebug action'); +;;; var node = oper.node; +;;; var nodeName = ''; +;;; if (node != null) { +;;; nodeName = node.nodeName; +;;; } +;;; var message = oper.parms.message; +;;; if (oper.eventrule) { +;;; message = message + ', event=' + oper.eventrule.kss_selector.name + ', rule=#' + oper.eventrule.getNr() + ', node=' + nodeName; +;;; } +;;; kukit.logDebug(message); +;;; if (kukit.hasFirebug) { +;;; kukit.logDebug(oper.node); +;;; } }); kukit.commandsGlobalRegistry.registerFromAction('logDebug', kukit.cr.makeGlobalCommand); kukit.actionsGlobalRegistry.register("log", function (oper) { - oper.completeParms([], {'message': 'Log action'}, 'log action'); - var node = oper.node; - var nodeName = ''; - if (node != null) { - nodeName = node.nodeName; - } - var message = oper.parms.message; - if (oper.eventrule) { - message = message + ', event=' + oper.eventrule.kss_selector.name + ', rule=#' + oper.eventrule.getNr() + ', node=' + nodeName; - } - kukit.log(message); +;;; oper.completeParms([], {'message': 'Log action'}, 'log action'); +;;; var node = oper.node; +;;; var nodeName = ''; +;;; if (node != null) { +;;; nodeName = node.nodeName; +;;; } +;;; var message = oper.parms.message; +;;; if (oper.eventrule) { +;;; message = message + ', event=' + oper.eventrule.kss_selector.name + ', rule=#' + oper.eventrule.getNr() + ', node=' + nodeName; +;;; } +;;; kukit.log(message); }); kukit.commandsGlobalRegistry.registerFromAction('log', kukit.cr.makeGlobalCommand); kukit.actionsGlobalRegistry.register("alert", function (oper) { - oper.completeParms([], {'message': 'Alert action'}, 'alert action'); - var node = oper.node; - var nodeName = ''; - if (node != null) { - nodeName = node.nodeName; - } - var message = oper.parms.message; - if (oper.eventrule) { - message = message + ', rule=#' + oper.eventrule.getNr() + ', node=' + nodeName; - } - alert(message); +;;; oper.completeParms([], {'message': 'Alert action'}, 'alert action'); +;;; var node = oper.node; +;;; var nodeName = ''; +;;; if (node != null) { +;;; nodeName = node.nodeName; +;;; } +;;; var message = oper.parms.message; +;;; if (oper.eventrule) { +;;; message = message + ', rule=#' + oper.eventrule.getNr() + ', node=' + nodeName; +;;; } +;;; alert(message); }); kukit.commandsGlobalRegistry.registerFromAction('alert', kukit.cr.makeGlobalCommand); @@ -500,9 +518,9 @@ /* * accepts both string and dom. */ - oper.completeParms(['html'], {'withKssSetup':true}, - 'replaceInnerHTML action'); - oper.evalBool('withKssSetup', 'setup events on inserted nodes'); + ;;; oper.componentname = 'replaceInnerHTML action'; + oper.completeParms(['html'], {'withKssSetup': true}); + oper.evalBool('withKssSetup'); var node = oper.node; var insertedNodes; if (typeof(oper.parms.html) == 'string') { @@ -523,8 +541,9 @@ /* * accepts both string and dom. */ - oper.completeParms(['html'], {'withKssSetup':true}, 'replaceHTML action'); - oper.evalBool('withKssSetup', 'setup events on inserted nodes'); + ;;; oper.componentname = 'replaceHTML action'; + oper.completeParms(['html'], {'withKssSetup':true}); + oper.evalBool('withKssSetup'); var node = oper.node; oper.parms.html = kukit.dom.forceToDom(oper.parms.html); var elements = oper.parms.html.childNodes; @@ -550,7 +569,8 @@ kukit.commandsGlobalRegistry.registerFromAction('replaceHTML', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('setAttribute', function(oper) { - oper.completeParms(['name', 'value'], {}, 'setAttribute action'); + ;;; oper.componentname = 'setAttribute action'; + oper.completeParms(['name', 'value'], {}); if (oper.parms.name.toLowerCase() == 'style') { throw 'Style attribute is not allowed with setAttribute'; } @@ -559,33 +579,37 @@ kukit.commandsGlobalRegistry.registerFromAction('setAttribute', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('setKssAttribute', function(oper) { - oper.completeParms(['name', 'value'], {}, 'setKssAttribute action'); + ;;; oper.componentname = 'setKssAttribute action'; + oper.completeParms(['name', 'value'], {}); kukit.dom.setKssAttribute(oper.node, oper.parms.name, oper.parms.value); }); kukit.commandsGlobalRegistry.registerFromAction('setKssAttribute', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('setStyle', function(oper) { - oper.completeParms(['name', 'value'], {}, 'setStyle action'); + ;;; oper.componentname = 'setStyle action'; + oper.completeParms(['name', 'value'], {}); oper.node.style[oper.parms.name] = oper.parms.value; }); kukit.commandsGlobalRegistry.registerFromAction('setStyle', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('addClassName', function(oper) { - oper.completeParms(['name'], {}, 'addClassName action'); + ;;; oper.componentname = 'addClassName action'; + oper.completeParms(['name'], {}); addClassName(oper.node, oper.parms.name); }); kukit.commandsGlobalRegistry.registerFromAction('addClassName', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('removeClassName', function(oper) { + ;;; oper.componentname = 'removeClassName action'; oper.completeParms(['name'], {}, 'removeClassName action'); removeClassName(oper.node, oper.parms.name); }); kukit.commandsGlobalRegistry.registerFromAction('removeClassName', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('insertHTMLAfter', function(oper) { - oper.completeParms(['html'], {'withKssSetup':true}, - 'insertHTMLAfter action'); - oper.evalBool('withKssSetup', 'setup events on inserted nodes'); + ;;; oper.componentname = 'insertHTMLAfter action'; + oper.completeParms(['html'], {'withKssSetup':true}); + oper.evalBool('withKssSetup'); oper.parms.html = kukit.dom.forceToDom(oper.parms.html); var content = oper.parms.html; var parentNode = oper.node.parentNode; @@ -597,7 +621,7 @@ insertedNodes = kukit.dom.insertBefore(content, parentNode, toNode); } // update the events for the new nodes - kukit.logDebug("Inserted nodes length: "+insertedNodes.length); + ;;; kukit.logDebug("Inserted nodes length: "+insertedNodes.length); if (oper.parms.withKssSetup) { kukit.engine.setupEvents(insertedNodes); } @@ -605,16 +629,16 @@ kukit.commandsGlobalRegistry.registerFromAction('insertHTMLAfter', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('insertHTMLBefore', function(oper) { - oper.completeParms(['html'], {'withKssSetup':true}, - 'insertHTMLBefore action'); - oper.evalBool('withKssSetup', 'setup events on inserted nodes'); + ;;; oper.componentname = 'insertHTMLBefore action'; + oper.completeParms(['html'], {'withKssSetup':true}); + oper.evalBool('withKssSetup'); oper.parms.html = kukit.dom.forceToDom(oper.parms.html); var content = oper.parms.html; var toNode = oper.node; var parentNode = toNode.parentNode; var insertedNodes = kukit.dom.insertBefore(content, parentNode, toNode); // update the events for the new nodes - kukit.logDebug("Inserted nodes length: "+insertedNodes.length); + ;;; kukit.logDebug("Inserted nodes length: "+insertedNodes.length); if (oper.parms.withKssSetup) { kukit.engine.setupEvents(insertedNodes); } @@ -622,14 +646,14 @@ kukit.commandsGlobalRegistry.registerFromAction('insertHTMLBefore', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('insertHTMLAsLastChild', function(oper) { - oper.completeParms(['html'], {'withKssSetup':true}, - 'insertHTMLAsLastChild action'); - oper.evalBool('withKssSetup', 'setup events on inserted nodes'); + ;;; oper.componentname = 'insertHTMLAsLastChild action'; + oper.completeParms(['html'], {'withKssSetup':true}); + oper.evalBool('withKssSetup'); oper.parms.html = kukit.dom.forceToDom(oper.parms.html); var insertedNodes = kukit.dom.appendChildren(oper.parms.html, oper.node); insertedNodes = kukit.dom.appendChildren(oper.parms.html.childNodes, oper.node); // update the events for the new nodes - kukit.logDebug("Inserted nodes length: "+insertedNodes.length); + ;;; kukit.logDebug("Inserted nodes length: "+insertedNodes.length); if (oper.parms.withKssSetup) { kukit.engine.setupEvents(insertedNodes); } @@ -637,9 +661,9 @@ kukit.commandsGlobalRegistry.registerFromAction('insertHTMLAsLastChild', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('insertHTMLAsFirstChild', function(oper) { - oper.completeParms(['html'], {'withKssSetup':true}, - 'insertHTMLAsFirstChild action'); - oper.evalBool('withKssSetup', 'setup events on inserted nodes'); + ;;; oper.componentname = 'insertHTMLAsFirstChild action'; + oper.completeParms(['html'], {'withKssSetup':true}); + oper.evalBool('withKssSetup'); oper.parms.html = kukit.dom.forceToDom(oper.parms.html); var content = oper.parms.html; var parentNode = oper.node; @@ -651,7 +675,7 @@ insertedNodes = kukit.dom.insertBefore(content, parentNode, toNode); } // update the events for the new nodes - kukit.logDebug("Inserted nodes length: "+insertedNodes.length); + ;;; kukit.logDebug("Inserted nodes length: "+insertedNodes.length); if (oper.parms.withKssSetup) { kukit.engine.setupEvents(insertedNodes); } @@ -660,7 +684,8 @@ kukit.actionsGlobalRegistry.register('deleteNodeAfter', function(oper) { - oper.completeParms([], {}, 'deleteNodeAfter action'); + ;;; oper.componentname = 'deleteNodeAfter action'; + ;;; oper.completeParms([], {}); var parentNode = oper.node.parentNode; var toNode = kukit.dom.getNextSiblingTag(oper.node); if (toNode != null) { @@ -670,7 +695,8 @@ kukit.commandsGlobalRegistry.registerFromAction('deleteNodeAfter', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('deleteNodeBefore', function(oper) { - oper.completeParms([], {}, 'deleteNodeBefore action'); + ;;; oper.componentname = 'deleteNodeBefore action'; + ;;; oper.completeParms([], {}); var parentNode = oper.node.parentNode; var toNode = kukit.dom.getPreviousSiblingTag(oper.node); parentNode.removeChild(toNode); @@ -678,7 +704,8 @@ kukit.commandsGlobalRegistry.registerFromAction('deleteNodeBefore', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('deleteNode', function(oper) { - oper.completeParms([], {}, 'deleteNode action'); + ;;; oper.componentname = 'deleteNode action'; + ;;; oper.completeParms([], {}); var parentNode = oper.node.parentNode; parentNode.removeChild(oper.node); }); @@ -686,20 +713,23 @@ kukit.actionsGlobalRegistry.register('clearChildNodes', function(oper) { // TODO get rid of none - oper.completeParms([], {'none': false}, 'clearChildNodes action'); + ;;; oper.componentname = 'clearChildNodes action'; + oper.completeParms([], {'none': false}); kukit.dom.clearChildNodes(oper.node); }); kukit.commandsGlobalRegistry.registerFromAction('clearChildNodes', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('focus', function(oper) { // TODO get rid of none - oper.completeParms([], {'none': false}, 'focus action'); + ;;; oper.componentname = 'focus action'; + oper.completeParms([], {'none': false}); kukit.dom.focus(oper.node); }); kukit.commandsGlobalRegistry.registerFromAction('focus', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('moveNodeAfter', function(oper) { - oper.completeParms(['html_id'], {}, 'moveNodeAfter action'); + ;;; oper.componentname = 'moveNodeAfter action'; + ;;; oper.completeParms(['html_id'], {}); var node = oper.node; var parentNode = node.parentNode; parentNode.removeChild(node); @@ -714,7 +744,8 @@ kukit.commandsGlobalRegistry.registerFromAction('moveNodeAfter', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('moveNodeBefore', function(oper) { - oper.completeParms(['html_id'], {}, 'moveNodeBefore action'); + ;;; oper.componentname = 'moveNodeBefore action'; + ;;; oper.completeParms(['html_id'], {}); var node = oper.node; var parentNode = node.parentNode; parentNode.removeChild(node); @@ -724,21 +755,24 @@ kukit.commandsGlobalRegistry.registerFromAction('moveNodeBefore', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('copyChildNodesFrom', function(oper) { - oper.completeParms(['html_id'], {}, 'copyChildNodesFrom action'); + ;;; oper.componentname = 'copyChildNodesFrom action'; + ;;; oper.completeParms(['html_id'], {}); var fromNode = document.getElementById(oper.parms.html_id); Sarissa.copyChildNodes(fromNode, oper.node); }); kukit.commandsGlobalRegistry.registerFromAction('copyChildNodesFrom', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('copyChildNodesTo', function(oper) { - oper.completeParms(['html_id'], {}, 'copyChildNodesTo action'); + ;;; oper.componentname = 'copyChildNodesTo action'; + ;;; oper.completeParms(['html_id'], {}); toNode = document.getElementById(oper.parms.html_id); Sarissa.copyChildNodes(oper.node, toNode) }); kukit.commandsGlobalRegistry.registerFromAction('copyChildNodesTo', kukit.cr.makeSelectorCommand); kukit.actionsGlobalRegistry.register('setStateVar', function(oper) { - oper.completeParms(['varname', 'value'], {}, 'setStateVar action'); + ;;; oper.componentname = 'setStateVar action'; + ;;; oper.completeParms(['varname', 'value'], {}); kukit.engine.statevars[oper.parms.varname] = oper.parms.value; }); kukit.commandsGlobalRegistry.registerFromAction('setStateVar', kukit.cr.makeGlobalCommand); @@ -747,7 +781,8 @@ // Trigger continuation event. Event will be triggered on the same node or // on all the nodes bound for the current event state. // allows excess parms in the following check. - oper.completeParms(['name'], {'allnodes': 'false'}, 'continueEvent action', true); + ;;; oper.componentname = 'continue action'; + oper.completeParms(['name'], {'allnodes': 'false'}, '', true); oper.evalBool('allnodes', 'continueEvent'); var parms = oper.parms; var binderinstance = oper.binderinstance; @@ -771,9 +806,10 @@ // Allows executing a local action on a different selection. // // allows excess parms in the following check + ;;; oper.componentname = 'executeCommand action'; oper.completeParms(['name', 'selector'], {'selectorType': null}, - 'executeCommand action', true); + '', true); var parms = oper.parms; // marshall it, the rest of the parms will be passed var actionparms = {}; @@ -790,7 +826,8 @@ // Add/remove a class to/from a node kukit.actionsGlobalRegistry.register("toggleClass", function (oper) { - oper.completeParms(['classname'], {}, 'toggleClass action'); + ;;; oper.componentname = 'toggleClass action'; + ;;; oper.completeParms(['classname'], {}); var node = oper.node; var classname = oper.parms.classname; Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/providerreg.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/providerreg.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/providerreg.js Sun May 6 11:21:48 2007 @@ -33,11 +33,11 @@ if (typeof(func) == 'undefined') { throw 'func argument is mandatory when registering a parameter provider (ParamProviderRegistry.register).'; } - if (this.content[name]) { - // Do not allow redefinition - kukit.logError('Error : parameter provider "' + name + '" already registered.'); - return; - } + ;;; if (this.content[name]) { + ;;; // Do not allow redefinition + ;;; kukit.logError('Error : parameter provider "' + name + '" already registered.'); + ;;; return; + ;;; } this.content[name] = func; }; @@ -53,8 +53,9 @@ if (name == '') { // default provider for the strings return kukit.pr.IdentityPP; - } else { - throw 'Error : undefined parameter provider "' + name + '"'; + } else { + ;;; throw 'Error : undefined parameter provider "' + name + '"'; + throw 'E'; } } return func; @@ -87,12 +88,16 @@ kukit.pr.IdentityPP = function() {}; kukit.pr.IdentityPP.prototype = { + /* + ;;; */ check: function(args) { // check does not need to be used here actually. if (args.length != 1) { throw 'internal error, IdentityPP needs 1 argument'; } }, + /* + */ eval: function(args, node) { return args[0]; } @@ -101,11 +106,15 @@ kukit.pr.FormVarPP = function() {}; kukit.pr.FormVarPP.prototype = { + /* + ;;; */ check: function(args) { if (args.length != 2) { throw 'formVar method needs 2 arguments (formname, varname)'; } }, + /* + */ eval: function(args, node) { return kukit.fo.getFormVar(new kukit.fo.NamedFormLocator(args[0]), args[1]); } @@ -114,11 +123,15 @@ kukit.pr.CurrentFormVarPP = function() {}; kukit.pr.CurrentFormVarPP.prototype = { + /* + ;;; */ check: function(args) { if (args.length != 0 && args.length != 1) { throw 'currentFormVar method needs 0 or 1 argument (varname)'; } }, + /* + */ eval: function(args, node) { if (args.length == 1) { return kukit.fo.getFormVar(new kukit.fo.CurrentFormLocator(node), args[0]); @@ -132,16 +145,23 @@ kukit.pr.CurrentFormVarFromKssAttrPP = function() {}; kukit.pr.CurrentFormVarFromKssAttrPP.prototype = { + /* + ;;; */ check: function(args) { if (args.length != 1 && args.length != 2) { throw 'currentFormVarFromKssAttr method needs 1 or 2 argument (attrname, [recurseParents])'; } }, + /* + */ eval: function(args, node) { var argname = args[0]; var recurseParents = false; if (args.length == 2) { - kukit.ut.evalBool(args[1], '2nd attribute of currentFormVarForKssAttr must be a boolean'); + ;;; kukit.ut.evalBool(args[1], '2nd attribute of currentFormVarForKssAttr must be a boolean'); + ;;; /* + kukit.ut.evalBool(args[1], ''); + ;;; */ recurseParents = args[1]; } var formvarname = kukit.dom.getRecursiveAttribute(node, argname, recurseParents, kukit.dom.getKssAttribute); @@ -154,12 +174,16 @@ /* BBB. To be deprecated at 2007-08-15 */ kukit.pr.FormPP = function() {}; kukit.pr.FormPP.prototype = { + /* + ;;; */ check: function(args) { if (args.length != 1) { throw 'form method needs 1 arguments (formname)'; } kukit.logWarning('Deprecated the form(formname) parameter provider, use xxx-kssSubmitForm: form(formname) instead!'); }, + /* + */ eval: function(args, node) { return kukit.fo.getAllFormVars(new kukit.fo.NamedFormLocator(args[0]), new kukit.ut.DictCollector()); } @@ -169,12 +193,16 @@ /* BBB. To be deprecated at 2007-08-15 */ kukit.pr.CurrentFormPP = function() {}; kukit.pr.CurrentFormPP.prototype = { + /* + ;;; */ check: function(args) { if (args.length != 0) { throw 'currentForm method needs no argument'; } kukit.logWarning('Deprecated the currentForm() parameter provider, use xxx-kssSubmitForm: currentForm() instead!'); }, + /* + */ eval: function(args, node) { return kukit.fo.getAllFormVars(new kukit.fo.CurrentFormLocator(node), new kukit.ut.DictCollector()); } @@ -183,6 +211,8 @@ kukit.pr.NodeAttrPP = function() {}; kukit.pr.NodeAttrPP.prototype = { + /* + ;;; */ check: function(args) { if (args.length != 1 && args.length != 2) { throw 'nodeAttr method needs 1 or 2 argument (attrname, [recurseParents])'; @@ -194,12 +224,17 @@ throw 'attrname parameter in nodeAttr method cannot contain space.'; } }, + /* + */ eval: function(args, node) { var argname = args[0]; var recurseParents = false; if (args.length == 2) { recurseParents = args[1]; - kukit.ut.evalBool(recurseParents, '2nd attribute of nodeAttr must be a boolean'); + ;;; kukit.ut.evalBool(recurseParents, '2nd attribute of nodeAttr must be a boolean'); + ;;; /* + kukit.ut.evalBool(recurseParents, ''); + ;;; */ } return kukit.dom.getRecursiveAttribute(node, argname, recurseParents, kukit.dom.getAttribute); } @@ -208,6 +243,8 @@ kukit.pr.KssAttrPP = function() {}; kukit.pr.KssAttrPP.prototype = { + /* + ;;; */ check: function(args) { if (args.length != 1 && args.length != 2) { throw 'kssAttr method needs 1 or 2 argument (attrname, [recurseParents])'; @@ -216,12 +253,17 @@ throw 'attrname parameter in kssAttr method cannot contain "-" or space.'; } }, + /* + */ eval: function(args, node) { var argname = args[0]; var recurseParents = false; if (args.length == 2) { recurseParents = args[1]; - kukit.ut.evalBool(recurseParents, '2nd attribute of kssAttr must be a boolean'); + ;;; kukit.ut.evalBool(recurseParents, '2nd attribute of kssAttr must be a boolean'); + ;;; /* + kukit.ut.evalBool(recurseParents, '2nd attribute of kssAttr must be a boolean'); + ;;; */ } return kukit.dom.getRecursiveAttribute(node, argname, recurseParents, kukit.dom.getKssAttribute); } @@ -230,11 +272,15 @@ kukit.pr.NodeContentPP = function() {}; kukit.pr.NodeContentPP.prototype = { + /* + ;;; */ check: function(args) { if (args.length != 0 && args.length != 1) { throw 'nodeContent method needs 0 or 1 argument (recursive)'; } }, + /* + */ eval: function(args, node) { var recursive = false; if (args.length == 1) { @@ -247,17 +293,22 @@ kukit.pr.StateVarPP = function() {}; kukit.pr.StateVarPP.prototype = { + /* + ;;; */ check: function(args) { if (args.length != 1) { throw 'stateVar method needs 1 argument (varname)'; } }, + /* + */ eval: function(args, node) { var key = args[0]; var value = kukit.engine.statevars[key]; if (typeof(value) == 'undefined') { // notfound arguments will get null - throw 'Nonexistent statevar "'+ key +'"'; + ;;; throw 'Nonexistent statevar "'+ key +'"'; + throw 'E'; } return value; } @@ -266,17 +317,22 @@ kukit.pr.PassPP = function() {}; kukit.pr.PassPP.prototype = { + /* + ;;; */ check: function(args) { if (args.length != 1) { throw 'pass method needs 1 argument (attrname)'; } }, + /* + */ eval: function(args, node, defaultparms) { var key = args[0]; var value = defaultparms[key]; if (typeof(value) == 'undefined') { // notfound arguments will get null - throw 'Nonexistent default parm "'+ key +'"'; + ;;; throw 'Nonexistent default parm "'+ key +'"'; + throw 'E'; } return value; } Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/requestmanager.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/requestmanager.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/requestmanager.js Sun May 6 11:21:48 2007 @@ -187,13 +187,13 @@ // max request number kukit.rm.RequestManager.prototype.maxNr = 4; -kukit.rm.RequestManager.prototype.getInfo = function() { - return '(RQ: ' + this.sentNr + ' OUT, ' + this.waitingQueue.size() + ' WAI)'; -}; - -kukit.rm.RequestManager.prototype.log = function(txt) { - kukit.logDebug('RequestManager ' + this.namestr + txt + ' ' + this.getInfo()); -}; +;;; kukit.rm.RequestManager.prototype.getInfo = function() { +;;; return '(RQ: ' + this.sentNr + ' OUT, ' + this.waitingQueue.size() + ' WAI)'; +;;; }; + +;;; kukit.rm.RequestManager.prototype.log = function(txt) { +;;; kukit.logDebug('RequestManager ' + this.namestr + txt + ' ' + this.getInfo()); +;;; }; kukit.rm.RequestManager.prototype.setSpinnerState = function(newState) { if (this.spinnerState != newState) { @@ -228,7 +228,7 @@ kukit.rm.RequestManager.prototype.pushSentRequest = function(item, now) { this.sentNr += 1; - this.log('Notify server ' + item.url + ', rid=' + item.rid); + ;;; this.log('Notify server ' + item.url + ', rid=' + item.rid); // Set the spinner state this.setSpinnerState(true); // Set the timeout @@ -253,7 +253,7 @@ //var now = (new Date()).valueOf(); //this.log('Next timeout check in: ' + (nextWake - now)); } else { - this.log('Timeout checking suspended until the next requests'); + ;;; this.log('Timeout checking suspended until the next requests'); // Set the spinner state this.setSpinnerState(false); } @@ -284,7 +284,7 @@ if (waiting != null) { // see if we can send another request in place of the received one // request is waiting, send it. - this.log('Dequeue server notification at ' + waiting.url + ', rid=' + waiting.rid); + ;;; this.log('Dequeue server notification at ' + waiting.url + ', rid=' + waiting.rid); this.pushSentRequest(waiting, now); } else { // this.log("Request queue empty."); @@ -298,17 +298,17 @@ kukit.rm.RequestManager.prototype.receiveItem = function(item, now) { // calls result processing var success = this.receivedResult(item, now); - if (success) { - this.log('Received result with rid=' + item.rid); - } else { - this.log('Received timed out result rid=' + item.rid + ', to be ignored'); - } + ;;; if (success) { + ;;; this.log('Received result with rid=' + item.rid); + ;;; } else { + ;;; this.log('Received timed out result rid=' + item.rid + ', to be ignored'); + ;;; } return success; }; kukit.rm.RequestManager.prototype.timeoutItem = function(item) { /* Time out this item. */ - this.log('Timed out request rid=' + item.rid); + ;;; this.log('Timed out request rid=' + item.rid); // Call the timeout hook on the item item.callTimeoutHook(); }; @@ -339,7 +339,7 @@ this.pushSentRequest(item, now); } else { this.pushWaitingRequest(item, now); - this.log('Queue server notification at ' + item.url + ', rid=' + item.rid); + ;;; this.log('Queue server notification at ' + item.url + ', rid=' + item.rid); } }; Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/resourcedata.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/resourcedata.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/resourcedata.js Sun May 6 11:21:48 2007 @@ -47,18 +47,18 @@ if (! name) { throw 'KssSelector must have name'; } - if (name.indexOf('@') != -1) - throw new kukit.err.rd.KssSelectorError('Kss selector name must not contain @: "' + name + '"'); - if (id && id.indexOf('@') != -1) - throw new kukit.err.rd.KssSelectorError('Kss selector id must not contain @: "' + id + '"'); - if (namespace && namespace.indexOf('@') != -1) - throw new kukit.err.rd.KssSelectorError('Kss selector namespace must not contain @: "' + namespace + '"'); - if (! isEvent) { - // method rule - if (css != 'document' && css != 'behaviour') { - throw new kukit.err.rd.KssSelectorError('KssSpecialSelector "' + name + '" must have one of the allowed names'); - } - } + ;;; if (name.indexOf('@') != -1) + ;;; throw new kukit.err.rd.KssSelectorError('Kss selector name must not contain @: "' + name + '"'); + ;;; if (id && id.indexOf('@') != -1) + ;;; throw new kukit.err.rd.KssSelectorError('Kss selector id must not contain @: "' + id + '"'); + ;;; if (namespace && namespace.indexOf('@') != -1) + ;;; throw new kukit.err.rd.KssSelectorError('Kss selector namespace must not contain @: "' + namespace + '"'); + ;;; if (! isEvent) { + ;;; // method rule + ;;; if (css != 'document' && css != 'behaviour') { + ;;; throw new kukit.err.rd.KssSelectorError('KssSpecialSelector "' + name + '" must have one of the allowed names'); + ;;; } + ;;; } this.css = css; this.name = name; this.namespace = namespace; @@ -121,7 +121,7 @@ // Check syntax var f = registry.get(this.methodname); this.pprovider = new f(); - this.pprovider.check(this.args); + ;;; this.pprovider.check(this.args); }; kukit.rd.KssMethodValue.prototype.evaluate = function(parms, key, node, defaultparms) { @@ -155,13 +155,13 @@ this.nr = kukit.rd.EventRuleNr; this.mergednr = null; kukit.rd.EventRuleNr = this.nr + 1; - var namestr; - if (kss_selector.namespace) { - namestr = kss_selector.namespace + '-' + kss_selector.name; - } else { - namestr = kss_selector.name; - } - kukit.logDebug("EventRule #" + this.getNr() + ": " + kss_selector.css + ' EVENT=' + namestr); + ;;; var namestr; + ;;; if (kss_selector.namespace) { + ;;; namestr = kss_selector.namespace + '-' + kss_selector.name; + ;;; } else { + ;;; namestr = kss_selector.name; + ;;; } + ;;; kukit.logDebug("EventRule #" + this.getNr() + ": " + kss_selector.css + ' EVENT=' + namestr); this.kss_selector = kss_selector; this.parms = parms; this.actions = actions; @@ -192,9 +192,9 @@ counter += 1; } } - if (counter > 0) { - kukit.logDebug('EventRule #' + this.getNr() + ' mergeid ' + this.kss_selector.mergeid + ' selected ' + counter + ' nodes'); - } + ;;; if (counter > 0) { + ;;; kukit.logDebug('EventRule #' + this.getNr() + ' mergeid ' + this.kss_selector.mergeid + ' selected ' + counter + ' nodes'); + ;;; } } else if (typeof(in_nodes) == 'undefined') { // Method selector. They only need to be handled on the initial // pageload, when the in_nodes parameter is ommitted. @@ -252,28 +252,28 @@ }; kukit.rd.EventRule.prototype.merge = function(other) { - if (! this.isMerged()) { - throw "Cannot merge into a genuine event rule"; - } - if (this.kss_selector.isEventSelector) { - if (this.kss_selector.id != other.kss_selector.id) { - throw "Differing kss selector ids in event rule merge"; - } - if (this.kss_selector.classname != other.kss_selector.classname) { - throw "Differing kss selector classes in event rule merge"; - } - } - if (this.kss_selector.name != other.kss_selector.name) { - throw "Differing kss selector names in event rule merge"; - } + ;;; if (! this.isMerged()) { + ;;; throw "Cannot merge into a genuine event rule"; + ;;; } + ;;; if (this.kss_selector.isEventSelector) { + ;;; if (this.kss_selector.id != other.kss_selector.id) { + ;;; throw "Differing kss selector ids in event rule merge"; + ;;; } + ;;; if (this.kss_selector.classname != other.kss_selector.classname) { + ;;; throw "Differing kss selector classes in event rule merge"; + ;;; } + ;;; } + ;;; if (this.kss_selector.name != other.kss_selector.name) { + ;;; throw "Differing kss selector names in event rule merge"; + ;;; } this.mergednr = this.mergednr + ',' + other.getNr(); for (var key in other.parms) { this.parms[key] = other.parms[key]; } this.actions.merge(other.actions); - if (this.mergednr.substr(0, 1) != 'X') - // ignore initial clone-merge - kukit.logDebug('Merged rule ' + this.mergednr + ' mergeid ' + this.kss_selector.mergeid); + ;;; if (this.mergednr.substr(0, 1) != 'X') + ;;; // ignore initial clone-merge + ;;; kukit.logDebug('Merged rule ' + this.mergednr + ' mergeid ' + this.kss_selector.mergeid); }; kukit.rd.EventRule.prototype.mergeIntoDict = function(dict, key, eventrule) { @@ -312,8 +312,9 @@ // new action action = new kukit.rd.Action(); this.content[key] = action; - } else { - throw new kukit.err.rd.RuleMergeError('Cannot action-delete unexisting action, "' + key + '"'); + } else { + ;;; throw new kukit.err.rd.RuleMergeError('Cannot action-delete unexisting action, "' + key + '"'); + throw 'E'; } } if (action2.type != 'X') { @@ -366,9 +367,9 @@ kukit.rd.ActionSet.prototype.deleteAction = function(name) { var action = this.content[name]; - if (typeof(action) == 'undefined') { - throw('Action "' + name + '" does not exist and cannot be deleted.'); - } + ;;; if (typeof(action) == 'undefined') { + ;;; throw('Action "' + name + '" does not exist and cannot be deleted.'); + ;;; } delete this.content[name]; }; @@ -394,14 +395,14 @@ }; kukit.rd.Action.prototype.setName = function(name) { - if (this.name != null && this.name != name) { - throw new kukit.err.rd.RuleMergeError('Error overriding action name "' + this.name + '" to "' + name + '" (Unmatching action names at merge?)'); - } + ;;; if (this.name != null && this.name != name) { + ;;; throw new kukit.err.rd.RuleMergeError('Error overriding action name "' + this.name + '" to "' + name + '" (Unmatching action names at merge?)'); + ;;; } this.name = name; if (name == 'default') { - if (this.type != null && this.type != 'D') { - throw new kukit.err.rd.RuleMergeError('Error setting action to default on action "' + this.name + '", current type "' + this.type + '"'); - } + ;;; if (this.type != null && this.type != 'D') { + ;;; throw new kukit.err.rd.RuleMergeError('Error setting action to default on action "' + this.name + '", current type "' + this.type + '"'); + ;;; } this.setType('D'); } }; @@ -413,20 +414,20 @@ // E = error / client // D = default (unsettable) // X = cancel action - if ((type != 'S' && type != 'C' && type != 'E' && type != 'X') || - (this.type != null && this.type != type)) { - throw new kukit.err.rd.RuleMergeError('Error setting action type on action "' + this.name + '" from "' + this.type + '" to "' + type + '" (Attempt to merge client, server or error actions?)'); - } - if (this.error != null && this.type != 'S') { - throw new kukit.err.rd.RuleMergeError('Error setting action error handler on action "' + this.name + '", this is only allowed on server actions.'); - } + ;;; if ((type != 'S' && type != 'C' && type != 'E' && type != 'X') || + ;;; (this.type != null && this.type != type)) { + ;;; throw new kukit.err.rd.RuleMergeError('Error setting action type on action "' + this.name + '" from "' + this.type + '" to "' + type + '" (Attempt to merge client, server or error actions?)'); + ;;; } + ;;; if (this.error != null && this.type != 'S') { + ;;; throw new kukit.err.rd.RuleMergeError('Error setting action error handler on action "' + this.name + '", this is only allowed on server actions.'); + ;;; } this.type = type; }; kukit.rd.Action.prototype.setError = function(error) { - if (this.type != null && this.type != 'S') { - throw new kukit.err.rd.RuleMergeError('Error setting action error handler on action "' + this.name + '", this is only allowed on server actions.'); - } + ;;; if (this.type != null && this.type != 'S') { + ;;; throw new kukit.err.rd.RuleMergeError('Error setting action error handler on action "' + this.name + '", this is only allowed on server actions.'); + ;;; } this.error = error; }; @@ -599,13 +600,13 @@ } counter += 1; } - kukit.logDebug('Binding to ' + counter + ' nodes in grand total'); + ;;; kukit.logDebug('Binding to ' + counter + ' nodes in grand total'); // Execute the load actions in a deferred manner var loadactions = this.loadScheduler; if (! loadactions.empty()) { - kukit.logDebug('Start executing delayed load actions'); + ;;; kukit.logDebug('Start executing delayed load actions'); var nr = loadactions.executeAll(); - kukit.logDebug('Executed ' + nr + ' load actions'); + ;;; kukit.logDebug('Executed ' + nr + ' load actions'); } }; @@ -647,9 +648,9 @@ // Get the entry by the type which is now at css var category = eventrule.kss_selector.css; var dict = this.content[category]; - if (typeof(dict) == 'undefined') { - throw 'Unknown method rule category "' + category + '"'; - } + ;;; if (typeof(dict) == 'undefined') { + ;;; throw 'Unknown method rule category "' + category + '"'; + ;;; } // Merge into the corresponding category eventrule.mergeIntoDict(dict, eventrule.kss_selector.mergeid, eventrule); }; @@ -658,9 +659,9 @@ // Returns the rule for a given event instance, // Get the entry by category (= document or behaviour) var dict = this.content[category]; - if (typeof(dict) == 'undefined') { - throw 'Unknown method rule category "' + category + '"'; - } + ;;; if (typeof(dict) == 'undefined') { + ;;; throw 'Unknown method rule category "' + category + '"'; + ;;; } // look up the rule var namespace = binderinstance.__event_namespace__; var id = binderinstance.__binder_id__; @@ -682,5 +683,5 @@ documentrules[mergeid].bind(null); counter += 1; } - kukit.logDebug('Binding ' + counter + ' special rules in grand total'); + ;;; kukit.logDebug('Binding ' + counter + ' special rules in grand total'); }; Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/selectorreg.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/selectorreg.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/selectorreg.js Sun May 6 11:21:48 2007 @@ -28,12 +28,17 @@ // be used with the makeAnyPP factory function. kukit.sr.AnyPP = function() {}; kukit.sr.AnyPP.prototype = { + /* + ;;; */ check: function(args) { // check does not need to be used here actually. if (args.length != 1) { - throw 'internal error, AnyPP needs 1 argument'; + ;;; throw 'internal error, AnyPP needs 1 argument'; + throw 'E'; } }, + /* + */ eval: function(args, node) { var f = kukit.selectorTypesGlobalRegistry.get(this.selector_type); return f(args[0], node); @@ -45,7 +50,7 @@ kukit.sr.makeAnyPP = function(selector_type) { var pp = function () {}; pp.prototype.eval = kukit.sr.AnyPP.prototype.eval; - pp.prototype.check = kukit.sr.AnyPP.prototype.check; + ;;; pp.prototype.check = kukit.sr.AnyPP.prototype.check; pp.prototype.selector_type = selector_type; return pp; }; @@ -73,11 +78,11 @@ if (typeof(func) == 'undefined') { throw 'Func is mandatory.'; } - if (this.mapping[name]) { - // Do not allow redefinition - kukit.logError('Error : redefinition attempt of selector ' + name); - return; - } + ;;; if (this.mapping[name]) { + ;;; // Do not allow redefinition + ;;; kukit.logError('Error : redefinition attempt of selector ' + name); + ;;; return; + ;;; } this.mapping[name] = func; // Also register the selector param provider (not for samenode though) if (name != 'sanenode') { @@ -93,9 +98,9 @@ name = this.defaultSelectorType; } var result = this.mapping[name]; - if (typeof(result) == 'undefined') { - throw 'Unknown selector type "' + name + '"'; - } + ;;; if (typeof(result) == 'undefined') { + ;;; throw 'Unknown selector type "' + name + '"'; + ;;; } return result; }; Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/serveraction.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/serveraction.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/serveraction.js Sun May 6 11:21:48 2007 @@ -108,27 +108,27 @@ if (success) { // catch the errors otherwise won't get logged. // In FF they seem to get swallowed silently. - try { + ;;; try { // process the results this.processResult(domDoc); - } catch(e) { - if (e.name == 'RuleMergeError' || e.name == 'EventBindError') { - // Log the message - var msg = 'Error setting up events: ' + e.toString(); - kukit.logFatal(msg); - // just throw it too... - throw msg; - } else if (e.name == 'ResponseParsingError') { - this.processError('Response parsing error: ' + e); - } else if (e.name == 'ExplicitError') { - this.processError(e.errorcommand); - } else { - kukit.logError('Unhandled error during command execution: ' + e); - // also IE acts foul on thrown errors - // but at least mumbles something - throw e; - } - } + ;;; } catch(e) { + ;;; if (e.name == 'RuleMergeError' || e.name == 'EventBindError') { + ;;; // Log the message + ;;; var msg = 'Error setting up events: ' + e.toString(); + ;;; kukit.logFatal(msg); + ;;; // just throw it too... + ;;; throw msg; + ;;; } else if (e.name == 'ResponseParsingError') { + ;;; this.processError('Response parsing error: ' + e); + ;;; } else if (e.name == 'ExplicitError') { + ;;; this.processError(e.errorcommand); + ;;; } else { + ;;; kukit.logError('Unhandled error during command execution: ' + e); + ;;; // also IE acts foul on thrown errors + ;;; // but at least mumbles something + ;;; throw e; + ;;; } + ;;; } } /* } else { kukit.logDebug('Request arrived with readyState = ' + domDoc.readyState); */ @@ -157,7 +157,8 @@ try { dom = (new DOMParser()).parseFromString(payload, "text/xml"); } catch(e) { - throw new kukit.err.ResponseParsingError('Error parsing X-KSSCOMMANDS header.'); + ;;; throw new kukit.err.ResponseParsingError('Error parsing X-KSSCOMMANDS header.'); + throw 'E'; } commandstags = kukit.dom.getNsTags(dom, 'commands'); if (commandstags.length != 1) { @@ -169,23 +170,25 @@ // Check if there was a parsing error in the xml, and log it as reported from the dom // Opera <= 8.5 does not have the parseError attribute, so check for it first dom = domDoc.responseXML; - var errtxt = 'Unknown server error (invalid KSS response, no error info received)'; - if (dom && dom.parseError && (dom.parseError != 0)) { - throw new kukit.err.ResponseParsingError(errtxt + ': ' + Sarissa.getParseErrorText(dom)); - } else { - throw new kukit.err.ResponseParsingError(errtxt); - } + ;;; var errtxt = 'Unknown server error (invalid KSS response, no error info received)'; + ;;; if (dom && dom.parseError && (dom.parseError != 0)) { + ;;; throw new kukit.err.ResponseParsingError(errtxt + ': ' + Sarissa.getParseErrorText(dom)); + ;;; } else { + ;;; throw new kukit.err.ResponseParsingError(errtxt); + ;;; } + throw 'E'; } } if (dom == null) { // this should not happen - throw new kukit.err.ResponseParsingError('Neither xml nor html payload.'); + ;;; throw new kukit.err.ResponseParsingError('Neither xml nor html payload.'); + throw 'E'; } // find the commands (atm we don't limit ourselves inside the commandstag) var commands = kukit.dom.getNsTags(dom, 'command'); // Warning, if there is a valid response containing 0 commands. if (commands.length == 0) { - kukit.logWarning('No commands in kukit response'); + ;;; kukit.logWarning('No commands in kukit response'); return; } // One or more valid commands to parse @@ -199,23 +202,26 @@ if (this.oper.eventrule) { var error_action = this.oper.eventrule.actions.getErrorActionFor(this.oper.action); } - var reason = ''; - if (typeof(errorcommand) == 'string') { - // not a command, just a string - reason = ', client_reason="' + errorcommand + '" '; - } else if (typeof(errorcommand) != 'undefined') { - // a real error command, sent by the server - reason = ', server_reason="' + errorcommand.parms.message + '" '; - } + ;;; var reason = ''; + ;;; if (typeof(errorcommand) == 'string') { + ;;; // not a command, just a string + ;;; reason = ', client_reason="' + errorcommand + '" '; + ;;; } else if (typeof(errorcommand) != 'undefined') { + ;;; // a real error command, sent by the server + ;;; reason = ', server_reason="' + errorcommand.parms.message + '" '; + ;;; } if (error_action) { + /* + ;;; */ kukit.logWarning('Request failed at url ' + this.oper.queueItem.url + ', rid=' + this.oper.queueItem.rid + reason + ', will be handled by action "' + error_action.name + '"'); // Individual error handler was defined. Execute it! + ;;; /* + */ error_action.execute(this.oper); } else { // Unhandled: just log it... - kukit.logError('Request failed at url ' + this.oper.queueItem.url - + ', rid=' + this.oper.queueItem.rid + reason); + ;;; kukit.logError('Request failed at url ' + this.oper.queueItem.url + ', rid=' + this.oper.queueItem.rid + reason); } }; Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/tokenizer.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/tokenizer.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/tokenizer.js Sun May 6 11:21:48 2007 @@ -31,7 +31,8 @@ kukit.tk._TokenBase.prototype.emitError = function(txt) { // Use the start position of the token for the error report. - throw new kukit.err.tk.ParsingError(txt, this.src.makeMarker(this.startpos)); + ;;; throw new kukit.err.tk.ParsingError(txt, this.src.makeMarker(this.startpos)); + throw 'E'; }; kukit.tk._TokenBase.prototype.setSrcStatus = function(eofOk) { @@ -39,7 +40,8 @@ if (eofOk) { this.finished = true; } else { - this.emitError('Unexpected EOF'); + ;;; this.emitError('Unexpected EOF'); + this.emitError(''); } } }; @@ -107,13 +109,16 @@ if (token) { var symbol = token.prototype.symbol; if (i >= this.result.length) { - this.emitError('Expected [' + symbol + ']'); + ;;; this.emitError('Expected [' + symbol + ']'); + this.emitError(''); } else if (this.result[i].symbol != symbol) { - this.emitError('Expected [' + symbol + '], found [' + this.result[i].symbol + ']'); + ;;; this.emitError('Expected [' + symbol + '], found [' + this.result[i].symbol + ']'); + this.emitError(''); } } else { if (i >= this.result.length) { - this.emitError('Expected token'); + ;;; this.emitError('Expected token'); + this.emitError(''); } } cursor.token = this.result[i]; @@ -188,7 +193,8 @@ this.src = src; this.startpos = src.pos; if (src.text.substr(src.pos, txt.length) != txt) { - this.emitError('Expected "' + txt + '", found "' + src.text.substr(src.pos, txt.length) + '"'); + ;;; this.emitError('Expected "' + txt + '", found "' + src.text.substr(src.pos, txt.length) + '"'); + this.emitError(''); } else { src.pos += txt.length; this.finished = true; Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/utils.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/utils.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/utils.js Sun May 6 11:21:48 2007 @@ -26,6 +26,11 @@ var kukit = {}; } +;;; /* ---------------------------------------------------------------- +;;; * Lines starting with the ;;; are only cooked in development mode. +;;; * ---------------------------------------------------------------- +;;; */ + // Browser identification. We need these switches only at the moment. try { kukit.HAVE_SAFARI = navigator.vendor && navigator.vendor.indexOf('Apple') != -1; @@ -35,9 +40,9 @@ // Activation of extra logging panel: if necessary // this allows to start the logging panel from the browser with // javascript:kukit.showlog(); -kukit.showlog = function() { - kukit.logWarning('Logging is on the console: request to show logging pane ignored'); -}; +;;; kukit.showlog = function() { +;;; kukit.logWarning('Logging is on the console: request to show logging pane ignored'); +;;; }; // We want a way of knowing if Firebug is available : // it is very convenient to log a node in Firebug; @@ -49,6 +54,8 @@ kukit.hasFirebug = false; /* check whether the logging stuff of Firebug is available */ +/* +;;; */ if (typeof kukit.log == 'undefined' && typeof console != 'undefined' && typeof console.log != 'undefined' && @@ -62,8 +69,12 @@ kukit.logWarning = console.warn; kukit.hasFirebug = true; } +;;; /* + */ /* check whether the logging stuff of MochiKit is available */ +/* +;;; */ if (typeof kukit.log == 'undefined' && typeof MochiKit != 'undefined' && typeof MochiKit.Logging != 'undefined' && @@ -81,8 +92,12 @@ createLoggingPane(true); }; } +;;; /* + */ /* check whether the logging stuff of Safari is available */ +/* +;;; */ if (typeof kukit.log == 'undefined' && typeof console != 'undefined' && typeof console.log != 'undefined') { @@ -92,18 +107,20 @@ kukit.logFatal = function(str) { console.log('FATAL: '+str); }; kukit.logWarning = function(str) { console.log('WARNING: '+str); }; } +;;; /* + */ /* no logging solution available */ -if (typeof kukit.log == 'undefined') { +;;; if (typeof kukit.log == 'undefined') { kukit.log = function(str){}; kukit.logError = kukit.log; kukit.logDebug = kukit.log; kukit.logFatal = kukit.log; kukit.logWarning = kukit.log; -} +;;; } // log a startup message -kukit.log('Initializing kss'); +;;; kukit.log('Initializing kss'); /* utilities */ @@ -210,23 +227,23 @@ value = true; } else if (value == 'false' || value == 'False' || value == '0' || value == '') { value = false; - } else { - throw 'Bad boolean value "' + value + '" ' + errname; +;;; } else { +;;; throw 'Bad boolean value "' + value + '" ' + errname; } return value; }; kukit.ut.evalInt = function(value, errname) { - try { +;;; try { value = parseInt(value); - } catch(e) { - throw 'Bad integer value "' + value + '" ' + errname; - } +;;; } catch(e) { +;;; throw 'Bad integer value "' + value + '" ' + errname; +;;; } return value; }; kukit.ut.evalList = function(value, errname) { - try { +;;; try { // remove whitespace from beginning, end value = value.replace(/^ +/, ''); //while (value && value.charAt(0) == ' ') { @@ -235,9 +252,9 @@ value = value.replace(/ +$/, ''); // do the splitting value = value.split(/ *, */); - } catch(e) { - throw 'Bad list value "' + value + '" ' + errname; - } +;;; } catch(e) { +;;; throw 'Bad list value "' + value + '" ' + errname; +;;; } return value; }; @@ -374,7 +391,7 @@ if (! item) { break; } - kukit.log('Starting ' + item.remark); + ;;; kukit.log('Starting ' + item.remark); var ts_start = (new Date()).valueOf(); try { item.func(); @@ -383,7 +400,7 @@ throw(e); } var ts_end = (new Date()).valueOf(); - kukit.log('Finished ' + item.remark + ' in ' + (ts_end - ts_start) + ' ms'); + ;;; kukit.log('Finished ' + item.remark + ' in ' + (ts_end - ts_start) + ' ms'); } this.lock = false; } From reebalazs at codespeak.net Mon May 7 10:04:01 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Mon, 7 May 2007 10:04:01 +0200 (CEST) Subject: [KSS-checkins] r42767 - in kukit/kss.core/branch/ree-stripout-comments/kss/core: . pluginregistry pluginregistry/browser Message-ID: <20070507080401.E7C2F806F@code0.codespeak.net> Author: reebalazs Date: Mon May 7 10:04:01 2007 New Revision: 42767 Added: kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/ kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/__init__.py kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/configure.zcml kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.css kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.js kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.kss kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.pt kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develview.py Modified: kukit/kss.core/branch/ree-stripout-comments/kss/core/concatresource.zcml kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/configure.zcml Log: Added the kukit-devel.js resource, and create a view + ui for handling the browser cookie to set development mode Modified: kukit/kss.core/branch/ree-stripout-comments/kss/core/concatresource.zcml ============================================================================== --- kukit/kss.core/branch/ree-stripout-comments/kss/core/concatresource.zcml (original) +++ kukit/kss.core/branch/ree-stripout-comments/kss/core/concatresource.zcml Mon May 7 10:04:01 2007 @@ -8,6 +8,7 @@ to cache concatenation of kukit.js --> + + + + + + + + + + + + + + + + + + + Added: kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.css ============================================================================== --- (empty file) +++ kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.css Mon May 7 10:04:01 2007 @@ -0,0 +1,99 @@ +body { + font-family: Verdana, Arial, sans-serif; + font-size: 11pt; +} + +h3 { + font-size: 110%; + margin-top: 0.5em; + margin-bottom: 0.2em; +} + +#global-links { + display: table; + font-size: 80%; +} + +#global-links ul { + display: table-row; +} + +#global-links ul li { + display: table-cell; +} + +#global-links a { + display: block; + padding: 0.25em; + margin: 0.25em; + border: 1px solid #FF8888; + color: #CC0000; + text-decoration: none; +} + +#global-links a:hover { + border-color: #FF0000; + background-color: #FFCCCC; +} + +#target { + padding: 1em; + margin: 0.5em 0; + border: 1px solid #CCCCCC; + background-color: #EEEEEE; +} + +.cursorPointer { + cursor: pointer; +} + +.click { + color: #880000; +} + +radio.click { + background-color: #880000; +} + +a.button, +input[type="submit"] { + width: auto; + padding: 0.2em; + border: 1px solid #FF8888; + color: #CC0000; + text-decoration: none; +} + +fieldset { + margin: 0.5em 0; +} + +fieldset div { + margin: 0.3em 0; +} + +.help { + font-size: 80%; + color: #AAAAAA; +} + +.help pre { + color: black; + border: 1px solid #CCCCCC; + background-color: #EEEEEE; + padding: 0.5em; + margin: 0.25em; +} + +.container { + padding : 1em; +} + +.red { + color: red; +} + +.green { + color: green; +} + Added: kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.js ============================================================================== --- (empty file) +++ kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.js Mon May 7 10:04:01 2007 @@ -0,0 +1,5 @@ + +/* At the moment, there is no javascript, and + * switching is done from the server side. + */ + Added: kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.kss ============================================================================== --- (empty file) +++ kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.kss Mon May 7 10:04:01 2007 @@ -0,0 +1,4 @@ + +/* At the moment, there is no kss. + */ + Added: kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.pt ============================================================================== --- (empty file) +++ kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.pt Mon May 7 10:04:01 2007 @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Kss development mode browser setup

+
+

+ Different browser side parameters can be set up. +

+ +

+ @@kss_devel_mode/ison on the current context +

+ +

+ Kss development mode is + on + off + +

+ +

+ Set kss development mode cookie +

+

The cookie is global to the site and may be overridden by a + local utility (eg. ResourceRegistries, in Plone)

+
+ Click the button here. +
+ +
+ + +
+ +
+ + + Added: kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develview.py ============================================================================== --- (empty file) +++ kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develview.py Mon May 7 10:04:01 2007 @@ -0,0 +1,87 @@ + +try: + from Products.Five import BrowserView + BrowserView +except ImportError: + from zope.publisher.browser import BrowserView + +from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile + +COOKIE_NAME = '__kss_devel' + +class DevelView(BrowserView): + + def ison(self, REQUEST=None): + '''Checks if running in development mode + + Two ways to induce development mode: + + - set the cookie on the request + + - switch portal_js tool into debug mode, this will + select development mode without the cookie + + ''' + ison = COOKIE_NAME in self.request.cookies + + if not ison: + # Check from javascript tool + # XXX this should not be done from here, but I don't want to + # modify other components yet. + try: + from Products.CMFCore.utils import getToolByName + js_tool = getToolByName(self.context.aq_inner, 'portal_javascripts') + ison = js_tool.getDebugMode() + except: + pass + + result = bool(ison) + if REQUEST is not None: + result = str(result) + return result + + def isoff(self, REQUEST=None): + 'Check if running in production mode' + result = not(self.ison()) + if REQUEST is not None: + result = str(result) + return result + + def set(self): + 'XXX' + self.request.RESPONSE.setCookie(COOKIE_NAME, '1', path='/') + + def unset(self): + 'XXX' + self.request.RESPONSE.expireCookie(COOKIE_NAME, path='/') + + _ui = ViewPageTemplateFile('develui.pt', content_type='text/html;charset=utf-8') + + def ui(self): + 'XXX' + if 'devel' in self.request.form: + self.set() + self.request.cookies[COOKIE_NAME] = '1' + if 'prod' in self.request.form: + self.unset() + if COOKIE_NAME in self.request.cookies: + del self.request.cookies[COOKIE_NAME] + return self._ui() + + def ui_js(self): + 'XXX' + resource = self.context.restrictedTraverse('++resource++kss_devel_ui.js') + cooked = resource.GET() + return cooked + + def ui_css(self): + 'XXX' + resource = self.context.restrictedTraverse('++resource++kss_devel_ui.css') + cooked = resource.GET() + return cooked + + def ui_kss(self): + 'XXX' + resource = self.context.restrictedTraverse('++resource++kss_devel_ui.kss') + cooked = resource.GET() + return cooked Modified: kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/configure.zcml ============================================================================== --- kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/configure.zcml (original) +++ kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/configure.zcml Mon May 7 10:04:01 2007 @@ -7,6 +7,8 @@ + + + + From reebalazs at codespeak.net Mon May 7 10:59:32 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Mon, 7 May 2007 10:59:32 +0200 (CEST) Subject: [KSS-checkins] r42772 - kukit/kss.core/branch/ree-stripout-comments/kss/core Message-ID: <20070507085932.8CFDA8067@code0.codespeak.net> Author: reebalazs Date: Mon May 7 10:59:32 2007 New Revision: 42772 Modified: kukit/kss.core/branch/ree-stripout-comments/kss/core/concatresource.zcml Log: Add legend to contatresource.zcml about compression levels Modified: kukit/kss.core/branch/ree-stripout-comments/kss/core/concatresource.zcml ============================================================================== --- kukit/kss.core/branch/ree-stripout-comments/kss/core/concatresource.zcml (original) +++ kukit/kss.core/branch/ree-stripout-comments/kss/core/concatresource.zcml Mon May 7 10:59:32 2007 @@ -8,6 +8,20 @@ to cache concatenation of kukit.js --> + + Author: reebalazs Date: Mon May 7 18:52:49 2007 New Revision: 42823 Added: kukit/azax/branch/1.1-ree-stripout-comments/ - copied from r42822, kukit/azax/branch/1.1-performance_improvement/ Log: Branch off From reebalazs at codespeak.net Mon May 7 19:37:38 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Mon, 7 May 2007 19:37:38 +0200 (CEST) Subject: [KSS-checkins] r42833 - kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser Message-ID: <20070507173738.C66C78061@code0.codespeak.net> Author: reebalazs Date: Mon May 7 19:37:38 2007 New Revision: 42833 Modified: kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.pt Log: Fix @@kss_devel_mode/ui Modified: kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.pt ============================================================================== --- kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.pt (original) +++ kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.pt Mon May 7 19:37:38 2007 @@ -58,7 +58,7 @@ @@kss_devel_mode/ison on the current context -

+

Kss development mode is on off From reebalazs at codespeak.net Mon May 7 19:42:01 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Mon, 7 May 2007 19:42:01 +0200 (CEST) Subject: [KSS-checkins] r42834 - in kukit/azax/branch/1.1-ree-stripout-comments: . pluginregistry pluginregistry/browser Message-ID: <20070507174201.434B38061@code0.codespeak.net> Author: reebalazs Date: Mon May 7 19:42:00 2007 New Revision: 42834 Added: kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/browser/ - copied from r42767, kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/ kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/browser/__init__.py - copied unchanged from r42767, kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/__init__.py kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/browser/configure.zcml - copied unchanged from r42767, kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/configure.zcml kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/browser/develui.css - copied unchanged from r42767, kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.css kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/browser/develui.js - copied unchanged from r42767, kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.js kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/browser/develui.kss - copied unchanged from r42767, kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.kss kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/browser/develui.pt - copied, changed from r42767, kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develui.pt kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/browser/develview.py - copied, changed from r42767, kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develview.py Modified: kukit/azax/branch/1.1-ree-stripout-comments/ (props changed) kukit/azax/branch/1.1-ree-stripout-comments/EXTERNALS.TXT kukit/azax/branch/1.1-ree-stripout-comments/concatresource.zcml kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/ (props changed) kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/EXTERNALS.TXT kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/configure.zcml kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/registry.py Log: Adjust branch. (Also include patch -r42832:42833 from trunk.) Modified: kukit/azax/branch/1.1-ree-stripout-comments/EXTERNALS.TXT ============================================================================== --- kukit/azax/branch/1.1-ree-stripout-comments/EXTERNALS.TXT (original) +++ kukit/azax/branch/1.1-ree-stripout-comments/EXTERNALS.TXT Mon May 7 19:42:00 2007 @@ -5,5 +5,5 @@ # You can update your working dir by: # svn propset svn:externals -F EXTERNALS.TXT . # -kukit http://codespeak.net/svn/kukit/kukit.js/branch/performance_improvement +kukit http://codespeak.net/svn/kukit/kukit.js/branch/ree-stripout-comments configfeature http://codespeak.net/svn/z3/jsonserver/branch/merge/configfeature Modified: kukit/azax/branch/1.1-ree-stripout-comments/concatresource.zcml ============================================================================== --- kukit/azax/branch/1.1-ree-stripout-comments/concatresource.zcml (original) +++ kukit/azax/branch/1.1-ree-stripout-comments/concatresource.zcml Mon May 7 19:42:00 2007 @@ -2,6 +2,7 @@ xmlns:browser="http://namespaces.zope.org/browser" xmlns:five="http://namespaces.zope.org/five"> + + + + + + +

Kss development mode is on off Copied: kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/browser/develview.py (from r42767, kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develview.py) ============================================================================== --- kukit/kss.core/branch/ree-stripout-comments/kss/core/pluginregistry/browser/develview.py (original) +++ kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/browser/develview.py Mon May 7 19:42:00 2007 @@ -66,6 +66,8 @@ self.unset() if COOKIE_NAME in self.request.cookies: del self.request.cookies[COOKIE_NAME] + # fix for Zope 2.9 + self.request.debug = {} return self._ui() def ui_js(self): Modified: kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/configure.zcml ============================================================================== --- kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/configure.zcml (original) +++ kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/configure.zcml Mon May 7 19:42:00 2007 @@ -6,5 +6,7 @@ - + + + Modified: kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/registry.py ============================================================================== --- kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/registry.py (original) +++ kukit/azax/branch/1.1-ree-stripout-comments/pluginregistry/registry.py Mon May 7 19:42:00 2007 @@ -15,6 +15,8 @@ registry = AzaxPluginRegistry() capi.provideUtility(registry, IAzaxPluginRegistry) capi.provideUtility(registry, IConcatResourceAddon, name='kukit.js') + capi.provideUtility(registry, IConcatResourceAddon, name='kukit-devel.js') + capi.provideUtility(registry, IConcatResourceAddon, name='kukit-src.js') return registry class AzaxPluginError(Exception): From reebalazs at codespeak.net Tue May 8 12:01:30 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Tue, 8 May 2007 12:01:30 +0200 (CEST) Subject: [KSS-checkins] r42844 - kukit/kukit.js/branch/ree-stripout-comments/kukit Message-ID: <20070508100130.096908065@code0.codespeak.net> Author: reebalazs Date: Tue May 8 12:01:30 2007 New Revision: 42844 Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js Log: Fix commentification Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js Tue May 8 12:01:30 2007 @@ -635,14 +635,14 @@ // Get the oper that is bound to a given eventname to a node in this binderinstance // returns null, if there is no such oper. var rules_per_name = this.infopername[name]; - ;;; if (typeof(rules_per_name) == 'undefined') { - ;;; return null; - ;;; } + if (typeof(rules_per_name) == 'undefined') { + return null; + } var nodehash = kukit.rd.hashnode(node); var oper = rules_per_name[nodehash]; - ;;; if (typeof(oper) == 'undefined') { - ;;; return null; - ;;; } + if (typeof(oper) == 'undefined') { + return null; + } // Return it return oper; }; From reebalazs at codespeak.net Tue May 8 14:48:16 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Tue, 8 May 2007 14:48:16 +0200 (CEST) Subject: [KSS-checkins] r42858 - kukit/kukit.js/branch/performance_improvement/kukit Message-ID: <20070508124816.1C6948069@code0.codespeak.net> Author: reebalazs Date: Tue May 8 14:48:15 2007 New Revision: 42858 Modified: kukit/kukit.js/branch/performance_improvement/kukit/plugin.js Log: Fix a namespace problem that caused events to bind with error Modified: kukit/kukit.js/branch/performance_improvement/kukit/plugin.js ============================================================================== --- kukit/kukit.js/branch/performance_improvement/kukit/plugin.js (original) +++ kukit/kukit.js/branch/performance_improvement/kukit/plugin.js Tue May 8 14:48:15 2007 @@ -182,10 +182,9 @@ // var name = oper.getEventName(); if (oper.parms.preventdefault && kukit.HAVE_SAFARI && (oper.parms.allowbubbling || name == 'click' && oper.node.tagName.toLowerCase() == 'a')) { - function cancelClickSafari() { + oper.node.onclick = function cancelClickSafari() { return false; - } - node.onclick = cancelClickSafari; + }; } }; From reebalazs at codespeak.net Tue May 8 14:50:35 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Tue, 8 May 2007 14:50:35 +0200 (CEST) Subject: [KSS-checkins] r42859 - kukit/kukit.js/branch/ree-stripout-comments/kukit Message-ID: <20070508125035.7F82A8065@code0.codespeak.net> Author: reebalazs Date: Tue May 8 14:50:35 2007 New Revision: 42859 Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/plugin.js Log: Merge from performance_improvement branch -r42857:42858 : Fix a namespace problem that caused events to bind with error Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/plugin.js ============================================================================== --- kukit/kukit.js/branch/ree-stripout-comments/kukit/plugin.js (original) +++ kukit/kukit.js/branch/ree-stripout-comments/kukit/plugin.js Tue May 8 14:50:35 2007 @@ -183,10 +183,9 @@ // var name = oper.getEventName(); if (oper.parms.preventdefault && kukit.HAVE_SAFARI && (oper.parms.allowbubbling || name == 'click' && oper.node.tagName.toLowerCase() == 'a')) { - function cancelClickSafari() { + oper.node.onclick = function cancelClickSafari() { return false; - } - node.onclick = cancelClickSafari; + }; } }; From reebalazs at codespeak.net Wed May 9 11:32:45 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 9 May 2007 11:32:45 +0200 (CEST) Subject: [KSS-checkins] r42906 - kukit/azax/branch/1.1-ree-plugin-dad Message-ID: <20070509093245.471458076@code0.codespeak.net> Author: reebalazs Date: Wed May 9 11:32:44 2007 New Revision: 42906 Added: kukit/azax/branch/1.1-ree-plugin-dad/ - copied from r42905, kukit/azax/branch/1.1-ree-stripout-comments/ Log: Branch off From reebalazs at codespeak.net Wed May 9 11:44:38 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 9 May 2007 11:44:38 +0200 (CEST) Subject: [KSS-checkins] r42909 - kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop Message-ID: <20070509094438.1BFD38078@code0.codespeak.net> Author: reebalazs Date: Wed May 9 11:44:37 2007 New Revision: 42909 Added: kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/ - copied from r42908, kukit/kss.core/trunk/kss/core/plugins/draganddrop/ Log: Copy draganddrop plugin to experimental branch From reebalazs at codespeak.net Wed May 9 13:08:13 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 9 May 2007 13:08:13 +0200 (CEST) Subject: [KSS-checkins] r42927 - in kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop: . browser Message-ID: <20070509110813.C6285807A@code0.codespeak.net> Author: reebalazs Date: Wed May 9 13:08:13 2007 New Revision: 42927 Modified: kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/configure.zcml Log: Fixup files for bundle Modified: kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js ============================================================================== --- kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js (original) +++ kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js Wed May 9 13:08:13 2007 @@ -26,25 +26,25 @@ onHover: this.__make_func_to_bind__('hover', oper.node) }; Droppables.add(oper.node, options); - kukit.logDebug('Droppable bound'); } }; kukit.draganddrop.DragAndDropEvent.prototype.__bind_drag__ = function(name, func_to_bind, oper) { // validate and set parameters - oper.completeParms([], {'constraint' : 'not-set'}, 'dad-drag event binding'); + oper.completeParms([], {'constraint' : 'none'}, 'dad-drag event binding'); + if (oper.parms.constaint != 'horizontal' && oper.parms.constaint != 'vertical' && oper.parms.constaint != 'none') { + raise 'Unknown dad-drag constraint "' + oper.parms.constraint + '"'; + } if (this.isNotBoundDraggable(oper)) { var options = { onDrag : this.__make_func_to_bind__('drag', oper.node), onStart : this.__make_func_to_bind__('start', oper.node), onEnd : this.__make_func_to_bind__('end', oper.node) }; - if (oper.parms.constraint == 'horizontal' || oper.parms.constraint == 'vertical') { - kukit.logDebug('constraint: ' + oper.parms.constraint + "|" + name); + if (oper.parms.constraint != 'none') { options['constraint'] = oper.parms.constraint; } new Draggable(oper.node, options); - kukit.logDebug('Draggable bound'); } }; Modified: kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/configure.zcml ============================================================================== --- kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/configure.zcml (original) +++ kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/configure.zcml Wed May 9 13:08:13 2007 @@ -1,6 +1,6 @@ @@ -35,25 +35,29 @@ - - - - - From reebalazs at codespeak.net Wed May 9 14:46:50 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 9 May 2007 14:46:50 +0200 (CEST) Subject: [KSS-checkins] r42941 - in kukit/azax/branch/1.1-ree-plugin-dad/plugins: . draganddrop/browser Message-ID: <20070509124650.748AD807A@code0.codespeak.net> Author: reebalazs Date: Wed May 9 14:46:48 2007 New Revision: 42941 Modified: kukit/azax/branch/1.1-ree-plugin-dad/plugins/configure.zcml kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js Log: Small typo fix (and enable it) Modified: kukit/azax/branch/1.1-ree-plugin-dad/plugins/configure.zcml ============================================================================== --- kukit/azax/branch/1.1-ree-plugin-dad/plugins/configure.zcml (original) +++ kukit/azax/branch/1.1-ree-plugin-dad/plugins/configure.zcml Wed May 9 14:46:48 2007 @@ -13,4 +13,7 @@ + + + Modified: kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js ============================================================================== --- kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js (original) +++ kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js Wed May 9 14:46:48 2007 @@ -32,7 +32,7 @@ kukit.draganddrop.DragAndDropEvent.prototype.__bind_drag__ = function(name, func_to_bind, oper) { // validate and set parameters oper.completeParms([], {'constraint' : 'none'}, 'dad-drag event binding'); - if (oper.parms.constaint != 'horizontal' && oper.parms.constaint != 'vertical' && oper.parms.constaint != 'none') { + if (oper.parms.constraint != 'horizontal' && oper.parms.constraint != 'vertical' && oper.parms.constraint != 'none') { raise 'Unknown dad-drag constraint "' + oper.parms.constraint + '"'; } if (this.isNotBoundDraggable(oper)) { From reebalazs at codespeak.net Wed May 9 14:50:16 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Wed, 9 May 2007 14:50:16 +0200 (CEST) Subject: [KSS-checkins] r42942 - kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser Message-ID: <20070509125016.8B4E8807A@code0.codespeak.net> Author: reebalazs Date: Wed May 9 14:50:16 2007 New Revision: 42942 Modified: kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js Log: Small pythonic error fix Modified: kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js ============================================================================== --- kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js (original) +++ kukit/azax/branch/1.1-ree-plugin-dad/plugins/draganddrop/browser/kss_dragdrop.js Wed May 9 14:50:16 2007 @@ -33,7 +33,7 @@ // validate and set parameters oper.completeParms([], {'constraint' : 'none'}, 'dad-drag event binding'); if (oper.parms.constraint != 'horizontal' && oper.parms.constraint != 'vertical' && oper.parms.constraint != 'none') { - raise 'Unknown dad-drag constraint "' + oper.parms.constraint + '"'; + throw 'Unknown dad-drag constraint "' + oper.parms.constraint + '"'; } if (this.isNotBoundDraggable(oper)) { var options = { From gotcha at codespeak.net Wed May 9 15:51:20 2007 From: gotcha at codespeak.net (gotcha at codespeak.net) Date: Wed, 9 May 2007 15:51:20 +0200 (CEST) Subject: [KSS-checkins] r42951 - in kukit/kss.core/trunk/kss/core: . pluginregistry pluginregistry/json plugins/core plugins/effects tests Message-ID: <20070509135120.6D7ED807A@code0.codespeak.net> Author: gotcha Date: Wed May 9 15:51:19 2007 New Revision: 42951 Modified: kukit/kss.core/trunk/kss/core/__init__.py kukit/kss.core/trunk/kss/core/actionwrapper.py kukit/kss.core/trunk/kss/core/azaxview.py kukit/kss.core/trunk/kss/core/azaxview.txt kukit/kss.core/trunk/kss/core/browserview.py kukit/kss.core/trunk/kss/core/commands.py kukit/kss.core/trunk/kss/core/configure.zcml kukit/kss.core/trunk/kss/core/deprecated.py kukit/kss.core/trunk/kss/core/interfaces.py kukit/kss.core/trunk/kss/core/parsers.py kukit/kss.core/trunk/kss/core/pluginregistry/__init__.py kukit/kss.core/trunk/kss/core/pluginregistry/action.py kukit/kss.core/trunk/kss/core/pluginregistry/command.py kukit/kss.core/trunk/kss/core/pluginregistry/commandset.py kukit/kss.core/trunk/kss/core/pluginregistry/configure.py kukit/kss.core/trunk/kss/core/pluginregistry/event_type.py kukit/kss.core/trunk/kss/core/pluginregistry/interfaces.py kukit/kss.core/trunk/kss/core/pluginregistry/json/configure.zcml kukit/kss.core/trunk/kss/core/pluginregistry/json/interfaces.py kukit/kss.core/trunk/kss/core/pluginregistry/json/utils.py kukit/kss.core/trunk/kss/core/pluginregistry/plugin.py kukit/kss.core/trunk/kss/core/pluginregistry/pprovider.py kukit/kss.core/trunk/kss/core/pluginregistry/registry.py kukit/kss.core/trunk/kss/core/pluginregistry/selector_type.py kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml kukit/kss.core/trunk/kss/core/plugins/effects/commands.py kukit/kss.core/trunk/kss/core/plugins/effects/configure.zcml kukit/kss.core/trunk/kss/core/selectors.py kukit/kss.core/trunk/kss/core/tests/base.py kukit/kss.core/trunk/kss/core/tests/commandinspector.py kukit/kss.core/trunk/kss/core/tests/configure-unittest.zcml kukit/kss.core/trunk/kss/core/tests/ecmaview.py kukit/kss.core/trunk/kss/core/tests/test_azaxview.py kukit/kss.core/trunk/kss/core/tests/test_azaxview_core.py kukit/kss.core/trunk/kss/core/tests/test_browserview.py kukit/kss.core/trunk/kss/core/tests/test_ttwapi.py kukit/kss.core/trunk/kss/core/unicode_quirks.py Log: death to azax; license comments Modified: kukit/kss.core/trunk/kss/core/__init__.py ============================================================================== --- kukit/kss.core/trunk/kss/core/__init__.py (original) +++ kukit/kss.core/trunk/kss/core/__init__.py Wed May 9 15:51:19 2007 @@ -1,7 +1,5 @@ -# Copyright (c) 2006 -# Authors: -# Godefroid Chapelle -# Balazs Ree +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as published @@ -16,10 +14,12 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# -__all__ = ('AzaxBaseView', 'force_unicode', 'AzaxUnicodeError', - 'KssExplicitError', 'kssaction', + +__all__ = ('force_unicode', 'KSSUnicodeError', + 'KSSExplicitError', 'kssaction', 'KSSView', 'CommandSet', 'ICommandSet', +#BBB + 'AzaxBaseView', 'KssExplicitError', ) import mimetypes @@ -28,12 +28,13 @@ mimetypes.types_map['.kukit'] = 'text/xml' from kss.core.azaxview import KSSView, CommandSet -from kss.core.actionwrapper import KssExplicitError, kssaction -from kss.core.unicode_quirks import force_unicode, AzaxUnicodeError +from kss.core.actionwrapper import KSSExplicitError, kssaction +from kss.core.unicode_quirks import force_unicode, KSSUnicodeError from kss.core.interfaces import ICommandSet # BBB from kss.core.azaxview import AzaxBaseView +from kss.core.actionwrapper import KssExplicitError try: import Products.Five Modified: kukit/kss.core/trunk/kss/core/actionwrapper.py ============================================================================== --- kukit/kss.core/trunk/kss/core/actionwrapper.py (original) +++ kukit/kss.core/trunk/kss/core/actionwrapper.py Wed May 9 15:51:19 2007 @@ -14,14 +14,13 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# from textwrap import dedent from inspect import formatargspec, getargspec, getargvalues, \ formatargvalues, currentframe from zope.interface import implements -class KssExplicitError(Exception): +class KSSExplicitError(Exception): 'Explicit error to be raised' class kssaction(object): @@ -30,27 +29,27 @@ - render() will be called automatically if there is no return value - - if KssExplicitError is raised, a normal response is returned, + - if KSSExplicitError is raised, a normal response is returned, containing a single command:error azax command. Let's say we have a class here - that is supposed to be a kss view. - >>> from kss.core import kssaction, KssExplicitError, AzaxBaseView + >>> from kss.core import kssaction, KSSExplicitError, KSSView - >>> class MyView(AzaxBaseView): + >>> class MyView(KSSView): ... def ok(self, a, b, c=0): ... return 'OK %s %s %s' % (a, b, c) ... def notok(self, a, b, c=0): ... pass ... def error(self, a, b, c=0): - ... raise KssExplicitError, 'The error' + ... raise KSSExplicitError, 'The error' ... def exception(self, a, b, c=0): ... raise Exception, 'Unknown exception' Now we try qualifying with kssaction. We overwrite render too, just to enable sensible testing of the output: - >>> class MyView(AzaxBaseView): + >>> class MyView(KSSView): ... def render(self): ... return 'Rendered' ... @kssaction @@ -61,7 +60,7 @@ ... pass ... @kssaction ... def error(self, a, b, c=3): - ... raise KssExplicitError, 'The error' + ... raise KSSExplicitError, 'The error' ... @kssaction ... def exception(self, a, b, c=3): ... raise Exception, 'Unknown exception' @@ -100,14 +99,14 @@ >>> from zope.publisher.browser import TestRequest >>> from zope.publisher.http import HTTPResponse - >>> class MyView(AzaxBaseView): + >>> class MyView(KSSView): ... @kssaction ... def error(self, a, b, c=3): - ... raise KssExplicitError, 'The error' + ... raise KSSExplicitError, 'The error' ... @kssaction ... def with_docstring(self, a, b, c=3): ... "Docstring" - ... raise KssExplicitError, 'The error' + ... raise KSSExplicitError, 'The error' >>> request = TestRequest() >>> request.RESPONSE = HTTPResponse() @@ -239,7 +238,7 @@ def apply(self, obj, *arg, **kw): try: result = self.f(obj, *arg, **kw) - except KssExplicitError, exc: + except KSSExplicitError, exc: # Clear all the commands, and emit an error command obj._initcommands() obj.commands.addCommand('error', message=str(exc)) @@ -248,3 +247,12 @@ # render not returned - so we do it. result = obj.render() return result + +# backward compatibility +class KssExplicitError(KSSExplicitError): + def __init__(self, *args, **kw): + message = "'KssExplicitError' is deprecated," \ + "use 'KSSExplicitError'- KSS uppercase instead." + warnings.warn(message, DeprecationWarning, 2) + KSSExplicitError.__init__(self, *args, **kw) + Modified: kukit/kss.core/trunk/kss/core/azaxview.py ============================================================================== --- kukit/kss.core/trunk/kss/core/azaxview.py (original) +++ kukit/kss.core/trunk/kss/core/azaxview.py Wed May 9 15:51:19 2007 @@ -1,8 +1,5 @@ -# Copyright (c) 2005-2006 -# Authors: -# Godefroid Chapelle -# Tarek Ziade -# Balazs Ree +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as published @@ -17,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# + '''\ AZAX Base view class @@ -31,12 +28,14 @@ as well. ''' +import warnings + try: from Products.Five import BrowserView except ImportError: from zope.publisher.browser import BrowserView -from kss.core.commands import AzaxCommands +from kss.core.commands import KSSCommands from kss.core.interfaces import IKSSView, ICommandSet from kss.core.pluginregistry.commandset import getRegisteredCommandSet @@ -122,7 +121,7 @@ self._initcommands() def _initcommands(self): - self.commands = AzaxCommands() + self.commands = KSSCommands() # XXX avoid weird acquisition behaviour in Zope 2... this should # go away when Five views aren't Acquisition objects anymore. @@ -149,9 +148,6 @@ # return the adapted view return commandset.provides(self) -# BBB deprecated -AzaxBaseView = KSSView - class CommandSet: interface.implements(ICommandSet) @@ -165,4 +161,17 @@ return self.view.getCommandSet(name) # BBB deprecated -AzaxViewAdapter = CommandSet +class AzaxBaseView(KSSView): + def __init__(self, *args, **kw): + message = "'AzaxBaseView' is deprecated," \ + "use 'KSSView' instead." + warnings.warn(message, DeprecationWarning, 2) + KSSView.__init__(self, *args, **kw) + +class AzaxViewAdapter(CommandSet): + def __init__(self, *args, **kw): + message = "'AzaxViewAdapter' is deprecated," \ + "use 'CommandSet' instead." + warnings.warn(message, DeprecationWarning, 2) + CommandSet.__init__(self, *args, **kw) + Modified: kukit/kss.core/trunk/kss/core/azaxview.txt ============================================================================== --- kukit/kss.core/trunk/kss/core/azaxview.txt (original) +++ kukit/kss.core/trunk/kss/core/azaxview.txt Wed May 9 15:51:19 2007 @@ -10,7 +10,7 @@ example of such a modification change would be changing the title. This should also update the navigation portlet. -To make this work azax views do something special. We will explain +To make this work KSS views do something special. We will explain this by creating an example. The following will setup our enviroment and show that normal operation works. @@ -49,7 +49,7 @@ Now that we have shown that this will not generate any KSS commands we will register a handler. This handler will catch the object event -and add some Azax commands. +and add some KSS commands. >>> @component.adapter(None, SampleView, IObjectModifiedEvent) ... def stuff_happend(object, view, event): Modified: kukit/kss.core/trunk/kss/core/browserview.py ============================================================================== --- kukit/kss.core/trunk/kss/core/browserview.py (original) +++ kukit/kss.core/trunk/kss/core/browserview.py Wed May 9 15:51:19 2007 @@ -17,15 +17,15 @@ # 02111-1307, USA. # -import cgi +import cgi, warnings + try: from Products.Five import BrowserView except ImportError: from zope.app.publisher.browser import BrowserView -#from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile from zope.pagetemplate.pagetemplatefile import PageTemplateFile -class KssBrowserView(BrowserView): +class KSSBrowserView(BrowserView): # XML output gets rendered via a page template # XXX note: barefoot rendering, use python: only after zope2.9 @@ -43,3 +43,13 @@ # get rid of newlines payload = payload.replace('\n', ' ') self.request.RESPONSE.setHeader(header_name, payload) + +# coherent naming KSS +# deprecate Kss +class KssBrowserView(KSSBrowserView): + def __init__(self, *args, **kw): + message = "'KssBrowserView' is deprecated," \ + "use 'KSSBrowserView'- KSS uppercase instead." + warnings.warn(message, DeprecationWarning, 2) + KSSBrowserView.__init__(self, *args, **kw) + Modified: kukit/kss.core/trunk/kss/core/commands.py ============================================================================== --- kukit/kss.core/trunk/kss/core/commands.py (original) +++ kukit/kss.core/trunk/kss/core/commands.py Wed May 9 15:51:19 2007 @@ -1,8 +1,6 @@ # -*- coding: ISO-8859-15 -*- -# Copyright (c) 2006 -# Authors: -# Godefroid Chapelle -# Balazs Ree +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as published @@ -17,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# + '''\ Marshal objects @@ -27,31 +25,31 @@ from zope.interface import implements from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile -from interfaces import IAzaxCommands, IAzaxCommand, IAzaxParam, IAzaxCommandView +from interfaces import IKSSCommands, IKSSCommand, IKSSParam, IKSSCommandView from unicode_quirks import force_unicode from zope.interface import Interface import zope.component from parsers import XmlParser, HtmlParser from pluginregistry import checkRegisteredCommand_old from pluginregistry import checkRegisteredCommand, checkRegisteredSelector, \ - AzaxPluginError + KSSPluginError -class AzaxCommands(list): - implements(IAzaxCommands) +class KSSCommands(list): + implements(IKSSCommands) def addCommand(self, command_name, selector=None, **kw): - command = AzaxCommand(command_name, selector=selector, **kw) + command = KSSCommand(command_name, selector=selector, **kw) self.append(command) return command def render(self, request): '''All methods must use this to return their command set ''' - adapter = zope.component.getMultiAdapter((self, request), IAzaxCommandView) + adapter = zope.component.getMultiAdapter((self, request), IKSSCommandView) return adapter.render() -class AzaxParam: - implements(IAzaxParam) +class KSSParam: + implements(IKSSParam) def __init__(self, name, content=''): self.name = name @@ -67,13 +65,13 @@ def getContent(self): return self.content -class AzaxCommand: - implements(IAzaxCommand) +class KSSCommand: + implements(IKSSCommand) def __init__(self, command_name, selector=None, **kw): try: checkRegisteredCommand_old(command_name) - except AzaxPluginError: + except KSSPluginError: # we expect this is not registered as command, anyway # so check it as an action. checkRegisteredCommand(command_name) @@ -111,7 +109,7 @@ def addParam(self, name, content=''): 'Add the param as is' - param = AzaxParam(name, content) + param = KSSParam(name, content) self.params.append(param) return param @@ -166,7 +164,7 @@ The render method does actual marshalling of the commands to be sent to the client. ''' - implements(IAzaxCommandView) + implements(IKSSCommandView) def __init__(self, context, request): self.context = context Modified: kukit/kss.core/trunk/kss/core/configure.zcml ============================================================================== --- kukit/kss.core/trunk/kss/core/configure.zcml (original) +++ kukit/kss.core/trunk/kss/core/configure.zcml Wed May 9 15:51:19 2007 @@ -37,9 +37,9 @@ Modified: kukit/kss.core/trunk/kss/core/deprecated.py ============================================================================== --- kukit/kss.core/trunk/kss/core/deprecated.py (original) +++ kukit/kss.core/trunk/kss/core/deprecated.py Wed May 9 15:51:19 2007 @@ -1,8 +1,6 @@ # -*- coding: ISO-8859-15 -*- -# Copyright (c) 2006 -# Authors: -# Godefroid Chapelle -# Balazs Ree +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as published @@ -17,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# + import warnings, textwrap def deprecated(method, message): Modified: kukit/kss.core/trunk/kss/core/interfaces.py ============================================================================== --- kukit/kss.core/trunk/kss/core/interfaces.py (original) +++ kukit/kss.core/trunk/kss/core/interfaces.py Wed May 9 15:51:19 2007 @@ -1,7 +1,5 @@ -# Copyright (c) 2005 -# Authors: -# Godefroid Chapelle -# Tarek Ziade +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as published @@ -16,12 +14,11 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# from zope.interface import Interface, Attribute -class IAzaxCommands(Interface): - 'Azax commands' +class IKSSCommands(Interface): + 'KSS commands' def addCommand(self, name, selector=None): 'Add a command' @@ -40,8 +37,8 @@ def getHtmlIdSelector(self, selector): 'Return selector' -class IAzaxCommand(Interface): - 'An Azax command' +class IKSSCommand(Interface): + 'An KSS command' def addParam(self, name, content=''): 'Add the param as is' @@ -81,15 +78,15 @@ def getParams(self): '' -class IAzaxCommandView(Interface): +class IKSSCommandView(Interface): 'View of a command set' def render(): 'This renders the command set' -class IAzaxParam(Interface): - 'An Azax parameter' +class IKSSParam(Interface): + 'An KSS parameter' def force_content_unicode(self): 'Content must be str with ascii encoding, or unicode' @@ -102,7 +99,7 @@ class IKSSView(Interface): - commands = Attribute('An IAzaxCommands object that keeps track of ' + commands = Attribute('An IKSSCommands object that keeps track of ' 'all commands that are sent to the browser') def render(self): Modified: kukit/kss.core/trunk/kss/core/parsers.py ============================================================================== --- kukit/kss.core/trunk/kss/core/parsers.py (original) +++ kukit/kss.core/trunk/kss/core/parsers.py Wed May 9 15:51:19 2007 @@ -1,8 +1,6 @@ # -*- coding: ISO-8859-15 -*- -# Copyright (c) 2006 -# Authors: -# Godefroid Chapelle -# Balazs Ree +# Copyright (c) 2006-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as published @@ -17,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# + '''\ Parser implementations Modified: kukit/kss.core/trunk/kss/core/pluginregistry/__init__.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/__init__.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/__init__.py Wed May 9 15:51:19 2007 @@ -1,8 +1,25 @@ +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + '''\ Module init ''' -from plugin import AzaxPluginError +from plugin import KSSPluginError from command import Command, checkRegisteredCommand_old from event_type import EventType from action import Action, checkRegisteredCommand Modified: kukit/kss.core/trunk/kss/core/pluginregistry/action.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/action.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/action.py Wed May 9 15:51:19 2007 @@ -1,5 +1,21 @@ +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. -from plugin import AzaxPlugin, AzaxPluginError +from plugin import KSSPlugin, KSSPluginError from interfaces import IAction from zope.interface import implements import zope.component as capi @@ -9,14 +25,14 @@ try: command = capi.getUtility(IAction, name) except capi.ComponentLookupError: - raise AzaxPluginError, '"%s" is not a registered kss command' % (name, ) + raise KSSPluginError, '"%s" is not a registered kss command' % (name, ) # check if the action has a valid command factory if command.command_factory == 'none': - raise AzaxPluginError, '"%s" kss command has missing command_factory' % (name, ) + raise KSSPluginError, '"%s" kss command has missing command_factory' % (name, ) # issue deprecation warning, if necessary command.check_deprecation() -class Action(AzaxPlugin): +class Action(KSSPlugin): '''The action plugin ''' @@ -25,7 +41,7 @@ def __init__(self, name, jsfile, command_factory, params_mandatory, params_optional, deprecated): - AzaxPlugin.__init__(self, name, jsfile) + KSSPlugin.__init__(self, name, jsfile) self.command_factory = command_factory self.params_mandatory = params_mandatory self.params_optional = params_optional Modified: kukit/kss.core/trunk/kss/core/pluginregistry/command.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/command.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/command.py Wed May 9 15:51:19 2007 @@ -1,7 +1,23 @@ +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. -from plugin import AzaxPlugin +from plugin import KSSPlugin from interfaces import ICommand -from plugin import AzaxPluginError +from plugin import KSSPluginError import zope.component as capi from zope.interface import implements @@ -10,9 +26,9 @@ try: command = capi.getUtility(ICommand, name) except capi.ComponentLookupError: - raise AzaxPluginError, '"%s" is not a registered kss command' % (name, ) + raise KSSPluginError, '"%s" is not a registered kss command' % (name, ) -class Command(AzaxPlugin): +class Command(KSSPlugin): '''The command plugin ''' @@ -20,4 +36,4 @@ implements(ICommand) def __init__(self, name, jsfile): - AzaxPlugin.__init__(self, name, jsfile) + KSSPlugin.__init__(self, name, jsfile) Modified: kukit/kss.core/trunk/kss/core/pluginregistry/commandset.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/commandset.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/commandset.py Wed May 9 15:51:19 2007 @@ -1,7 +1,24 @@ +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + from zope.interface import implements import zope.component as capi -from plugin import AzaxPluginError +from plugin import KSSPluginError from plugin import registerPlugin from interfaces import ICommandSet @@ -10,7 +27,7 @@ try: commandset = capi.getUtility(ICommandSet, name) except capi.ComponentLookupError: - raise AzaxPluginError, '"%s" is not a registered kss command set' % (name, ) + raise KSSPluginError, '"%s" is not a registered kss command set' % (name, ) return commandset class CommandSet(object): Modified: kukit/kss.core/trunk/kss/core/pluginregistry/configure.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/configure.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/configure.py Wed May 9 15:51:19 2007 @@ -1,3 +1,19 @@ +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. from zope.component.zcml import adapter from interfaces import IEventType, ISelectorType, IAction, IParamProvider @@ -8,9 +24,6 @@ from pprovider import ParamProvider from plugin import registerPlugin -#class AzaxConfigurationError(Exception): -# pass - def registerEventType(_context, name, jsfile=None): 'Directive that registers an event type' Modified: kukit/kss.core/trunk/kss/core/pluginregistry/event_type.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/event_type.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/event_type.py Wed May 9 15:51:19 2007 @@ -1,9 +1,25 @@ +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. -from plugin import AzaxPlugin +from plugin import KSSPlugin from interfaces import IEventType from zope.interface import implements -class EventType(AzaxPlugin): +class EventType(KSSPlugin): '''The event type plugin ''' @@ -11,5 +27,5 @@ implements(IEventType) def __init__(self, name, jsfile): - AzaxPlugin.__init__(self, name, jsfile) + KSSPlugin.__init__(self, name, jsfile) Modified: kukit/kss.core/trunk/kss/core/pluginregistry/interfaces.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/interfaces.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/interfaces.py Wed May 9 15:51:19 2007 @@ -1,25 +1,42 @@ +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + from zope.interface import Interface -class IAzaxPlugin(Interface): +class IKSSPlugin(Interface): '''Base for azax plugins this represents an entity implemented in a javascript file ''' -class ICommand(IAzaxPlugin): +class ICommand(IKSSPlugin): '''Command plugin''' -class IAction(IAzaxPlugin): +class IAction(IKSSPlugin): '''Action plugin''' -class IEventType(IAzaxPlugin): +class IEventType(IKSSPlugin): '''Event type plugin''' -class ISelectorType(IAzaxPlugin): +class ISelectorType(IKSSPlugin): '''Selector type plugin''' class ICommandSet(Interface): '''Command set plugin''' -class IParamProvider(IAzaxPlugin): +class IParamProvider(IKSSPlugin): '''Parameter provider plugin''' Modified: kukit/kss.core/trunk/kss/core/pluginregistry/json/configure.zcml ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/json/configure.zcml (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/json/configure.zcml Wed May 9 15:51:19 2007 @@ -15,7 +15,7 @@ - + - + - + -# Tarek Ziad? +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as published @@ -17,7 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# import config from zope.interface import Interface Modified: kukit/kss.core/trunk/kss/core/pluginregistry/json/utils.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/json/utils.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/json/utils.py Wed May 9 15:51:19 2007 @@ -44,7 +44,7 @@ def render(self): return self.context -class AzaxCommandWriter(object): +class KSSCommandWriter(object): 'Writes a command to JSON' implements(IJSONStreamWriteable) Modified: kukit/kss.core/trunk/kss/core/pluginregistry/plugin.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/plugin.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/plugin.py Wed May 9 15:51:19 2007 @@ -1,9 +1,25 @@ +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. -from interfaces import IAzaxPlugin +from interfaces import IKSSPlugin import zope.component as capi from zope.interface import implements -class AzaxPluginError(Exception): +class KSSPluginError(Exception): pass def registerPlugin(cls, interface, name, *arg, **kw): @@ -15,14 +31,14 @@ except capi.ComponentLookupError: pass else: - raise AzaxPluginError, 'Duplicate registration attempt for plugin "%s" of type %s' % (plugin.name, interface) + raise KSSPluginError, 'Duplicate registration attempt for plugin "%s" of type %s' % (plugin.name, interface) # provide the utility. capi.provideUtility(plugin, interface, name=name) -class AzaxPlugin(object): +class KSSPlugin(object): 'The base plugin class' - implements(IAzaxPlugin) + implements(IKSSPlugin) def __init__(self, name, jsfile): self.name = name Modified: kukit/kss.core/trunk/kss/core/pluginregistry/pprovider.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/pprovider.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/pprovider.py Wed May 9 15:51:19 2007 @@ -1,14 +1,30 @@ +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. -from plugin import AzaxPlugin +from plugin import KSSPlugin from interfaces import IParamProvider import zope.component as capi from zope.interface import implements -class ParamProvider(AzaxPlugin): +class ParamProvider(KSSPlugin): '''The parameter provider plugin ''' implements(IParamProvider) def __init__(self, name, jsfile): - AzaxPlugin.__init__(self, name, jsfile) + KSSPlugin.__init__(self, name, jsfile) Modified: kukit/kss.core/trunk/kss/core/pluginregistry/registry.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/registry.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/registry.py Wed May 9 15:51:19 2007 @@ -1,5 +1,22 @@ +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + import zope.component as capi -from interfaces import IAzaxPlugin +from interfaces import IKSSPlugin from zope.interface import implements # concatresource is an embedded product import _concatresource @@ -7,7 +24,7 @@ from json import getJsonAddonFiles import zope.component as capi -class AzaxConcatResourceAddon(object): +class KSSConcatResourceAddon(object): implements(IConcatResourceAddon) def getAddonFiles(self): @@ -17,10 +34,10 @@ # Lazy setup of addon files self._addon_files = files = getJsonAddonFiles() # Lookup all utilities and add up the files from it - plugins = capi.getAllUtilitiesRegisteredFor(IAzaxPlugin) + plugins = capi.getAllUtilitiesRegisteredFor(IKSSPlugin) for plugin in plugins: if plugin.jsfile and plugin.jsfile not in files: files.append(plugin.jsfile) return files -azaxConcatResourceAddon = AzaxConcatResourceAddon() +azaxConcatResourceAddon = KSSConcatResourceAddon() Modified: kukit/kss.core/trunk/kss/core/pluginregistry/selector_type.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/selector_type.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/selector_type.py Wed May 9 15:51:19 2007 @@ -1,6 +1,22 @@ +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. -from plugin import AzaxPlugin -from plugin import AzaxPluginError +from plugin import KSSPlugin +from plugin import KSSPluginError from interfaces import ISelectorType import zope.component as capi from zope.interface import implements @@ -10,9 +26,9 @@ try: command = capi.getUtility(ISelectorType, name) except capi.ComponentLookupError: - raise AzaxPluginError, '"%s" is not a registered kss selector' % (name, ) + raise KSSPluginError, '"%s" is not a registered kss selector' % (name, ) -class SelectorType(AzaxPlugin): +class SelectorType(KSSPlugin): '''The selectortype plugin ''' @@ -20,4 +36,4 @@ implements(ISelectorType) def __init__(self, name, jsfile): - AzaxPlugin.__init__(self, name, jsfile) + KSSPlugin.__init__(self, name, jsfile) Modified: kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml ============================================================================== --- kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml (original) +++ kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml Wed May 9 15:51:19 2007 @@ -399,7 +399,7 @@ Modified: kukit/kss.core/trunk/kss/core/plugins/effects/commands.py ============================================================================== --- kukit/kss.core/trunk/kss/core/plugins/effects/commands.py (original) +++ kukit/kss.core/trunk/kss/core/plugins/effects/commands.py Wed May 9 15:51:19 2007 @@ -1,3 +1,20 @@ +# Copyright (c) 2006-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + from interfaces import IScriptaculousEffectsCommands from kss.core.azaxview import CommandSet Modified: kukit/kss.core/trunk/kss/core/plugins/effects/configure.zcml ============================================================================== --- kukit/kss.core/trunk/kss/core/plugins/effects/configure.zcml (original) +++ kukit/kss.core/trunk/kss/core/plugins/effects/configure.zcml Wed May 9 15:51:19 2007 @@ -53,7 +53,7 @@ Modified: kukit/kss.core/trunk/kss/core/selectors.py ============================================================================== --- kukit/kss.core/trunk/kss/core/selectors.py (original) +++ kukit/kss.core/trunk/kss/core/selectors.py Wed May 9 15:51:19 2007 @@ -1,6 +1,5 @@ -# Copyright (c) 2006 -# Authors: -# Godefroid Chapelle +# Copyright (c) 2006-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as published @@ -15,7 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# CSS_SELECTOR = 'css' HTMLID_SELECTOR = 'htmlid' Modified: kukit/kss.core/trunk/kss/core/tests/base.py ============================================================================== --- kukit/kss.core/trunk/kss/core/tests/base.py (original) +++ kukit/kss.core/trunk/kss/core/tests/base.py Wed May 9 15:51:19 2007 @@ -1,9 +1,6 @@ # -*- coding: latin-1 -*- -# Copyright (c) 2005-2006 -# Authors: -# Godefroid Chapelle -# Tarek Ziad? -# Bal?zs Re? +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as published @@ -18,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# + from textwrap import dedent import warnings @@ -104,7 +101,7 @@ class IDebugRequest(IBrowserRequest): 'The debug request' -class KssViewTestCase(ZopeTestCase): +class KSSViewTestCase(ZopeTestCase): layer = KSSLayer def loadCoreConfig(self, kss_core=True): @@ -125,9 +122,30 @@ request, interface.directlyProvidedBy(request) + IDebugRequest) -class KssViewFunctionalTestCase(FunctionalTestCase, KssViewTestCase): +class KSSViewFunctionalTestCase(FunctionalTestCase, KSSViewTestCase): 'Functional test base' - # backward compatibility -AzaxViewTestCase = KssViewTestCase +class AzaxViewTestCase(KSSViewTestCase): + def __init__(self, *args, **kw): + message = "'AzaxViewTestCase' is deprecated," \ + "use 'KSSViewTestCase'- KSS uppercase instead." + warnings.warn(message, DeprecationWarning, 2) + KSSViewTestCase.__init__(self, *args, **kw) + +class KssViewTestCase(KSSViewTestCase): + def __init__(self, *args, **kw): + message = "'KssViewTestCase' is deprecated," \ + "use 'KSSViewTestCase'- KSS uppercase instead." + warnings.warn(message, DeprecationWarning, 2) + KSSViewTestCase.__init__(self, *args, **kw) + +class KssViewFunctionalTestCase(KSSViewFunctionalTestCase): + def __init__(self, *args, **kw): + message = "'KssViewFunctionalTestCase' is deprecated," \ + "use 'KSSViewFunctionalTestCase'- KSS uppercase instead." + warnings.warn(message, DeprecationWarning, 2) + KSSViewFunctionalTestCase.__init__(self, *args, **kw) + + + Modified: kukit/kss.core/trunk/kss/core/tests/commandinspector.py ============================================================================== --- kukit/kss.core/trunk/kss/core/tests/commandinspector.py (original) +++ kukit/kss.core/trunk/kss/core/tests/commandinspector.py Wed May 9 15:51:19 2007 @@ -1,6 +1,5 @@ -# Authors: -# Godefroid Chapelle -# Balazs Ree +# Copyright (c) 2006-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as published @@ -15,10 +14,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# from zope.interface import implements -from kss.core.interfaces import IAzaxCommandView +from kss.core.interfaces import IKSSCommandView class CommandInspectorView(object): '''Inspector view of a command. @@ -28,7 +26,7 @@ Look at the tests to see what checks this makes possible. ''' - implements(IAzaxCommandView) + implements(IKSSCommandView) def __init__(self, context, request): self.context = context Modified: kukit/kss.core/trunk/kss/core/tests/configure-unittest.zcml ============================================================================== --- kukit/kss.core/trunk/kss/core/tests/configure-unittest.zcml (original) +++ kukit/kss.core/trunk/kss/core/tests/configure-unittest.zcml Wed May 9 15:51:19 2007 @@ -9,9 +9,9 @@ --> Modified: kukit/kss.core/trunk/kss/core/tests/ecmaview.py ============================================================================== --- kukit/kss.core/trunk/kss/core/tests/ecmaview.py (original) +++ kukit/kss.core/trunk/kss/core/tests/ecmaview.py Wed May 9 15:51:19 2007 @@ -1,6 +1,5 @@ -# Authors: -# Godefroid Chapelle -# Balazs Ree +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as published @@ -15,7 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# try: from Products.Five import BrowserView Modified: kukit/kss.core/trunk/kss/core/tests/test_azaxview.py ============================================================================== --- kukit/kss.core/trunk/kss/core/tests/test_azaxview.py (original) +++ kukit/kss.core/trunk/kss/core/tests/test_azaxview.py Wed May 9 15:51:19 2007 @@ -1,9 +1,6 @@ # -*- coding: latin-1 -*- -# Copyright (c) 2005-2006 -# Authors: -# Godefroid Chapelle -# Tarek Ziad? -# Bal?zs Re? +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as published @@ -18,10 +15,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# + import unittest -from kss.core.interfaces import IKSSView, IAzaxCommands +from kss.core.interfaces import IKSSView, IKSSCommands from kss.core.plugins.core.interfaces import IKSSCoreCommands from kss.core.plugins.core.commands import KSSCoreCommands from kss.core.pluginregistry.interfaces import IAction, ICommandSet @@ -38,7 +35,7 @@ def setUpAjaxView(test=None): setHooks() zope.component.provideAdapter(CommandInspectorView, - adapts=(IAzaxCommands, IBrowserRequest)) + adapts=(IKSSCommands, IBrowserRequest)) registerPlugin(Action, IAction, 'replaceInnerHTML', None, 'selector', 'html', [], None) zope.component.provideAdapter(KSSCoreCommands, Modified: kukit/kss.core/trunk/kss/core/tests/test_azaxview_core.py ============================================================================== --- kukit/kss.core/trunk/kss/core/tests/test_azaxview_core.py (original) +++ kukit/kss.core/trunk/kss/core/tests/test_azaxview_core.py Wed May 9 15:51:19 2007 @@ -1,11 +1,28 @@ # -*- coding: latin-1 -*- +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + import unittest import textwrap -from kss.core import AzaxUnicodeError -from kss.core.tests.base import KssViewTestCase +from kss.core import KSSUnicodeError +from kss.core.tests.base import KSSViewTestCase from Testing.ZopeTestCase import FunctionalDocFileSuite -class TestKSSViewCoreCommandSet(KssViewTestCase): +class TestKSSViewCoreCommandSet(KSSViewTestCase): def test_empty(self): view = self.createView() @@ -71,9 +88,9 @@ def test_setHtmlChecksForNonUnicode(self): 'Test that it does not accept non unicode (unless pure ascii)' - self.assertRaises(AzaxUnicodeError, self._checkSetHtmlResult, 'abc?') + self.assertRaises(KSSUnicodeError, self._checkSetHtmlResult, 'abc?') -class FTestKSSViewCoreCommandSet(KssViewTestCase): +class FTestKSSViewCoreCommandSet(KSSViewTestCase): 'Functional tests' def _wrapped_commands(self, inline): @@ -129,7 +146,7 @@ self.assertCommandsEqual(result, awaited) def afterSetUp(self): - KssViewTestCase.afterSetUp(self) + KSSViewTestCase.afterSetUp(self) self.setDebugRequest() @@ -138,7 +155,7 @@ suites.append(unittest.makeSuite(TestKSSViewCoreCommandSet)) suites.append(unittest.makeSuite(FTestKSSViewCoreCommandSet)) suites.append(FunctionalDocFileSuite('../actionwrapper.py', - test_class=KssViewTestCase, + test_class=KSSViewTestCase, setUp=afterSetUp, - tearDown=KssViewTestCase.beforeTearDown.im_func)) + tearDown=KSSViewTestCase.beforeTearDown.im_func)) return unittest.TestSuite(suites) Modified: kukit/kss.core/trunk/kss/core/tests/test_browserview.py ============================================================================== --- kukit/kss.core/trunk/kss/core/tests/test_browserview.py (original) +++ kukit/kss.core/trunk/kss/core/tests/test_browserview.py Wed May 9 15:51:19 2007 @@ -15,11 +15,11 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# + import unittest -from base import AzaxViewTestCase +from base import KSSViewTestCase -class TestBrowserView(AzaxViewTestCase): +class TestBrowserView(KSSViewTestCase): def test_attach_error(self): 'Test if errors are attached properly' Modified: kukit/kss.core/trunk/kss/core/tests/test_ttwapi.py ============================================================================== --- kukit/kss.core/trunk/kss/core/tests/test_ttwapi.py (original) +++ kukit/kss.core/trunk/kss/core/tests/test_ttwapi.py Wed May 9 15:51:19 2007 @@ -14,11 +14,11 @@ from zope.app.component.hooks import setHooks from kss.core import KSSView -from kss.core.tests.base import KssViewTestCase +from kss.core.tests.base import KSSViewTestCase -class TTWTestCase(KssViewTestCase): +class TTWTestCase(KSSViewTestCase): - class layer(KssViewTestCase.layer): + class layer(KSSViewTestCase.layer): @classmethod def setUp(cls): configure_zcml = '''\ @@ -31,7 +31,7 @@ zcml.load_string(configure_zcml) def afterSetUp(self): - KssViewTestCase.afterSetUp(self) + KSSViewTestCase.afterSetUp(self) setHooks() self.app.manage_addProduct['PythonScripts'].manage_addPythonScript( 'kss_test') Modified: kukit/kss.core/trunk/kss/core/unicode_quirks.py ============================================================================== --- kukit/kss.core/trunk/kss/core/unicode_quirks.py (original) +++ kukit/kss.core/trunk/kss/core/unicode_quirks.py Wed May 9 15:51:19 2007 @@ -1,5 +1,21 @@ +# Copyright (c) 2005-2007 +# Authors: KSS Project Contributors (see docs/CREDITS.txt) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. -class AzaxUnicodeError(RuntimeError): +class KSSUnicodeError(RuntimeError): pass def force_unicode(value, encoding='ascii'): @@ -8,7 +24,7 @@ try: value = unicode(value, encoding) except UnicodeDecodeError, exc: - raise AzaxUnicodeError, 'Content must be unicode or ascii string, original exception: %s' % (exc, ) + raise KSSUnicodeError, 'Content must be unicode or ascii string, original exception: %s' % (exc, ) else: assert isinstance(value, unicode) return value From gotcha at codespeak.net Wed May 9 21:19:11 2007 From: gotcha at codespeak.net (gotcha at codespeak.net) Date: Wed, 9 May 2007 21:19:11 +0200 (CEST) Subject: [KSS-checkins] r42970 - in kukit/kss.core/trunk/kss/core: . pluginregistry pluginregistry/deprecated plugins/core plugins/effects tests Message-ID: <20070509191911.4D749807B@code0.codespeak.net> Author: gotcha Date: Wed May 9 21:19:10 2007 New Revision: 42970 Added: kukit/kss.core/trunk/kss/core/kssview.py - copied, changed from r42951, kukit/kss.core/trunk/kss/core/azaxview.py kukit/kss.core/trunk/kss/core/kssview.txt - copied unchanged from r42951, kukit/kss.core/trunk/kss/core/azaxview.txt kukit/kss.core/trunk/kss/core/tests/test_kssview.py - copied, changed from r42951, kukit/kss.core/trunk/kss/core/tests/test_azaxview.py kukit/kss.core/trunk/kss/core/tests/test_kssview_core.py - copied unchanged from r42951, kukit/kss.core/trunk/kss/core/tests/test_azaxview_core.py kukit/kss.core/trunk/kss/core/tests/test_kssview_functional.py - copied, changed from r42919, kukit/kss.core/trunk/kss/core/tests/test_azaxview_functional.py Removed: kukit/kss.core/trunk/kss/core/azaxview.py kukit/kss.core/trunk/kss/core/azaxview.txt kukit/kss.core/trunk/kss/core/tests/test_azaxview.py kukit/kss.core/trunk/kss/core/tests/test_azaxview_core.py kukit/kss.core/trunk/kss/core/tests/test_azaxview_functional.py Modified: kukit/kss.core/trunk/kss/core/__init__.py kukit/kss.core/trunk/kss/core/actionwrapper.py kukit/kss.core/trunk/kss/core/configure.zcml kukit/kss.core/trunk/kss/core/pluginregistry/configure.zcml kukit/kss.core/trunk/kss/core/pluginregistry/deprecated/directives.py kukit/kss.core/trunk/kss/core/pluginregistry/interfaces.py kukit/kss.core/trunk/kss/core/pluginregistry/registry.py kukit/kss.core/trunk/kss/core/plugins/core/commands.py kukit/kss.core/trunk/kss/core/plugins/effects/commands.py kukit/kss.core/trunk/kss/core/siteview.txt Log: death to azax, step 2 Modified: kukit/kss.core/trunk/kss/core/__init__.py ============================================================================== --- kukit/kss.core/trunk/kss/core/__init__.py (original) +++ kukit/kss.core/trunk/kss/core/__init__.py Wed May 9 21:19:10 2007 @@ -27,14 +27,16 @@ mimetypes.types_map['.kkt'] = 'text/xml' # BBB legacy! mimetypes.types_map['.kukit'] = 'text/xml' -from kss.core.azaxview import KSSView, CommandSet +from kss.core.kssview import KSSView, CommandSet from kss.core.actionwrapper import KSSExplicitError, kssaction from kss.core.unicode_quirks import force_unicode, KSSUnicodeError from kss.core.interfaces import ICommandSet # BBB -from kss.core.azaxview import AzaxBaseView +from kss.core.kssview import AzaxBaseView from kss.core.actionwrapper import KssExplicitError +import sys, kssview +sys.modules['kss.core.azaxview'] = kssview try: import Products.Five Modified: kukit/kss.core/trunk/kss/core/actionwrapper.py ============================================================================== --- kukit/kss.core/trunk/kss/core/actionwrapper.py (original) +++ kukit/kss.core/trunk/kss/core/actionwrapper.py Wed May 9 21:19:10 2007 @@ -30,7 +30,7 @@ return value - if KSSExplicitError is raised, a normal response is returned, - containing a single command:error azax command. + containing a single command:error KSS command. Let's say we have a class here - that is supposed to be a kss view. Deleted: /kukit/kss.core/trunk/kss/core/azaxview.py ============================================================================== --- /kukit/kss.core/trunk/kss/core/azaxview.py Wed May 9 21:19:10 2007 +++ (empty file) @@ -1,177 +0,0 @@ -# Copyright (c) 2005-2007 -# Authors: KSS Project Contributors (see docs/CREDITS.txt) -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -'''\ -AZAX Base view class - -All the implementations should create a specialization -of this class when building their browser views. - -The policy is that a method should build up a command -set on available methods and then return self.render(). - -The default command set is implemented in the base class -as well. -''' - -import warnings - -try: - from Products.Five import BrowserView -except ImportError: - from zope.publisher.browser import BrowserView - -from kss.core.commands import KSSCommands -from kss.core.interfaces import IKSSView, ICommandSet -from kss.core.pluginregistry.commandset import getRegisteredCommandSet - -from zope import component, interface, event -from zope.interface.adapter import VerifyingAdapterRegistry -from zope.component import getSiteManager -from zope.component.globalregistry import BaseGlobalComponents -from zope.component.interfaces import IComponentLookup, ComponentLookupError -from zope.component.interfaces import IObjectEvent -from zope.app.component.interfaces import ISite -from zope.app.publication.zopepublication import BeforeTraverseEvent - -class SiteViewComponents(BaseGlobalComponents): - - def _init_registries(self): - # This is why this class is needed: we can't work with a - # regular AdapterRegistry because it wants to do funny things - # with __bases__. - self.adapters = VerifyingAdapterRegistry() - self.utilities = VerifyingAdapterRegistry() - -class SiteView(BrowserView): - """A browser view that is its own site - """ - interface.implements(ISite) - - def __init__(self, context, request): - super(SiteView, self).__init__(context, request) - - next = component.getSiteManager() - self._sitemanager = SiteViewComponents('siteview') - self._sitemanager.__bases__ = (next, ) - - # On Five, we should wrap it in the acquisition context - # see, if self has aq_parent, it is done obligatoraly - try: - self.context.aq_parent - except AttributeError: - # Zope3 - No problem. - wrapped_view = self - else: - wrapped_view = self.__of__(self.context) - - # register object event handler - self._sitemanager.registerHandler(wrapped_view._eventRedispatcher) - - # Zope 2.10 doesn't send BeforeTraverseEvents for all objects, - # only the ones for which you explicitly enable a before traverse - # hook available from Five.component. Hence, this view won't - # become the current site when it's traversed. This is bad, - # hopefully Zope 2.11 will fix this. For now, we'll just take - # care of it ourselves... - def __before_publishing_traverse__(self, obj, request): - event.notify(BeforeTraverseEvent(self, request)) - - # ISite interface - - def getSiteManager(self): - return self._sitemanager - - def setSiteManager(self, sm): - raise TypeError("Site manager of SiteView can't be changed.") - - @component.adapter(IObjectEvent) - def _eventRedispatcher(self, event): - """This works similar to zope.component.event.objectEventNotify: - It dispatches object events to subscribers that listen to - (object, view, event).""" - adapters = component.subscribers((event.object, self, event), None) - for adapter in adapters: - pass # getting them does the work - -class KSSView(SiteView): - """KSS view - - This allows setting up the content of the response, and then - generate it out. - """ - interface.implements(IKSSView) - - def __init__(self, context, request): - super(KSSView, self).__init__(context, request) - self._initcommands() - - def _initcommands(self): - self.commands = KSSCommands() - - # XXX avoid weird acquisition behaviour in Zope 2... this should - # go away when Five views aren't Acquisition objects anymore. - def _set_context(self, context): - self._context = [context] - def _get_context(self): - return self._context[0] - context = property(_get_context, _set_context) - - def render(self): - """Views can use this to return their command set.""" - return self.commands.render(self.request) - - def cancelRedirect(self): - if self.request.RESPONSE.getStatus() in (302, 303): - # Try to not redirect if requested - self.request.RESPONSE.setStatus(200) - - def getCommands(self): - return self.commands - - def getCommandSet(self, name): - commandset = getRegisteredCommandSet(name) - # return the adapted view - return commandset.provides(self) - -class CommandSet: - interface.implements(ICommandSet) - - def __init__(self, view): - self.view = view - self.context = self.view.context - self.request = self.view.request - self.commands = self.view.commands - - def getCommandSet(self, name): - return self.view.getCommandSet(name) - -# BBB deprecated -class AzaxBaseView(KSSView): - def __init__(self, *args, **kw): - message = "'AzaxBaseView' is deprecated," \ - "use 'KSSView' instead." - warnings.warn(message, DeprecationWarning, 2) - KSSView.__init__(self, *args, **kw) - -class AzaxViewAdapter(CommandSet): - def __init__(self, *args, **kw): - message = "'AzaxViewAdapter' is deprecated," \ - "use 'CommandSet' instead." - warnings.warn(message, DeprecationWarning, 2) - CommandSet.__init__(self, *args, **kw) - Deleted: /kukit/kss.core/trunk/kss/core/azaxview.txt ============================================================================== --- /kukit/kss.core/trunk/kss/core/azaxview.txt Wed May 9 21:19:10 2007 +++ (empty file) @@ -1,66 +0,0 @@ -==================== -KSS views and events -==================== - -When we make a change using Ajax calls we would like to update the -browser page. This can be done by sending browser commands. Some part -of the page may need to be update based on modifications. - -We don't want to handle all these modifications in our own code. An -example of such a modification change would be changing the -title. This should also update the navigation portlet. - -To make this work KSS views do something special. We will explain -this by creating an example. The following will setup our enviroment -and show that normal operation works. - - >>> from kss.core import KSSView - >>> from zope import component - >>> from zope.lifecycleevent import ObjectModifiedEvent - >>> from zope.lifecycleevent.interfaces import IObjectModifiedEvent - >>> from zope.publisher.browser import TestRequest - >>> from zope.publisher.http import HTTPResponse - >>> from zope import event - - >>> from zope.app.folder import folder - >>> myfolder = folder.rootFolder() - >>> request = TestRequest() - >>> request.RESPONSE = HTTPResponse() - -Now we will write our custom. - - >>> class SampleView(KSSView): - ... def setTitle(self, title): - ... self.context.title = title - ... event.notify(ObjectModifiedEvent(self.context)) - ... return self.render() - - >>> view = SampleView(myfolder, request) - -Simulate traversal by making the view the current site: - - >>> from zope.app.component.hooks import setSite - >>> setSite(view) - -Let's set a title: - - >>> view.setTitle("some title") - [] - -Now that we have shown that this will not generate any KSS commands -we will register a handler. This handler will catch the object event -and add some KSS commands. - - >>> @component.adapter(None, SampleView, IObjectModifiedEvent) - ... def stuff_happend(object, view, event): - ... view.getCommandSet('core').replaceInnerHTML( - ... 'div.class', object.title) - >>> component.provideHandler(stuff_happend) - -When we call the renderer now it should have some more data in it. - - >>> view = SampleView(myfolder, request) - >>> setSite(view) - - >>> view.setTitle(u"some title")[0]['params']['html'] - u'some title' Modified: kukit/kss.core/trunk/kss/core/configure.zcml ============================================================================== --- kukit/kss.core/trunk/kss/core/configure.zcml (original) +++ kukit/kss.core/trunk/kss/core/configure.zcml Wed May 9 21:19:10 2007 @@ -35,7 +35,7 @@ name="MochiKit.js" /> - + Modified: kukit/kss.core/trunk/kss/core/pluginregistry/deprecated/directives.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/deprecated/directives.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/deprecated/directives.py Wed May 9 21:19:10 2007 @@ -4,7 +4,7 @@ GlobalInterface class IRegisterCommandDirective(Interface): - 'Register an AZAX command plugin' + 'Register a KSS command plugin' name = TextLine( title=u"Name", Modified: kukit/kss.core/trunk/kss/core/pluginregistry/interfaces.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/interfaces.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/interfaces.py Wed May 9 21:19:10 2007 @@ -18,7 +18,7 @@ from zope.interface import Interface class IKSSPlugin(Interface): - '''Base for azax plugins + '''Base for KSS plugins this represents an entity implemented in a javascript file ''' Modified: kukit/kss.core/trunk/kss/core/pluginregistry/registry.py ============================================================================== --- kukit/kss.core/trunk/kss/core/pluginregistry/registry.py (original) +++ kukit/kss.core/trunk/kss/core/pluginregistry/registry.py Wed May 9 21:19:10 2007 @@ -40,4 +40,4 @@ files.append(plugin.jsfile) return files -azaxConcatResourceAddon = KSSConcatResourceAddon() +kssConcatResourceAddon = KSSConcatResourceAddon() Modified: kukit/kss.core/trunk/kss/core/plugins/core/commands.py ============================================================================== --- kukit/kss.core/trunk/kss/core/plugins/core/commands.py (original) +++ kukit/kss.core/trunk/kss/core/plugins/core/commands.py Wed May 9 21:19:10 2007 @@ -1,6 +1,6 @@ from kss.core.selectors import Selector, CssSelector, HtmlIdSelector from kss.core.selectors import ParentNodeSelector, SameNodeSelector -from kss.core.azaxview import CommandSet +from kss.core.kssview import CommandSet from kss.core.deprecated import deprecated from kss.core.parsers import HtmlParser from kss.core.plugins.core.interfaces import IKSSCoreCommands Modified: kukit/kss.core/trunk/kss/core/plugins/effects/commands.py ============================================================================== --- kukit/kss.core/trunk/kss/core/plugins/effects/commands.py (original) +++ kukit/kss.core/trunk/kss/core/plugins/effects/commands.py Wed May 9 21:19:10 2007 @@ -16,7 +16,7 @@ # 02111-1307, USA. from interfaces import IScriptaculousEffectsCommands -from kss.core.azaxview import CommandSet +from kss.core.kssview import CommandSet class ScriptaculousEffectsCommands(CommandSet): Modified: kukit/kss.core/trunk/kss/core/siteview.txt ============================================================================== --- kukit/kss.core/trunk/kss/core/siteview.txt (original) +++ kukit/kss.core/trunk/kss/core/siteview.txt Wed May 9 21:19:10 2007 @@ -15,7 +15,7 @@ The main class which implements views with a site manager is ``SiteView``: - >>> from kss.core.azaxview import SiteView + >>> from kss.core.kssview import SiteView >>> from zope import component >>> old_sitemanager = component.getSiteManager() Deleted: /kukit/kss.core/trunk/kss/core/tests/test_azaxview.py ============================================================================== --- /kukit/kss.core/trunk/kss/core/tests/test_azaxview.py Wed May 9 21:19:10 2007 +++ (empty file) @@ -1,56 +0,0 @@ -# -*- coding: latin-1 -*- -# Copyright (c) 2005-2007 -# Authors: KSS Project Contributors (see docs/CREDITS.txt) -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -import unittest - -from kss.core.interfaces import IKSSView, IKSSCommands -from kss.core.plugins.core.interfaces import IKSSCoreCommands -from kss.core.plugins.core.commands import KSSCoreCommands -from kss.core.pluginregistry.interfaces import IAction, ICommandSet -from kss.core.pluginregistry.action import Action -from kss.core.pluginregistry.plugin import registerPlugin -from kss.core.pluginregistry.commandset import CommandSet -from kss.core.tests.commandinspector import CommandInspectorView - -import zope.component.event -from zope.testing import doctest, cleanup -from zope.publisher.interfaces.browser import IBrowserRequest -from zope.app.component.hooks import setHooks - -def setUpAjaxView(test=None): - setHooks() - zope.component.provideAdapter(CommandInspectorView, - adapts=(IKSSCommands, IBrowserRequest)) - registerPlugin(Action, IAction, 'replaceInnerHTML', None, - 'selector', 'html', [], None) - zope.component.provideAdapter(KSSCoreCommands, - adapts=(IKSSView,), - provides=IKSSCoreCommands) - registerPlugin(CommandSet, ICommandSet, 'core', IKSSCoreCommands) - -def tearDownAjaxView(test=None): - cleanup.cleanUp() - -def test_suite(): - return unittest.TestSuite([ - doctest.DocTestSuite('kss.core.azaxview'), - doctest.DocFileSuite('azaxview.txt', - package='kss.core', - setUp=setUpAjaxView, - tearDown=tearDownAjaxView), - ]) Deleted: /kukit/kss.core/trunk/kss/core/tests/test_azaxview_core.py ============================================================================== --- /kukit/kss.core/trunk/kss/core/tests/test_azaxview_core.py Wed May 9 21:19:10 2007 +++ (empty file) @@ -1,161 +0,0 @@ -# -*- coding: latin-1 -*- -# Copyright (c) 2005-2007 -# Authors: KSS Project Contributors (see docs/CREDITS.txt) -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -import unittest -import textwrap -from kss.core import KSSUnicodeError -from kss.core.tests.base import KSSViewTestCase -from Testing.ZopeTestCase import FunctionalDocFileSuite - -class TestKSSViewCoreCommandSet(KSSViewTestCase): - - def test_empty(self): - view = self.createView() - commands = view.getCommands() - self.assertEqual(len(commands), 0) - - def test_addCommand(self): - view = self.createView() - commands = view.getCommands() - command = commands.addCommand('replaceInnerHTML', 'selector') - self.assertEqual(len(commands), 1) - self.assertEqual(command.getName(), 'replaceInnerHTML') - self.assertEqual(command.getSelector(), 'selector') - params = command.getParams() - self.assertEqual(len(params), 0) - - # XXX since lxml is gone, the next cases are no problem anymore - # Nevertheless, we test all these cases - - def _checkSetHtmlResult(self, content, content2=None): - view = self.createView() - view.getCommandSet('core').replaceInnerHTML('div.class', content) - commands = view.getCommands() - self.assertEqual(len(commands), 1) - command = commands[0] - self.assertEqual(command.getName(), 'replaceInnerHTML') - self.assertEqual(command.getSelector(), 'div.class') - params = command.getParams() - self.assertEqual(len(params), 2) - self.assertEqual(params[0].getName(), 'html') - self.assertEqual(params[1].getName(), 'withKssSetup') - if content2 == None: - content2 = content - self.assertEqual(params[0].getContent().encode('ascii', 'xmlcharrefreplace'), content2.encode('ascii', 'xmlcharrefreplace')) - - def test_replaceInnerHTMLTextPlusEntity(self): - 'See if non breaking space entity works' - ##self._checkSetHtmlResult(' ') - # XXX we remove html named entities now - self._checkSetHtmlResult(' ', ' ') - - def test_replaceInnerHTMLTextPlusEntityOthers(self): - 'See if the other HTML entities work as well' - # XXX we remove html named entities now - self._checkSetHtmlResult('

»Hello world!«

', - '

»Hello world!«

') - - def test_replaceInnerHTMLTextOnly(self): - self._checkSetHtmlResult('new content') - - def test_replaceInnerHTMLTagOnly(self): - self._checkSetHtmlResult('

new_content

') - - def test_replaceInnerHTMLTagPlusText(self): - self._checkSetHtmlResult('

new_content

after') - - def test_replaceInnerHTMLTextTagPlusText(self): - self._checkSetHtmlResult('before

new_content

after') - - def test_setHtmlAcceptsUnicode(self): - 'Test that it accepts unicode' - self._checkSetHtmlResult(u'abc?') - - def test_setHtmlChecksForNonUnicode(self): - 'Test that it does not accept non unicode (unless pure ascii)' - self.assertRaises(KSSUnicodeError, self._checkSetHtmlResult, 'abc?') - -class FTestKSSViewCoreCommandSet(KSSViewTestCase): - 'Functional tests' - - def _wrapped_commands(self, inline): - header = textwrap.dedent(u'''\ - - - - ''') - footer = textwrap.dedent('''\ - - - ''') - return header + inline + footer - - def assertXMLEquals(self, a, b): - self.assertEqual(a, b) - - def assertCommandsEqual(self, a, b): - self.assertXMLEquals(a, self._wrapped_commands(b)) - - def test_empty(self): - view = self.createView() - result = view.render() - self.assertEquals(view.request.response.getHeader('content-type'), 'text/xml;charset=utf-8') - self.assertCommandsEqual(result, '') - - def test_replaceInnerHTML(self): - view = self.createView() - view.getCommandSet('core').replaceInnerHTML('div.class', 'new content') - result = view.render() - awaited = u'''\ - - new content - True - -''' - self.assertCommandsEqual(result, awaited) - - def test_setCommandSet(self): - view = self.createView() - cs = view.getCommandSet('core') - cs.replaceInnerHTML('div.class', 'new content') - result = view.render() - awaited = u'''\ - - new content - True - -''' - self.assertCommandsEqual(result, awaited) - -def afterSetUp(self): - KSSViewTestCase.afterSetUp(self) - self.setDebugRequest() - - -def test_suite(): - suites = [] - suites.append(unittest.makeSuite(TestKSSViewCoreCommandSet)) - suites.append(unittest.makeSuite(FTestKSSViewCoreCommandSet)) - suites.append(FunctionalDocFileSuite('../actionwrapper.py', - test_class=KSSViewTestCase, - setUp=afterSetUp, - tearDown=KSSViewTestCase.beforeTearDown.im_func)) - return unittest.TestSuite(suites) Deleted: /kukit/kss.core/trunk/kss/core/tests/test_azaxview_functional.py ============================================================================== --- /kukit/kss.core/trunk/kss/core/tests/test_azaxview_functional.py Wed May 9 21:19:10 2007 +++ (empty file) @@ -1,83 +0,0 @@ -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. -# -import unittest - -import Products.Five -from Products.Five import zcml -from Testing.ZopeTestCase import FunctionalDocTestSuite - -from zope import event, component -from zope.testing.cleanup import cleanUp -from zope.lifecycleevent import ObjectModifiedEvent -from zope.app.component.hooks import getSite, setHooks - -from kss.core import KSSView - -class TestKSSView(KSSView): - - def __call__(self): - self.messages = [] - if getSite() == self: - self.messages.append("I'm the current site.") - if component.getSiteManager() == self.getSiteManager(): - self.messages.append("I have the current site manager.") - event.notify(ObjectModifiedEvent(self.context)) - return "\n".join(self.messages) - - at component.adapter(None, KSSView, ObjectModifiedEvent) -def objectModifiedThruKSSView(obj, view, event): - view.messages.append("Event subscriber was here.") - -def setUp(test=None): - configure_zcml = '''\ - - - - ''' - zcml.load_config('configure.zcml', Products.Five) - zcml.load_string(configure_zcml) - setHooks() - -def tearDown(test=None): - cleanUp() - -def ftest_kssview(): - """ - Let's verify that a KSSView actually is the current site when it's - being traversed to. Also, let's make sure that if in the course - of this view, an object event is fired, the view will dispatch to - KSS-specific subscribers: - - >>> from Products.Five.testbrowser import Browser - >>> browser = Browser('http://localhost:8080/testkssview') - >>> print browser.contents - I'm the current site. - I have the current site manager. - Event subscriber was here. - """ - -def test_suite(): - return unittest.TestSuite([ - FunctionalDocTestSuite(setUp=setUp, tearDown=tearDown), - ]) Copied: kukit/kss.core/trunk/kss/core/tests/test_kssview.py (from r42951, kukit/kss.core/trunk/kss/core/tests/test_azaxview.py) ============================================================================== --- kukit/kss.core/trunk/kss/core/tests/test_azaxview.py (original) +++ kukit/kss.core/trunk/kss/core/tests/test_kssview.py Wed May 9 21:19:10 2007 @@ -48,8 +48,8 @@ def test_suite(): return unittest.TestSuite([ - doctest.DocTestSuite('kss.core.azaxview'), - doctest.DocFileSuite('azaxview.txt', + doctest.DocTestSuite('kss.core.kssview'), + doctest.DocFileSuite('kssview.txt', package='kss.core', setUp=setUpAjaxView, tearDown=tearDownAjaxView), Copied: kukit/kss.core/trunk/kss/core/tests/test_kssview_functional.py (from r42919, kukit/kss.core/trunk/kss/core/tests/test_azaxview_functional.py) ============================================================================== --- kukit/kss.core/trunk/kss/core/tests/test_azaxview_functional.py (original) +++ kukit/kss.core/trunk/kss/core/tests/test_kssview_functional.py Wed May 9 21:19:10 2007 @@ -46,7 +46,7 @@ + package="kss.core.tests.test_kssview_functional"> Author: gotcha Date: Wed May 9 21:53:05 2007 New Revision: 42976 Modified: kukit/kss.core/trunk/kss/core/configure.zcml Log: replace Kss with KSS Modified: kukit/kss.core/trunk/kss/core/configure.zcml ============================================================================== --- kukit/kss.core/trunk/kss/core/configure.zcml (original) +++ kukit/kss.core/trunk/kss/core/configure.zcml Wed May 9 21:53:05 2007 @@ -48,7 +48,7 @@ for="*" name="kss_view" permission="zope.Public" - class=".browserview.KssBrowserView" + class=".browserview.KSSBrowserView" allowed_attributes="attach_error" /> From gotcha at codespeak.net Thu May 10 00:00:35 2007 From: gotcha at codespeak.net (gotcha at codespeak.net) Date: Thu, 10 May 2007 00:00:35 +0200 (CEST) Subject: [KSS-checkins] r42989 - in kukit/kss.demo/trunk/kss/demo: . browser browser/coreplugin browser/coresyntax tests tests/selenium_tests Message-ID: <20070509220035.CBFDE807A@code0.codespeak.net> Author: gotcha Date: Thu May 10 00:00:35 2007 New Revision: 42989 Added: kukit/kss.demo/trunk/kss/demo/browser/autoupdate.kss - copied unchanged from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_three_autoupdate.kss kukit/kss.demo/trunk/kss/demo/browser/autoupdate.pt - copied, changed from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_three_autoupdate.pt kukit/kss.demo/trunk/kss/demo/browser/basic_commands.kss - copied unchanged from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_demo.kss kukit/kss.demo/trunk/kss/demo/browser/basic_commands.pt - copied, changed from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_demo.pt kukit/kss.demo/trunk/kss/demo/browser/coreplugin/demoview.py - copied, changed from r42976, kukit/kss.demo/trunk/kss/demo/browser/coreplugin/azaxview.py kukit/kss.demo/trunk/kss/demo/browser/coresyntax/demoview.py - copied, changed from r42976, kukit/kss.demo/trunk/kss/demo/browser/coresyntax/azaxview.py kukit/kss.demo/trunk/kss/demo/browser/effects.kss - copied unchanged from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_effects.kss kukit/kss.demo/trunk/kss/demo/browser/effects.pt - copied unchanged from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_effects.pt kukit/kss.demo/trunk/kss/demo/browser/inline_edit.kss - copied unchanged from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_instant_edit.kss kukit/kss.demo/trunk/kss/demo/browser/inline_edit.pt - copied, changed from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_instant_edit.pt kukit/kss.demo/trunk/kss/demo/browser/kss_demo_index.pt - copied, changed from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_demo_index.pt kukit/kss.demo/trunk/kss/demo/browser/tree.kss - copied unchanged from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_tree.kss kukit/kss.demo/trunk/kss/demo/browser/tree.pt - copied, changed from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_tree.pt kukit/kss.demo/trunk/kss/demo/browser/two_selects.kss - copied unchanged from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_two_select.kss kukit/kss.demo/trunk/kss/demo/browser/two_selects.pt - copied, changed from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_two_select.pt kukit/kss.demo/trunk/kss/demo/browser/xpath.kss - copied unchanged from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_xpath.kss kukit/kss.demo/trunk/kss/demo/browser/xpath.pt - copied, changed from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_xpath.pt kukit/kss.demo/trunk/kss/demo/demoview.py - copied, changed from r42976, kukit/kss.demo/trunk/kss/demo/azaxview.py kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/autopupdate.html - copied, changed from r42976, kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/three_autopupdate.html kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/basic_commands.html - copied unchanged from r42976, kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/demo1.html kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/inline_edit.html - copied, changed from r42976, kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/azax_instant_edit.html kukit/kss.demo/trunk/kss/demo/tests/test_demoview.py - copied, changed from r42976, kukit/kss.demo/trunk/kss/demo/tests/test_azaxview.py Removed: kukit/kss.demo/trunk/kss/demo/azaxview.py kukit/kss.demo/trunk/kss/demo/browser/azax_demo.kss kukit/kss.demo/trunk/kss/demo/browser/azax_demo.pt kukit/kss.demo/trunk/kss/demo/browser/azax_demo_index.pt kukit/kss.demo/trunk/kss/demo/browser/azax_effects.kss kukit/kss.demo/trunk/kss/demo/browser/azax_effects.pt kukit/kss.demo/trunk/kss/demo/browser/azax_instant_edit.kss kukit/kss.demo/trunk/kss/demo/browser/azax_instant_edit.pt kukit/kss.demo/trunk/kss/demo/browser/azax_three_autoupdate.kss kukit/kss.demo/trunk/kss/demo/browser/azax_three_autoupdate.pt kukit/kss.demo/trunk/kss/demo/browser/azax_tree.kss kukit/kss.demo/trunk/kss/demo/browser/azax_tree.pt kukit/kss.demo/trunk/kss/demo/browser/azax_two_select.kss kukit/kss.demo/trunk/kss/demo/browser/azax_two_select.pt kukit/kss.demo/trunk/kss/demo/browser/azax_xpath.kss kukit/kss.demo/trunk/kss/demo/browser/azax_xpath.pt kukit/kss.demo/trunk/kss/demo/browser/coreplugin/azaxview.py kukit/kss.demo/trunk/kss/demo/browser/coresyntax/azaxview.py kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/azax_instant_edit.html kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/demo1.html kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/three_autopupdate.html kukit/kss.demo/trunk/kss/demo/tests/test_azaxview.py Modified: kukit/kss.demo/trunk/kss/demo/EXTERNALS.TXT kukit/kss.demo/trunk/kss/demo/browser/coresyntax/configure.zcml kukit/kss.demo/trunk/kss/demo/configure.zcml Log: death to azax, long life kss Modified: kukit/kss.demo/trunk/kss/demo/EXTERNALS.TXT ============================================================================== --- kukit/kss.demo/trunk/kss/demo/EXTERNALS.TXT (original) +++ kukit/kss.demo/trunk/kss/demo/EXTERNALS.TXT Thu May 10 00:00:35 2007 @@ -1,6 +1,6 @@ # # results of svn propget svn:externals -# http://codespeak.net/svn/kukit/azaxdemo/trunk +# http://codespeak.net/svn/kukit/kss.demo/trunk # # You can update your working dir by: # svn propset svn:externals -F EXTERNALS.TXT . Deleted: /kukit/kss.demo/trunk/kss/demo/azaxview.py ============================================================================== --- /kukit/kss.demo/trunk/kss/demo/azaxview.py Thu May 10 00:00:35 2007 +++ (empty file) @@ -1,204 +0,0 @@ -# -*- coding: ISO-8859-15 -*- -# Copyright (c) 2005 -# Authors: -# Godefroid Chapelle -# Tarek Ziad? -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. -# - -from kss.core import AzaxBaseView, force_unicode, KssExplicitError, kssaction -import datetime - -class AzaxView(AzaxBaseView): - - def clearDivContent(self): - """ clear div content """ - self.getCommandSet('core').clearChildNodes('div#demo') - return self.render() - - def copyFromDivContent(self): - """ copy div content """ - self.getCommandSet('core').copyChildNodesFrom('div#copy', 'demo') - return self.render() - - def copyToDivContent(self): - """ copy div content """ - self.getCommandSet('core').copyChildNodesTo('div#copy', 'demo') - return self.render() - - def moveToDivContent(self): - """ copy div content """ - self.getCommandSet('core').copyChildNodesTo('div#copy', 'demo') - self.getCommandSet('core').clearChildNodes('div#copy') - return self.render() - - def getDivContent(self): - """ returns div content """ - self.getCommandSet('core').replaceInnerHTML('div#demo', '

it worked

') - self.getCommandSet('core').replaceInnerHTML('div#demo', '

it worked again

') - return self.render() - - def getCorrespondingSelect(self, value): - """ returns select content """ - mapping = {} - mapping['']=[] - mapping['animals']=['dog', 'cat', 'cow'] - mapping['machines']=['computer', 'car', 'airplane'] - # XXX Note that originally we just used replaceInnerHTML to just put - # the options inside the select, however this is principally broken - # on IE due to an IE bug. Microsoft has confirmed the bug but is not - # giving information on whether it has or it will ever be fixed. - # For further info, see http://support.microsoft.com/default.aspx?scid=kb;en-us;276228 - # The current solution, replace the outer node, works solidly. - result = ['') - self.getCommandSet('core').replaceHTML('select#second', ' '.join(result)) - return self.render() - - def getAutoupdateMarkup(self): - """ returns the current time """ - self.getCommandSet('core').replaceInnerHTML('div#update-wrapper', '
') - return self.render() - - def getCurrentTime(self): - """ returns the current time """ - self.getCommandSet('core').replaceInnerHTML('div#update-area', "

%s

" % str(datetime.datetime.now())) - return self.render() - - def getInputField(self, value): - 'Inserts the value as entered into an input field' - # We need to make unicode. But on Z2 we receive utf-8, on Z3 unicode - value = force_unicode(value, 'utf') - self.getCommandSet('core').replaceInnerHTML('div#text', - '
' \ - '' - ) - return self.render() - - def saveText(self, value): - 'Inserts the value to display it on the page' - # We need to make unicode. But on Z2 we receive utf-8, on Z3 unicode - value = force_unicode(value, 'utf') - self.getCommandSet('core').replaceInnerHTML('div#text', value+'') - return self.render() - - def expandSubTree(self, value, xvalue): - 'Expands given subtree' - self.getCommandSet('core').replaceInnerHTML('#text', 'works, expand %s (xhtml attr: %s)' % (value, xvalue)) - return self.render() - - def collapseSubTree(self, value, xvalue): - 'Collapses given subtree' - self.getCommandSet('core').replaceInnerHTML('#text', 'works, collapse %s (xhtml attr: %s)' % (value, xvalue)) - return self.render() - - def cancelSubmitSave(self, text_save): - # We need to make unicode. But on Z2 we receive utf-8, on Z3 unicode - text_save = force_unicode(text_save, 'utf') - self.getCommandSet('core').replaceInnerHTML('div#async', 'Async saved %s' % text_save) - return self.render() - - def removeNodeXpath(self): - # XXX the xpath selector is now moved out of the core, see suppl, product "azaxslt" - sel = self.getSelector('xpath', "//P[@id='xpath']/following-sibling::*[position()=1]") - self.getCommandSet('core').deleteNode(sel) - return self.render() - - def clickedButton(self, id): - 'Show status of the button clicked' - self.getCommandSet('core').replaceInnerHTML('#update-status', "

Button %s clicked. %s

" % (id, datetime.datetime.now())) - return self.render() - - def updateSlaveSelector(self, masterid, value): - """ returns select content """ - mapping = {} - mapping['']=[] - mapping['animals']=['dog', 'cat', 'cow'] - mapping['machines']=['computer', 'car', 'airplane'] - # calculate the slave id - master, _dummy = masterid.split('-') - slaveid = '%s-slave' % master - # make the payload - result = ['') - # XXX See above remark why we need to replace the outer select. - self.getCommandSet('core').replaceHTML('select#%s' % slaveid, ' '.join(result)) - return self.render() - - def formSubmitSave(self, data): - result = ['

Async saved:

'] - for key, value in data.items(): - result.append('' % (key, value)) - result.append('
Name:Value:
%s%s
') - # We need to make unicode. But on Z2 we receive utf-8, on Z3 unicode - retval = force_unicode(''.join(result), 'utf') - self.getCommandSet('core').replaceInnerHTML('div#async', retval) - return self.render() - - def reset(self): - self.getCommandSet('effects').effect('.effects', 'appear') - return self.render() - - @kssaction - def errTest(self, id, act): - if act == 'error': - raise Exception, 'We have an error here.' - elif act == 'explicit': - raise KssExplicitError, 'Explicit error raised.' - elif act == 'empty': - # Just do nothing, we want to return a response with no commands. - # This is valid behaviour, should raise no error, however - # gives a warning in the kukit log. - pass - ## XXX This is commented out by default, but you can try this on your own - ## server, together with the timeout buttons in the page template timeout buttons in the page template. - ## - #elif act == 'timeout': - # # Wait longer then timeout, this is currently 4 s - # time.sleep(6.0); - # # the next reply will never arrive. - # self.replaceInnerHTML('#update-status', u'Timeout response, button %s clicked. %s' % (id, datetime.datetime.now())) - else: - # act = noerror: standard response. - self.getCommandSet('core').replaceInnerHTML('#update-status', u'Normal response, button %s clicked. %s' % (id, datetime.datetime.now())) - return self.render() - - def htmlReplace(self): - """html replace""" - self.getCommandSet('core').replaceHTML('div#frame', '

KSS for a life.

') - return self.render() - - def htmlInsertBefore(self): - """html insert""" - self.getCommandSet('core').insertHTMLBefore('#core', '
KSS for a life. %s
' % (str(datetime.datetime.now()), )) - return self.render() - - def htmlInsertAfter(self): - """html insert""" - self.getCommandSet('core').insertHTMLAfter('#core', '
KSS for a life. %s
' % (str(datetime.datetime.now()), )) - return self.render() - - def htmlInsertAsFirstChild(self): - """html insert""" - self.getCommandSet('core').insertHTMLAsFirstChild('div#frame', '
KSS for a life. %s
' % (str(datetime.datetime.now()), )) - return self.render() - - def htmlInsertAsLastChild(self): - """html insert""" - self.getCommandSet('core').insertHTMLAsLastChild('div#frame', '
KSS for a life. %s
' % (str(datetime.datetime.now()), )) - return self.render() Copied: kukit/kss.demo/trunk/kss/demo/browser/autoupdate.pt (from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_three_autoupdate.pt) ============================================================================== --- kukit/kss.demo/trunk/kss/demo/browser/azax_three_autoupdate.pt (original) +++ kukit/kss.demo/trunk/kss/demo/browser/autoupdate.pt Thu May 10 00:00:35 2007 @@ -1,7 +1,7 @@ + tal:attributes="href string:${context/@@absolute_url}/++resource++autoupdate.kss"/> - - -

All demos

-

Start logging pane

-

View KSS resource

-

Effects

- -

Demo

-
Click here to make me fade
-
Click here to make me puff
-
Click here to make me blindup
- - - Deleted: /kukit/kss.demo/trunk/kss/demo/browser/azax_instant_edit.kss ============================================================================== --- /kukit/kss.demo/trunk/kss/demo/browser/azax_instant_edit.kss Thu May 10 00:00:35 2007 +++ (empty file) @@ -1,20 +0,0 @@ -div#text:click { - action-server: getInputField; - getInputField-value: currentFormVar(value); -} - -div#text:keydown { -evt-keydown-allowbubbling: true; -evt-keydown-keycodes: 13; -action-client:log; -action-server: saveText; -saveText-value:currentFormVar(value); - -} - -input#save:click { - action-server: saveText; - saveText-value: currentFormVar(value); -} - - Deleted: /kukit/kss.demo/trunk/kss/demo/browser/azax_instant_edit.pt ============================================================================== --- /kukit/kss.demo/trunk/kss/demo/browser/azax_instant_edit.pt Thu May 10 00:00:35 2007 +++ (empty file) @@ -1,22 +0,0 @@ - - - - - - -

All demos

-

Start logging pane

-

View KSS resource

- -

Instant edit Demo

-
-
-
- click me! - -
-
-
- - Deleted: /kukit/kss.demo/trunk/kss/demo/browser/azax_three_autoupdate.kss ============================================================================== --- /kukit/kss.demo/trunk/kss/demo/browser/azax_three_autoupdate.kss Thu May 10 00:00:35 2007 +++ (empty file) @@ -1,9 +0,0 @@ -div#update-area:timeout { - evt-timeout-delay: 2000; - action-server: getCurrentTime; -} - -input#start-update:click { - action-server: getAutoupdateMarkup; -} - Deleted: /kukit/kss.demo/trunk/kss/demo/browser/azax_three_autoupdate.pt ============================================================================== --- /kukit/kss.demo/trunk/kss/demo/browser/azax_three_autoupdate.pt Thu May 10 00:00:35 2007 +++ (empty file) @@ -1,37 +0,0 @@ - - - - - - - - -

All demos

-

Start logging pane

-

View KSS resource

-

Three autoupdate

- -

Demo

-
-
- - - Deleted: /kukit/kss.demo/trunk/kss/demo/browser/azax_tree.kss ============================================================================== --- /kukit/kss.demo/trunk/kss/demo/browser/azax_tree.kss Thu May 10 00:00:35 2007 +++ (empty file) @@ -1,11 +0,0 @@ -.state-expanded:click { - action-server: collapseSubTree; - collapseSubTree-value: kssAttr("node"); - collapseSubTree-xvalue: kssAttr("xnode"); -} - -.state-collapsed:click { - action-server: expandSubTree; - expandSubTree-value: kssAttr("node"); - expandSubTree-xvalue: kssAttr("xnode"); -} Deleted: /kukit/kss.demo/trunk/kss/demo/browser/azax_tree.pt ============================================================================== --- /kukit/kss.demo/trunk/kss/demo/browser/azax_tree.pt Thu May 10 00:00:35 2007 +++ (empty file) @@ -1,50 +0,0 @@ - - - - - - - -

All demos

-

Start logging pane

-

View KSS resource

- -

Tree Demo

-

This is not finished yet.

-

In this demo we use attributes in a special namespace. This makes - it possible to put attributes to nodes without being forced to reuse "id" - or otherwise produce invalid html.

-

There are two ways to provide these attributes in pages: - with real xhtml (mimetype text/xhtml), namespace attributes can be used, - with transitional xhtml (mimetype text/html) - the attributes can be encoded into "class" attributes. Both are demonstrated - in this example in parallel, but in reality, one of these should be - used depending on the content type of the page.

-
-
    -
  • 1
  • -
  • 2
  • -
      -
    • 2.1
    • -
    • 2.2
    • -
    -
  • 3
  • -
      -
    • 3.1
    • -
    • 3.2
    • -
    -
- -
- - Deleted: /kukit/kss.demo/trunk/kss/demo/browser/azax_two_select.kss ============================================================================== --- /kukit/kss.demo/trunk/kss/demo/browser/azax_two_select.kss Thu May 10 00:00:35 2007 +++ (empty file) @@ -1,4 +0,0 @@ -select#first:change { - action-server: getCorrespondingSelect; - getCorrespondingSelect-value: currentFormVar(value); -} Deleted: /kukit/kss.demo/trunk/kss/demo/browser/azax_two_select.pt ============================================================================== --- /kukit/kss.demo/trunk/kss/demo/browser/azax_two_select.pt Thu May 10 00:00:35 2007 +++ (empty file) @@ -1,21 +0,0 @@ - - - - - - -

All demos

-

Start logging pane

-

View KSS resource

-

Two Selects

-
- - - -

Remove Node with XPath

-

XPath

-

next 1

-

next 2

-

next 3

- - - Copied: kukit/kss.demo/trunk/kss/demo/browser/basic_commands.pt (from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_demo.pt) ============================================================================== --- kukit/kss.demo/trunk/kss/demo/browser/azax_demo.pt (original) +++ kukit/kss.demo/trunk/kss/demo/browser/basic_commands.pt Thu May 10 00:00:35 2007 @@ -1,13 +1,13 @@ + tal:attributes="href string:${context/@@absolute_url}/++resource++basic_commands.kss"/>

All demos

Start logging pane

-

View KSS resource

+

View KSS resource

Change tag content

Top div

@@ -63,7 +63,7 @@

This page defines a link in the header which rel attribute points to a .kss resource file on the server : - + see the kss file here.

This .kss file declares CSS selectors associated with events and server URLs called when the event occur. Deleted: /kukit/kss.demo/trunk/kss/demo/browser/coreplugin/azaxview.py ============================================================================== --- /kukit/kss.demo/trunk/kss/demo/browser/coreplugin/azaxview.py Thu May 10 00:00:35 2007 +++ (empty file) @@ -1,23 +0,0 @@ -# -*- coding: ISO-8859-15 -*- -# Copyright (c) 2005-2007 -# Authors: KSS Project Contributors (see docs/CREDITS.txt) -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. -# - -from kss.core import AzaxBaseView, force_unicode, KssExplicitError, kssaction - -class AzaxView(AzaxBaseView): - pass \ No newline at end of file Copied: kukit/kss.demo/trunk/kss/demo/browser/coreplugin/demoview.py (from r42976, kukit/kss.demo/trunk/kss/demo/browser/coreplugin/azaxview.py) ============================================================================== --- kukit/kss.demo/trunk/kss/demo/browser/coreplugin/azaxview.py (original) +++ kukit/kss.demo/trunk/kss/demo/browser/coreplugin/demoview.py Thu May 10 00:00:35 2007 @@ -17,7 +17,7 @@ # 02111-1307, USA. # -from kss.core import AzaxBaseView, force_unicode, KssExplicitError, kssaction +from kss.core import KSSView -class AzaxView(AzaxBaseView): - pass \ No newline at end of file +class KSSDemoView(KSSView): + pass Deleted: /kukit/kss.demo/trunk/kss/demo/browser/coresyntax/azaxview.py ============================================================================== --- /kukit/kss.demo/trunk/kss/demo/browser/coresyntax/azaxview.py Thu May 10 00:00:35 2007 +++ (empty file) @@ -1,34 +0,0 @@ -# -*- coding: ISO-8859-15 -*- -# Copyright (c) 2005-2007 -# Authors: KSS Project Contributors (see docs/CREDITS.txt) -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. -# - -from kss.core import AzaxBaseView, force_unicode, KssExplicitError, kssaction - -class AzaxView(AzaxBaseView): - - @kssaction - def urlMethod1(self): - self.getCommandSet('core').replaceInnerHTML('div#target', 'Method 1 called') - - @kssaction - def urlMethod2(self): - self.getCommandSet('core').replaceInnerHTML('div#target', 'Method 2 called') - - @kssaction - def urlMethod3(self): - self.getCommandSet('core').replaceInnerHTML('div#target', 'Method 3 called') Modified: kukit/kss.demo/trunk/kss/demo/browser/coresyntax/configure.zcml ============================================================================== --- kukit/kss.demo/trunk/kss/demo/browser/coresyntax/configure.zcml (original) +++ kukit/kss.demo/trunk/kss/demo/browser/coresyntax/configure.zcml Thu May 10 00:00:35 2007 @@ -28,7 +28,7 @@ + tal:attributes="href string:${context/@@absolute_url}/++resource++inline_edit.kss"/>

All demos

Start logging pane

-

View KSS resource

+

View KSS resource

Instant edit Demo

Copied: kukit/kss.demo/trunk/kss/demo/browser/kss_demo_index.pt (from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_demo_index.pt) ============================================================================== --- kukit/kss.demo/trunk/kss/demo/browser/azax_demo_index.pt (original) +++ kukit/kss.demo/trunk/kss/demo/browser/kss_demo_index.pt Thu May 10 00:00:35 2007 @@ -8,11 +8,10 @@
  • Change tag content
  • Two selects
  • -
  • Three autoupdate
  • -
  • instant edit
  • - +
  • Auto update
  • +
  • Inline edit
  • Cancel Submit Click
  • -
  • Tree
  • +
  • Tree
  • More complex selectors
  • Master-slave selects revisited
  • Form submit
  • Copied: kukit/kss.demo/trunk/kss/demo/browser/tree.pt (from r42976, kukit/kss.demo/trunk/kss/demo/browser/azax_tree.pt) ============================================================================== --- kukit/kss.demo/trunk/kss/demo/browser/azax_tree.pt (original) +++ kukit/kss.demo/trunk/kss/demo/browser/tree.pt Thu May 10 00:00:35 2007 @@ -1,7 +1,7 @@ + tal:attributes="href string:${context/@@absolute_url}/++resource++tree.kss"/> + + +
    +

    KSS Demo

    +

    This demo will demonstrate a tiny bit of KSS.

    +
    Press me to show a picture!
    + +
    Look at the KSS
    + +
    + + Added: kukit/euro-python-2007/staticdemo/photo.jpg ============================================================================== Binary file. No diff available. From reebalazs at codespeak.net Mon May 28 22:12:12 2007 From: reebalazs at codespeak.net (reebalazs at codespeak.net) Date: Mon, 28 May 2007 22:12:12 +0200 (CEST) Subject: [KSS-checkins] r43821 - kukit/kss.core/trunk/kss/core/plugins/core Message-ID: <20070528201212.E78148095@code0.codespeak.net> Author: reebalazs Date: Mon May 28 22:12:11 2007 New Revision: 43821 Modified: kukit/kss.core/trunk/kss/core/plugins/core/commands.py kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml kukit/kss.core/trunk/kss/core/plugins/core/interfaces.py Log: Add commands addClassName, removeClassName previously missing from core commandset. Modified: kukit/kss.core/trunk/kss/core/plugins/core/commands.py ============================================================================== --- kukit/kss.core/trunk/kss/core/plugins/core/commands.py (original) +++ kukit/kss.core/trunk/kss/core/plugins/core/commands.py Mon May 28 22:12:11 2007 @@ -135,6 +135,16 @@ command = self.commands.addCommand('toggleClass', selector) data = command.addParam('classname', classname) + def addClassName(self, selector, name): + """ see interfaces.py """ + command = self.commands.addCommand('addClassName', selector) + data = command.addParam('name', name) + + def removeClassName(self, selector, name): + """ see interfaces.py """ + command = self.commands.addCommand('removeClassName', selector) + data = command.addParam('name', name) + def focus(self, selector): """ see interfaces.py """ command = self.commands.addCommand('focus', selector) Modified: kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml ============================================================================== --- kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml (original) +++ kukit/kss.core/trunk/kss/core/plugins/core/configure.zcml Mon May 28 22:12:11 2007 @@ -256,6 +256,18 @@ /> + + + + Modified: kukit/kss.core/trunk/kss/core/plugins/core/interfaces.py ============================================================================== --- kukit/kss.core/trunk/kss/core/plugins/core/interfaces.py (original) +++ kukit/kss.core/trunk/kss/core/plugins/core/interfaces.py Mon May 28 22:12:11 2007 @@ -86,5 +86,11 @@ If the class is present it will be removed. Else the class will be added. """ + def addClassName(selector, name): + """Add a class to a node.""" + + def removeClassName(selector, name): + """Remove a class from a node.""" + def focus(selector): """Set focus to selected node."""