quick command to apply a modifier

Hi all,
I am looking for a quick way to apply a given modifier in a script. I looked into the doc and forum topics and found the function modifiers_applyModifier() but not sure if it is the right thing to do. Currently I have a piece of code like the following:


from Blender import *
import bpy

sce = bpy.data.scenes.active
ob = sce.objects.active

me = ob.getData(mesh=1)
mods=ob.modifiers
mod=mods.append(Modifier.Type.DECIMATE)
mod[Modifier.Settings.RATIO]=0.5



and then I need to apply this modifier.
Any idea?

Cheers

me = ob.create_mesh(scene, True, "RENDER")

This line will return a mesh with all modifiers applied. It applies all modifiers, however…

The above is for 2.5 API.

Here is the 2.49 equivalent.


me.getFromObject(ob)        #Get the mesh with modifiers applied to the passed object.
me.transform(ob.matrix)     #Apply the current matrix for this frame to the mesh.

Thank you very much Atom.