If I understand your question correctly, it should be sufficient to project
w to the FunctionSpace
that v is in, or vice versa. See the small example below.
from dolfin import *
mesh1 = UnitSquareMesh(20, 20)
mesh2 = UnitSquareMesh(20, 20)
V1 = FunctionSpace(mesh1, "Lagrange", 1)
V2 = FunctionSpace(mesh2, "Lagrange", 1)
v = Function(V1)
w = Function(V2)
w = project(w, V1) # note this line, or it won't run
inner_product = assemble(v * w * dx)
print inner_product