[Checkins] SVN: z3c.viewlet/trunk/z3c/viewlet/manager.py Added
weight ordered viewlet manager
Roger Ineichen
roger at projekt01.ch
Thu Aug 10 08:55:01 EDT 2006
Log message for revision 69390:
Added weight ordered viewlet manager
Changed:
A z3c.viewlet/trunk/z3c/viewlet/manager.py
-=-
Added: z3c.viewlet/trunk/z3c/viewlet/manager.py
===================================================================
--- z3c.viewlet/trunk/z3c/viewlet/manager.py 2006-08-10 12:51:39 UTC (rev 69389)
+++ z3c.viewlet/trunk/z3c/viewlet/manager.py 2006-08-10 12:55:00 UTC (rev 69390)
@@ -0,0 +1,31 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id$
+"""
+
+from zope.viewlet import manager
+
+
+def getWeight((name, viewlet)):
+ try:
+ return int(viewlet.weight)
+ except AttributeError:
+ return 0
+
+
+class WeightOrderedViewletManager(manager.ViewletManagerBase):
+
+ def sort(self, viewlets):
+ return sorted(viewlets, key=getWeight)
Property changes on: z3c.viewlet/trunk/z3c/viewlet/manager.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
More information about the Checkins
mailing list