The functions that retrieves/stores the data should go in your models. Your controllers use these functions and manipulate the data, to save it will pass the data to a save model.
So gettime() would just call a function say getdata(). getdata() would httplib the external data and check it for errors, and maybe parse it into say a python dictionary for manipulation. Hope that helps. -Thadeus On Sat, Dec 5, 2009 at 10:02 AM, David <[email protected]> wrote: > Hey guys, > > I've been working on converting my PHP web service client for eBay to > web2py . I've got it successfully pulling the time from the eBay > servers using xml.dom.minidom and I am quite excited about this > because it's a lot easier to do so far. > > I am still a bit confused on the MVC way of doing things however. > Since the service is similar to a database in a remote location should > I be writing the service calls as part of the models or controllers? > > The way I am doing it now is all from the controller, then returning > the information to the views. I can see a way to separate it even > further but I want to make sure I am following the MVC style and not > allowing my bad PHP habits to follow me. > > Here's a small example of the controller as it is now without all the > code. > > def buildHeaders(): > setup http headers with credentials > return > > def buildConnectio(): > do httplib stuff > return > > def checkErrors() > parse returned data for errors > return > > def gettime(): > build the time requestXML, setup headers, open a connection, pull > data, check for errors and return results to view > return dict(time=time) > > > As you can see the only thing really applicable to this controller > will be "gettime". The first three functions will remain the same for > the most part and should actually be private methods. Thanks for any > light you can shed on this. > > - David > > > > > -- > > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

