@@ -69,6 +69,13 @@ def __init__(self, client, db):
6969 self .client = client # it might be unnecessary to receive the client
7070 self .db = db
7171
72+ protocol = 'http'
73+ host = self .client .env ['HTTP_HOST' ]
74+ tracker = self .client .env ['TRACKER_NAME' ]
75+ self .base_path = '%s://%s/%s/rest/' % (protocol , host , tracker )
76+
77+ print self .base_path
78+
7279 def get_collection (self , class_name , input ):
7380 if not self .db .security .hasPermission ('View' , self .db .getuid (),
7481 class_name ):
@@ -197,6 +204,7 @@ def dispatch(self, method, uri, input):
197204 # PATH is split to multiple pieces
198205 # 0 - rest
199206 # 1 - resource
207+ # 2 - attribute
200208 resource_uri = uri .split ("/" )[1 ]
201209
202210 output = None
@@ -210,6 +218,8 @@ def dispatch(self, method, uri, input):
210218 class_name , item_id , input )
211219
212220 output = data_obj (output )
221+ except IndexError , msg :
222+ output = error_obj (404 , msg )
213223 except Unauthorised , msg :
214224 output = error_obj (403 , msg )
215225 except (hyperdb .DesignatorError , UsageError ), msg :
@@ -218,7 +228,7 @@ def dispatch(self, method, uri, input):
218228 output = error_obj (405 , 'Method Not Allowed' )
219229 except NotImplementedError :
220230 output = error_obj (402 , 'Method is under development' )
221- # nothing to pay, just mark that this is under development
231+ # nothing to pay, just a mark for debugging purpose
222232 except :
223233 # if self.DEBUG_MODE in roundup_server
224234 # else msg = 'An error occurred. Please check...',
0 commit comments