Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
e48881c6
Commit
e48881c6
authored
Jan 19, 2000
by
Michel Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug where apply_path was an empty string.
parent
fe6dd1c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
10 deletions
+60
-10
lib/python/Products/ZCatalog/ZCatalog.py
lib/python/Products/ZCatalog/ZCatalog.py
+60
-10
No files found.
lib/python/Products/ZCatalog/ZCatalog.py
View file @
e48881c6
...
...
@@ -99,17 +99,46 @@ from DocumentTemplate.DT_Util import Eval, expr_globals
from
AccessControl.Permission
import
name_trans
from
Catalog
import
Catalog
,
orify
from
SearchIndex
import
UnIndex
,
UnTextIndex
from
Vocabulary
import
Vocabulary
import
IOBTree
manage_addZCatalogForm
=
HTMLFile
(
'addZCatalog'
,
globals
())
def
manage_addZCatalog
(
self
,
id
,
title
,
REQUEST
=
None
):
def
manage_addZCatalog
(
self
,
id
,
title
,
vocab
=
''
,
vocab_id
=
''
,
REQUEST
=
None
):
"""Add a ZCatalog object
"""
c
=
ZCatalog
(
id
,
title
)
self
.
_setObject
(
id
,
c
)
c
=
ZCatalog
(
id
,
title
,
vocab
,
vocab_id
,
self
)
self
.
_setObject
(
id
,
c
)
if
REQUEST
is
not
None
:
return
self
.
manage_main
(
self
,
REQUEST
)
return
self
.
manage_main
(
self
,
REQUEST
)
def
VocabularyIDs
(
self
):
""" returns a list of acquireable vocabularies. Stole this from
ZSQLMethods """
ids
=
{}
have_id
=
ids
.
has_key
StringType
=
type
(
''
)
while
self
is
not
None
:
if
hasattr
(
self
,
'objectValues'
):
for
o
in
self
.
objectValues
():
if
(
hasattr
(
o
,
'_isAVocabulary'
)
and
o
.
_isAVocabulary
and
hasattr
(
o
,
'id'
)):
id
=
o
.
id
if
type
(
id
)
is
not
StringType
:
id
=
id
()
if
not
have_id
(
id
):
if
hasattr
(
o
,
'title_and_id'
):
o
=
o
.
title_and_id
()
else
:
o
=
id
ids
[
id
]
=
id
if
hasattr
(
self
,
'aq_parent'
):
self
=
self
.
aq_parent
else
:
self
=
None
ids
=
map
(
lambda
item
:
(
item
[
1
],
item
[
0
]),
ids
.
items
())
ids
.
sort
()
return
ids
class
ZCatalog
(
Folder
,
Persistent
,
Implicit
):
...
...
@@ -190,14 +219,24 @@ class ZCatalog(Folder, Persistent, Implicit):
threshold
=
10000
_v_total
=
0
_v_vocabulary
=
None
def
__init__
(
self
,
id
,
title
=
''
):
def
__init__
(
self
,
id
,
title
=
''
,
vocab
=
0
,
vocab_id
=
''
,
container
=
None
):
self
.
id
=
id
self
.
title
=
title
self
.
vocab_id
=
vocab_id
self
.
threshold
=
10000
self
.
_v_total
=
0
self
.
_catalog
=
Catalog
()
if
not
vocab
:
v
=
Vocabulary
(
'Vocabulary'
,
'Vocabulary'
,
globbing
=
1
)
self
.
_setObject
(
'Vocabulary'
,
v
)
v
=
'Vocabulary'
else
:
v
=
vocab_id
self
.
_catalog
=
Catalog
(
vocabulary
=
v
)
self
.
_catalog
.
addColumn
(
'id'
)
self
.
_catalog
.
addIndex
(
'id'
,
'FieldIndex'
)
...
...
@@ -213,7 +252,15 @@ class ZCatalog(Folder, Persistent, Implicit):
self
.
_catalog
.
addColumn
(
'summary'
)
self
.
_catalog
.
addIndex
(
'PrincipiaSearchSource'
,
'TextIndex'
)
self
.
_catalog
.
addColumn
(
'absolute_url'
)
self
.
_catalog
.
addIndex
(
'absolute_url'
,
'FieldIndex'
)
def
getVocabulary
(
self
):
""" more ack! """
return
getattr
(
self
,
self
.
vocab_id
)
def
manage_edit
(
self
,
RESPONSE
,
URL1
,
threshold
=
1000
,
REQUEST
=
None
):
""" edit the catalog """
...
...
@@ -359,7 +406,7 @@ class ZCatalog(Folder, Persistent, Implicit):
if
self
.
_v_total
>
self
.
threshold
:
# commit a subtransaction
get_transaction
().
commit
(
1
)
# kick the chache
# kick the chache
, this may be overkill but ya never know
self
.
_p_jar
.
cacheFullSweep
(
1
)
self
.
_v_total
=
0
...
...
@@ -545,7 +592,10 @@ class ZCatalog(Folder, Persistent, Implicit):
)
):
if
apply_func
:
apply_func
(
ob
,
(
apply_path
+
'/'
+
p
))
if
apply_path
:
apply_func
(
ob
,
(
apply_path
+
'/'
+
p
))
else
:
apply_func
(
ob
,
p
)
else
:
add_result
((
p
,
ob
))
dflag
=
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment