[cpif] r55 - trunk/frontend-web

svn at argo.es svn at argo.es
Sat May 19 21:49:02 CEST 2007


Author: jcea
Date: Sat May 19 21:49:01 2007
New Revision: 55

Log:
Permite hacer 'log out'

Added:
   trunk/frontend-web/url_logout.py
      - copied, changed from r54, /trunk/frontend-web/url_stop.py
Modified:
   trunk/frontend-web/servidor_web.py
   trunk/frontend-web/url_.py

Modified: trunk/frontend-web/servidor_web.py
==============================================================================
--- trunk/frontend-web/servidor_web.py	(original)
+++ trunk/frontend-web/servidor_web.py	Sat May 19 21:49:01 2007
@@ -46,7 +46,6 @@
       if cookie :
         import Cookie
         cookie=Cookie.SimpleCookie(cookie)
-        print cookie
         @monitor
         def verifica(conn,cookie) :
           import database
@@ -56,7 +55,6 @@
         path=self.path.split("/")[1:]
         if not cookie :
           cookie,resultado=self.elige_usuario(path)
-          print cookie
         else :
           usuario,cookie=cookie
           resultado=urls.get(path[0],None)
@@ -75,11 +73,17 @@
         raise
 
       estado=resultado[0]
-      self.send_response(estado)
       if estado==301 or estado==302 :
+        self.send_response(estado)
         self.send_header("Location",resultado[1])
         self.send_header("Content-Type","text/html; charset=utf-8")
+      elif estado==401 :
+        cookie=resultado[1]
+        self.send_response(302)
+        self.send_header("Location","/")
+        self.send_header("Content-Type","text/html; charset=utf-8")
       else :
+        self.send_response(estado)
         self.send_header("Content-Type",resultado[1])
       if cookie!=None :
         self.send_header("Set-Cookie",cookie)

Modified: trunk/frontend-web/url_.py
==============================================================================
--- trunk/frontend-web/url_.py	(original)
+++ trunk/frontend-web/url_.py	Sat May 19 21:49:01 2007
@@ -81,6 +81,7 @@
 <tr><td colspan=2 align=right><input class="form-element" type="submit" name="submit" value="Publicar nuevo hilo"/></td></tr>
 </table>
 </form>
+<p><a href="/logout">LOG OUT</a>
 <p><a href="/stop">Parar la demo</a>
 <p><a href="/nuevo_usuario">Dar de alta un nuevo usuario</a>
 </body></html>""" %("\r\n".join(texto),calendario.vista_mensual(conn,fecha_elegida,usuario)))

Copied: trunk/frontend-web/url_logout.py (from r54, /trunk/frontend-web/url_stop.py)
==============================================================================
--- /trunk/frontend-web/url_stop.py	(original)
+++ trunk/frontend-web/url_logout.py	Sat May 19 21:49:01 2007
@@ -3,20 +3,5 @@
 from globales import monitor
 
 def gestiona_url(handler,path,usuario) :
-  if usuario!="master" :
-    return(200,"text/html; charset=utf-8",
-"""
-<html><head></head><body>
-<h1>Solo el usuario 'master' puede parar el servicio</h1>
-<p><a href="/">P&aacute;gina principal</a>
-<p><a href="/stop">Parar la demo</a>
-</body></html>""")
-
-
-  handler.must_stop=True
-  return (200,"text/html; charset=utf-8",
-"""
-<html><head></head><body>
-<h1>PARAMOS EL SERVICIO!!</h1>
-</body></html>""")
+  return (401,"cpif_auth=X; path=/; expires=Sat, 19-05-2007 00:00:00 GMT","")
 



More information about the cpif mailing list