ah, danke dir ! that's exactly what I was looking for
full encodings here: http://docs.python.org/library/codecs.html#standard-encodings actually I guess in this case I would have a series of numbers; [ content_type_id, object_id, index, width, height ] rather than a string. I can figure that out, or it would be simple enough to join them and do the pack. it won't be so long as the example I posted. FYI this would be for thumbnails : if the thumbnail exists the static server will serve it, else django will be triggered to build it. but I wouldn't want to open up the URL so that anybody could request say for i in range(0,10000): get image urls until my server gives up ... but I will design the paths so that it exposes the object ID like so: %(content_type_id)s_%(object_id)s_%(encoded)s.jpg so that I can easily delete all thumbs when the object is deleted currently I create thumbs on demand via template tags. this also leaves dead thumbs laying around. On Tue, Jan 27, 2009 at 5:43 PM, Puneet Madaan <puneetmad...@gmail.com>wrote: > I am assuming that you already have an idea of how your datastring will > look like, and what data it is containing... I am considering *"music > artist 32L 2L 100 100"* as input data > so here is a example... > > L1 = "music artist 32L 2L 100 100".encode("hex") >> L2 = zlib.compress(L1) >> L3 = L2.encode("hex") >> print L3 >> > > L3 can now be taken as URI referencing string.. which in this special case > is > > > '789c35c5c10d00200c02c095102aa4f3e8fe336862fcdc7967466e8bf00853ee28454862adfb7308c2ff00401d0b64' > > and reverse algo for this is also as easy > > >> D1=789c35c5c10d00200c02c095102aa4f3e8fe336862fcdc7967466e8bf00853ee28454862adfb7308c2ff00401d0b64'.decode("hex") >> D2 = zlib.decompress(D1) >> D3 = D2.decode("hex") >> > > you will get your "music artist 32L 2L 100 100" back > > And your URL will not send further a psuedo encoded number which is ugly > enough for non-developers :D > you are free to choose encoding, and can nest them in multiple algos to > make the thing more complex > > greetings, > Puneet > > > On Tue, Jan 27, 2009 at 4:48 PM, felix <crucialfe...@gmail.com> wrote: > >> >> there is some hashing function or combination of URL encoding that can do >> this : >> >> >> given some parameters : >> >> 'music' 'artist' 32L 2L 100 100 >> ( artist id 32, 2nd picture, dimensions 100 x 100 ) >> >> I wish to generate a fake filename eg: >> >> tartan_ba6e5e06e794f1368ed3ec20b4594eec.png >> >> and then be able to reverse that filename back into the original >> parameters when needed. >> >> so its either hashing, or compressing the string (to use the most of the >> allowable chars a-zA-Z0-9_ ) or something >> >> hints or pointers anyone ? >> thanks >> >> >> >> http://crucial-systems.com >> >> >> >> > > > -- > If you spin an oriental man, does he become disoriented? > (-: ¿ʇɥǝɹpɹǝʌ ɟdoʞ uǝp ɹıp ɥɔı ,qɐɥ 'ɐɐu > > is der net süß » ε(●̮̮̃•̃)з > -----PM > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---