Community
This page, updated every hour, aggregates blog entries by people who are
writing about Django.
Posted on August 28, 2008 at 1:42 AM by Alberto García Hierro
Simon has recently featured this snippet which shrinks a SHA1 hash from 40 to 27 characters using base65 encoding. I've been using another approach for some time and, modestly, I think mine is better, so let me tell you how I do it before you start using the suboptimal approach. Python does it for us First, the base64 module already provides a pair of functions, aptly named urlsafe_b64encode and urlsafe_b64decode, which do quasi-safe url encoding using base64. For example: >>> base64.urlsafe_b64encode(sha1('foobar').digest()) 'iEPX-SQWIR3p67lj_0zigSWTKHg=' The problem here is the equal sign, since we can't put it safely in a URL. However, since we are using this to store a hash and we're going to generate the hash again when we verify the data, we can encode the hash again instead of decoding the base64-encoded string, which lets us safely remove the equal sign. Furthermore, we are also using 27 characters, the same as the other more complex implementation. Can we decode it? Sure! Sometimes, you'll want to decode the base64 encoded data. However, once we remove the equal sign, we can't no longer pass the base64 encoded string to urlsafe_b64decode: >>> base64.urlsafe_b64decode('iEPX-SQWIR3p67lj_0zigSWTKHg') Traceback (most recent call last): File "<stdin>", line 1, in ...
Read this post in context »
Posted on August 28, 2008 at 12:20 AM by Alberto García Hierro
I think there are lots of people which misunterstand the Affero GPL v3, so I decided to write this entry to clarify some things. Keep in mind I'm not a lawyer, so you should read my advice with a grain of salt. I've been using free software licenses for some years and I always take the time to read and understand them, but that doesn't mean I cannot make mistakes or misunderstand some sections. You can Sell commercial software under an AGPLv3 license: Nobody prevents you from selling AGPLv3 licensed code, even when you didn't write it. However, customers buying the software from you must abide by the license terms. Paying for an AGPLv3 product doesn't mean you can avoid the license terms. However, if you're the copyright owner, you can sell the same software under a different license. Build another software on top of it: AGPLv3 grants you permission to download and modify any software which you can use, even if it's over a network (this an importante difference with the GPLv3). You're free to modify it or use it into another project, making your project a derivative work of the original software. Link to or use BSD ...
Read this post in context »
Posted on August 27, 2008 at 11:18 PM by Simon Willison
Django snippets: Sign a string using SHA1, then shrink it using url-safe base65. I needed a way to create tamper-proof URLs and cookies by signing them, but didn’t want the overhead of a full 40 character SHA1 hash. After some experimentation, it turns out you can knock a 40 char hash down to 27 characters by encoding it using a custom base65 encoding which only uses URL-safe characters.
Read this post in context »
Posted on August 27, 2008 at 11:05 PM by Alberto García Hierro
This entry puts and end to "Building a website API with Django". I think I've covered everything you need to build a website API with Wapi, so it's now time for you to start playing with it. I hope you've enjoyed reading this series as much as I enjoyed writing it. I've finally pylinted and documented almost all the code, so Wapi 0.2 should be released in the next few hours. From now, I'll try to keep the current API and every backwards incompatible change will be documented. Documenting your API with Wapi Documenting your functions As we've seen on part 4 on this series, every API parameter takes an optional third argument which documents it. In addition, every function docstring is also passed to the documentation template. Furthermore, validators applied to parameters are also autodocumented. Let's see an example: @readonly @required_parameter('type', int, _('Admin division type, ranging from 1 to 4.'), validators=RangeValidator(min_value=1, max_value=4)) @required_parameter('id', int, _('The administrative division id.')) def geo__admin(self, request, dct): """Returns information for the given administrative division type and id. Keep in mind that administrative divisions identificators are not guaranteed to be permanent, as it happens with geoname identifiers.""" If you want to check how it looks ...
Read this post in context »
Posted on August 27, 2008 at 3:41 PM by Simon Willison
Django 1.0 beta 2 released!. 1.0 draws ever closer. Important new features include major documentation and comment system refactorings, plus the removal of a bunch of deprecated code (including oldforms). Feature and string freezes are now in place, so it’s just bugs and documentation improvements between now and the final release.
Read this post in context »
Posted on August 27, 2008 at 1:07 PM by Simon Willison
Django 1.0 release party. The big ass-party will be at the Tied House in Mountain View on Saturday the 6th from 7pm. RSVP on the linked announcement.
Read this post in context »
Posted on August 27, 2008 at 8:18 AM by Eric Holscher
Setting up Django and mod_wsgi
Read this post in context »
Posted on August 27, 2008 at 8:18 AM by Eric Holscher
DjangoCon 2008
Read this post in context »
Posted on August 27, 2008 at 8:18 AM by Eric Holscher
DjangoCon September 6-7, at Google!
Read this post in context »
Posted on August 26, 2008 at 1:59 PM by Guilherme Mesquita Gondim
Boa notícia para os desenvolvedores Django! Ontem foi feita a refatoração da aplicação bult-in comments do Django (changeset 8557). Dentre as mudanças, as que mais gostei são: Aquela idéia de FreeComment foi abandonada: agora existe somente um model Comment; foi adicionado os campos email e URL; e agora é documentado! Detalhes de como atualizar seu código para o novo comments em http://docs.djangoproject.com/en/dev/ref/contrib/comments/upgrade/. Se ainda não gosta desta aplicação, existe uma alternativa com suporte a threads: é o django-threadedcomments. Comentários | Link permanente Etiquetas: apps, comments, django © Guilherme M. Gondim, 2008. Termos de Uso
Read this post in context »
Posted on August 26, 2008 at 9:58 AM by Jannis Leidel
Just a short message concerning the Google Summer of Code.
Read this post in context »
Posted on August 26, 2008 at 5:22 AM by Michael Trier
This Week in Django 35 has been posted. Don’t miss it. We catch up with Robert Lofthouse, Chairman of DjangoCon and EuroDjangoCon.
Read this post in context »
Posted on August 26, 2008 at 4:25 AM by Patrick Altman
I have started a new app over on github called django-aws. It’s pretty bare bones right now but wanted to announce it earlier rather than later as I am hoping to: Get some folks who might be interested to help me out. Get some eyeballs on it for recommendations for how to (or how to not) [...]
Read this post in context »
Posted on August 25, 2008 at 10:43 PM by This Week in Django
Big News (0:42) TWiD Updates TWiD Shirts Available – check them out, let us know what you think. We’ll have a supply of them at DjangoCon. We have feeds on the site now and it has been submitted to the Django Community Aggregator. SXSW Podcast Panel – We’re hoping to do a podcast showdown at SXSW. Please vote for our panel to make it all possible. Panel will feature podcasters that will each do a lightning talk revealing how they produce, publicize, and publish their podcasts. We’ll also find out what podcasts they admire and what advice they would pass on to fellow podcasters. Final DjangoCon Slot Filled by TWiD Live – We’re very excited to be able to do the show live at DjangoCon. Documentation Refactor (8506) – With Changeset 8506 Django documentation has been refactored and is now using the excellent Sphinx – Python documentation generator. This is the same package used to generate the new Python documentation New Documentation Site Georg Brandl Receives PSF Community Award – for his excellent work on Sphinx and the new Python documentation. Interview – Robert Lofthouse talks about DjangoCon (7:47) Robert Lofthouse is the Technical Director and co-founder of Siu Design, ...
Read this post in context »
Posted on August 25, 2008 at 10:38 PM by Scott Barnham
For a while I’ve been using the CustomImageField as a way to specify an upload path for images. It’s a hack that lets you use ids or slugs from your models in the upload path, e.g.: /path/to/media/photos/1234/flowers.jpg or /path/to/media/photos/scotland-trip/castle.jpg CustomImageField no more Since the FileStorageRefactor was merged in to trunk r8244, it’s no longer necessary to use the custom [...]
Read this post in context »