[cpif] r376 - trunk/frontend-web

svn at argo.es svn at argo.es
Fri Sep 21 16:34:23 CEST 2007


Author: alvaro
Date: Fri Sep 21 16:34:23 2007
New Revision: 376

Log:
Aniadio el profile en el skin


Modified:
   trunk/frontend-web/skins.py
   trunk/frontend-web/url_perfil.py

Modified: trunk/frontend-web/skins.py
==============================================================================
--- trunk/frontend-web/skins.py	(original)
+++ trunk/frontend-web/skins.py	Fri Sep 21 16:34:23 2007
@@ -44,7 +44,8 @@
     'link_login':     'link_login.html',
     'form_login_err': 'form_login_err.html',
     'form_login':     'form_login.html',
-    'footer':         'footer.html'
+    'profile':        'profile.html',
+    'footer':         'footer.html',
     }
 
 urls = {
@@ -54,6 +55,7 @@
     '/nuevo_usuario':          ['new_user'],
     '/login_err':              ['login_err'],
     '/LOGIN':                  ['login'],
+    '/perfil':                 ['profile'],
     '/error':                  [],
     '/stop':                   [],
     '/nuevo_usuario_POST':     [],
@@ -323,6 +325,13 @@
           aux = available_skins[self._skin]['body_thread_ro'] 
       else:
         aux = available_skins[self._skin]['body_thread_anonymous']
+    elif "profile" in urls[self._url]:
+      self._dict["body"] = available_skins[self._skin]['profile']
+      if self._dict["avatar"]:
+        self._dict["profile avatar"] = available_skins[self._skin]['avatar'] % {"avatar": self._dict["avatar"], "author": self._dict["user"], "width": "", "height": ""} 
+      else:
+        self._dict["profile avatar"]=""
+      aux = available_skins[self._skin]['generic'] % self._dict 
     elif "login" in urls[self._url]:
       self._dict["body"] = available_skins[self._skin]['form_login']
       aux = available_skins[self._skin]['generic'] % self._dict 

Modified: trunk/frontend-web/url_perfil.py
==============================================================================
--- trunk/frontend-web/url_perfil.py	(original)
+++ trunk/frontend-web/url_perfil.py	Fri Sep 21 16:34:23 2007
@@ -26,37 +26,20 @@
   if not u :
     return None
 
-  texto=["<tr><td>Usuario:</td><td>%s%s</td></tr>" %(usuario_pedido, " <b><i>&iexcl;&iexcl;NO LOGIN!!</i></b>" if "no_login" in u else "")]
-  texto.append('<tr><td>Clave nueva:</td><td><input type="password" name="clave1" size="25" value="" /></td></tr>')
-  texto.append('<tr><td>Confirma clave nueva:</td><td><input type="password" name="clave2" size="25" value="" /></td></tr>')
-  a="(Se ha solicitado un cambio de direcci&oacute;n de correo electr&oacute;nico, y est&aacute; pendiente de confirmaci&oacute;n)" if "new email" in u else ""
-  texto.append('<tr><td>Correo electr&oacute;nico:</td><td>%s %s</td></tr>' %(u["email"],a))
-  texto.append('<tr><td>Nueva direcci&oacute;n de<br/>correo electr&oacute;nico:</td><td><input type="text" name="new_email" size=30 value="" /> </td></tr>')
+  import skins
+  pagina = skins.Skin(path,usuario)
+  advise = "(Se ha solicitado un cambio de direcci&oacute;n de correo electr&oacute;nico, y est&aacute; pendiente de confirmaci&oacute;n)" if "new email" in u else ""
   OpenIDs=list(u["OpenID"])+["","","","",""] # Padding
-  texto.append('<tr><td>Servidores OpenID:</td><td><input type="text" name="OpenID1" size=55 value="%s" /></td></tr>' %OpenIDs[0])
-  texto.append('<tr><td align=right>(opcionales)</td><td><input type="text" name="OpenID2" size=55 value="%s" /></td></tr>' %OpenIDs[1])
-  for i,j in zip([3,4,5],OpenIDs[2:]) :
-    texto.append('<tr><td>&nbsp;</td><td><input type="text" name="OpenID%d" size=55 value="%s" /></td></tr>' %(i,j))
-
-  texto.append('<tr><td>Nuevo avatar:</td><td><input type="file" name="avatar" size=45 value="" /></td></tr>')
-
-  avatar=u["avatar"]
-  if not avatar :
-    avatar=""
-  else :
-    size=database.get_static_metadata(conn,"avatars",avatar)["size"]
-    avatar='<img src="/static/avatars/%s" width="%d" height="%d" />' %(avatar,size[0],size[1])
-
-  return (200,{"Content-Type":"text/html; charset=utf-8"},"""
-<html>
-<head><title>Perfil - %s</title></head>
-<body>
-<form action="/perfil_POST/%s" method="post" enctype="multipart/form-data">
-<table>
-%s
-<tr><td colspan=2 align=right><input class="form-element" type="submit" name="submit" value="Cambia perfil"/></td></tr>
-</table>
-%s
-</body>
-</html>""" %(usuario_pedido,usuario_pedido,"\r\n".join(texto),avatar))
+  d = {
+          "page_title": "cpif - perfil %s" % usuario,
+          "profile user": "%s %s" % (usuario_pedido, "<b><i>&iexcl;&iexcl;NO LOGIN!!</i></b>" if "no_login" in u else ""),
+          "profile email": "%s %s" % (u["email"], advise),
+          "profile openid1": "%s" % OpenIDs[0],
+          "profile openid2": "%s" % OpenIDs[1],
+          "avatar": u["avatar"],
+    }
+  for i,j in zip([3,4,5],OpenIDs[2:]):
+    d["profile openid%d" % i] =  "%s" % j
+  pagina.load_dict(d)
 
+  return (pagina.web())



More information about the cpif mailing list