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
ee6c5127
Commit
ee6c5127
authored
Aug 13, 1998
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added find in all subfolders option
parent
a06f83ef
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
103 deletions
+51
-103
lib/python/OFS/FindSupport.py
lib/python/OFS/FindSupport.py
+15
-101
lib/python/OFS/findAdv.dtml
lib/python/OFS/findAdv.dtml
+12
-0
lib/python/OFS/findForm.dtml
lib/python/OFS/findForm.dtml
+12
-0
lib/python/OFS/findResult.dtml
lib/python/OFS/findResult.dtml
+12
-2
No files found.
lib/python/OFS/FindSupport.py
View file @
ee6c5127
__doc__
=
"""Principia Find support"""
__version__
=
'$Revision: 1.
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
2
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
time
,
Globals
...
...
@@ -11,18 +11,13 @@ from string import find
class
FindSupport
:
"""Find support for Principia Folders"""
def
PrincipiaFind
(
self
,
obj
,
obj_ids
=
None
,
obj_metatypes
=
None
,
obj_searchterm
=
None
,
obj_expr
=
None
,
obj_mtime
=
None
,
obj_mspec
=
None
,
obj_permission
=
None
,
obj_roles
=
None
,
search_sub
=
0
,
REQUEST
=
None
,
result
=
None
,
pre
=
''
):
"""Principia Find interface"""
...
...
@@ -38,6 +33,9 @@ class FindSupport:
if
obj_permission
:
obj_permission
=
p_name
(
obj_permission
)
if
obj_roles
and
type
(
obj_roles
)
is
type
(
's'
):
obj_roles
=
[
obj_roles
]
if
obj_expr
:
# Setup expr machinations
md
=
td
()
...
...
@@ -83,11 +81,6 @@ class FindSupport:
(
not
obj_expr
or
expr_match
(
ob
,
obj_expr
))
and
(
not
obj_mtime
or
mtime_match
(
ob
,
obj_mtime
,
obj_mspec
))
# (obj_modspec=='<' and hasattr(ob, '_p_mtime') and \
# ob._p_mtime < obj_modtime) or
# (obj_modspec=='>' and hasattr(ob, '_p_mtime') and \
# ob._p_mtime > obj_modtime)
# )
and
(
(
not
obj_permission
or
not
obj_roles
)
or
\
role_match
(
ob
,
obj_permission
,
obj_roles
)
...
...
@@ -96,11 +89,12 @@ class FindSupport:
add_result
((
p
,
ob
))
dflag
=
0
if
hasattr
(
bs
,
'objectItems'
):
if
search_sub
and
hasattr
(
bs
,
'objectItems'
):
self
.
PrincipiaFind
(
ob
,
obj_ids
,
obj_metatypes
,
obj_searchterm
,
obj_expr
,
obj_mtime
,
obj_mspec
,
obj_permission
,
obj_roles
,
search_sub
,
REQUEST
,
result
,
p
)
if
dflag
:
ob
.
_p_deactivate
()
...
...
@@ -130,7 +124,6 @@ def mtime_match(ob, t, q, fn=hasattr):
def
role_match
(
ob
,
permission
,
roles
,
lt
=
type
([]),
tt
=
type
(())):
# ob=obj
pr
=
[]
fn
=
pr
.
append
...
...
@@ -149,7 +142,7 @@ def role_match(ob, permission, roles, lt=type([]), tt=type(())):
if
p
is
None
:
map
(
fn
,
(
'Manager'
,
'Anonymous'
))
break
if
hasattr
(
ob
,
'aq_parent'
):
ob
=
ob
.
aq_parent
continue
...
...
@@ -176,88 +169,9 @@ def p_name(name):
## def oldpermission_match(obj, permission, roles):
## # if not hasattr(obj, '__ac_permissions__'):
## # return 0
## r=proles(obj, permission)
## for role in roles:
## if not (role in r):
## return 0
## return 1
## def pldproles(obj, permission):
## for p in obj.__ac_permissions__:
## name, value = p[:2]
## if name==permission:
## p=Permission(name,value,obj)
## r=p.getRoles()
## if r is None: r=['Anonymous']
## if type(r) is type(()):
## r=list(r)
## if hasattr(obj, 'aq_parent'):
## o=obj.aq_parent
## n=p._p
## while 1:
## if hasattr(o, n):
## roles=getattr(o, n)
## if roles is None:
## if not ('Anonymous' in r):
## r.append('Anonymous')
## return r
## if type(roles) is type(()):
## return r+list(roles)
## r=r+list(roles)
## if hasattr(o, 'aq_parent'):
## o=o.aq_parent
## else: break
## return r
## return []
## def PrincipiaFind1(self, start, _initial=None, prefix='',
## type=None, substring=None, name=None,
## ):
## if _initial is None: _initial=[]
## if hasattr(start,'aq_base'): start=start.aq_base
## if not hasattr(start, 'objectItems'): return _initial
## try: items=start.objectItems()
## except: return _initial
## for oname, o in items:
## if prefix: p="%s/%s" % (prefix, oname)
## else: p=oname
## if hasattr(o,'aq_base'): o=o.aq_base
## if (
## (type is None or not hasattr(o,'meta_type') or
## type==o.meta_type)
## and
## (name is None or oname==name)
## and
## (substring is None or
## (hasattr(o,'PrincipiaSearchSource') and
## find(o.PrincipiaSearchSource(),substring) >= 0
## ))
## ):
## _initial.append(p)
## if hasattr(o, 'objectItems'):
## self.PrincipiaFind(o,_initial,p,type,substring,name)
## return _initial
##############################################################################
#
# $Log: FindSupport.py,v $
# Revision 1.2 1998/08/13 13:48:16 brian
# Added find in all subfolders option
#
lib/python/OFS/findAdv.dtml
View file @
ee6c5127
...
...
@@ -106,6 +106,18 @@ function show_opt()
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="RADIO" NAME="search_sub:int" VALUE="0">
Search only in this folder
<BR>
<INPUT TYPE="RADIO" NAME="search_sub:int" VALUE="1" CHECKED>
Search all subfolders
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
</TD>
...
...
lib/python/OFS/findForm.dtml
View file @
ee6c5127
...
...
@@ -71,6 +71,18 @@ function show_opt()
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="RADIO" NAME="search_sub:int" VALUE="0">
Search only in this folder
<BR>
<INPUT TYPE="RADIO" NAME="search_sub:int" VALUE="1" CHECKED>
Search all subfolders
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
</TD>
...
...
lib/python/OFS/findResult.dtml
View file @
ee6c5127
...
...
@@ -12,14 +12,24 @@ function new_wnd()
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
<P>
<!--#in expr="('obj_ids', 'obj_metatypes', 'obj_searchterm', 'obj_expr', 'obj_mtime', 'obj_mspec', 'obj_permission', 'obj_roles')"-->
<!--#in expr="('obj_ids', 'obj_metatypes', 'obj_searchterm', 'obj_expr', 'obj_mtime', 'obj_mspec', 'obj_permission', 'obj_roles'
, 'search_sub'
)"-->
<!--#else expr="_.hasattr(REQUEST, _['sequence-item'])"-->
<!--#call expr="REQUEST.set(_['sequence-item'], _.None)"-->
<!--#/else-->
<!--#/in-->
<!--#if btn_submit-->
<!--#call expr="REQUEST.set('results', PrincipiaFind(this(), obj_ids=obj_ids, obj_metatypes=obj_metatypes, obj_searchterm=obj_searchterm, obj_expr=obj_expr, obj_mtime=obj_mtime, obj_mspec=obj_mspec, obj_permission=obj_permission, obj_roles=obj_roles, REQUEST=REQUEST))"-->
<!--#call expr="REQUEST.set('results', PrincipiaFind(this(),
obj_ids=obj_ids,
obj_metatypes=obj_metatypes,
obj_searchterm=obj_searchterm,
obj_expr=obj_expr,
obj_mtime=obj_mtime,
obj_mspec=obj_mspec,
obj_permission=obj_permission,
obj_roles=obj_roles,
search_sub=search_sub,
REQUEST=REQUEST))"-->
<!--#call expr="REQUEST.set('result_len', _.len(results))"-->
<!--#if results-->
...
...
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