http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11472
Revision: 11472
Author: legoktm
Date: 2013-04-27 11:27:20 +0000 (Sat, 27 Apr 2013)
Log Message:
-----------
Convert raw MediaWiki timestamps to pywikibot.Timestamp in Page.getVersionHistory and User.contributions
This makes it easier to manipulate timestamps, and you don't have to worry
about what format you'll get them in. I also added this to README-conversion.txt.
Modified Paths:
--------------
branches/rewrite/README-conversion.txt
branches/rewrite/pywikibot/page.py
Modified: branches/rewrite/README-conversion.txt
===================================================================
--- branches/rewrite/README-conversion.txt 2013-04-27 11:17:54 UTC (rev 11471)
+++ branches/rewrite/README-conversion.txt 2013-04-27 11:27:20 UTC (rev 11472)
@@ -88,6 +88,10 @@
- removeImage()
- replaceImage()
+The following methods have had their outputs changed:
+
+- getVersionHistory(): Returns a pywikibot.Timestamp object instead of a MediaWiki one
+
=== ImagePage objects ===
For ImagePage objects, the getFileMd5Sum() method is deprecated; it is
@@ -107,4 +111,14 @@
- supercategories: use self.categories() instead
- supercategoriesList: use, for example, list(self.categories()) instead
+=== User objects ===
+
+The User object has been moved from the userlib module to the pywikibot
+namespace. Any references to "userlib.User" can be replaced by
+"pywikibot.User", but the old for mis retained for backwards-compatibility.
+
+The following changes have occured in the User object:
+
+- contributions(): returns a pywikibot.Timestamp object instead of a Mediawiki one
+
# MORE TO COME #
Modified: branches/rewrite/pywikibot/page.py
===================================================================
--- branches/rewrite/pywikibot/page.py 2013-04-27 11:17:54 UTC (rev 11471)
+++ branches/rewrite/pywikibot/page.py 2013-04-27 11:27:20 UTC (rev 11472)
@@ -1115,7 +1115,7 @@
self.site.loadrevisions(self, getText=False, rvdir=reverseOrder,
step=step, total=total)
return [ ( self._revisions[rev].revid,
- self._revisions[rev].timestamp,
+ pywikibot.Timestamp.fromtimestampformat(self._revisions[rev].timestamp),
self._revisions[rev].user,
self._revisions[rev].comment
) for rev in sorted(self._revisions,
@@ -2188,7 +2188,6 @@
for contrib in self.site.usercontribs(user=self.username,
namespaces=namespaces, total=total):
ts = pywikibot.Timestamp.fromISOformat(contrib['timestamp'])
- ts = int(ts.strftime("%Y%m%d%H%M%S"))
yield Page(self.site, contrib['title'], contrib['ns']), \
contrib['revid'], ts, contrib.get('comment', None)
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11468
Revision: 11468
Author: drtrigon
Date: 2013-04-27 09:51:46 +0000 (Sat, 27 Apr 2013)
Log Message:
-----------
bug fix; solve windows issue in r11462
improvement; enable the use of doxypy if available
Modified Paths:
--------------
trunk/pywikipedia/Doxyfile
trunk/pywikipedia/maintenance/release.py
Modified: trunk/pywikipedia/Doxyfile
===================================================================
--- trunk/pywikipedia/Doxyfile 2013-04-27 07:34:04 UTC (rev 11467)
+++ trunk/pywikipedia/Doxyfile 2013-04-27 09:51:46 UTC (rev 11468)
@@ -1634,3 +1634,18 @@
# the various graphs.
DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to doxypy (http://code.foosel.org/doxypy)
+#---------------------------------------------------------------------------
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the doxypy input filter (if set
+# using INPUT_FILTER) will be used to filter the input files when producing
+# docs. The doxypy filter reformats python comments to conform to doxygen
+# documentation blocks. This makes it possible to use the Doxygen/Javadoc
+# syntax inside of docstrings when writing code documentation and automatically
+# generate API documentation out of it instead of being forced to use non-
+# python documentation blocks or to document code redundantly.
+
+#FILTER_SOURCE_FILES = YES
+#INPUT_FILTER = "python docs/doxypy.py"
Modified: trunk/pywikipedia/maintenance/release.py
===================================================================
--- trunk/pywikipedia/maintenance/release.py 2013-04-27 07:34:04 UTC (rev 11467)
+++ trunk/pywikipedia/maintenance/release.py 2013-04-27 09:51:46 UTC (rev 11468)
@@ -3,7 +3,10 @@
performing several actions:
* create docs from docstrings in HTML and LaTeX (PDF) format
- [doxygen]
+ [doxygen & doxypy]
+ (enable doxypy by downloading doxypy.py from http://code.foosel.org/doxypy,
+ placing it into the docs/ folder and uncommenting the doxypy related lines
+ in Doxygen config file)
* run unittests
[nosetests]
* create coverage report in HTML format
@@ -22,7 +25,7 @@
__version__ = '$Id$'
#
-import sys, os
+import sys, os, time
scriptdir = os.path.dirname(sys.argv[0])
if not os.path.isabs(scriptdir):
@@ -36,8 +39,12 @@
print '* create docs from docstrings in HTML and LaTeX (PDF) format\n' \
- ' [doxygen]'
-os.system('date > %s' % os.path.join(docsdir, 'release-doxygen.log'))
+ ' [doxygen & doxypy]\n' \
+ ' (enable doxypy by downloading doxypy.py from http://code.foosel.org/doxypy,\n' \
+ ' placing it into the docs/ folder and uncommenting the doxypy related lines\n' \
+ ' in Doxygen config file)'
+with open(os.path.join(docsdir, 'release-doxygen.log'), 'w') as f:
+ f.write('%s\n' % time.asctime())
os.system('doxygen &>> %s' % os.path.join(docsdir, 'release-doxygen.log'))
@@ -50,7 +57,8 @@
#""")
#os.system('date > ../output/test_pywikipedia.txt')
#os.system('nosetests --with-xunit --xunit-file=../output/xunit_pywikipedia.xml tests 2>> ../output/test_pywikipedia.txt')
-os.system('date > %s' % os.path.join(docsdir, 'release-nosetests.log'))
+with open(os.path.join(docsdir, 'release-nosetests.log'), 'w') as f:
+ f.write('%s\n' % time.asctime())
os.system('nosetests 2>> %s' % os.path.join(docsdir, 'release-nosetests.log'))