Bugs item #1816352, was opened at 2007-10-19 18:33
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1816352&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: John Vandenberg (zeroj)
Assigned to: Nobody/Anonymous (nobody)
Summary: replace.py regex '(?ms)^(.*)$'
Initial Comment:
In order to use replace.py to "append" text, the regex needs to match the entire page using '(?ms)^(.*)$' '\1 text to add'. I thought that this was working a while ago, and I documented it as an example on [[m:Replace.py]] on September 24.
This doesnt appear to be working now, with the code infinitely looping: it continually matches the page and appends the replacement text.
The attached patch makes any regex that matches the entire page a special case.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1816352&group_…
Patches item #1815987, was opened at 2007-10-18 19:06
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1815987&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Multichill (multichill)
Assigned to: Nobody/Anonymous (nobody)
Summary: Pagefromfile.py only work on existing pages
Initial Comment:
I created a patch for pagefromfile.py
In this patch two new options are introduced:
-onlyappendtop only add the text to the top of the page if the page already exists
-onlyappendbottom only add the text to the bottom of the page if the page already exists
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1815987&group_…
(Now posting as member.)
> I am new at running pywikipedia bots and running an update bot with
> the same structure/calls as in the script at:
>
> http://ontoworld.org/wiki/Ontology_import#Alternative_import
>
> The problem is that when I run the bot NO new page is created;
>
> I have tested that the bot user/password works in the wiki.
>
Questions:
> - Is there some other configuration setting which needs to be set ot
> allow bots to make updates to the wiki?
> - What other troubleshooting can I do to find out why this isn't
> working?
>
> Thanks in advance for your help.
>
> Dave J.
>
> The trace of this script is:
>
> Checked for running processes. 2 processes currently running,
> including the current process.
> clone:en
> BOT ALLOWED? True
> cloneBot
> password
> Creating Works {{Tools-Models
> |Description=3D model building tool
>
> }}
> Getting a page to check if we're logged in on clone:en
> Password for user cloneBot on clone:en: Warning: Problem with
> getpass. Passwords may be echoed.
> password
> Logging in to clone:en as cloneBot
> Should be logged in now
> Sleeping for 3.5 seconds, 2007-10-17 14:32:44
> Creating page [[en:Works]]
> Pages that already exist; no overwrite. []
>
> By the way:
>
> There is an apparent code error in wikipedia.py at line, which I
> changed as follows:
>
> ##
> predata.append(("Content-type","application/x-www-form-urlencoded"))
> ## predata.append(("User-agent", useragent))
> ## Mod by DHJ
> predata["Content-type"] =
> "application/x-www-form-urlencoded"
> predata["User-agent"] = useragent
>
> This is somewhat suspicious that this error hasn't been found yet, if
> it part of the normal update process.
>
Bugs item #1773949, was opened at 2007-08-14 08:31
Message generated for change (Comment added) made by sf-robot
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1773949&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
Resolution: Accepted
Priority: 3
Private: No
Submitted By: Falk Steinhauer (falk_steinhauer)
Assigned to: Leonardo Gregianin (leogregianin)
Summary: wrong argument description of movepages.py
Initial Comment:
I am using snapshot 2007-06-19.
The commandline help of movepages.py shows an option called "-addprefix", but the respective option in the sourcecode is spelled "-prefix".
Users that are not able to understand the sourcecode might not be able to understand how to call the script.
Another thing is, that this script is not using page title highlighting like replace.py when user interaction is desired. The first line in "def treat(self,page)" should be:
colors = [None] * 6 + [13] * len(page.title()) + [None] * 4
----------------------------------------------------------------------
>Comment By: SourceForge Robot (sf-robot)
Date: 2007-10-17 19:20
Message:
Logged In: YES
user_id=1312539
Originator: NO
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
----------------------------------------------------------------------
Comment By: Leonardo Gregianin (leogregianin)
Date: 2007-09-20 09:38
Message:
Logged In: YES
user_id=1136737
Originator: NO
See this snapshot http://tools.wikimedia.de/~valhallasw/pywiki/
----------------------------------------------------------------------
Comment By: Falk Steinhauer (falk_steinhauer)
Date: 2007-09-13 01:06
Message:
Logged In: YES
user_id=1810075
Originator: YES
Bug still exists in snapshot 2007-08-11.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1773949&group_…
Bugs item #1809991, was opened at 2007-10-09 15:39
Message generated for change (Comment added) made by wikishizhao
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1809991&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: other
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: shizhao (wikishizhao)
Assigned to: Nobody/Anonymous (nobody)
Summary: welcome.py time bug
Initial Comment:
welcome.py use localtime() add welcome log sub page. plese use gmtime(), is UTC time.
----------------------------------------------------------------------
>Comment By: shizhao (wikishizhao)
Date: 2007-10-18 08:22
Message:
Logged In: YES
user_id=1853316
Originator: YES
localtime() => gmtime()
File Added: welcome.patch
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1809991&group_…
Revision: 4465
Author: russblau
Date: 2007-10-17 21:25:20 +0000 (Wed, 17 Oct 2007)
Log Message:
-----------
Finished docstring cleanup at last!
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2007-10-17 20:04:39 UTC (rev 4464)
+++ trunk/pywikipedia/wikipedia.py 2007-10-17 21:25:20 UTC (rev 4465)
@@ -38,29 +38,30 @@
Other functions:
getall(): Load a group of pages via Special:Export
-
- handleArgs(): Process all standard command line arguments (such as -family,
- -lang, -log and others)
-
- translate(xx, dict): dict is a dictionary, giving text depending on language,
- xx is a language. Returns the text in the most applicable language for
- the xx: wiki
-
+ handleArgs(): Process all standard command line arguments (such as
+ -family, -lang, -log and others)
+ translate(xx, dict): dict is a dictionary, giving text depending on
+ language, xx is a language. Returns the text in the most applicable
+ language for the xx: wiki
setAction(text): Use 'text' instead of "Wikipedia python library" in
edit summaries
setUserAgent(text): Sets the string being passed to the HTTP server as
the User-agent: header. Defaults to 'Pywikipediabot/1.0'.
output(text): Prints the text 'text' in the encoding of the user's
- console.
+ console. **Use this instead of "print" statements**
input(text): Asks input from the user, printing the text 'text' first.
+ inputChoice: Shows user a list of choices and returns user's selection.
+
showDiff(oldtext, newtext): Prints the differences between oldtext and
newtext on the screen
- url2link: Convert urlname of a wiki page into interwiki link format.
-
+ datafilepath: Return an absolute path to a data file in a standard
+ location.
+ shortpath: Return a relative form of the data file pathname.
+
Wikitext manipulation functions: each of these takes a unicode string
- containing wiki text as its first argument, and returns a modified
- version of the text unless otherwise noted --
+containing wiki text as its first argument, and returns a modified version
+of the text unless otherwise noted --
replaceExcept: replace all instances of 'old' by 'new', skipping any
instances of 'old' within comments and other special text blocks
@@ -71,7 +72,8 @@
encodeEsperantoX: convert wikitext to the Esperanto x-encoding.
sectionencode: encode text for use as a section title in wiki-links.
-Wikitext maniupulation functions for interlanguage links:
+Wikitext manipulation functions for interlanguage links:
+
getLanguageLinks(text,xx): extract interlanguage links from text and
return in a dict
removeLanguageLinks(text): remove all interlanguage links from text
@@ -80,8 +82,10 @@
getLanguageLinks
interwikiFormat(links): convert a dict of interlanguage links to text
(using same dict format as getLanguageLinks)
+ url2link: Convert urlname of a wiki page into interwiki link format.
Wikitext manipulation functions for category links:
+
getCategoryLinks(text): return list of Category objects corresponding
to links in text
removeCategoryLinks(text): remove all category links from text
@@ -3404,6 +3408,13 @@
Methods:
+ language: This Site's language code.
+ family: This Site's Family object.
+ sitename: A string representing this Site.
+ languages: A list of all languages contained in this site's Family.
+ validLanguageLinks: A list of language codes that can be used in interwiki
+ links.
+
loggedInAs: return current username, or None if not logged in.
forceLogin: require the user to log in to the site
messages: return True if there are new messages on the site
@@ -3413,6 +3424,13 @@
urlEncode: Encode a query to be sent using an http POST request.
postForm: Post form data to an address at this site.
postData: Post encoded form data to an http address at this site.
+
+ namespace(num): Return local name of namespace 'num'.
+ normalizeNamespace(value): Return preferred name for namespace 'value' in
+ this Site's language.
+ namespaces: Return list of canonical namespace names for this Site.
+ getNamespaceIndex(name): Return the int index of namespace 'name', or None
+ if invalid.
redirect: Return the localized redirect tag for the site.
redirectRegex: Return compiled regular expression matching on redirect
@@ -3420,6 +3438,7 @@
mediawiki_message: Retrieve the text of a specified MediaWiki message
has_mediawiki_message: True if this site defines specified MediaWiki
message
+
shared_image_repository: Return tuple of image repositories used by this
site.
category_on_one_line: Return True if this site wants all category links
@@ -3429,11 +3448,16 @@
linkto(title): Return string in the form of a wikilink to 'title'
isInterwikiLink(s): Return True if 's' is in the form of an interwiki
link.
+ getSite(lang): Return Site object for wiki in same family, language
+ 'lang'.
version: Return MediaWiki version string from Family file.
versionnumber: Return int identifying the MediaWiki version.
live_version: Return version number read from Special:Version.
checkCharset(charset): Warn if charset doesn't match family file.
+ linktrail: Return regex for trailing chars displayed as part of a link.
+ disambcategory: Category in which disambiguation pages are listed.
+
Methods that yield Page objects derived from a wiki's Special: pages
(note, some methods yield other information in a tuple along with the
Pages; see method docs for details) --
@@ -3927,7 +3951,7 @@
return self._mediawiki_messages[key]
def has_mediawiki_message(self, key):
- """Return True iff this site defines a MediaWiki message for key "key" """
+ """Return True iff this site defines a MediaWiki message for 'key'."""
try:
v = self.mediawiki_message(key)
return True
@@ -4788,9 +4812,12 @@
def normalizeNamespace(self, value):
"""Return canonical name for namespace 'value' in this Site's language.
+ 'Value' should be a string or unicode.
If no match, return 'value' unmodified.
"""
+ if not self.nocapitalize and value[0].islower():
+ value = value[0].upper() + value[1:]
return self.family.normalizeNamespace(self.lang, value)
def namespaces(self):
@@ -4817,27 +4844,35 @@
return nslist
def getNamespaceIndex(self, namespace):
+ """Given a namespace name, return its int index, or None if invalid."""
return self.family.getNamespaceIndex(self.lang, namespace)
def linktrail(self):
+ """Return regex for trailing chars displayed as part of a link."""
return self.family.linktrail(self.lang)
def language(self):
+ """Return Site's language code."""
return self.lang
def fam(self):
+ """Return Family object for this Site."""
return self.family
def sitename(self):
+ """Return string representing this Site's name and language."""
return self.family.name+':'+self.lang
def languages(self):
+ """Return list of all valid language codes for this site's Family."""
return self.family.langs.keys()
def validLanguageLinks(self):
+ """Return list of language codes that can be used in interwiki links."""
return self._validlanguages
def disambcategory(self):
+ """Return Category in which disambig pages are listed."""
import catlib
try:
return catlib.Category(self,
@@ -4866,7 +4901,7 @@
else:
return self._token
- def putToken(self,value, sysop = False):
+ def putToken(self, value, sysop = False):
if sysop:
self._sysoptoken = value
else:
@@ -5131,7 +5166,8 @@
return []
def translate(code, xdict):
- """
+ """Return the most appropriate translation from a translation dict.
+
Given a language code and a dictionary, returns the dictionary's value for
key 'code' if this key exists; otherwise tries to return a value for an
alternative language that is most applicable to use on the Wikipedia in
@@ -5236,9 +5272,7 @@
colorTagR = re.compile('\03{.*?}', re.UNICODE)
def log(text):
- """
- Writes the given text to the logfile.
- """
+ """Write the given text to the logfile."""
if logfile:
# remove all color markup
# TODO: consider pre-compiling this regex for speed improvements
@@ -5251,7 +5285,8 @@
input_lock = threading.Lock()
output_cache = []
def output(text, decoder = None, newline = True, toStdout = False):
- """
+ """Output a message to the user via the userinterface.
+
Works like print, but uses the encoding used by the user's console
(console_encoding in the configuration file) instead of ASCII.
If decoder is None, text should be a unicode string. Otherwise it
@@ -5266,6 +5301,7 @@
text can contain special sequences to create colored output. These
consist of the escape character \03 and the color name in curly braces,
e. g. \03{lightpurple}. \03{default} resets the color.
+
"""
output_lock.acquire()
try:
@@ -5299,8 +5335,7 @@
ui.output(*args, **kwargs)
def input(question, password = False):
- """
- Asks the user a question, then returns the user's answer.
+ """Ask the user a question, return the user's answer.
Parameters:
* question - a unicode string that will be shown to the user. Don't add a
@@ -5309,6 +5344,7 @@
* password - if True, hides the user's input (for password entry).
Returns a unicode string.
+
"""
input_lock.acquire()
try:
@@ -5320,11 +5356,11 @@
return data
def inputChoice(question, answers, hotkeys, default = None):
- """
- Asks the user a question and offers several options, then returns the
- user's choice. The user's input will be case-insensitive, so the hotkeys
- should be distinctive case-insensitively.
+ """Ask the user a question with several options, return the user's choice.
+ The user's input will be case-insensitive, so the hotkeys should be
+ distinctive case-insensitively.
+
Parameters:
* question - a unicode string that will be shown to the user. Don't add a
space after the question mark, this method will do this
@@ -5335,6 +5371,7 @@
be returned when the user just presses Enter.
Returns a one-letter string in lowercase.
+
"""
input_lock.acquire()
try:
Revision: 4463
Author: huji
Date: 2007-10-17 19:27:12 +0000 (Wed, 17 Oct 2007)
Log Message:
-----------
Updating simplejson to 1.7.3
Modified Paths:
--------------
trunk/pywikipedia/simplejson/__init__.py
trunk/pywikipedia/simplejson/encoder.py
Modified: trunk/pywikipedia/simplejson/__init__.py
===================================================================
--- trunk/pywikipedia/simplejson/__init__.py 2007-10-17 14:55:24 UTC (rev 4462)
+++ trunk/pywikipedia/simplejson/__init__.py 2007-10-17 19:27:12 UTC (rev 4463)
@@ -86,7 +86,7 @@
Note that the JSON produced by this module's default settings
is a subset of YAML, so it may be used as a serializer for that as well.
"""
-__version__ = '1.7.1'
+__version__ = '1.7.3'
__all__ = [
'dump', 'dumps', 'load', 'loads',
'JSONDecoder', 'JSONEncoder',
Modified: trunk/pywikipedia/simplejson/encoder.py
===================================================================
--- trunk/pywikipedia/simplejson/encoder.py 2007-10-17 14:55:24 UTC (rev 4462)
+++ trunk/pywikipedia/simplejson/encoder.py 2007-10-17 19:27:12 UTC (rev 4463)
@@ -37,7 +37,7 @@
elif o == -INFINITY:
text = '-Infinity'
else:
- return str(o)
+ return repr(o)
if not allow_nan:
raise ValueError("Out of range float values are not JSON compliant: %r"