Mercurial > moin > 1.9
changeset 4072:8bbb028087f1
merge changes from moin/1.7
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Sun, 07 Sep 2008 16:22:59 +0200 |
parents | c40f5e5560d4 (current diff) e2107f4b6217 (diff) |
children | 83d99e08e931 |
files | MoinMoin/auth/_tests/test_auth.py MoinMoin/i18n/__init__.py |
diffstat | 12 files changed, 50 insertions(+), 83 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/action/PackagePages.py Sun Sep 07 16:14:34 2008 +0200 +++ b/MoinMoin/action/PackagePages.py Sun Sep 07 16:22:59 2008 +0200 @@ -70,6 +70,7 @@ # Get new name from form and normalize. pagelist = form.get('pagelist', [u''])[0] packagename = form.get('packagename', [u''])[0] + include_attachments = form.get('include_attachments', [False])[0] if not form.get('submit', [None])[0]: self.request.theme.add_msg(self.makeform(), "dialog") @@ -91,7 +92,7 @@ # Generate a package output = open(fpath, "wb") - package = self.collectpackage(unpackLine(pagelist, ","), output, target) + package = self.collectpackage(unpackLine(pagelist, ","), output, target, include_attachments) if package: self.request.theme.add_msg(self.makeform(), "dialog") @@ -119,6 +120,7 @@ 'action': self.__class__.__name__, 'pagename': wikiutil.escape(self.pagename, True), 'pagename_quoted': wikiutil.quoteWikinameURL(self.pagename), + 'include_attachments_label': _('Include all attachments?'), 'package': _('Package pages'), 'cancel': _('Cancel'), 'newname_label': _("Package name"), @@ -142,6 +144,11 @@ </td> </tr> <tr> + <td class="label"> + %(include_attachments_label)s<input type="checkbox" name="include_attachments" value="0" %(include_attachments_label)s> + </td> + </tr> + <tr> <td></td> <td class="buttons"> <input type="submit" name="submit" value="%(package)s"> @@ -172,7 +179,7 @@ titles.append(title.page_name) return titles - def collectpackage(self, pagelist, fileobject, pkgname=""): + def collectpackage(self, pagelist, fileobject, pkgname="", include_attachments=False): """ Expects a list of pages as an argument, and fileobject to be an open file object, which a zipfile will get written to. @@ -181,6 +188,8 @@ @param pkgname: optional file name, to prevent self packaging @rtype: string or None @return: error message, if one happened + @rtype: boolean + @param include_attachments: True if you want attachments collected """ _ = self.request.getText COMPRESSION_LEVEL = zipfile.ZIP_DEFLATED @@ -211,13 +220,14 @@ zi = zipfile.ZipInfo(filename=str(cnt), date_time=datetime.fromtimestamp(timestamp).timetuple()[:6]) zi.compress_type = COMPRESSION_LEVEL zf.writestr(zi, page.get_raw_body().encode("utf-8")) - for attname in files: - if attname != pkgname: - cnt += 1 - zipname = "%d_attachment" % cnt - script.append(packLine(["AddAttachment", zipname, attname, page.page_name, userid, "Created by the PackagePages action."])) - filename = AttachFile.getFilename(self.request, page.page_name, attname) - zf.write(filename, zipname) + if include_attachments: + for attname in files: + if attname != pkgname: + cnt += 1 + zipname = "%d_attachment" % cnt + script.append(packLine(["AddAttachment", zipname, attname, page.page_name, userid, "Created by the PackagePages action."])) + filename = AttachFile.getFilename(self.request, page.page_name, attname) + zf.write(filename, zipname) script += [packLine(['Print', 'Thank you for using PackagePages!'])] zf.writestr(MOIN_PACKAGE_FILE, u"\n".join(script).encode("utf-8"))
--- a/MoinMoin/auth/_tests/test_auth.py Sun Sep 07 16:14:34 2008 +0200 +++ b/MoinMoin/auth/_tests/test_auth.py Sun Sep 07 16:22:59 2008 +0200 @@ -55,7 +55,9 @@ def process_request(self, environ): request = request_wsgi.Request(environ) + save_user = request.user # keep a reference, request.finish does "del request.user" request.run() + request.user = save_user return request # request.status, request.headers, request.output()
--- a/MoinMoin/filter/application_msword.py Sun Sep 07 16:14:34 2008 +0200 +++ b/MoinMoin/filter/application_msword.py Sun Sep 07 16:22:59 2008 +0200 @@ -8,6 +8,8 @@ @license: GNU GPL, see COPYING for details. """ +import os + from MoinMoin.filter import execfilter def execute(indexobj, filename):
--- a/MoinMoin/i18n/__init__.py Sun Sep 07 16:14:34 2008 +0200 +++ b/MoinMoin/i18n/__init__.py Sun Sep 07 16:22:59 2008 +0200 @@ -279,7 +279,7 @@ else: try: language = languages[lang]['x-language-in-english'] - dictpagename = "%sDict" % language + dictpagename = "%sDict" % language.replace(' ', '') dicts = request.dicts if dicts.has_dict(dictpagename): userdict = dicts.dict(dictpagename)
--- a/MoinMoin/macro/TableOfContents.py Sun Sep 07 16:14:34 2008 +0200 +++ b/MoinMoin/macro/TableOfContents.py Sun Sep 07 16:22:59 2008 +0200 @@ -149,6 +149,11 @@ tocfm = TOCFormatter(macro.request) p = Page(macro.request, pname, formatter=tocfm, rev=macro.request.rev) + + # this is so we get a correctly updated TOC if we just preview in the editor - + # the new content is not stored on disk yet, but available as macro.parser.raw: + p.set_raw_body(macro.parser.raw, modified=1) + output = macro.request.redirectedOutput(p.send_page, content_only=True, count_hit=False,
--- a/MoinMoin/mail/mailimport.py Sun Sep 07 16:14:34 2008 +0200 +++ b/MoinMoin/mail/mailimport.py Sun Sep 07 16:22:59 2008 +0200 @@ -245,7 +245,7 @@ fname = att.filename + new_suffix try: # get the fname again, it might have changed - fname = add_attachment(request, pagename, fname, att.data) + fname, fsize = add_attachment(request, pagename, fname, att.data) attachments.append(fname) except AttachmentAlreadyExists: i += 1
--- a/MoinMoin/script/export/package.py Sun Sep 07 16:14:34 2008 +0200 +++ b/MoinMoin/script/export/package.py Sun Sep 07 16:22:59 2008 +0200 @@ -42,6 +42,9 @@ 4. Optionally, the --user argument could be added to any of the above examples, causing the script to respect ACLs. + + 5. Optionally, the --include_attachments argument could be added to any of the above examples, + causing the script to include attachments into the output file. """ def __init__(self, argv=None, def_values=None): @@ -51,6 +54,10 @@ help="List of pages to package. Can be regular expressions, comma seperated lists, or a lone * for everything." ) self.parser.add_option( + "-a", "--include_attachments", action="store_true", dest="attachment", + help="Include attachments from each page" + ) + self.parser.add_option( "-o", "--output", dest="output", help="Output file for the package." ) @@ -80,6 +87,10 @@ elif not self.options.pages and not self.options.search: script.log(_("No pages specified using --pages or --search, assuming full package.")) + include_attachments = self.options.attachment or False + if include_attachments: + script.log(_("All attachments included into the package.")) + # Sanity checks if os.path.exists(self.options.output): script.fatal(_("Output file already exists! Cowardly refusing to continue!")) @@ -96,14 +107,15 @@ packageoutput = open(self.options.output, "wb") if self.options.search: packagedata = package.collectpackage(package.searchpackage(request, - self.options.search), packageoutput) + self.options.search), packageoutput, + include_attachments=include_attachments) elif self.options.pages: - packagedata = package.collectpackage(self.options.pages.split(","), packageoutput) + packagedata = package.collectpackage(self.options.pages.split(","), packageoutput, include_attachments=include_attachments) else: packagedata = package.collectpackage(request.rootpage.getPageList( include_underlay=False, filter=lambda name: not wikiutil.isSystemPage(request, name)), - packageoutput) + packageoutput, include_attachments=include_attachments) if packagedata: script.fatal(packagedata)
--- a/MoinMoin/script/old/xmlrpc-tools/UpdateGroupTest.py Sun Sep 07 16:14:34 2008 +0200 +++ b/MoinMoin/script/old/xmlrpc-tools/UpdateGroupTest.py Sun Sep 07 16:22:59 2008 +0200 @@ -2,7 +2,7 @@ # -*- coding: iso-8859-1 -*- """ MoinMoin - client side of xmlrpc UpdateGroup functionality. - + You can use this code to update a group page in a target wiki via xmlrpc. Of course you need to enable the xmlrpc service in the target wiki, see your actions_excluded settings (by default, it contains 'xmlrpc')! @@ -33,7 +33,6 @@ @param groupdesc: group description (unicode) @param groupmembers: group member names (list of unicode) @param acl: Access Control List value (optional, unicode) - @return: """ wiki = xmlrpclib.ServerProxy(server_url) auth_token = wiki.getAuthToken(username, password)
--- a/MoinMoin/server/server_standalone.py Sun Sep 07 16:14:34 2008 +0200 +++ b/MoinMoin/server/server_standalone.py Sun Sep 07 16:22:59 2008 +0200 @@ -133,6 +133,7 @@ return t = Thread(target=self.process_request_thread, args=(request, client_address)) + t.setDaemon(True) t.start() finally: self.lock.release() @@ -164,11 +165,6 @@ This server is 5 times faster than ThreadingServer for static files, and about the same for wiki pages. - - TODO: sometimes the server won't exit on Conrol-C, and continue to - run with few threads (you can kill it with kill -9). Same problem - exist with the twisted server. When the problem is finally solved, - remove the commented debug prints. """ use_threads = True @@ -186,6 +182,7 @@ from threading import Thread for dummy in range(self.poolSize): t = Thread(target=self.serve_forever_thread) + t.setDaemon(True) t.start() SimpleServer.serve_forever(self) @@ -219,7 +216,6 @@ except: self.handle_error(request, client_address) self.close_request(request) - # sys.stderr.write('thread exiting...\n') def pop_request(self): """ Pop a request from the queue @@ -240,7 +236,6 @@ self.lock.wait() finally: self.lock.release() - # sys.stderr.write('thread exiting...\n') sys.exit() def die(self): @@ -256,7 +251,6 @@ def wake_all_threads(self): self.lock.acquire() try: - # sys.stderr.write('waking up all threads...\n') self.lock.notifyAll() finally: self.lock.release()
--- a/wiki/htdocs/classic/css/msie.css Sun Sep 07 16:14:34 2008 +0200 +++ b/wiki/htdocs/classic/css/msie.css Sun Sep 07 16:22:59 2008 +0200 @@ -25,26 +25,6 @@ /* Spans for line-anchors - needed for IE6 and IE7 where omitting the "display: none" triggers rendering bugs. */ span.anchor { display: none; } -/* -This could maybe avoid screen jumping in IE with IE7 hack. - -It works (or rather: should work) like this: -First, IE sees the a.interwiki definition only as it doesn't understand neither -* > a.interwiki, nor a.interwiki:before. We use a.interwiki to reserve some -space for the icon inserted later. -Later, the IE7 hack kicks in and then IE also understands those 2 other css lines. -The * > a.interwiki line now removes the space we previously reserved and the -:before inserts the icon. - -a.interwiki {margin-left: 25px; padding-top: 25px; padding-bottom: 25px;} -* > a.interwiki {margin-left: 0px; padding-top: 25px; padding-bottom: 25px;} -a.interwiki:before {content: url(../img/moin-inter.png);} - -Problem: -While margin-left seems to work, margin-/padding-top/bottom doesnt. -After getting it to work, this has to be fine-tuned to avoid screen jumping. -*/ - /* Some * html hacks for IE6 and below only (IE7 ignores * html) */ /* IE6 has a bug with rendering of float elements. We workaround this bug by
--- a/wiki/htdocs/modern/css/msie.css Sun Sep 07 16:14:34 2008 +0200 +++ b/wiki/htdocs/modern/css/msie.css Sun Sep 07 16:22:59 2008 +0200 @@ -25,26 +25,6 @@ /* Spans for line-anchors - needed for IE6 and IE7 where omitting the "display: none" triggers rendering bugs. */ span.anchor { display: none; } -/* -This could maybe avoid screen jumping in IE with IE7 hack. - -It works (or rather: should work) like this: -First, IE sees the a.interwiki definition only as it doesn't understand neither -* > a.interwiki, nor a.interwiki:before. We use a.interwiki to reserve some -space for the icon inserted later. -Later, the IE7 hack kicks in and then IE also understands those 2 other css lines. -The * > a.interwiki line now removes the space we previously reserved and the -:before inserts the icon. - -a.interwiki {margin-left: 25px; padding-top: 25px; padding-bottom: 25px;} -* > a.interwiki {margin-left: 0px; padding-top: 25px; padding-bottom: 25px;} -a.interwiki:before {content: url(../img/moin-inter.png);} - -Problem: -While margin-left seems to work, margin-/padding-top/bottom doesnt. -After getting it to work, this has to be fine-tuned to avoid screen jumping. -*/ - /* Some * html hacks for IE6 and below only (IE7 ignores * html) */ /* IE6 has a bug with rendering of float elements. We workaround this bug by
--- a/wiki/htdocs/rightsidebar/css/msie.css Sun Sep 07 16:14:34 2008 +0200 +++ b/wiki/htdocs/rightsidebar/css/msie.css Sun Sep 07 16:22:59 2008 +0200 @@ -25,25 +25,8 @@ /* Spans for line-anchors - needed for IE6 and IE7 where omitting the "display: none" triggers rendering bugs. */ span.anchor { display: none; } -/* -This could maybe avoid screen jumping in IE with IE7 hack. - -It works (or rather: should work) like this: -First, IE sees the a.interwiki definition only as it doesn't understand neither -* > a.interwiki, nor a.interwiki:before. We use a.interwiki to reserve some -space for the icon inserted later. -Later, the IE7 hack kicks in and then IE also understands those 2 other css lines. -The * > a.interwiki line now removes the space we previously reserved and the -:before inserts the icon. - -a.interwiki {margin-left: 25px; padding-top: 25px; padding-bottom: 25px;} -* > a.interwiki {margin-left: 0px; padding-top: 25px; padding-bottom: 25px;} -a.interwiki:before {content: url(../img/moin-inter.png);} - -Problem: -While margin-left seems to work, margin-/padding-top/bottom doesnt. -After getting it to work, this has to be fine-tuned to avoid screen jumping. -*/ +/* Fix for PeekABoo Bug */ +#page { min-height: 1%; } /* Some * html hacks for IE6 and below only (IE7 ignores * html) */