@@ -64,31 +64,27 @@ def uptake(request):
64
64
return xml .error ('product and/or os are required GET parameters.' ,
65
65
errno = 101 )
66
66
67
+ product_names = None
67
68
if product :
68
69
if fuzzy :
69
70
products = Product .objects .filter (name__icontains = product )
70
71
else :
71
72
products = Product .objects .filter (name__exact = product )
72
- pids = [p .id for p in products ]
73
- if not pids :
73
+ product_names = [p .name for p in products ]
74
+ if not product_names :
74
75
return xml .error ('No products found' , errno = 102 )
75
- else :
76
- pids = None
77
76
77
+ os_names = None
78
78
if os :
79
79
if fuzzy :
80
80
oses = OS .objects .filter (name__icontains = os )
81
81
else :
82
82
oses = OS .objects .filter (name__exact = os )
83
- osids = [o .id for o in oses ]
84
- if not osids :
83
+ os_names = [o .name for o in oses ]
84
+ if not os_names :
85
85
return xml .error ('No OSes found' , errno = 102 )
86
- else :
87
- osids = None
88
-
89
- uptake = Location .get_mirror_uptake (products = pids , oses = osids )
90
86
91
- xml .prepare_uptake ( uptake )
87
+ xml .prepare_uptake_fake ( products = product_names , oses = os_names )
92
88
return xml .render ()
93
89
94
90
@@ -504,6 +500,32 @@ def prepare_locations(self, product, locations):
504
500
locnode .appendChild (self .doc .createTextNode (location .path ))
505
501
prodnode .appendChild (locnode )
506
502
503
+ def prepare_uptake_fake (self , products , oses ):
504
+ root = self .doc .createElement ('mirror_uptake' )
505
+ self .doc .appendChild (root )
506
+
507
+ for product in products :
508
+ for os_name in oses :
509
+ item = self .doc .createElement ('item' )
510
+
511
+ elem = self .doc .createElement ('product' )
512
+ elem .appendChild (self .doc .createTextNode (str (product )))
513
+ item .appendChild (elem )
514
+
515
+ elem = self .doc .createElement ('os' )
516
+ elem .appendChild (self .doc .createTextNode (str (os_name )))
517
+ item .appendChild (elem )
518
+
519
+ elem = self .doc .createElement ('available' )
520
+ elem .appendChild (self .doc .createTextNode (str (2000000 )))
521
+ item .appendChild (elem )
522
+
523
+ elem = self .doc .createElement ('total' )
524
+ elem .appendChild (self .doc .createTextNode (str (2000000 )))
525
+ item .appendChild (elem )
526
+
527
+ root .appendChild (item )
528
+
507
529
def prepare_uptake (self , uptake ):
508
530
"""Product uptake"""
509
531
content_map = {'product' : 'location__product__name' ,
0 commit comments