projects
/
mw
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move code for status to reusable function
[mw]
/
src
/
mw
/
api.py
diff --git
a/src/mw/api.py
b/src/mw/api.py
index 135c2a1e56deb4e529d9dbf7ec863c75fd09ff5e..88dee80e2371e640253ce81658901ebc692acd5e 100644
(file)
--- a/
src/mw/api.py
+++ b/
src/mw/api.py
@@
-1,6
+1,6
@@
###
# mw - VCS-like nonsense for MediaWiki websites
###
# mw - VCS-like nonsense for MediaWiki websites
-# Copyright (C) 20
09
Ian Weller <ian@ianweller.org>
+# Copyright (C) 20
10
Ian Weller <ian@ianweller.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@
-13,8
+13,7
@@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# with this program. If not, see <http://www.gnu.org/licenses/>.
###
import cookielib
###
import cookielib
@@
-24,7
+23,9
@@
from StringIO import StringIO
import urllib
import urllib2
import urllib
import urllib2
+
class API(object):
class API(object):
+
def __init__(self, api_url):
self.api_url = api_url
self.cookiejar = cookielib.CookieJar()
def __init__(self, api_url):
self.api_url = api_url
self.cookiejar = cookielib.CookieJar()
@@
-56,3
+57,15
@@
class API(object):
return high
else:
return low
return high
else:
return low
+
+
+def pagename_to_filename(name):
+ name = name.replace(' ', '_')
+ name = name.replace('/', '!')
+ return name
+
+
+def filename_to_pagename(name):
+ name = name.replace('!', '/')
+ name = name.replace('_', ' ')
+ return name
Benjamin Mako Hill
||
Want to submit a patch?