Attachment 'cache1.7.patch'
Download 1 --- moin-1.7.orig/MoinMoin/user.py 2007-12-01 16:50:42.000000000 +0200
2 +++ moin-1.7/MoinMoin/user.py 2007-12-04 16:48:40.000000000 +0200
3 @@ -72,18 +72,34 @@
4 return None
5 cfg = request.cfg
6 cachekey = '%s2id' % key
7 + cachekey_mtime = '%s2id_mtime' % key
8 + cache = caching.CacheEntry(request, 'user', cachekey, scope='wiki', use_pickle=True)
9 +
10 try:
11 _key2id = getattr(cfg.cache, cachekey)
12 + _key2id_mtime = getattr(cfg.cache, cachekey_mtime)
13 except AttributeError:
14 - arena = 'user'
15 - cache = caching.CacheEntry(request, arena, cachekey, scope='wiki', use_pickle=True)
16 try:
17 _key2id = cache.content()
18 + _key2id_mtime = cache.mtime()
19 except caching.CacheError:
20 _key2id = {}
21 + _key2id_mtime = 0
22 setattr(cfg.cache, cachekey, _key2id)
23 + setattr(cfg.cache, cachekey_mtime, _key2id_mtime)
24 +
25 + try:
26 + _key2id_mtime = cache.mtime()
27 + if getattr(cfg.cache, cachekey_mtime) != _key2id_mtime:
28 + _key2id = cache.content()
29 + setattr(cfg.cache, cachekey, _key2id)
30 + setattr(cfg.cache, cachekey_mtime, _key2id_mtime)
31 + except caching.CacheError:
32 + setattr(cfg.cache, cachekey_mtime, 0)
33 +
34 uid = _key2id.get(search, None)
35 - if uid is None:
36 + if uid is None or getattr(cfg.cache, cachekey_mtime) == 0:
37 + _key2id = {}
38 for userid in getUserList(request):
39 u = User(request, id=userid)
40 if hasattr(u, key):
41 @@ -93,10 +109,10 @@
42 _key2id[val] = userid
43 else:
44 _key2id[value] = userid
45 - arena = 'user'
46 - cache = caching.CacheEntry(request, arena, cachekey, scope='wiki', use_pickle=True)
47 +
48 try:
49 cache.update(_key2id)
50 + setattr(cfg.cache, cachekey_mtime, cache.mtime())
51 except caching.CacheError:
52 pass
53 uid = _key2id.get(search, None)
54 --- moin-1.7.orig/MoinMoin/userprefs/prefs.py 2007-12-01 16:50:42.000000000 +0200
55 +++ moin-1.7/MoinMoin/userprefs/prefs.py 2007-12-04 16:48:54.000000000 +0200
56 @@ -8,7 +8,7 @@
57 """
58
59 import time
60 -from MoinMoin import user, util, wikiutil, events
61 +from MoinMoin import user, util, wikiutil, events, caching
62 from MoinMoin.widget import html
63 from MoinMoin.userprefs import UserPrefBase
64
65 @@ -200,6 +200,11 @@
66 # set valid to false so the current request won't
67 # show the user as logged-in any more
68 theuser.valid = False
69 +
70 + # update file cache
71 + cache = caching.CacheEntry(self.request, 'user', 'name2id', scope='wiki', use_pickle=True)
72 + cache.remove()
73 +
74 self.request.user = theuser
75
76 result = _("User preferences saved!")
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.