Attachment 'fakerequest.diff'
Download 1 diff -r 5b92be3da023 -r fc11712e0df0 MoinMoin/search/builtin.py
2 --- a/MoinMoin/search/builtin.py Sun May 27 20:21:32 2012 +0200
3 +++ b/MoinMoin/search/builtin.py Sun Jul 22 20:59:35 2012 +0200
4 @@ -270,19 +270,31 @@
5
6 @param request: current request
7 """
8 - import copy
9 from MoinMoin.security import Permissions
10 - from MoinMoin.logfile import editlog
11 + from MoinMoin.user import User
12
13 class SecurityPolicy(Permissions):
14 -
15 def read(self, *args, **kw):
16 return True
17
18 - r = copy.copy(request)
19 - r.user.may = SecurityPolicy(r.user)
20 - r.editlog = editlog.EditLog(r)
21 - return r
22 + user = User(request)
23 + user.may = SecurityPolicy(user)
24 +
25 + class FakeRequest(object):
26 + """ minimal request object for indexing code """
27 + def __init__(self, request, user):
28 + NAMES = """action cfg clock current_lang dicts form
29 + getPragma getText href html_formatter
30 + isSpiderAgent mode_getpagelinks page
31 + parsePageLinks_running redirect redirectedOutput
32 + rev rootpage script_root session setContentLanguage
33 + setPragma theme uid_generator values write""".split()
34 + for name in NAMES:
35 + value = getattr(request, name, None)
36 + setattr(self, name, value)
37 + self.user = user
38 +
39 + return FakeRequest(request, user)
40
41
42 ##############################################################################
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.