|
Date: October 25, 2007
Chapter 10: Custom Content Types
Page 202: Code
Corrections
Last three rows of code example:
# This turns a list of title->id pairs into a Zope 3 style
vocabulary return SimpleVocabulary.fronmItems(items)
directlyProvides(CurrentFilmsVocabularyFactory, IVocabularyFactory)
'vocabulary' word should be in comment line, and return have to begin second line, and the last line:
directlyProvides(...
should begin with decreased line indentation (out of function body)
def CurrentFilmsVocabularyFactory(context):
"""Vocabulary factory for currently published films
"""
catalog = getToolByName(context, 'portal_catalog')
items = [(r.Title, r.UID) for r in
catalog(object_provides=IFilm.__identifier__,
review_state="published",
sort_on='sortable_title')]
# Turns a list of title->id pairs into a Zope 3 style vocabulary
return SimpleVocabulary.fromItems(items)
directlyProvides(CurrentFilmsVocabularyFactory, IVocabularyFactory)
Notice the changes,
- made the comment shorter so that it fits on one line
- made sure the second-to-last line starts with 'return'
- un-indented the last line so that it's aligned with the outermost "def".
Date: October 23, 2007
Chapter 10: Custom Content Types
Page 229: Code
Corrections
On page 229, we have this line:
>>> browser.open(portal_url + '/login')
This will fail under certain circumstances. A safer version is:
>>> browser.open(portal_url + '/login_form?came_from=' + portal_url)
Date: October 19, 2007
Chapter 8: Creating a
Custom Theme
Page 113: Code
Corrections
ztc.installProduct('optilux.policy', package=True)
ztc.installProduct('optilux.theme', package=True)
This should be changed to:
ztc.installPackage('optilux.policy')
ztc.installPackage('optilux.theme')
Date: October 4, 2007 Chapter 14: Rich User
Interfaces with KSS The KSS
reference in chapter 14 describes the following KSS commands:
- 'addClassName', with parameter 'name'
- 'removeClassName', with parameter
'name'
- 'toggleClass', with parameter 'name'.
In the version of KSS released with Plone 3,
the names of the commands and parameters have changed. The correct
names and parameters are:
- 'addClass', with parameter 'value'
- 'removeClass', with parameter 'value'
- 'toggleClass', with paramater 'value'.
Page 321: Corrected
Code
#showClosedButton:click(show_button) {
evt-click-preventdefault: true;
action-client: toggleClass;
toggleClass-value: hiddenItem;
action-client: removeClass;
removeClass-kssSelector: css("#deliverablesTable tr.closed");
removeClass-value: hiddenItem;
action-client: setStateVar;
setStateVar-varname: showHidden;
setStateVar-value: true;
}
/* At the same time, show the "show" button */
#showClosedButton:click(hide_button) {
evt-click-preventdefault: true;
action-client: toggleClass;
toggleClass-kssSelector: htmlid(hideClosedButton);
toggleClass-value: hiddenItem;
Page 324: Corrected
Table Entries
|
Action
|
Parameters
|
Effect
|
|
addClass,
removeClass
|
value
|
Add or remove a particular CSS class on the matched node.
|
|
toggleClass
|
value
|
Toggle (add or remove) the given CSS class on the matched node.
|
Page 325: Corrected
Code
/* At the same time, show the "show" button */
#showClosedButton:click(hide_button) {
evt-click-preventdefault: true;
action-client: toggleClass;
toggleClass-kssSelector: htmlid(hideClosedButton);
toggleClass-value: hiddenItem;
}
/* The reverse of the above two actions */
#hideClosedButton:click(hide_button) {
evt-click-preventdefault: true;
...
action-client: addClass;
addClass-kssSelector: css("#deliverablesTable tr.closed");
addClass-value: hiddenItem;
...
}
Page 328: Corrected
Table Entries
|
Method
|
Effect
|
|
toggleClass
(selector, classname)
|
Toggle (add or remove) the given CSS class on the selected node.
There are also
addClass (selector, value) and
removeClass (selector, value).
|
For more information, please visit
www.PacktPub.com
|