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
7a1b3ca8
Commit
7a1b3ca8
authored
Mar 27, 2001
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged patch to parse title from html help files
parent
6ab4f9e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
lib/python/App/ProductContext.py
lib/python/App/ProductContext.py
+16
-3
No files found.
lib/python/App/ProductContext.py
View file @
7a1b3ca8
...
@@ -91,7 +91,7 @@ from HelpSys import HelpTopic, APIHelpTopic
...
@@ -91,7 +91,7 @@ from HelpSys import HelpTopic, APIHelpTopic
from
HelpSys.HelpSys
import
ProductHelp
from
HelpSys.HelpSys
import
ProductHelp
from
FactoryDispatcher
import
FactoryDispatcher
from
FactoryDispatcher
import
FactoryDispatcher
from
zLOG
import
LOG
,
WARNING
from
zLOG
import
LOG
,
WARNING
import
string
,
os
.
path
import
string
,
os
.
path
,
re
import
stat
import
stat
from
DateTime
import
DateTime
from
DateTime
import
DateTime
...
@@ -305,7 +305,8 @@ class ProductContext:
...
@@ -305,7 +305,8 @@ class ProductContext:
if
getattr
(
h
,
'title'
,
None
)
!=
title
:
if
getattr
(
h
,
'title'
,
None
)
!=
title
:
h
.
title
=
title
h
.
title
=
title
def
registerHelp
(
self
,
directory
=
'help'
,
clear
=
1
):
def
registerHelp
(
self
,
directory
=
'help'
,
clear
=
1
,
title_re
=
re
.
compile
(
r'<title>(.+?)</title>'
,
re
.
I
)):
"""
"""
Registers Help Topics for all objects in a directory.
Registers Help Topics for all objects in a directory.
...
@@ -348,10 +349,22 @@ class ProductContext:
...
@@ -348,10 +349,22 @@ class ProductContext:
ext
=
os
.
path
.
splitext
(
file
)[
1
]
ext
=
os
.
path
.
splitext
(
file
)[
1
]
ext
=
string
.
lower
(
ext
)
ext
=
string
.
lower
(
ext
)
if
ext
in
(
'.dtml'
,):
if
ext
in
(
'.dtml'
,):
contents
=
open
(
os
.
path
.
join
(
path
,
file
),
'rb'
).
read
()
m
=
title_re
.
search
(
contents
)
if
m
:
title
=
m
.
group
(
1
)
else
:
title
=
''
ht
=
HelpTopic
.
DTMLTopic
(
file
,
''
,
os
.
path
.
join
(
path
,
file
))
ht
=
HelpTopic
.
DTMLTopic
(
file
,
''
,
os
.
path
.
join
(
path
,
file
))
self
.
registerHelpTopic
(
file
,
ht
)
self
.
registerHelpTopic
(
file
,
ht
)
elif
ext
in
(
'.html'
,
'.htm'
):
elif
ext
in
(
'.html'
,
'.htm'
):
ht
=
HelpTopic
.
TextTopic
(
file
,
''
,
os
.
path
.
join
(
path
,
file
))
contents
=
open
(
os
.
path
.
join
(
path
,
file
),
'rb'
).
read
()
m
=
title_re
.
search
(
contents
)
if
m
:
title
=
m
.
group
(
1
)
else
:
title
=
''
ht
=
HelpTopic
.
TextTopic
(
file
,
title
,
os
.
path
.
join
(
path
,
file
))
self
.
registerHelpTopic
(
file
,
ht
)
self
.
registerHelpTopic
(
file
,
ht
)
elif
ext
in
(
'.stx'
,
'.txt'
):
elif
ext
in
(
'.stx'
,
'.txt'
):
title
=
string
.
split
(
open
(
os
.
path
.
join
(
path
,
file
),
'rb'
).
readline
(),
':'
)[
0
]
title
=
string
.
split
(
open
(
os
.
path
.
join
(
path
,
file
),
'rb'
).
readline
(),
':'
)[
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