import settings
import wiring 

#Constructs the "POST" URL
#First category of publish. Caling it first category because for publishing photos or more complex stuffs,
#might have to code another publish method. The function is used by the publish method 

def publish_cat1(method, con, token, cat, kwargs):
        req_str="/"+str( kwargs['id'] )+"/"+cat+'?'   	        #/id/category?
        del kwargs['id']
 	kwargs['access_token']=token 				#add access token tokwwargs
        res=wiring.send_request(method, con, req_str, kwargs)    
	return res


#Constructs the "GET" and "DELETE" URL
#First Category of get method. Again calling it first category because more complex methods maybe added later
#The functions is used by both the get_object and delete method 

def get_object_cat1(con, token, cat, kwargs):
	req_str="/"+kwargs['id']+"?"               #/{id}?
	req_str+="access_token="+token             #/{id}?@acces_token=......
	del kwargs['id']
	
	key=settings.get_object_cat1_param[cat]    #get the param name for the category(fields, ids)
	req_str+="&"+key+"="                       #/{id}?@acces_token=......{key}=
	if key in kwargs.keys():
		length=len( kwargs[key] )
		for i in range(length):
			if i==0:
				req_str+=kwargs[key][i]
			else:
				req_str+=","+kwargs[key][i]	
	else:
		return "Parameter Error"
	
	res=wiring.send_request("GET", con, req_str, '')
	return res

@@ -25,16 +25,17 @@
 iring %0A%0A
+%0A
 #Constru
@@ -38,19 +38,17 @@
 structs 
-the
+a
  %22POST%22 
@@ -54,35 +54,97 @@
  URL
-%0A#First category of publish
+. The function is used by the publish method %0A#First category of  %22POST%22 url construction
 . Ca
@@ -178,16 +178,18 @@
 use for 
+%0A#
 publishi
@@ -225,97 +225,67 @@
 ffs,
-%0A#might have to code another publish method. The function is used by the publish method %0A
+ newer fucntions may have to be added to deal with %22POST%22. 
 %0Adef
@@ -578,16 +578,17 @@
 n res%0A%0A%0A
+%0A
 #Constru
@@ -621,38 +621,127 @@
  URL
-%0A#First Category of get method
+. The functions is used by both the get_object and delete method %0A#First Category of %22GET and %22DELETE%22 URL construction
 . Ag
@@ -782,25 +782,26 @@
 use more
- 
+%0A#
 complex 
 methods 
@@ -796,99 +796,38 @@
 lex 
-methods maybe added later%0A#The functions is used by both the get_object and delete method %0A
+functions  maybe added later. 
 %0Adef
@@ -915,20 +915,18 @@
       #/
-%7B
 id
-%7D
 ?%0A%09req_s
@@ -957,36 +957,34 @@
 n             #/
-%7B
 id
-%7D
 ?@acces_token=..
@@ -1152,12 +1152,10 @@
   #/
-%7B
 id
-%7D
 ?@ac
@@ -1174,13 +1174,11 @@
 ....
-%7B
 key
-%7D
 =%0A%09i

version 0.2.0