Skip to content

Commit c6a7f90

Browse files
authored
Merge pull request #4 from kmaehashi/support-pedit-mode
support pedit mode
2 parents a23dc4a + e8d8e45 commit c6a7f90

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

atwiki/uri.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from urllib import quote as urlquote
1313

1414
import os.path
15+
import warnings
16+
1517

1618
class AtWikiURI(object):
1719
def __init__(self, base):
@@ -115,8 +117,23 @@ def diff(self, page_id):
115117
def word(self, page_id, keyword):
116118
return '{0}/?cmd=word&pageid={1}&word={2}&type=normal'.format(self._base, page_id, urlquote(keyword))
117119

118-
def edit(self, page_id, menu=True):
119-
mode = 'editx' if menu else 'editxx'
120+
def edit(self, page_id, menu=None, mode=None):
121+
if menu is not None:
122+
warnings.warn(
123+
'`menu` option will be removed in the future release. Use `mode` option instead.',
124+
DeprecationWarning)
125+
else:
126+
menu = True
127+
128+
if mode is None:
129+
mode = 'editx' if menu else 'editxx'
130+
131+
if mode not in [
132+
'pedit', # standard
133+
'editx', # simple (with menu)
134+
'editxx', # simple (without menu)
135+
]:
136+
raise ValueError('invalid mode: {}'.format(mode))
120137
return '{0}/{1}/{2}.html'.format(self._base, mode, page_id)
121138

122139
def rename(self, page_id):

0 commit comments

Comments
 (0)