xpcom/analysis/MDC-attach.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/analysis/MDC-attach.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,23 @@
     1.4 +#!/usr/bin/env python
     1.5 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 +
     1.9 +
    1.10 +"""
    1.11 +Upload a file attachment to MDC
    1.12 +
    1.13 +Usage: python MDC-attach.py <file> <parent page name> <MIME type> <description>
    1.14 +Please set MDC_USER and MDC_PASSWORD in the environment
    1.15 +"""
    1.16 +
    1.17 +import os, sys, deki
    1.18 +
    1.19 +wikiuser = os.environ['MDC_USER']
    1.20 +wikipw = os.environ['MDC_PASSWORD']
    1.21 +
    1.22 +file, pageid, mimetype, description = sys.argv[1:]
    1.23 +
    1.24 +wiki = deki.Deki("http://developer.mozilla.org/@api/deki/", wikiuser, wikipw)
    1.25 +wiki.create_file(pageid, os.path.basename(file), open(file).read(), mimetype,
    1.26 +                 description)

mercurial