Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mwclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WebU
shared
mwclient
Commits
40cbbb46
Commit
40cbbb46
authored
17 years ago
by
Bryan Tong Minh
Browse files
Options
Downloads
Patches
Plain Diff
Add protect compatibility for 1.13; change the compatibility format slightly
parent
5c328781
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mwclient/compatibility.py
+8
-3
8 additions, 3 deletions
mwclient/compatibility.py
mwclient/page.py
+4
-4
4 additions, 4 deletions
mwclient/page.py
with
12 additions
and
7 deletions
mwclient/compatibility.py
+
8
−
3
View file @
40cbbb46
...
@@ -18,8 +18,8 @@ def userinfo(data, new_format = None):
...
@@ -18,8 +18,8 @@ def userinfo(data, new_format = None):
else
:
else
:
return
data
[
'
userinfo
'
]
return
data
[
'
userinfo
'
]
def
iiprop
(
post_112
):
def
iiprop
(
version
):
if
post_1
12
:
if
version
[:
2
]
>=
(
1
,
12
)
:
return
'
timestamp|user|comment|url|size|sha1|metadata
'
return
'
timestamp|user|comment|url|size|sha1|metadata
'
else
:
else
:
return
'
timestamp|user|comment|url|size|sha1
'
return
'
timestamp|user|comment|url|size|sha1
'
...
@@ -29,4 +29,9 @@ def cmtitle(page, new_format, prefix = ''):
...
@@ -29,4 +29,9 @@ def cmtitle(page, new_format, prefix = ''):
return
prefix
+
'
title
'
,
page
.
name
return
prefix
+
'
title
'
,
page
.
name
else
:
else
:
return
prefix
+
'
category
'
,
page
.
strip_namespace
(
page
.
name
)
return
prefix
+
'
category
'
,
page
.
strip_namespace
(
page
.
name
)
\ No newline at end of file
def
protectright
(
version
):
if
version
[:
2
]
>=
(
1
,
13
):
return
'
editprotected
'
else
:
return
'
protect
'
\ No newline at end of file
This diff is collapsed.
Click to expand it.
mwclient/page.py
+
4
−
4
View file @
40cbbb46
...
@@ -64,7 +64,7 @@ class Page(object):
...
@@ -64,7 +64,7 @@ class Page(object):
def
can
(
self
,
action
):
def
can
(
self
,
action
):
level
=
self
.
protection
.
get
(
action
,
(
action
,
))[
0
]
level
=
self
.
protection
.
get
(
action
,
(
action
,
))[
0
]
if
level
==
'
sysop
'
:
level
=
'
protect
'
if
level
==
'
sysop
'
:
level
=
compatibility
.
protectright
(
site
.
version
)
return
level
in
self
.
site
.
rights
return
level
in
self
.
site
.
rights
...
@@ -247,14 +247,14 @@ class Image(Page):
...
@@ -247,14 +247,14 @@ class Image(Page):
def
__init__
(
self
,
site
,
name
,
info
=
None
):
def
__init__
(
self
,
site
,
name
,
info
=
None
):
site
.
require
(
1
,
11
)
site
.
require
(
1
,
11
)
Page
.
__init__
(
self
,
site
,
name
,
info
,
Page
.
__init__
(
self
,
site
,
name
,
info
,
extra_properties
=
{
'
imageinfo
'
:
((
'
iiprop
'
,
compatibility
.
iiprop
(
extra_properties
=
{
'
imageinfo
'
:
((
'
iiprop
'
,
site
.
require
(
1
,
12
,
raise_error
=
False
)
)),
)})
compatibility
.
iiprop
(
site
.
version
)),
)})
self
.
imagerepository
=
self
.
_info
.
get
(
'
imagerepository
'
,
''
)
self
.
imagerepository
=
self
.
_info
.
get
(
'
imagerepository
'
,
''
)
self
.
imageinfo
=
self
.
_info
.
get
(
'
imageinfo
'
,
((),
))[
0
]
self
.
imageinfo
=
self
.
_info
.
get
(
'
imageinfo
'
,
((),
))[
0
]
def
imagehistory
(
self
):
def
imagehistory
(
self
):
return
listing
.
PageProperty
(
self
,
'
imageinfo
'
,
'
ii
'
,
return
listing
.
PageProperty
(
self
,
'
imageinfo
'
,
'
ii
'
,
iiprop
=
compatibility
.
iiprop
(
s
elf
.
site
.
require
(
1
,
12
,
raise_error
=
False
)
))
iiprop
=
compatibility
.
iiprop
(
s
ite
.
version
))
def
imageusage
(
self
,
namespace
=
None
,
filterredir
=
'
all
'
,
redirect
=
False
,
def
imageusage
(
self
,
namespace
=
None
,
filterredir
=
'
all
'
,
redirect
=
False
,
limit
=
None
,
generator
=
True
):
limit
=
None
,
generator
=
True
):
self
.
site
.
require
(
1
,
11
)
self
.
site
.
require
(
1
,
11
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment