r13566 - Products.ATVocabularyManager/trunk/Products/ATVocabularyManager/doc
"Wouter Vanden Hove" <[email protected]> Tue, 05 Apr 2011 17:13:55 +0000
| Newsgroups | gmane.comp.web.zope.plone.archetypes.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: WouterVH
Date: Tue Apr 5 17:13:54 2011
New Revision: 13566
Modified:
Products.ATVocabularyManager/trunk/Products/ATVocabularyManager/doc/search_treevocabulary.txt
Products.ATVocabularyManager/trunk/Products/ATVocabularyManager/doc/simplevocabulary.txt
Log:
remove some whitespace
Modified: Products.ATVocabularyManager/trunk/Products/ATVocabularyManager/doc/search_treevocabulary.txt
==============================================================================
--- Products.ATVocabularyManager/trunk/Products/ATVocabularyManager/doc/search_treevocabulary.txt (original)
+++ Products.ATVocabularyManager/trunk/Products/ATVocabularyManager/doc/search_treevocabulary.txt Tue Apr 5 17:13:54 2011
@@ -7,11 +7,11 @@
imagine the following vocabulary:
engine-type
-
+
* electrical
* mechanical
* otto engine
- * diesel engine
+ * diesel engine
a search for engine==mechanical should return all entries
for otto and diesel engines
@@ -35,7 +35,7 @@
>>> from Products.CMFCore.utils import getToolByName
>>> atvm = getToolByName(self.portal, 'portal_vocabularies')
>>> from Products.ATVocabularyManager.utils.vocabs import createHierarchicalVocabs
-
+
>>> dictionary = {
... ('electrical', 'electrical engines'): {},
... ('mechanical', 'mechanial engines'): {
@@ -46,8 +46,8 @@
>>> hierarchicalVocabs = {}
>>> hierarchicalVocabs[('enginetypes', 'Diffetent types of engines')] = dictionary
>>> createHierarchicalVocabs(atvm, hierarchicalVocabs)
-
-
+
+
now we've got our vocabulary available::
@@ -71,7 +71,7 @@
>>> ottomotor = engines.mechanical.otto
>>> ottomotor.getTermKey() == ottomotor.UID()
True
-
+
A ``TreeVocabularyTerm`` implements the method ``getTermKeyPath``
that returns a list of vocabularyterm-keys of the term itself
@@ -80,7 +80,7 @@
>>> ottoPath = ottomotor.getTermKeyPath()
>>> engines.mechanical.getTermKey() in ottoPath
True
-
+
Each VocabularyTerm is indexed using a KeywordIndex on
@@ -94,10 +94,10 @@
>>> uid_catalog = getToolByName(self.portal, 'uid_catalog')
>>> uid_catalog(getTermKeyPath=ottomotor.UID())[0].getObject()
<TreeVocabularyTerm at .../enginetypes/mechanical/otto>
-
+
a search for a machanical engine returns 3 vocabularies:
the ottomotor, the dieselengine and the term for mechanicalengine too::
-
+
>>> result = uid_catalog(getTermKeyPath=engines.mechanical.UID())
>>> [brain.id for brain in result]
['mechanical', 'diesel', 'otto']
@@ -137,7 +137,7 @@
``getKeyPathForTerms`` method and define it as index method::
# .. somewhere in the schemadefinition
-
+
ReferenceField(
name='myfield',
widget=...
@@ -147,7 +147,7 @@
),
# .. somewhere in your content type definition
-
+
define someIndexMethod(self):
"""used to index myfield
"""
Modified: Products.ATVocabularyManager/trunk/Products/ATVocabularyManager/doc/simplevocabulary.txt
==============================================================================
--- Products.ATVocabularyManager/trunk/Products/ATVocabularyManager/doc/simplevocabulary.txt (original)
+++ Products.ATVocabularyManager/trunk/Products/ATVocabularyManager/doc/simplevocabulary.txt Tue Apr 5 17:13:54 2011
@@ -13,7 +13,7 @@
>>> atvm = self.portal.portal_vocabularies
>>> self.setRoles(['Manager'])
>>> _ = atvm.invokeFactory('SimpleVocabulary', 'testvocab', title="test vocabulary")
-
+
You can fetch a vocabulary calling ``getVocabularyByName`` on
the vocabulary library
@@ -28,11 +28,11 @@
================================
Simple vocabularies can only contain SimpleVocabularyTerms.
-
+
>>> simple.allowedContentTypes()
[<FactoryTypeInformation at /plone/portal_types/SimpleVocabularyTerm>]
-
-
+
+
You can add terms using ``invokeFactory`` or the method
``addTerm``::
@@ -47,7 +47,7 @@
False
>>> simple.getDisplayList(self)
<DisplayList [('term1', ''), ('term2', 'first time')] at ...>
-
+
Batch creation
@@ -72,8 +72,6 @@
-
-
Sorting
=======
@@ -86,7 +84,7 @@
['getObjPositionInParent', 'lexicographic_values', 'lexicographic_keys']
>>> sorting.getSortMethod()
'lexicographic_values'
-
+
Sorting by Values
@@ -99,7 +97,7 @@
>>> sorting.setSortMethod(SORT_METHOD_LEXICO_KEYS)
>>> sorting.getDisplayList(self)
<DisplayList [('a', 'Zeppelin'), ('c', 'Alpha'), ('y', 'Charly')] at ...>
-
+
Sorting by folder position
>>> sorting.listFolderContents()
@@ -139,14 +137,11 @@
Also sorting on translated vocabularies works as excepted:
XXX write tests for the following
-* keys are the same for every language, so sorting by key should
- result in the same order in every language
-
-* sorting on title might result in completely differnt order
-* sorting on position in folder might be differnt to, since translations have their separate order
+* keys are the same for every language, so sorting by key should result in the same order in every language
+* sorting on title might result in completely differnt order
+* sorting on position in folder might be differnt to, since translations have their separate order
-
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev