DrTrigon has submitted this change and it was merged.
Change subject: bugfix; path adopted to tool-labs to solve: * <type
'exceptions.ImportError'>: No module named subster * <type
'exceptions.ImportError'>: No module named query * <type 'exceptions.IOError'>:
[Errno 2] No such file or directory: '/data/project/data/subster
......................................................................
bugfix; path adopted to tool-labs to solve:
* <type 'exceptions.ImportError'>: No module named subster
* <type 'exceptions.ImportError'>: No module named query
* <type 'exceptions.IOError'>: [Errno 2] No such file or directory:
'/data/project/data/subster/mail_inbox'
Change-Id: If9d2476ed40ca9a3e6d414fc01649b4efb89c6ee
---
M public_html/cgi-bin/ps_wikinew.py
M public_html/cgi-bin/subster_mail_queue.py
M public_html/cgi-bin/substersim.py
M public_html/cgi-bin/sum_cat_disc.py
4 files changed, 44 insertions(+), 19 deletions(-)
Approvals:
DrTrigon: Verified; Looks good to me, approved
diff --git a/public_html/cgi-bin/ps_wikinew.py
b/public_html/cgi-bin/ps_wikinew.py
index bc7d6cd..a3bcc88 100644
--- a/public_html/cgi-bin/ps_wikinew.py
+++ b/public_html/cgi-bin/ps_wikinew.py
@@ -112,6 +112,9 @@
# === labs conversion patch: variables === === ===
ver_desc = { 'ts': ['trunk', 'rewrite'],
'labs': ['compat', 'core'], }
-
+
localdir = { 'ts': ['..', 'DrTrigonBot', '.'],
'labs': ['..', 'public_html', 'logs', '.'], }
+
+bot_path = { 'ts': ["../../pywikipedia/", "../../rewrite/"],
+ 'labs': ["../pywikibot-compat/", "../pywikibot-core/"], }
diff --git a/public_html/cgi-bin/subster_mail_queue.py
b/public_html/cgi-bin/subster_mail_queue.py
index 5edd275..cad05a6 100755
--- a/public_html/cgi-bin/subster_mail_queue.py
+++ b/public_html/cgi-bin/subster_mail_queue.py
@@ -51,6 +51,8 @@
#import ps_wiki as style # panel-stylesheet 'wiki (monobook)'
import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1
compilant
+bot_path = os.path.realpath(style.bot_path[style.host(os.environ)][0])
+
# === page HTML contents === === ===
#
@@ -75,7 +77,7 @@
def displaystate(form):
data = {}
- mbox = mailbox.mbox('../../data/subster/mail_inbox')
+ mbox = mailbox.mbox(os.path.join(bot_path,
'../data/subster/mail_inbox'))
buf = []
buf.append( '\n<table>' )
diff --git a/public_html/cgi-bin/substersim.py
b/public_html/cgi-bin/substersim.py
index 4b7ef5a..697d3bc 100755
--- a/public_html/cgi-bin/substersim.py
+++ b/public_html/cgi-bin/substersim.py
@@ -55,7 +55,19 @@
import StringIO, traceback, signal
-bot_path = os.path.realpath("../../pywikipedia/")
+# === panel HTML stylesheets === === ===
+# MAY BE USING Cheetah (http://www.cheetahtemplate.org/) WOULD BE BETTER (or
needed at any point...)
+#
+#import ps_plain as style # panel-stylesheet 'plain'
+#import ps_simple as style # panel-stylesheet 'simple'
+#import ps_wiki as style # panel-stylesheet 'wiki (monobook)'
+import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1
compilant
+
+bot_path = os.path.realpath(style.bot_path[style.host(os.environ)][0])
+
+
+# === pywikibot framework === === ===
+#
#importglobal("subster_beta", bot_path)
#importglobal(["wikipedia", "xmlreader", "config", "dtbext", "subster_beta"],
bot_path)
#
http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
@@ -65,15 +77,8 @@
import wikipedia as pywikibot
-# === panel HTML stylesheets === === ===
-# MAY BE USING Cheetah (http://www.cheetahtemplate.org/) WOULD BE BETTER (or
needed at any point...)
+# === page HTML contents === === ===
#
-#import ps_plain as style # panel-stylesheet 'plain'
-#import ps_simple as style # panel-stylesheet 'simple'
-#import ps_wiki as style # panel-stylesheet 'wiki (monobook)'
-import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1
compilant
-
-
maindisplay_content = \
"""<small>(analog to <a
href="http://meta.wikimedia.org/wiki/Special:ExpandTemplates">Special:ExpandTemplates</a>)</small><br><br>
Version:<br>
@@ -194,6 +199,8 @@
<br>"""
+# === variables === === ===
+#
sim_param_default = { 'value': 'val',
'action': '',
'content': '<!--SUBSTER-val--><!--SUBSTER-val-->',
@@ -201,6 +208,8 @@
timeout = 60 # xx-sec. max. delay for url request
+# === code === === ===
+#
# from 'runbotrun.py'
def gettraceback(exc_info):
output = StringIO.StringIO()
diff --git a/public_html/cgi-bin/sum_cat_disc.py
b/public_html/cgi-bin/sum_cat_disc.py
index 4885547..d36c7b1 100755
--- a/public_html/cgi-bin/sum_cat_disc.py
+++ b/public_html/cgi-bin/sum_cat_disc.py
@@ -46,7 +46,18 @@
import MySQLdb, _mysql_exceptions
-bot_path = os.path.realpath("../../pywikipedia/")
+# === panel HTML stylesheets === === ===
+#
+#import ps_plain as style # panel-stylesheet 'plain'
+#import ps_simple as style # panel-stylesheet 'simple'
+#import ps_wiki as style # panel-stylesheet 'wiki (monobook)'
+import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1
compilant
+
+bot_path = os.path.realpath(style.bot_path[style.host(os.environ)][0])
+
+
+# === pywikibot framework === === ===
+#
sys.path.append( bot_path ) # bot import form other
path (!)
import query #
import wikipedia as pywikibot #
@@ -56,14 +67,8 @@
# may be best would be to get namespace info from DB?!
-# === panel HTML stylesheets === === ===
+# === page HTML contents === === ===
#
-#import ps_plain as style # panel-stylesheet 'plain'
-#import ps_simple as style # panel-stylesheet 'simple'
-#import ps_wiki as style # panel-stylesheet 'wiki (monobook)'
-import ps_wikinew as style # panel-stylesheet 'wiki (new)' not CSS 2.1
compilant
-
-
displaystate_content = \
"""<br>
<form action="sum_cat_disc.py">
@@ -97,6 +102,8 @@
%(output)s"""
+# === SQL query contents === === ===
+#
# http://www.mediawiki.org/wiki/Manual:Database_layout
# http://en.wikipedia.org/wiki/Wikipedia:Namespace
# http://sql.1keydata.com/de/sql-like.php
@@ -190,6 +197,8 @@
ORDER BY SIZE DESC LIMIT %s;"""
+# === variables === === ===
+#
SQL_LIMIT_max = 1000
wikitime = "%Y%m%d%H%M%S"
@@ -197,6 +206,8 @@
asctime_fmt = "%a %b %d %H:%M:%S %Y"
+# === code === === ===
+#
def call_db(query, args=(), limit=SQL_LIMIT_max):
#db.query(query % args)
--
To view, visit https://gerrit.wikimedia.org/r/104200
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If9d2476ed40ca9a3e6d414fc01649b4efb89c6ee
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/drtrigonbot
Gerrit-Branch: master
Gerrit-Owner: DrTrigon <[email protected]>
Gerrit-Reviewer: DrTrigon <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits