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
8ae9c5a1
Commit
8ae9c5a1
authored
Jun 23, 1999
by
Michel Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First alpha! yehhHa!
parent
e0d08507
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
178 additions
and
43 deletions
+178
-43
lib/python/Products/ZCatalog/Catalog.py
lib/python/Products/ZCatalog/Catalog.py
+15
-5
lib/python/Products/ZCatalog/ZCatalog.py
lib/python/Products/ZCatalog/ZCatalog.py
+76
-34
lib/python/Products/ZCatalog/catalogIndexes.dtml
lib/python/Products/ZCatalog/catalogIndexes.dtml
+34
-0
lib/python/Products/ZCatalog/catalogSchema.dtml
lib/python/Products/ZCatalog/catalogSchema.dtml
+29
-0
lib/python/Products/ZCatalog/catalogStatus.dtml
lib/python/Products/ZCatalog/catalogStatus.dtml
+21
-0
lib/python/Products/ZCatalog/catalogView.dtml
lib/python/Products/ZCatalog/catalogView.dtml
+3
-4
No files found.
lib/python/Products/ZCatalog/Catalog.py
View file @
8ae9c5a1
...
...
@@ -46,7 +46,7 @@ class Catalog(Persistent, Acquisition.Implicit):
self
.
schema
=
{}
# mapping from attribute name to column number
self
.
names
=
()
# sequence of column names
self
.
indexes
=
{}
self
.
indexes
=
{}
# maping from index name to index object
# the catalog maintains a BTree of object meta_data for
# convienient display on result pages. meta_data attributes
...
...
@@ -95,7 +95,6 @@ class Catalog(Persistent, Acquisition.Implicit):
for
key
,
value
in
self
.
schema
.
items
():
scopy
[
key
]
=
value
scopy
[
'data_record_id_'
]
=
len
(
self
.
schema
.
keys
())
scopy
[
'data_record_unique_id_'
]
=
self
.
paths
[
scopy
[
'data_record_id_'
]]
mybrains
.
__theCircularGottaCoverUpABugRefOfJoy
=
mybrains
mybrains
.
__record_schema__
=
scopy
...
...
@@ -109,6 +108,9 @@ class Catalog(Persistent, Acquisition.Implicit):
schema
=
self
.
schema
names
=
list
(
self
.
names
)
if
schema
.
has_key
(
name
):
raise
'Column Exists'
,
'The column exists'
if
not
schema
.
has_key
(
name
):
if
schema
.
values
():
...
...
@@ -162,11 +164,14 @@ class Catalog(Persistent, Acquisition.Implicit):
""" adds an index """
if
self
.
indexes
.
has_key
(
name
):
raise
'Index Exists'
,
'The index specified allready exists'
indexes
=
self
.
indexes
if
type
==
'FieldIndex'
:
self
.
indexes
[
name
]
=
UnIndex
.
UnIndex
(
name
)
indexes
[
name
]
=
UnIndex
.
UnIndex
(
name
)
elif
type
==
'TextIndex'
:
self
.
indexes
[
name
]
=
UnTextIndex
.
UnTextIndex
(
name
)
indexes
[
name
]
=
UnTextIndex
.
UnTextIndex
(
name
)
self
.
indexes
=
indexes
def
delIndex
(
self
,
name
):
""" deletes an index """
...
...
@@ -243,6 +248,11 @@ class Catalog(Persistent, Acquisition.Implicit):
x
.
clear
()
def
uniqueValuesFor
(
self
,
name
):
""" return unique values for FieldIndex name """
return
self
.
indexes
[
name
].
uniqueValues
()
def
recordify
(
self
,
object
):
""" turns an object into a record tuple """
...
...
lib/python/Products/ZCatalog/ZCatalog.py
View file @
8ae9c5a1
...
...
@@ -99,6 +99,7 @@ from Acquisition import Implicit
from
Persistence
import
Persistent
from
Catalog
import
Catalog
,
orify
import
pdb
,
traceback
from
SearchIndex
import
UnIndex
,
UnTextIndex
manage_addZCatalogForm
=
HTMLFile
(
'addZCatalog'
,
globals
())
...
...
@@ -120,7 +121,14 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit):
{
'label'
:
'Contents'
,
'action'
:
'manage_catalogView'
,
'target'
:
'manage_main'
},
{
'label'
:
'Find Items to ZCatalog'
,
'action'
:
'manage_catalogFind'
,
'target'
:
'manage_main'
},)
'target'
:
'manage_main'
},
{
'label'
:
'Schema'
,
'action'
:
'manage_catalogSchema'
,
'target'
:
'manage_main'
},
{
'label'
:
'Indexes'
,
'action'
:
'manage_catalogIndexes'
,
'target'
:
'manage_main'
},
{
'label'
:
'Status'
,
'action'
:
'manage_catalogStatus'
,
'target'
:
'manage_main'
},
)
__ac_permissions__
=
(
...
...
@@ -142,6 +150,8 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit):
manage_catalogFind
=
HTMLFile
(
'catalogFind'
,
globals
())
manage_catalogFindResult
=
HTMLFile
(
'catalogFindResult'
,
globals
())
manage_catalogSchema
=
HTMLFile
(
'catalogSchema'
,
globals
())
manage_catalogIndexes
=
HTMLFile
(
'catalogIndexes'
,
globals
())
manage_catalogStatus
=
HTMLFile
(
'catalogStatus'
,
globals
())
manage_main
=
HTMLFile
(
'catalogView'
,
globals
())
...
...
@@ -157,7 +167,10 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit):
self
.
_catalog
.
addIndex
(
'title'
,
'TextIndex'
)
self
.
_catalog
.
addColumn
(
'meta_type'
)
self
.
_catalog
.
addIndex
(
'meta_type'
,
'TextIndex'
)
self
.
_catalog
.
addIndex
(
'meta_type'
,
'FieldIndex'
)
self
.
_catalog
.
addColumn
(
'bobobase_modification_time'
)
self
.
_catalog
.
addIndex
(
'bobobase_modification_time'
,
'FieldIndex'
)
def
manage_catalogObject
(
self
,
REQUEST
,
urls
=
None
,
blah
=
None
):
...
...
@@ -170,16 +183,13 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit):
# object.
obj
=
self
.
resolve_url
(
url
,
REQUEST
)
except
:
## print 'resolve_url failed while cataloging'
## c, i, t = sys.exc_info()
## traceback.print_exc()
continue
self
.
catalog_object
(
obj
,
url
)
return
MessageDialog
(
title
=
"Bah!"
,
message
=
"Say hello to my little friend"
,
action
=
"manage_main"
)
message
=
"Objects Cataloged"
return
self
.
manage_main
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
def
manage_uncatalogObject
(
self
,
REQUEST
,
urls
=
None
):
...
...
@@ -190,16 +200,12 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit):
try
:
obj
=
self
.
resolve_url
(
url
,
REQUEST
)
except
:
print
'resolve_url failed while uncataloging'
c
,
i
,
t
=
sys
.
exc_info
()
traceback
.
print_exc
()
continue
print
'uncataloging %s'
%
url
self
.
uncatalog_object
(
url
)
return
MessageDialog
(
title
=
"Bah!"
,
message
=
"Say hello to my little friend"
,
action
=
"manage_main"
)
message
=
"Object UnCataloged"
return
self
.
manage_main
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
def
manage_catalogReindex
(
self
,
REQUEST
):
...
...
@@ -218,19 +224,54 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit):
self
.
uncatalog_object
(
path
)
self
.
catalog_object
(
obj
,
path
)
return
MessageDialog
(
title
=
"Bah!"
,
message
=
"Say hello to my little friend"
,
action
=
"manage_main"
)
message
=
"Catalog Reindexed"
return
self
.
manage_main
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
def
manage_catalogClear
(
self
,
REQUEST
):
""" clears the whole enchelada """
self
.
_catalog
.
clear
()
return
MessageDialog
(
title
=
"Bah!"
,
message
=
"Say hello to my little friend"
,
action
=
"manage_main"
)
message
=
"Catalog Cleared"
return
self
.
manage_main
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
def
manage_addColumn
(
self
,
name
,
REQUEST
):
""" add a column """
self
.
_catalog
.
addColumn
(
name
)
message
=
"Column added"
return
self
.
manage_catalogSchema
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
def
manage_delColumns
(
self
,
names
,
REQUEST
):
""" del a column """
for
name
in
names
:
self
.
_catalog
.
delColumn
(
name
)
message
=
"Columns deleted"
return
self
.
manage_catalogSchema
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
def
manage_addIndex
(
self
,
name
,
type
,
REQUEST
):
""" add an index """
self
.
_catalog
.
addIndex
(
name
,
type
)
message
=
"Index added"
return
self
.
manage_catalogIndexes
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
def
manage_delIndexes
(
self
,
names
,
REQUEST
):
""" del an index """
for
name
in
names
:
self
.
_catalog
.
delIndex
(
name
)
message
=
"Indexes deleted"
return
self
.
manage_catalogIndexes
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
def
catalog_object
(
self
,
obj
,
uid
):
""" wrapper around catalog """
...
...
@@ -242,36 +283,37 @@ class ZCatalog(SimpleItem, FindSupport, Persistent, Implicit):
self
.
_catalog
.
uncatalogObject
(
uid
)
#miscilany
def
manage_enterDebuger
(
self
,
REQUEST
):
""" debugger VOODOO """
pdb
.
set_trace
()
if
REQUEST
is
not
None
:
return
MessageDialog
(
title
=
"Bah!"
,
message
=
"Say hello to my little friend"
,
action
=
"manage_main"
)
def
uniqueValuesFor
(
self
,
name
):
""" returns the unique values for a given FieldIndex """
return
self
.
_catalog
.
uniqueValuesFor
(
name
)
def
getpath
(
self
,
rid
):
return
self
.
_catalog
.
paths
[
rid
]
# impliment the searching interface
def
schema
(
self
):
return
self
.
_catalog
.
schema
.
keys
()
def
indexes
(
self
):
return
self
.
_catalog
.
indexes
.
keys
()
def
index_objects
(
self
):
return
self
.
_catalog
.
indexes
.
values
()
def
_searchable_arguments
(
self
):
r
=
{}
n
=
{
'optional'
:
1
}
for
name
in
self
.
_catalog
.
names
:
for
name
in
self
.
_catalog
.
indexes
.
keys
()
:
r
[
name
]
=
n
return
r
def
_searchable_result_columns
(
self
):
r
=
[]
for
name
in
self
.
_catalog
.
names
:
for
name
in
self
.
_catalog
.
indexes
.
keys
()
:
i
=
{}
i
[
'name'
]
=
name
i
[
'type'
]
=
's'
...
...
lib/python/Products/ZCatalog/catalogIndexes.dtml
0 → 100644
View file @
8ae9c5a1
<HTML>
<HEAD>
<TITLE>View Catalog Records</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<!--#var manage_tabs-->
<form action="<!--#var URL1-->">
<ul>
<!--#in indexes-->
<li>
<input type="checkbox" name="names:list" value="<!--#var sequence-item-->">
<!--#var sequence-item--></li>
<!--#/in-->
</ul>
<br>
<input name="manage_delIndexes:method" type=submit value=" Delete "><br>
Add Index: <input name="name"> <br>
of Index Type: <select name="type">
<option value="TextIndex">TextIndex</option>
<option value="FieldIndex">FieldIndex</options>
</select>
<input name="manage_addIndex:method" type=submit value=" Add ">
</form>
</BODY></HTML>
lib/python/Products/ZCatalog/catalogSchema.dtml
0 → 100644
View file @
8ae9c5a1
<HTML>
<HEAD>
<TITLE>View Catalog Records</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<!--#var manage_tabs-->
<form action="<!--#var URL1-->">
<ul>
<!--#in schema-->
<li>
<input type="checkbox" name="names:list" value="<!--#var sequence-item-->">
<!--#var sequence-item--></li>
<!--#/in-->
</ul>
<br>
<input name="manage_delColumns:method" type=submit value=" Delete "><br>
Add column: <input name="name">
<input name="manage_addColumn:method" type=submit value=" Add ">
</form>
</BODY></HTML>
lib/python/Products/ZCatalog/catalogStatus.dtml
0 → 100644
View file @
8ae9c5a1
<HTML>
<HEAD>
<TITLE>View Catalog Records</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<!--#var manage_tabs-->
<ul>
<!--#in index_objects-->
<li>
<!--#var "_.len(_['sequence-item'])"--> object are indexed in <b><!--#var "_['sequence-item'].id"--></b></li>
<!--#/in-->
</ul>
</BODY></HTML>
lib/python/Products/ZCatalog/catalogView.dtml
View file @
8ae9c5a1
...
...
@@ -50,8 +50,7 @@ NAME="manage_enterDebuger:method">
<tr valign=top>
<td valign="middle" align="center">
<INPUT TYPE="checkbox" NAME="urls:list" VALUE="<!--#var
data_record_unique_id_-->">
<INPUT TYPE="checkbox" NAME="urls:list" VALUE="<!--#var "getpath(data_record_id_)"-->"
</TD>
<td valign="top"><!--#var meta_type--></td>
<td valign="top" align="left">
...
...
@@ -65,8 +64,8 @@ data_record_unique_id_-->">
<!--#/in-->
</table>
<input type="submit" value=" Remove " NAME="
unindex
Object:method">
<input type="submit" value=" Update " NAME="
index
Object:method">
<input type="submit" value=" Remove " NAME="
manage_uncatalog
Object:method">
<input type="submit" value=" Update " NAME="
manage_catalog
Object:method">
</form>
...
...
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