Davide Muzzarelli

Two template filters for Django

I want to signal two new template filters for Django. Precise truncate words by chars It truncates the text when it exceeds a certain number of characters and deletes the last word. Adds ‘…’ at the end of the text, only if truncated. The difference between other similar filters is that this deletes the last [...]

Python client for the Nirvanix API

pubblicato it 29.07.2008 in # in english, * livello avanzato, python

I released a Python client for Nirvanix. The project page is: https://www.hosted-projects.com/trac/Design/pub/wiki/Nirvanapi It include the most important API calls, is light (one file and less of 400 lines of code) and have not dependences. The client support right now the following API calls: LoginLogoutCreateFoldersDeleteFoldersDeleteFilesCopyFilesCopyFoldersMoveFilesMoveFoldersRenameFileRenameFolderSideuploadListFolderCreateHostedItemExtractFrames The login is automatic also when the connection drop. List a [...]

Backpack Update – Aggiornamento per Backpack

pubblicato it 25.07.2007 in # in english, * livello intermedio, python

Since few hours Backpack has been updated and it is avaiable the new API that correct various problematic that plagued it. The Python client that I have wrote will be updated too and published soon. The new features will be: – multi list management; – all objects of the pages can now be ordered; – [...]

Backpack Client for Python

pubblicato it 24.07.2007 in # in english, * livello intermedio, python

A Backpack client API for Python will be released soon. Ready features: – API interface and object interface; – creation and updating of Backpack objects with a single save method; – objects avaiables: pages, notes, items, tags but also lists! – page linking; – page sending via email; – support for SSL (not tested). Next [...]

Preview di un testo con una sola riga di Python

pubblicato it 09.06.2007 in * livello avanzato, python, script completi

Nei siti web capita spesso di mostrare una preview di una news o di un articolo. Queste preview includono solo una parte del testo per poter elencare più articoli o news nella stessa pagina senza appesantire troppo la navigazione. A tal proposito ecco una funzione di una sola riga che prende un testo, lo accorcia [...]

Convertire l’HTML in HTML sicuro

pubblicato it 30.11.2006 in * livello avanzato, python, script completi

Scrivendo su di un blog tecnico capita spesso di aver codice da mostrare. In particolare, quando il suddetto codice proprio HTML bisogna provvedere a convertire alcuni caratteri perché altrimenti il browser, riconoscendolo, lo valuta. In python sono sufficienti pochi comandi per effettuare la conversione: # legge il file “from.txt” contenente il testo da convertiretext = [...]

Create an image model for your photos in Django with multiple categories

pubblicato it 18.07.2006 in # in english, * livello avanzato, django, python

I write this post because Django documentation is not exhaustive for the ImageField. Create an application in your project with: $ python manager.py startapp photos You can use what application name you like. Then create the directory “photos” in your media directory. Enter in the application directory and edit the models.py file: from django.db import [...]