It's best to lose the weight prior to surgery to ensure more predictable and lasting results. Good nutrition is important for the healing process following surgery, but some calorie restriction is Ok as long as you maintain a balanced diet. It's best to consult a nutritionist to ensure the approprate regimen to obtain your weight loss goals without compromising your healing.
You should be eating a healthy diet after your surgery, including plenty of fruits and vegetables and restrict empty calories. That being said, you should not restrict your caloric intake by more than a maintance amount for the first month after surgery to assure wound healing. After approx 4 weeks, you can begin restricting calories for weight loss. Good luck!