|
5 | 5 | |
6 | 6 | :license: MIT, see LICENSE for more details. |
7 | 7 | """ |
8 | | -from SoftLayer.utils import NestedDict, query_filter, IdentifierMixin, lookup |
| 8 | +from SoftLayer.utils import NestedDict, query_filter, query_filter_date, IdentifierMixin, lookup |
9 | 9 | import SoftLayer |
10 | 10 | from calendar import monthrange |
11 | 11 | from datetime import datetime, date, timedelta |
@@ -41,7 +41,7 @@ def get_info(self): |
41 | 41 | return result |
42 | 42 |
|
43 | 43 |
|
44 | | - def list_resources(self, from_date=None, to_date=None, group_by=None, resource_status=None, **kwargs): |
| 44 | + def list_resources(self, from_date=None, to_date=None, **kwargs): |
45 | 45 | """ Retrieve a list of all ordered resources along with their costing. |
46 | 46 |
|
47 | 47 | :param dict \\*\\*kwargs: response-level option (limit) |
@@ -75,15 +75,15 @@ def list_resources(self, from_date=None, to_date=None, group_by=None, resource_s |
75 | 75 | _filter['orders']['userRecordId'] = query_filter(user['id']) |
76 | 76 | date_format = '%Y-%m-%d' |
77 | 77 |
|
78 | | - if from_date: |
79 | | - from_date_filter = from_date + '*' |
| 78 | + if from_date and to_date: |
| 79 | + filter['orders']['createDate'] = query_filter_date(from_date, to_date) |
| 80 | + elif from_date: |
| 81 | + from_date_filter = '>=' + ' ' + from_date |
80 | 82 | _filter['orders']['createDate'] = query_filter(from_date_filter) |
81 | | - if to_date: |
82 | | - to_date_filter = to_date + '*' |
| 83 | + elif to_date: |
| 84 | + to_date_filter = '<=' + ' ' + to_date |
83 | 85 | _filter['orders']['createDate'] = query_filter(to_date_filter) |
84 | | - if group_by: |
85 | | - group_by_filter = '*' + group_by |
86 | | - _filter['orders']['description'] = query_filter(group_by_filter) |
| 86 | + print _filter['orders']['createDate'] |
87 | 87 | orders = self.account.getOrders(filter=_filter.to_dict()) |
88 | 88 | total = 0.0 |
89 | 89 | result = [] |
|
0 commit comments