I've added your proposal to this ticket:
http://trac.turbogears.org/turbogears/ticket/163
So we can keep track of this.
Ciao
Michele
Rune Hansen wrote:
> I'd like to include a new variable in stdvars -> hash_random
>
> Why, because of IE's caching of GET requests. This is particularly
> annoying when working with XMLHttpRequests.
>
> With a hash_random variable you can construct URLs with std.url like
> this:
> <a href="${std.url('/Edit',tg_format='json',rand=std.hash())}>LINK</a>
> (Yes, this can also be solved , rather awkwardly, with javascript)
>
> def hash_random(seed=None):
> _r = random.Random(seed)
> return md5.new(str(time.time()*_r.random())).hexdigest()
>
> I haven't given much thought on just how "random" this random
> generator is, but it should be more than good enough for this
> particular use.
>
> """
> view.py
>
> > import md5
> > import random
> 215a217,220
> >
> > def hash_random(seed=None):
> > _r = random.Random(seed)
> > return md5.new(str(_r.random())).hexdigest()
> 255c260,261
> < locale = get_locale())
> ---
> > locale = get_locale(),
> > hash=hash_random)
> """
>
> regards
> /rune
>
> ---------------------------------------------------------------------
> Behind the firewall, nobody can hear you scream...