I think you'll want to keep the activity traces (Apre, Apost) unchanged from the example, and instead multiply the weight-dependent factor directly into the weight update, e.g. like so:
on_post = '''
Apost += dApost
w = clip(w + Apre * (1-w/gmax), 0, gmax)
'''
Like this, the activity trace remains a faithful representation of past spiking activity, and the weight dependence doesn't propagate through time. I'm fairly confident (though only by intuition, not by derivation; I'll leave that one up to you) that this makes the model equivalent to your formal description.
Hope that helps!