r252652 - in collective.smartkeywordmanager/trunk: . collective/smartkeywordmanager collective/smartkeywordmanager/profiles/default docs
"Tom Gross" <svn-changes-z4DKO/[email protected]> Fri, 18 Oct 2013 13:13:44 +0000 (UTC)
| Newsgroups | gmane.comp.web.zope.plone.collective.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: tom_gross
Date: Fri Oct 18 13:13:43 2013
New Revision: 252652
Modified:
collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/configure.zcml
collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/profiles/default/actions.xml
collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/smart_keyword_edit_form.pt
collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/views.py
collective.smartkeywordmanager/trunk/docs/HISTORY.txt
collective.smartkeywordmanager/trunk/setup.py
Log:
allow view for newstyle collections
Modified: collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/configure.zcml
==============================================================================
--- collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/configure.zcml (original)
+++ collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/configure.zcml Fri Oct 18 13:13:43 2013
@@ -16,6 +16,14 @@
permission="zope2.View"
/>
+ <browser:page
+ for="plone.app.collection.interfaces.ICollection"
+ name="smart-keyword-edit-form"
+ class=".views.smart_keyword_edit_form_view"
+ template="smart_keyword_edit_form.pt"
+ permission="zope2.View"
+ />
+
<include package="plone.app.registry" />
<genericsetup:registerProfile
Modified: collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/profiles/default/actions.xml
==============================================================================
--- collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/profiles/default/actions.xml (original)
+++ collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/profiles/default/actions.xml Fri Oct 18 13:13:43 2013
@@ -10,7 +10,7 @@
<property name="link_target"></property>
<property name="icon_expr"></property>
<property
- name="available_expr">python: object.portal_type=='Topic'</property>
+ name="available_expr">python: object.portal_type in ('Topic', 'Collection')</property>
<property name="permissions">
<element value="Manage portal"/>
</property>
Modified: collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/smart_keyword_edit_form.pt
==============================================================================
--- collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/smart_keyword_edit_form.pt (original)
+++ collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/smart_keyword_edit_form.pt Fri Oct 18 13:13:43 2013
@@ -13,29 +13,27 @@
<tal:foldercontents define="b_start request/b_start | python: 0;
b_size request/b_size | view/b_size;
all_keywords view/getAllKeywords;
- folderContents python:here.queryCatalog();
- use_view_action site_properties/typesUseViewActionInListings|python:();
+ folderContents python:here.queryCatalog(b_start=b_start, b_size=b_size);
batch folderContents;">
<tal:listing condition="folderContents">
<!-- Navigation -->
<div class="discreet">
<form method="get" action="smart-keyword-edit_form"
- tal:attributes="action string:${here/absolute_url}/@@smart-keyword-edit_form">
- <span i18n:translate="label_batch_size">Batch size</span> :
+ tal:attributes="action request/getURL">
+ <span i18n:translate="label_batch_size">Batch size</span> :
<input size="4" name="b_size:int" tal:attributes="value b_size" />
—
- <span i18n:translate="label_batch_start">Start at</span> :
+ <span i18n:translate="label_batch_start">Start at</span> :
<input size="4" name="b_start:int" tal:attributes="value b_start" />
—
<input type="submit" value="Refresh" i18n:attributes="value"
class="standalone" />
</form>
</div>
-
<form method="post" action="smart-keyword-edit"
- tal:attributes="action string:${here/absolute_url}/@@smart-keyword-edit-form">
+ tal:attributes="action request/getURL">
<input type="hidden" name="b_start:int" tal:attributes="value b_start" />
<input type="hidden" name="b_size:int" tal:attributes="value b_size" />
@@ -202,4 +200,4 @@
</div>
</body>
-</html>
\ No newline at end of file
+</html>
Modified: collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/views.py
==============================================================================
--- collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/views.py (original)
+++ collective.smartkeywordmanager/trunk/collective/smartkeywordmanager/views.py Fri Oct 18 13:13:43 2013
@@ -10,9 +10,9 @@
"""
def __init__(self, context, request):
- self.context = context
- self.request = request
+ super(smart_keyword_edit_form_view, self).__init__(context, request)
form = self.request.form
+ self.registry = getUtility(IRegistry)
# Get form data
global_add = form.get('global_add', [])
@@ -31,7 +31,7 @@
items = dict([ (item["uid"], item) for item in items ])
# Now proceed
- for item in self.context.queryCatalog():
+ for item in self.context.queryCatalog(b_start=b_start, b_size=b_size):
uid = item.UID
values = items.get(uid, {})
add = values.get("add", "")
@@ -41,10 +41,11 @@
def cook(self, what, joinfirst = True):
if joinfirst:
+ what = [unicode(kw, 'utf-8') for kw in what]
what = self.separator.join(what)
- what = [ kw.strip() for kw in what.split(self.separator) ]
- what = [ kw for kw in what if kw ]
- return what
+ else:
+ what = unicode(what, 'utf-8')
+ return [kw.encode('utf-8').strip() for kw in what.split(self.separator) if kw.strip()]
def modifyKeywords(self, uid, add = [], delete = []):
"""
@@ -53,7 +54,7 @@
# Shortcut out of dummy calls
if not add and not delete:
return
-
+
# Get object from catalog
catalog = getToolByName(self, "portal_catalog")
brains = catalog(UID = uid)
@@ -89,10 +90,8 @@
@property
def separator(self):
- registry = getUtility(IRegistry)
- return registry['collective.smartkeywordmanager.separator']
-
+ return self.registry['collective.smartkeywordmanager.separator']
+
@property
def b_size(self):
- registry = getUtility(IRegistry)
- return registry['collective.smartkeywordmanager.b_size']
+ return self.registry['collective.smartkeywordmanager.b_size']
Modified: collective.smartkeywordmanager/trunk/docs/HISTORY.txt
==============================================================================
--- collective.smartkeywordmanager/trunk/docs/HISTORY.txt (original)
+++ collective.smartkeywordmanager/trunk/docs/HISTORY.txt Fri Oct 18 13:13:43 2013
@@ -4,7 +4,8 @@
0.7 (unreleased)
----------------
-- Nothing changed yet.
+- Added view for Collection
+- Fixed UTF-8 encoding bug
0.6 (2011-01-04)
Modified: collective.smartkeywordmanager/trunk/setup.py
==============================================================================
--- collective.smartkeywordmanager/trunk/setup.py (original)
+++ collective.smartkeywordmanager/trunk/setup.py Fri Oct 18 13:13:43 2013
@@ -33,6 +33,4 @@
[z3c.autoinclude.plugin]
target = plone
""",
- setup_requires=["PasteScript"],
- paster_plugins=["ZopeSkel"],
)
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk