scripts/wiki/patches/moin-changes-show-hostname.patch
Antoine Durand-Gasselin a7a85ff7ec [wiki/patches] patches pour lee moinmoin du crans
Ces patches sont pour la version 1.9.2 de moinmoin
Pour le moinmoin du crans, récupérer les ressources statiques dans git et appliquer les patches
Actuellement, on est encore sur le paquet custom du crans, mais avec les ressources statiques du git. On migrera sans doute un peu avant squeeze ?

darcs-hash:20100908115755-bd074-f9fb78bcf8e62e8cee632acffe65b6d0d83907ab.gz
2010-09-08 13:57:55 +02:00

32 lines
1.1 KiB
Diff

diff -urN MoinMoin/user.py b/MoinMoin/user.py
--- a/MoinMoin/user.py 2008-07-14 21:11:24.000000000 +0200
+++ b/MoinMoin/user.py 2009-10-11 01:11:52.000000000 +0200
@@ -27,7 +27,9 @@
from MoinMoin import config, caching, wikiutil, i18n, events
from MoinMoin.util import timefuncs, filesys, random_string
from MoinMoin.wikiutil import url_quote_plus
-
+### HACK SAUVAGE 1/2
+import socket
+### FIN HACK 1/2
def getUserList(request):
""" Get a list of all (numerical) user IDs.
@@ -1023,7 +1025,16 @@
if self.name:
return self.wikiHomeLink()
else:
- return self.host()
+ ### HACK SAUVAGE 2/2
+ # return self.host()
+ try:
+ hostname = socket.gethostbyaddr(self.host())[0]
+ except socket.herror:
+ hostname = self.host()
+ if (hostname+'.').split('.', 1)[1] in ['crans.org.', 'wifi.crans.org.']:
+ hostname = hostname.split('.',1)[0]
+ return hostname
+ ### FIN HACK 2/2
def generate_recovery_token(self):
key = random_string(64, "abcdefghijklmnopqrstuvwxyz0123456789")