3 artigo/s coa etiqueta Web2py


<type 'exceptions.AttributeError'>('Expression' object has no attribute 'listable')

Erro no web2py:

<type 'exceptions.AttributeError'>('Expression' object has no attribute 'listable')

O erro estaba nun campo count engadido á táboa.
sub_menus = db[t_menus].with_alias('menusoptions')
query = (db[t_menus].parent_id == (parent_id or (None or 0)))
count = sub_menus.id.count()
[...]
count.tablename = t_menus
count.readable = True
count.represent = False
count.listable = False
count.formatter = lambda value:value
count.label = T('Count')
count.table = db[t_menus]

A solución foi engadir a liña

count.listable = False

Erro ó xerar os RSS no web2py

Ó actualizar, non lembro desde que versión, ó xerar os RSS o meu código produce un erro, de momento para solucionalo consígoo mudando no ficheiro /gluon/serializes.py a liña:

return str(obj[key]).encode('utf-8', 'replace') if key in obj else default

por

return str(obj[key]).decode('utf-8', 'replace') if key in obj else default

Ver esta incidencia

Leverage browser caching with apache.

Deixo aquí esta nota para mellorar Leverage browser caching, isto ponse dentro das etiquetas:

<VirtualHost>
</VirtualHost>

#
# associate .js with "text/javascript" type (if not present in mime.conf)
#
AddType text/javascript .js

#
# configure mod_expires
#
# URL: http://httpd.apache.org/docs/2.2/mod/mod_expires.html
#
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 seconds"
    ExpiresByType image/x-icon "access plus 604800 seconds"
    ExpiresByType image/jpeg "access plus 604800 seconds"
    ExpiresByType image/png "access plus 604800 seconds"
    ExpiresByType image/gif "access plus 604800 seconds"
    ExpiresByType application/x-shockwave-flash "access plus 604800 seconds"
    ExpiresByType text/css "access plus 604800 seconds"
    ExpiresByType text/javascript "access plus 604800 seconds"
    ExpiresByType application/x-javascript "access plus 604800 seconds"
    ExpiresByType text/html "access plus 600 seconds"
    ExpiresByType application/xhtml+xml "access plus 600 seconds"
</IfModule>

#