[Zope3-checkins]
SVN: Zope3/trunk/src/ Improved static apidoc a lot;
all images load now, some ReST fixes and
Stephan Richter
srichter at cosmos.phy.tufts.edu
Fri Oct 28 12:28:47 EDT 2005
Log message for revision 39692:
Improved static apidoc a lot; all images load now, some ReST fixes and
link corrections.
Changed:
U Zope3/trunk/src/bugtracker/README.txt
U Zope3/trunk/src/zope/app/apidoc/browser/details_macros.pt
U Zope3/trunk/src/zope/app/apidoc/browser/static_menu_macros.pt
U Zope3/trunk/src/zope/app/apidoc/browser/utilities.js
U Zope3/trunk/src/zope/app/apidoc/ifacemodule/iface_macros.pt
U Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.py
U Zope3/trunk/src/zope/app/apidoc/ifacemodule/presentation_macros.pt
U Zope3/trunk/src/zope/app/apidoc/static.py
U Zope3/trunk/src/zwiki/I18N.txt
-=-
Modified: Zope3/trunk/src/bugtracker/README.txt
===================================================================
--- Zope3/trunk/src/bugtracker/README.txt 2005-10-28 16:20:57 UTC (rev 39691)
+++ Zope3/trunk/src/bugtracker/README.txt 2005-10-28 16:28:46 UTC (rev 39692)
@@ -1,69 +1,71 @@
Bug Tracker Product for Zope 3
==============================
- This product is an implementation of a bug tracker in Zope 3.
+This product is an implementation of a bug tracker in Zope 3.
- Features
- --------
+Features
+--------
- Bug Tracker
+Bug Tracker
+~~~~~~~~~~~
- - View list of bugs
+- View list of bugs
- o Filtering by status, type, release, priority and text
+ o Filtering by status, type, release, priority and text
- o Batching, when list of bugs becomes too long.
+ o Batching, when list of bugs becomes too long.
- o Bug status and priority values are marked up based on value.
+ o Bug status and priority values are marked up based on value.
- - Settings
+- Settings
- o When creating a Bug Tracker, one can select the option to
- automatically create a set of status, type, release and priority
- choices.
+ o When creating a Bug Tracker, one can select the option to
+ automatically create a set of status, type, release and priority
+ choices.
- o The choices for the status, type, release and priority are flexible
- and can be changed.
+ o The choices for the status, type, release and priority are flexible
+ and can be changed.
- - Mail Subscriptions
+- Mail Subscriptions
- o These are Bug Tracker wide mail subscriptions that send the
- recipients an E-mail about additions, changes and deletions of bugs.
+ o These are Bug Tracker wide mail subscriptions that send the
+ recipients an E-mail about additions, changes and deletions of bugs.
- Bug
+Bug
+~~~
- - Overview
+- Overview
- o This screen provides a comprehensive overview of all the available
- information about the bug.
+ o This screen provides a comprehensive overview of all the available
+ information about the bug.
- o The status and priority are marked up based on their value.
+ o The status and priority are marked up based on their value.
- o The description and the comments are rendered using STX.
+ o The description and the comments are rendered using STX.
- o Upload Files and Images
+ o Upload Files and Images
- o Add new comments
+ o Add new comments
- - Edit
+- Edit
- o To provide a familiar interface, the edit form is layed out in the
- same way as the overview
+ o To provide a familiar interface, the edit form is layed out in the
+ same way as the overview
- - Dependencies
+- Dependencies
- o In my opinion, one major improvement over the current collector is
- the availability of a dependency feature, where I can say that this
- bug depends on that one.
+ o In my opinion, one major improvement over the current collector is
+ the availability of a dependency feature, where I can say that this
+ bug depends on that one.
- o Based on this information a dependency tree is generated using the
- markup rules for status and priority, so that a user can quickly
- recognize critical spots in the tree.
+ o Based on this information a dependency tree is generated using the
+ markup rules for status and priority, so that a user can quickly
+ recognize critical spots in the tree.
- o There is also a Statistics section that tells you how many bugs are
- completed, have not been viewed and are being fixed.
+ o There is also a Statistics section that tells you how many bugs are
+ completed, have not been viewed and are being fixed.
- - Mail Subscriptions
+- Mail Subscriptions
- o These are specific bug mail subscriptions that send the recipients
- an E-mail about additions, changes and deletions of the bug.
+ o These are specific bug mail subscriptions that send the recipients
+ an E-mail about additions, changes and deletions of the bug.
Modified: Zope3/trunk/src/zope/app/apidoc/browser/details_macros.pt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/browser/details_macros.pt 2005-10-28 16:20:57 UTC (rev 39691)
+++ Zope3/trunk/src/zope/app/apidoc/browser/details_macros.pt 2005-10-28 16:28:46 UTC (rev 39692)
@@ -35,20 +35,22 @@
<metal:block define-macro="displaySwitch">
- <a href="javascript:switchDisplay('')" style="text-decoration: none"
- tal:attributes="href string:javascript:switchDisplay('${elementId}')">
+ <img src="/@@/harrow.png" border="0" id=".arrow" onClick=""
+ style="vertical-align: middle"
+ tal:condition="not:show"
+ tal:attributes="
+ id string:${elementId}.arrow;
+ src context/++resource++harrow.png;
+ onClick string:javascript:switchDisplay('${elementId}')">
- <img src="/@@/harrow.png" border="0" id=".arrow"
- style="vertical-align: middle"
- tal:condition="not:show"
- tal:attributes="id string:${elementId}.arrow" />
+ <img src="/@@/varrow.png" border="0" id=".arrow" onClick=""
+ style="vertical-align: middle"
+ tal:condition="show"
+ tal:attributes="
+ id string:${elementId}.arrow;
+ src context/++resource++varrow.png;
+ onClick string:javascript:switchDisplay('${elementId}')">
- <img src="/@@/varrow.png" border="0" id=".arrow"
- style="vertical-align: middle"
- tal:condition="show"
- tal:attributes="id string:${elementId}.arrow" />
- </a>
-
</metal:block>
Modified: Zope3/trunk/src/zope/app/apidoc/browser/static_menu_macros.pt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/browser/static_menu_macros.pt 2005-10-28 16:20:57 UTC (rev 39691)
+++ Zope3/trunk/src/zope/app/apidoc/browser/static_menu_macros.pt 2005-10-28 16:28:46 UTC (rev 39692)
@@ -3,7 +3,7 @@
<html
xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en"
- lang="en"
+ lang="en"
i18n:domain="zope">
<head>
@@ -30,7 +30,7 @@
<metal:block define-slot="menu-title">
<div class="menu" i18n:translate="">Menu</div>
</metal:block>
-
+
<metal:block define-slot="pre_menu" />
<metal:block define-slot="menu">
@@ -41,8 +41,11 @@
result root/getFlatDicts;
nodeDictList python:result[0];
maxDepth python:result[1]">
- <tr tal:repeat="nodeInfo nodeDictList"
- tal:attributes="id repeat/nodeInfo/index; treedepth python:len(nodeInfo['row-state'])+1; treehasChildren nodeInfo/node/hasChildren;"
+ <tr tal:repeat="nodeInfo nodeDictList"
+ tal:attributes="
+ id repeat/nodeInfo/index;
+ treedepth python:len(nodeInfo['row-state'])+1;
+ treehasChildren nodeInfo/node/hasChildren;"
style="display:block" treestate="block">
<tal:block tal:define="node nodeInfo/node">
@@ -52,28 +55,29 @@
</td>
<td style="width:16px">
- <a href="#"
- tal:define="treeid repeat/nodeInfo/index"
- tal:attributes="onClick string:javascript:treeClick($treeid);"
- tal:condition="node/hasChildren">
+ <tal:block
+ define="treeid repeat/nodeInfo/index"
+ condition="node/hasChildren">
<tal:block condition="not:nodeInfo/last-level-node">
- <img tal:attributes="src context/++resource++tree_images/plus_vline.png; id string:i$treeid"
- tal:condition="not:node/expanded" alt="+" border="0" />
- <img tal:attributes="src context/++resource++tree_images/minus_vline.png; id string:i$treeid"
+ <img tal:attributes="
+ src context/++resource++tree_images/minus_vline.png;
+ id string:i$treeid;
+ onClick string:javascript:treeClick($treeid);"
tal:condition="node/expanded" alt="-" border="0" />
</tal:block>
<tal:block condition="nodeInfo/last-level-node">
- <img tal:attributes="src context/++resource++tree_images/plus.png; id string:i$treeid"
- tal:condition="not:node/expanded" alt="+" border="0" />
- <img tal:attributes="src context/++resource++tree_images/minus.png; id string:i$treeid"
+ <img tal:attributes="
+ src context/++resource++tree_images/minus.png;
+ id string:i$treeid;
+ onClick string:javascript:treeClick($treeid);"
tal:condition="node/expanded" alt="-" border="0" />
</tal:block>
- </a>
+ </tal:block>
<tal:block condition="not:node/hasChildren">
- <img tal:attributes="src context/++resource++tree_images/tline.png;"
+ <img tal:attributes="src context/++resource++tree_images/tline.png;"
tal:condition="not:nodeInfo/last-level-node" alt="T" border="0" />
- <img tal:attributes="src context/++resource++tree_images/lline.png;"
+ <img tal:attributes="src context/++resource++tree_images/lline.png;"
tal:condition="nodeInfo/last-level-node" alt="L" border="0" />
</tal:block>
</td>
@@ -86,7 +90,7 @@
tal:condition="python: view.getMenuLink(node) is not None"
i18n:translate="">
node/id
- </a><tal:block
+ </a><tal:block
replace="python: view.getMenuTitle(node)"
condition="python: view.getMenuLink(node) is None"
i18n:translate="" />
Modified: Zope3/trunk/src/zope/app/apidoc/browser/utilities.js
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/browser/utilities.js 2005-10-28 16:20:57 UTC (rev 39691)
+++ Zope3/trunk/src/zope/app/apidoc/browser/utilities.js 2005-10-28 16:28:46 UTC (rev 39692)
@@ -33,18 +33,18 @@
return;
}
- // Change the display style
+ // Change the display style
if (style.display == 'none') {
style.display = '';
- switchImage(id, 'varrow.png');
+ switchImage(id, 'harrow.png', 'varrow.png');
}
else {
style.display = 'none'
- switchImage(id, 'harrow.png');
+ switchImage(id, 'varrow.png', 'harrow.png');
}
}
-function switchImage(id, name) {
+function switchImage(id, oldname, newname) {
if(document.getElementById) {
// DOM
var element = document.getElementById(id+'.arrow');
@@ -52,7 +52,7 @@
// Proprietary DOM
var element = document.all[id+'.arrow'];
}
- element.src = '/@@/'+name;
+ element.src = element.src.replace(oldname, newname);
}
/*
Modified: Zope3/trunk/src/zope/app/apidoc/ifacemodule/iface_macros.pt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ifacemodule/iface_macros.pt 2005-10-28 16:20:57 UTC (rev 39691)
+++ Zope3/trunk/src/zope/app/apidoc/ifacemodule/iface_macros.pt 2005-10-28 16:28:46 UTC (rev 39692)
@@ -13,7 +13,7 @@
<code tal:content="field/name">field</code>
<span tal:condition="field/required">*</span>
</b>
- -
+ -
<a href=""
tal:attributes="href string:$rootURL/Code/${field/class/path}/index.html">
<code tal:content="field/class/name">Field</code>
@@ -63,7 +63,7 @@
</div>
<div class="indent">
- <ul class="attr-list"
+ <ul class="attr-list"
tal:condition="python: attributes or fields">
<li tal:repeat="attribute attributes">
<metal:block use-macro="context/@@interface_macros/attribute" />
@@ -72,11 +72,11 @@
<metal:block use-macro="context/@@interface_macros/field" />
</li>
</ul>
-
+
<p tal:condition="python: not (attributes or fields)">
<em i18n:translate="">There are no attributes or fields specified.</em>
</p>
-
+
<p tal:condition="python: attributes or fields">
<em><b class="required">*</b> =
<span i18n:translate="">required</span></em>
@@ -87,7 +87,7 @@
<metal:block define-macro="views" i18n:domain="zope">
- <div class="indent">
+ <div class="indent">
<ul class="attr-list" tal:condition="Views">
<li tal:repeat="View Views">
<metal:block use-macro="context/@@interface_macros/View" />
Modified: Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.py 2005-10-28 16:20:57 UTC (rev 39691)
+++ Zope3/trunk/src/zope/app/apidoc/ifacemodule/menu.py 2005-10-28 16:28:46 UTC (rev 39692)
@@ -27,7 +27,7 @@
for name in iface:
attr = iface[name]
text += attr.getName()
- text += attr.getDoc()
+ text += attr.getDoc() or ''
return text
@@ -40,7 +40,7 @@
name_only = ('name_only' in self.request) and True or False
search_str = self.request.get('search_str', None)
results = []
-
+
if search_str is None:
return results
for name, iface in self.context.items():
@@ -55,19 +55,12 @@
def findAllInterfaces(self):
"""Find all interfaces."""
-
- #name_only = ('name_only' in self.request) and True or False
- #search_str = self.request.get('search_str', None)
+
results = []
-
- #if search_str is None:
- # return results
+
counter = 0
for name, iface in self.context.items():
- #if (search_str in name or
- # (not name_only and search_str in getAllTextOfInterface(iface))):
rtext = getAllTextOfInterface(iface)
-
results.append(
{'name': name,
'url': './%s/apiindex.html' %name,
@@ -75,6 +68,6 @@
'doc': whitepattern.sub(' ',getAllTextOfInterface(iface))
})
counter += 1
-
+
results.sort(lambda x, y: cmp(x['name'], y['name']))
- return results
+ return results
Modified: Zope3/trunk/src/zope/app/apidoc/ifacemodule/presentation_macros.pt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ifacemodule/presentation_macros.pt 2005-10-28 16:20:57 UTC (rev 39691)
+++ Zope3/trunk/src/zope/app/apidoc/ifacemodule/presentation_macros.pt 2005-10-28 16:28:46 UTC (rev 39692)
@@ -7,7 +7,7 @@
<div tal:define="zcml View/zcml"
tal:condition="zcml">
- <i i18n:translate="">registered:</i>
+ <i i18n:translate="">registered:</i>
<metal:block use-macro="context/@@interface_macros/zcml" />
</div>
@@ -15,8 +15,8 @@
tal:condition="python: iface == View['required'][-1]">
<i i18n:translate="">presentation type:</i>
<a href=""
- tal:attributes="href
- string:../${iface/module}.${iface/name}/apiindex.html">
+ tal:attributes="
+ href string:../${iface/module}.${iface/name}/apiindex.html">
<metal:block use-macro="context/@@interface_macros/ifacename" />
</a>
</div>
@@ -26,9 +26,9 @@
<tal:block repeat="iface ifaces">
<a href=""
tal:condition="iface"
- tal:attributes="href
- string:../${iface/module}.${iface/name}/apiindex.html">
- <metal:block use-macro="context/@@interface_macros/ifacename"
+ tal:attributes="
+ href string:../${iface/module}.${iface/name}/apiindex.html">
+ <metal:block use-macro="context/@@interface_macros/ifacename"
/></a><tal:block condition="not:repeat/iface/end">, </tal:block>
</tal:block>
<span tal:condition="not: ifaces" i18n:translate="">
@@ -40,8 +40,8 @@
tal:condition="iface">
<i i18n:translate="">provides:</i>
<a href=""
- tal:attributes="href
- string:../${iface/module}.${iface/name}/apiindex.html">
+ tal:attributes="
+ href string:../${iface/module}.${iface/name}/apiindex.html">
<metal:block use-macro="context/@@interface_macros/ifacename" />
</a>
</div>
@@ -50,8 +50,8 @@
tal:condition="iface">
<i i18n:translate="">layer:</i>
<a href=""
- tal:attributes="href
- string:../${iface/module}.${iface/name}/apiindex.html">
+ tal:attributes="
+ href string:../${iface/module}.${iface/name}/apiindex.html">
<metal:block use-macro="context/@@interface_macros/ifacename" />
</a>
</div>
@@ -60,8 +60,7 @@
<i i18n:translate="">factory path:</i>
<a href=""
tal:condition="View/factory/referencable"
- tal:attributes="href
- string:../../Code/${View/factory/url}/index.html"
+ tal:attributes="href string:../../Code/${View/factory/url}/index.html"
tal:content="View/factory/path" />
<span
tal:condition="not:View/factory/referencable"
@@ -76,8 +75,7 @@
<div tal:condition="View/factory/resource">
<i i18n:translate="">resource:</i>
<a href=""
- tal:attributes="href
- string: /@@/${View/factory/resource}"
+ tal:attributes="href string: /@@/${View/factory/resource}"
tal:content="View/factory/resource" />
</div>
Modified: Zope3/trunk/src/zope/app/apidoc/static.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/static.py 2005-10-28 16:20:57 UTC (rev 39691)
+++ Zope3/trunk/src/zope/app/apidoc/static.py 2005-10-28 16:28:46 UTC (rev 39692)
@@ -17,6 +17,7 @@
"""
__docformat__ = "reStructuredText"
+import base64
import os
import sys
import time
@@ -37,7 +38,7 @@
URL = 'http://localhost:8080/'
-START_PAGE = '++apidoc++/static.html'
+START_PAGE = '++apidoc++/Type/@@staticmenu.html'
BASE_DIR = 'apidoc'
@@ -58,7 +59,11 @@
additionalURLs = [
'@@/varrow.png',
'@@/harrow.png',
- ]
+ '@@/tree_images/minus.png',
+ '@@/tree_images/plus.png',
+ '@@/tree_images/minus_vline.png',
+ '@@/tree_images/plus_vline.png',
+]
def getMaxWidth():
try:
@@ -94,40 +99,96 @@
url = url.replace(filename, filename[2:])
return url
-def isLocalURL(url):
- """Determine whether the passed in URL is local and accessible."""
- # Javascript function call
- if url.startswith('javascript:'):
- return False
- # Mail Link
- if url.startswith('mailto:'):
- return False
- # External Link
- if url.startswith('http://') and not url.startswith(URL):
- return False
- return True
-def isApidocLink(url):
- if url.startswith(URL+'++apidoc++/'):
+class Link(object):
+ """A link in the page."""
+
+ def __init__(self, mechLink, referenceURL=None):
+ self.referenceURL = referenceURL
+ self.originalURL = mechLink.url
+ self.callableURL = mechLink.absolute_url
+ self.url = completeURL(cleanURL(mechLink.url))
+ self.absoluteURL = completeURL(cleanURL(mechLink.absolute_url))
+
+ def isLocalURL(self):
+ """Determine whether the passed in URL is local and accessible."""
+ # Javascript function call
+ if self.url.startswith('javascript:'):
+ return False
+ # Mail Link
+ if self.url.startswith('mailto:'):
+ return False
+ # External Link
+ if self.url.startswith('http://') and not self.url.startswith(URL):
+ return False
return True
- if url.startswith(URL+'@@/'):
- return True
- return False
-class StaticAPODoc(object):
+ def isApidocLink(self):
+ # Make sure that only apidoc links are loaded
+ if self.absoluteURL.startswith(URL+'++apidoc++/'):
+ return True
+ if self.absoluteURL.startswith(URL+'@@/'):
+ return True
+ return False
+
+
+class OnlineBrowser(mechanize.Browser, object):
+
+ def setUserAndPassword(self, user, pw):
+ """Specify the username and password to use for the retrieval."""
+ hash = base64.encodestring(user+':'+pw).strip()
+ self.addheaders.append(('Authorization', 'Basic '+hash))
+
+ @property
+ def contents(self):
+ """Get the content of the returned data"""
+ response = self.response()
+ old_location = response.tell()
+ response.seek(0)
+ contents = response.read()
+ response.seek(old_location)
+ return contents
+
+
+class PublisherBrowser(zope.testbrowser.testing.PublisherMechanizeBrowser,
+ object):
+
+ def __init__(self, *args, **kw):
+ functional.FunctionalTestSetup()
+ super(PublisherBrowser, self).__init__(*args, **kw)
+
+ def setUserAndPassword(self, user, pw):
+ """Specify the username and password to use for the retrieval."""
+ self.addheaders.append(('Authorization', 'Basic %s:%s' %(user, pw)))
+
+ @property
+ def contents(self):
+ """Get the content of the returned data"""
+ response = self.response()
+ old_location = response.tell()
+ response.seek(0)
+ # Remove HTTP Headers
+ for line in iter(lambda: response.readline().strip(), ''):
+ pass
+ contents = response.read()
+ response.seek(old_location)
+ return contents
+
+
+class StaticAPIDocGenerator(object):
"""Static API doc Maker"""
def __init__(self):
- self.linkQueue = [mechanize.Link(URL, START_PAGE, '', '', ())]
- for url in additionalURLs:
- self.linkQueue.append(mechanize.Link(URL, url, '', '', ()))
+ self.linkQueue = []
+ for url in additionalURLs + [START_PAGE]:
+ link = Link(mechanize.Link(URL, url, '', '', ()))
+ self.linkQueue.append(link)
self.rootDir = os.path.join(os.path.dirname(__file__), BASE_DIR)
self.maxWidth = getMaxWidth()-13
def start(self):
"""Start the retrieval of the apidoc."""
t0 = time.time()
- c0 = time.clock()
self.visited = []
self.counter = 0
@@ -136,16 +197,11 @@
os.mkdir(self.rootDir)
if USE_PUBLISHER:
- self.sendMessage('Setting up Zope 3.')
- functional.FunctionalTestSetup()
- self.browser = zope.testbrowser.testing.PublisherMechanizeBrowser()
- self.browser.addheaders.append(
- ('Authorization', 'Basic mgr:mgrpw'))
+ self.browser = PublisherBrowser()
else:
- self.browser = mechanize.Browser()
- self.browser.addheaders.append(
- ('Authorization', 'Basic Z2FuZGFsZjoxMjM='))
+ self.browser = OnlineBrowser()
+ self.browser.setUserAndPassword('mgr', 'mgrpw')
self.browser.urltags = urltags
# Work through all links until there are no more to work on.
@@ -155,26 +211,24 @@
# Sometimes things are placed many times into the queue, for example
# if the same link appears twice in a page. In those cases, we can
# check at this point whether the URL has been already handled.
- if link.absolute_url not in self.visited:
+ if link.absoluteURL not in self.visited:
self.showStatistics(link)
self.processLink(link)
t1 = time.time()
- c1 = time.clock()
- self.sendMessage(
- "Run time: %.3f sec real, %.3f sec CPU" %(t1-t0, c1-c0))
+ self.sendMessage("Run time: %.3f sec real" % (t1-t0))
def showStatistics(self, link):
self.counter += 1
if VERBOSITY >= 3:
- url = link.absolute_url[-(self.maxWidth):]
+ url = link.absoluteURL[-(self.maxWidth):]
sys.stdout.write('\r' + ' '*(self.maxWidth+13))
sys.stdout.write('\rLink %5d: %s' % (self.counter, url))
sys.stdout.flush()
def sendMessage(self, msg, verbosity=4):
- if verbosity >= VERBOSITY:
+ if VERBOSITY >= verbosity:
sys.stdout.write('\n')
sys.stdout.write(VERBOSITY_MAP.get(verbosity, 'INFO')+': ')
sys.stdout.write(msg)
@@ -183,8 +237,24 @@
def processLink(self, link):
"""Process a link."""
- url = link.absolute_url
+ url = link.absoluteURL
+ # Whatever will happen, we have looked at the URL
+ self.visited.append(url)
+
+ # Retrieve the content
+ try:
+ self.browser.open(link.callableURL)
+ except urllib2.HTTPError, error:
+ # Something went wrong with retrieving the page.
+ self.sendMessage(
+ '%s (%i): %s' % (error.msg, error.code, link.callableURL), 2)
+ return
+ except ValueError:
+ # We had a bad URL running the publisher browser
+ self.sendMessage('Bad URL: ' + link.callableURL, 2)
+ return
+
# Make sure the directory exists and get a file path.
relativeURL = url.replace(URL, '')
dir = self.rootDir
@@ -198,34 +268,9 @@
filepath = os.path.join(dir, filename)
- # Whatever will happen, we have looked at the URL
- self.visited.append(url)
+ # Get the response content
+ contents = self.browser.contents
- # Retrieve the content
- try:
- self.browser.open(url)
- except urllib2.HTTPError:
- # TODO: Provide less misleading message; many different errors can
- # happen here.
- self.sendMessage('Link not found: ' + link.absolute_url, 2)
- return
- except ValueError:
- # We had a bad URL running the publisher browser
- self.sendMessage('Bad URL: ' + link.absolute_url, 2)
- return
-
- response = self.browser.response()
- old_location = response.tell()
- response.seek(0)
-
- if USE_PUBLISHER:
- # Remove HTTP Headers
- for line in iter(lambda: response.readline().strip(), ''):
- pass
-
- contents = response.read()
- response.seek(old_location)
-
# Now retrieve all links
if self.browser.viewing_html():
@@ -235,21 +280,21 @@
self.sendMessage('Failed to parse HTML: ' + url, 1)
links = []
+ links = [Link(mech_link, url) for mech_link in links]
+
for link in links:
- # Make sure URLs have file extensions, but no parameters
- original_url = link.url
- link.url = completeURL(cleanURL(link.url))
- link.absolute_url = completeURL(cleanURL(link.absolute_url))
+ # Make sure we do not handle unwanted links.
+ if not (link.isLocalURL() and link.isApidocLink()):
+ continue
- if isLocalURL(link.url) and isApidocLink(link.absolute_url):
- # Add link to the queue
- if link.absolute_url not in self.visited:
- self.linkQueue.insert(0, link)
+ # Add link to the queue
+ if link.absoluteURL not in self.visited:
+ self.linkQueue.insert(0, link)
- # Rewrite URLs
- parts = ['..']*len(segments)
- parts.append(link.absolute_url.replace(URL, ''))
- contents = contents.replace(original_url, '/'.join(parts))
+ # Rewrite URLs
+ parts = ['..']*len(segments)
+ parts.append(link.absoluteURL.replace(URL, ''))
+ contents = contents.replace(link.originalURL, '/'.join(parts))
# Write the data into the file
file = open(filepath, 'w')
@@ -258,14 +303,11 @@
# Cleanup; this is very important, otherwise we are opening too many
# files.
- self.browser.response().close() # bug fix
self.browser.close()
- self.browser._history = [] # bug fix
-
def main():
global BASE_DIR
BASE_DIR = sys.argv[1]
- maker = StaticAPODoc()
+ maker = StaticAPIDocGenerator()
maker.start()
sys.exit(0)
Modified: Zope3/trunk/src/zwiki/I18N.txt
===================================================================
--- Zope3/trunk/src/zwiki/I18N.txt 2005-10-28 16:20:57 UTC (rev 39691)
+++ Zope3/trunk/src/zwiki/I18N.txt 2005-10-28 16:28:46 UTC (rev 39692)
@@ -1,36 +1,36 @@
Internationalization (I18n) and Localization (L10n)
=====================================================
- Creating/Updating Message Catalog Template (POT) Files
- -----------------------------------------------------
+Creating/Updating Message Catalog Template (POT) Files
+------------------------------------------------------
- 1. Install 'zwiki' in 'ZOPE3/src'. See INSTALL.txt for details.
+1. Install 'zwiki' in 'ZOPE3/src'. See INSTALL.txt for details.
- 2. Set the the Python path::
+2. Set the the Python path::
- export PYTHONPATH=ZOPE3/src
+ export PYTHONPATH=ZOPE3/src
- 3. Go into the 'locales' directory and execute i18nextract.py::
+3. Go into the 'locales' directory and execute i18nextract.py::
- python2.4 utilities/i18nextract.py -d zwiki -p ..
+ python2.4 utilities/i18nextract.py -d zwiki -p ..
- Updating Message Catalog (PO) Files
- -----------------------------------
+Updating Message Catalog (PO) Files
+-----------------------------------
- 1. For each language do simply::
+1. For each language do simply::
- msgmerge -U de/LC_MESSAGES/zwiki.po zwiki.pot
+ msgmerge -U de/LC_MESSAGES/zwiki.po zwiki.pot
- 2. Translate the updated PO file.
- Note: KBabel is a great tool for this task!
+2. Translate the updated PO file.
+ Note: KBabel is a great tool for this task!
- Compiling Message Catalogs (PO) to binary (MO) Files
- ----------------------------------------------------
+Compiling Message Catalogs (PO) to binary (MO) Files
+----------------------------------------------------
- 1. Go to the right directory, such as '<zwiki>/locales/de/LC_MESSAGES'.
+1. Go to the right directory, such as '<zwiki>/locales/de/LC_MESSAGES'.
- 2. Run the following command::
+2. Run the following command::
- msgfmt -o zwiki.mo zwiki.po
+ msgfmt -o zwiki.mo zwiki.po
More information about the Zope3-Checkins
mailing list