Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/74267


Change subject: Use JSON schema API module rather than action=raw
......................................................................

Use JSON schema API module rather than action=raw

This patch migrates the EventLogging Python library to using the JSON Schema
API module to fetch schemas.

The URIs for fetching schemas should be read from a configuration file, but
that is work for another patch.

Change-Id: I2c644096adcea8a4d2860cb927128794767a74fc
---
M server/eventlogging/schema.py
1 file changed, 3 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EventLogging 
refs/changes/67/74267/1

diff --git a/server/eventlogging/schema.py b/server/eventlogging/schema.py
index 8bc4ce8..8436fb5 100644
--- a/server/eventlogging/schema.py
+++ b/server/eventlogging/schema.py
@@ -20,13 +20,10 @@
 
 #: URL of index.php on the schema wiki (same as
 #: '$wgEventLoggingSchemaIndexUri').
-SCHEMA_WIKI_INDEX_PHP = 'http://meta.wikimedia.org/w/index.php'
+SCHEMA_WIKI_API = 'http://meta.wikimedia.org/w/api.php'
 
 #: Template for schema article URLs. Interpolates SCIDs.
-SCHEMA_URL_FORMAT = SCHEMA_WIKI_INDEX_PHP + '?title=Schema:%s&oldid=%s'
-
-#: Template for raw schema URLs. Interpolates SCIDs.
-RAW_SCHEMA_URL_FORMAT = SCHEMA_URL_FORMAT + '&action=raw'
+SCHEMA_URL_FORMAT = SCHEMA_WIKI_API + '?action=jsonschema&title=%s&revid=%s'
 
 #: Schemas retrieved via HTTP are cached in this dictionary.
 schema_cache = {}
@@ -54,7 +51,7 @@
 
 def http_get_schema(scid):
     """Retrieve schema via HTTP."""
-    url = RAW_SCHEMA_URL_FORMAT % scid
+    url = SCHEMA_URL_FORMAT % scid
     try:
         content = urlopen(url).read().decode('utf-8')
         schema = json.loads(content)

-- 
To view, visit https://gerrit.wikimedia.org/r/74267
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c644096adcea8a4d2860cb927128794767a74fc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to