diff --git a/orm/services/audit_trail_manager/audit_server/external_mock/__init__.py b/orm/services/audit_trail_manager/audit_server/external_mock/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/audit_trail_manager/audit_server/external_mock/orm_common/__init__.py b/orm/services/audit_trail_manager/audit_server/external_mock/orm_common/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/audit_trail_manager/audit_server/external_mock/orm_common/utils/__init__.py b/orm/services/audit_trail_manager/audit_server/external_mock/orm_common/utils/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/audit_trail_manager/audit_server/external_mock/orm_common/utils/utils.py b/orm/services/audit_trail_manager/audit_server/external_mock/orm_common/utils/utils.py deleted file mode 100755 index ba516a7a..00000000 --- a/orm/services/audit_trail_manager/audit_server/external_mock/orm_common/utils/utils.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Utils module mock.""" - - -def report_config(conf, dump=False): - """Mock report_config function.""" - - pass - - -def set_utils_conf(conf): - """Mock set_utils_conf function.""" - - pass diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/audit_client/__init__.py b/orm/services/customer_manager/cms_rest/extenal_mock/audit_client/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/audit_client/api/__init__.py b/orm/services/customer_manager/cms_rest/extenal_mock/audit_client/api/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/audit_client/api/audit.py b/orm/services/customer_manager/cms_rest/extenal_mock/audit_client/api/audit.py deleted file mode 100644 index ec483bdd..00000000 --- a/orm/services/customer_manager/cms_rest/extenal_mock/audit_client/api/audit.py +++ /dev/null @@ -1,6 +0,0 @@ -def audit(*args, **kwargs): - pass - - -def init(*args, **kwargs): - pass diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/keystone_utils/__init__.py b/orm/services/customer_manager/cms_rest/extenal_mock/keystone_utils/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/keystone_utils/tokens.py b/orm/services/customer_manager/cms_rest/extenal_mock/keystone_utils/tokens.py deleted file mode 100755 index 99708117..00000000 --- a/orm/services/customer_manager/cms_rest/extenal_mock/keystone_utils/tokens.py +++ /dev/null @@ -1,6 +0,0 @@ -def is_token_valid(token_to_validate, lcp_id, conf, token_role): - pass - - -def TokenConf(mech_id, mech_password, rms_url, tenant_name, keystone_version): - pass diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/__init__.py b/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/logger.py b/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/logger.py deleted file mode 100644 index 77f80741..00000000 --- a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/logger.py +++ /dev/null @@ -1,2 +0,0 @@ -def get_logger(*a, **k): - pass diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/policy/__init__.py b/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/policy/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/policy/policy.py b/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/policy/policy.py deleted file mode 100755 index 9d652b2b..00000000 --- a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/policy/policy.py +++ /dev/null @@ -1,6 +0,0 @@ -def init(*a, **kw): - pass - - -def enforce(*a, **kw): - pass diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils.py b/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils.py deleted file mode 100755 index c3591af4..00000000 --- a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils.py +++ /dev/null @@ -1,23 +0,0 @@ -class utils: - @staticmethod - def set_utils_conf(conf): - pass - - @staticmethod - def report_config(conf, dump_to_log): - pass - - @staticmethod - def create_existing_uuid(uuid): - pass - - -class api_error_utils: - - @staticmethod - def get_error(transaction_id, - error_details="", - message=None, - status_code=400): - - pass diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils/__init__.py b/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils/api_error_utils.py b/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils/api_error_utils.py deleted file mode 100755 index 2bd8d210..00000000 --- a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils/api_error_utils.py +++ /dev/null @@ -1,8 +0,0 @@ - - -def get_error(transaction_id, - error_details="", - message=None, - status_code=400): - - pass diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils/cross_api_utils.py b/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils/cross_api_utils.py deleted file mode 100755 index 6903ff1f..00000000 --- a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils/cross_api_utils.py +++ /dev/null @@ -1,6 +0,0 @@ -def get_regions_of_group(*a, **k): - pass - - -def set_utils_conf(*a, **k): - pass diff --git a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils/utils.py b/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils/utils.py deleted file mode 100755 index f4f21e5c..00000000 --- a/orm/services/customer_manager/cms_rest/extenal_mock/orm_common/utils/utils.py +++ /dev/null @@ -1,10 +0,0 @@ -def set_utils_conf(conf): - pass - - -def report_config(conf, dump_to_log): - pass - - -def create_existing_uuid(uuid): - pass diff --git a/orm/services/customer_manager/htmlcov/cms_rest___init___py.html b/orm/services/customer_manager/htmlcov/cms_rest___init___py.html deleted file mode 100644 index c68bcbc0..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_app_py.html b/orm/services/customer_manager/htmlcov/cms_rest_app_py.html deleted file mode 100644 index fe68435b..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_app_py.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/app.py: 83% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

- -
-

from pecan import make_app 

-

from cms_rest import model 

-

from orm_common.utils import utils 

-

from cms_rest.logger import get_logger 

-

from pecan.commands import CommandRunner 

-

from orm_common.policy import policy 

-

from cms_rest.utils import authentication 

-

 

-

logger = get_logger(__name__) 

-

 

-

 

-

def setup_app(config): 

-

model.init_model() 

-

token_conf = authentication._get_token_conf(config) 

-

policy.init(config.authentication.policy_file, token_conf) 

-

app_conf = dict(config.app) 

-

 

-

# setting configurations for utils to be used from now and on 

-

utils.set_utils_conf(config) 

-

 

-

app = make_app( 

-

app_conf.pop('root'), 

-

logging=getattr(config, 'logging', {}), 

-

**app_conf 

-

) 

-

logger.info('Starting CMS...') 

-

return app 

-

 

-

 

-

def main(): 

-

runner = CommandRunner() 

-

runner.run(['serve', '../config.py']) 

-

 

-

34 ↛ 35line 34 didn't jump to line 35, because the condition on line 34 was never trueif __name__ == "__main__": 

-

main() 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers___init___py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers___init___py.html deleted file mode 100644 index aabf50d6..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_root_py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_root_py.html deleted file mode 100644 index 67d2afa9..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_root_py.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/root.py: 90% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

- -
-

from pecan import expose, request, response 

-

from webob.exc import status_map 

-

from pecan.secure import SecureController 

-

from cms_rest.controllers.v1 import root as v1 

-

from cms_rest.utils import authentication 

-

from pecan import conf 

-

 

-

 

-

class RootController(object): 

-

# url/v1/ 

-

v1 = v1.V1Controller() 

-

 

-

@expose(template='json') 

-

def _default(self): 

-

""" 

-

Method to handle GET / 

-

parameters: None 

-

return: dict describing cms rest version information 

-

""" 

-

return { 

-

"versions": { 

-

"values": [ 

-

{ 

-

"status": "stable", 

-

"id": "v1", 

-

"links": [ 

-

{ 

-

"href": "http://localhost:7080/" 

-

} 

-

] 

-

} 

-

] 

-

} 

-

} 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1___init___py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1___init___py.html deleted file mode 100644 index 3f476b00..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/v1/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_base_py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_base_py.html deleted file mode 100644 index 4a02153d..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_base_py.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/v1/base.py: 75% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

- -
-

import wsme 

-

from pecan import response 

-

from wsme import types as wtypes 

-

import inspect 

-

 

-

 

-

class ClientSideError(wsme.exc.ClientSideError): 

-

def __init__(self, error, status_code=400): 

-

response.translatable_error = error 

-

super(ClientSideError, self).__init__(error, status_code) 

-

 

-

 

-

class InputValueError(ClientSideError): 

-

def __init__(self, name, value, status_code=400): 

-

super(InputValueError, self).__init__("Invalid value for input {} : {}".format(name, value), status_code) 

-

 

-

 

-

class EntityNotFoundError(ClientSideError): 

-

def __init__(self, id): 

-

super(EntityNotFoundError, self).__init__("Entity not found for {}".format(id), status_code=404) 

-

 

-

 

-

class Base(wtypes.DynamicBase): 

-

pass 

-

 

-

''' 

-

@classmethod 

-

def from_model(cls, m): 

-

return cls(**(m.as_dict())) 

-

 

-

def as_dict(self, model): 

-

valid_keys = inspect.getargspec(model.__init__)[0] 

-

if 'self' in valid_keys: 

-

valid_keys.remove('self') 

-

return self.as_dict_from_keys(valid_keys) 

-

 

-

 

-

def as_dict_from_keys(self, keys): 

-

return dict((k, getattr(self, k)) 

-

for k in keys 

-

if hasattr(self, k) and 

-

getattr(self, k) != wsme.Unset) 

-

 

-

@classmethod 

-

def from_db_and_links(cls, m, links): 

-

return cls(links=links, **(m.as_dict())) 

-

 

-

''' 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm___init___py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm___init___py.html deleted file mode 100644 index 6a9316ac..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/v1/orm/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_configuration_py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_configuration_py.html deleted file mode 100644 index e4905b32..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_configuration_py.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/v1/orm/configuration.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

- -
-

"""Configuration rest API input module.""" 

-

 

-

import logging 

-

from orm_common.utils import utils 

-

from pecan import conf 

-

from pecan import rest 

-

from wsmeext.pecan import wsexpose 

-

 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class ConfigurationController(rest.RestController): 

-

"""Configuration controller.""" 

-

 

-

@wsexpose(str, str, status_code=200) 

-

def get(self, dump_to_log='false'): 

-

"""get method. 

-

 

-

:param dump_to_log: A boolean string that says whether the 

-

configuration should be written to log 

-

:return: A pretty string that contains the service's configuration 

-

""" 

-

logger.info("Get configuration...") 

-

 

-

dump = dump_to_log.lower() == 'true' 

-

utils.set_utils_conf(conf) 

-

result = utils.report_config(conf, dump, logger) 

-

return result 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer___init___py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer___init___py.html deleted file mode 100644 index f562f282..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/v1/orm/customer/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_enabled_py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_enabled_py.html deleted file mode 100644 index bc48ca15..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_enabled_py.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/v1/orm/customer/enabled.py: 91% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

- -
-

from pecan import rest, request 

-

from wsmeext.pecan import wsexpose 

-

 

-

from orm_common.utils import utils 

-

from orm_common.utils import api_error_utils as err_utils 

-

from cms_rest.model.Models import Enabled, CustomerResultWrapper 

-

from cms_rest.logic.customer_logic import CustomerLogic 

-

from cms_rest.logic.error_base import ErrorStatus 

-

from cms_rest.utils import authentication 

-

 

-

from cms_rest.logger import get_logger 

-

LOG = get_logger(__name__) 

-

 

-

 

-

class EnabledController(rest.RestController): 

-

@wsexpose(CustomerResultWrapper, str, body=Enabled, rest_content_types='json') 

-

def put(self, customer_uuid, enable): 

-

authentication.authorize(request, 'customers:enable') 

-

try: 

-

LOG.info("EnabledController - (put) customer id {0} enable: {1}".format(customer_uuid, enable)) 

-

customer_logic = CustomerLogic() 

-

result = customer_logic.enable(customer_uuid, enable, request.transaction_id) 

-

LOG.info("EnabledController - change enable (put) finished well: " + str(result)) 

-

 

-

event_details = 'Customer {} {}'.format(customer_uuid, 

-

'enabled' if enable.enabled else 'disabled') 

-

utils.audit_trail('Change enable', request.transaction_id, 

-

request.headers, customer_uuid, 

-

event_details=event_details) 

-

 

-

except ErrorStatus as exception: 

-

LOG.log_exception("EnabledController - Failed to Change enable", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=exception.status_code) 

-

 

-

except Exception as exception: 

-

LOG.log_exception("EnabledController - change enable (put) - Failed to Change enable", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=str(exception)) 

-

 

-

return result 

-

 

-

@wsexpose(None, str, rest_content_types='json') 

-

def post(self, customer_id): 

-

raise err_utils.get_error(request.transaction_id, status_code=405) 

-

 

-

@wsexpose(None, str, rest_content_types='json') 

-

def get(self, customer_id): 

-

raise err_utils.get_error(request.transaction_id, status_code=405) 

-

 

-

@wsexpose(None, str, rest_content_types='json') 

-

def delete(self, customer_id): 

-

raise err_utils.get_error(request.transaction_id, status_code=405) 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_metadata_py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_metadata_py.html deleted file mode 100644 index a9b7212b..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_metadata_py.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/v1/orm/customer/metadata.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

- -
-

from pecan import rest, request 

-

from wsmeext.pecan import wsexpose 

-

from cms_rest.model.Models import CustomerResultWrapper 

-

from orm_common.utils import utils 

-

from orm_common.utils import api_error_utils as err_utils 

-

 

-

from cms_rest.logic.error_base import ErrorStatus 

-

from cms_rest.model.Models import MetadataWrapper 

-

import cms_rest.logic.metadata_logic as logic 

-

from cms_rest.utils import authentication 

-

 

-

from cms_rest.logger import get_logger 

-

LOG = get_logger(__name__) 

-

 

-

 

-

class MetadataController(rest.RestController): 

-

@wsexpose(CustomerResultWrapper, str, body=MetadataWrapper, rest_content_types='json') 

-

def post(self, customer_uuid, metadata): 

-

authentication.authorize(request, 'customers:add_metadata') 

-

try: 

-

res = logic.add_customer_metadata(customer_uuid, metadata, request.transaction_id) 

-

 

-

event_details = 'Customer {} metadata added'.format(customer_uuid) 

-

utils.audit_trail('add customer metadata', request.transaction_id, 

-

request.headers, customer_uuid, 

-

event_details=event_details) 

-

return res 

-

except AttributeError as ex: 

-

raise err_utils.get_error(request.transaction_id, 

-

message=ex.message, status_code=409) 

-

except ValueError as ex: 

-

raise err_utils.get_error(request.transaction_id, 

-

message=ex.message, status_code=404) 

-

except ErrorStatus as ex: 

-

LOG.log_exception("MetaDataController - Failed to add metadata", ex) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=ex.status_code) 

-

except LookupError as ex: 

-

LOG.log_exception("MetaDataController - {0}".format(ex.message), ex) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=ex.message, status_code=400) 

-

except Exception as ex: 

-

LOG.log_exception("MetaDataController - Failed to add metadata", ex) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, error_details=str(ex)) 

-

 

-

@wsexpose(CustomerResultWrapper, str, body=MetadataWrapper, rest_content_types='json') 

-

def put(self, customer_uuid, metadata): 

-

authentication.authorize(request, 'customers:update_metadata') 

-

try: 

-

res = logic.update_customer_metadata(customer_uuid, metadata, request.transaction_id) 

-

 

-

event_details = 'Customer {} metadata updated'.format(customer_uuid) 

-

utils.audit_trail('update customer metadata', 

-

request.transaction_id, request.headers, 

-

customer_uuid, event_details=event_details) 

-

return res 

-

except AttributeError as ex: 

-

raise err_utils.get_error(request.transaction_id, 

-

message=ex.message, status_code=400) 

-

except ValueError as ex: 

-

raise err_utils.get_error(request.transaction_id, 

-

message=ex.message, status_code=404) 

-

except ErrorStatus as ex: 

-

LOG.log_exception("MetaDataController - Failed to add metadata", ex) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=ex.status_code) 

-

except LookupError as ex: 

-

LOG.log_exception("MetaDataController - {0}".format(ex.message), ex) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=ex.message, status_code=400) 

-

except Exception as ex: 

-

LOG.log_exception("MetaDataController - Failed to add metadata", ex) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, error_details=str(ex)) 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_regions_py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_regions_py.html deleted file mode 100644 index 0be6fee3..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_regions_py.html +++ /dev/null @@ -1,357 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/v1/orm/customer/regions.py: 94% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

- -
-

from oslo_db.exception import DBDuplicateEntry 

-

from pecan import rest, request 

-

from wsmeext.pecan import wsexpose 

-

 

-

from orm_common.utils import utils 

-

from orm_common.utils import api_error_utils as err_utils 

-

 

-

from cms_rest.controllers.v1.orm.customer.users import UserController 

-

from cms_rest.model.Models import Region, RegionResultWrapper 

-

from cms_rest.logic.customer_logic import CustomerLogic 

-

from cms_rest.logic.error_base import ErrorStatus, DuplicateEntryError 

-

from cms_rest.utils import authentication 

-

 

-

from cms_rest.logger import get_logger 

-

LOG = get_logger(__name__) 

-

 

-

 

-

class RegionController(rest.RestController): 

-

 

-

users = UserController() 

-

 

-

@wsexpose([str], str, str, rest_content_types='json') 

-

def get(self, customer_id, region_id): 

-

return ["This is the regions controller ", "customer id: " + customer_id] 

-

 

-

@wsexpose(RegionResultWrapper, str, body=[Region], rest_content_types='json', status_code=200) 

-

def post(self, customer_id, regions): 

-

LOG.info("RegionController - Add Regions (post) customer id {0} regions: {1}".format(customer_id, str(regions))) 

-

authentication.authorize(request, 'customers:add_region') 

-

try: 

-

customer_logic = CustomerLogic() 

-

result = customer_logic.add_regions(customer_id, regions, request.transaction_id) 

-

LOG.info("RegionController - Add Regions (post) finished well: " + str(result)) 

-

 

-

event_details = 'Customer {} regions: {} added'.format( 

-

customer_id, [r.name for r in regions]) 

-

utils.audit_trail('add regions', request.transaction_id, 

-

request.headers, customer_id, 

-

event_details=event_details) 

-

 

-

41 ↛ 42line 41 didn't jump to line 42, because the exception caught by line 41 didn't happen except DBDuplicateEntry as exception: 

-

LOG.log_exception("RegionController - Add Regions (post) - region already exists", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=409, 

-

message='Region already exists', 

-

error_details=exception.message) 

-

 

-

except ErrorStatus as exception: 

-

LOG.log_exception("CustomerController - Failed to update regions", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=exception.status_code) 

-

 

-

except Exception as exception: 

-

LOG.log_exception("RegionController - Add Regions (post) - Failed to update regions", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=str(exception)) 

-

 

-

return result 

-

 

-

@wsexpose(RegionResultWrapper, str, body=[Region], rest_content_types='json', status_code=200) 

-

def put(self, customer_id, regions): 

-

LOG.info("RegionController - Replace Regions (put) customer id {0} regions: {1}".format(customer_id, str(regions))) 

-

authentication.authorize(request, 'customers:update_region') 

-

self.validate_put_url() 

-

try: 

-

customer_logic = CustomerLogic() 

-

result = customer_logic.replace_regions(customer_id, regions, request.transaction_id) 

-

LOG.info("RegionController - Replace Regions (put) finished well: " + str(result)) 

-

 

-

event_details = 'Customer {} regions: {} updated'.format( 

-

customer_id, [r.name for r in regions]) 

-

utils.audit_trail('Replace regions', request.transaction_id, 

-

request.headers, customer_id, 

-

event_details=event_details) 

-

 

-

except ErrorStatus as exception: 

-

LOG.log_exception("CustomerController - Failed to Replace regions", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=exception.status_code) 

-

 

-

except Exception as exception: 

-

LOG.log_exception("RegionController - Replace Regions (put) - Failed to replace regions", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=str(exception)) 

-

 

-

return result 

-

 

-

@wsexpose(None, str, str, status_code=204) 

-

def delete(self, customer_id, region_id): 

-

LOG.info("RegionController - Delete Region (delete) customer id {0} region_id: {1}".format(customer_id, region_id)) 

-

authentication.authorize(request, 'customers:delete_region') 

-

try: 

-

customer_logic = CustomerLogic() 

-

customer_logic.delete_region(customer_id, region_id, request.transaction_id) 

-

LOG.info("RegionController - Delete Region (delete) finished well") 

-

 

-

event_details = 'Customer {} region: {} deleted'.format( 

-

customer_id, region_id) 

-

utils.audit_trail('delete region', request.transaction_id, 

-

request.headers, customer_id, 

-

event_details=event_details) 

-

 

-

107 ↛ 108line 107 didn't jump to line 108, because the exception caught by line 107 didn't happen except ValueError as exception: 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=404) 

-

except ErrorStatus as exception: 

-

LOG.log_exception("CustomerController - Failed to delete region", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=exception.status_code) 

-

 

-

except Exception as exception: 

-

LOG.log_exception("RegionController - Failed in delete Region", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=str(exception)) 

-

 

-

@staticmethod 

-

def validate_put_url(): 

-

url_elements = request.path.split('/') 

-

last_index = -2 if url_elements[-1] == '' else -1 

-

# If there's an element after 'regions', it is a region ID 

-

# which is currently unsupported 

-

if url_elements[last_index - 1] == 'regions': 

-

LOG.debug('Method not allowed for a specific region in Request: {}'.format(request.path)) 

-

raise err_utils.get_error(request.transaction_id, 

-

message='Method not allowed for a specific region', 

-

status_code=405) 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_root_py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_root_py.html deleted file mode 100644 index ed5e7db5..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_root_py.html +++ /dev/null @@ -1,459 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/v1/orm/customer/root.py: 97% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

- -
-

from pecan import rest, request, response 

-

import oslo_db 

-

from wsmeext.pecan import wsexpose 

-

 

-

from cms_rest.model.Models import Customer, CustomerResultWrapper, CustomerSummaryResponse 

-

from cms_rest.controllers.v1.orm.customer.users import DefaultUserController 

-

from cms_rest.controllers.v1.orm.customer.regions import RegionController 

-

from cms_rest.controllers.v1.orm.customer.metadata import MetadataController 

-

from cms_rest.controllers.v1.orm.customer.enabled import EnabledController 

-

from cms_rest.logic.customer_logic import CustomerLogic 

-

 

-

from cms_rest.logic.error_base import ErrorStatus 

-

from orm_common.utils import utils 

-

from orm_common.utils import api_error_utils as err_utils 

-

from cms_rest.utils import authentication 

-

 

-

from cms_rest.logger import get_logger 

-

 

-

LOG = get_logger(__name__) 

-

 

-

 

-

class CustomerController(rest.RestController): 

-

regions = RegionController() 

-

users = DefaultUserController() 

-

metadata = MetadataController() 

-

enabled = EnabledController() 

-

 

-

@wsexpose(Customer, str, rest_content_types='json') 

-

def get(self, customer_uuid): 

-

LOG.info("CustomerController - GetCustomerDetails: uuid is " + customer_uuid) 

-

authentication.authorize(request, 'customers:get_one') 

-

try: 

-

customer_logic = CustomerLogic() 

-

result = customer_logic.get_customer(customer_uuid) 

-

LOG.info("CustomerController - GetCustomerDetails finished well: " + str(result)) 

-

 

-

except ErrorStatus as exception: 

-

LOG.log_exception("CustomerController - Failed to GetCustomerDetails", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=exception.status_code) 

-

 

-

except Exception as exception: 

-

LOG.log_exception("CustomerController - Failed to GetCustomerDetails", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

return result 

-

 

-

@wsexpose(CustomerResultWrapper, body=Customer, rest_content_types='json', status_code=201) 

-

def post(self, customer): 

-

LOG.info("CustomerController - CreateCustomer: " + str(customer)) 

-

authentication.authorize(request, 'customers:create') 

-

try: 

-

uuid = None 

-

if not customer.custId: 

-

uuid = utils.make_uuid() 

-

else: 

-

60 ↛ 61line 60 didn't jump to line 61, because the condition on line 60 was never true if not CustomerController.validate_cust_id(customer.custId): 

-

utils.audit_trail('create customer', request.transaction_id, request.headers, customer.custId) 

-

raise ErrorStatus('400', None) 

-

try: 

-

uuid = utils.create_existing_uuid(customer.custId) 

-

except TypeError: 

-

raise ErrorStatus(409.1, 'Customer ID {0} already exists'.format(customer.custId)) 

-

 

-

customer_logic = CustomerLogic() 

-

try: 

-

result = customer_logic.create_customer(customer, uuid, request.transaction_id) 

-

except oslo_db.exception.DBDuplicateEntry as exception: 

-

raise ErrorStatus(409.2, 'Customer field {0} already exists'.format(exception.columns)) 

-

 

-

LOG.info("CustomerController - Customer Created: " + str(result)) 

-

event_details = 'Customer {} {} created in regions: {}, with users: {}'.format( 

-

uuid, customer.name, [r.name for r in customer.regions], 

-

[u.id for u in customer.users]) 

-

utils.audit_trail('create customer', request.transaction_id, 

-

request.headers, uuid, 

-

event_details=event_details) 

-

return result 

-

 

-

except ErrorStatus as exception: 

-

LOG.log_exception("CustomerController - Failed to CreateCustomer", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=exception.status_code) 

-

 

-

except Exception as exception: 

-

LOG.log_exception("CustomerController - Failed to CreateCustomer", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(CustomerResultWrapper, str, body=Customer, rest_content_types='json', status_code=200) 

-

def put(self, customer_id, customer): 

-

LOG.info("CustomerController - UpdateCustomer: " + str(customer)) 

-

authentication.authorize(request, 'customers:update') 

-

try: 

-

customer_logic = CustomerLogic() 

-

result = customer_logic.update_customer(customer, customer_id, request.transaction_id) 

-

response.status = 200 

-

LOG.info("CustomerController - UpdateCustomer finished well: " + str(customer)) 

-

 

-

event_details = 'Customer {} {} updated in regions: {}, with users: {}'.format( 

-

customer_id, customer.name, [r.name for r in customer.regions], 

-

[u.id for u in customer.users]) 

-

utils.audit_trail('update customer', request.transaction_id, 

-

request.headers, customer_id, 

-

event_details=event_details) 

-

 

-

except ErrorStatus as exception: 

-

LOG.log_exception("Failed in UpdateCustomer", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=exception.status_code) 

-

 

-

except Exception as exception: 

-

LOG.log_exception("CustomerController - Failed to UpdateCustomer", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

return result 

-

 

-

@wsexpose(CustomerSummaryResponse, str, str, str, str, [str], 

-

rest_content_types='json') 

-

def get_all(self, region=None, user=None, starts_with=None, 

-

contains=None, metadata=None): 

-

LOG.info("CustomerController - GetCustomerlist") 

-

authentication.authorize(request, 'customers:get_all') 

-

try: 

-

customer_logic = CustomerLogic() 

-

result = customer_logic.get_customer_list_by_criteria(region, user, 

-

starts_with, 

-

contains, 

-

metadata) 

-

 

-

return result 

-

except ErrorStatus as exception: 

-

LOG.log_exception("CustomerController - Failed to GetCustomerlist", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=exception.status_code) 

-

 

-

except Exception as exception: 

-

LOG.log_exception("CustomerController - Failed to GetCustomerlist", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(None, str, rest_content_types='json', status_code=204) 

-

def delete(self, customer_id): 

-

authentication.authorize(request, 'customers:delete') 

-

customer_logic = CustomerLogic() 

-

 

-

try: 

-

LOG.info("CustomerController - DeleteCustomer: uuid is " + customer_id) 

-

customer_logic.delete_customer_by_uuid(customer_id) 

-

LOG.info("CustomerController - DeleteCustomer finished well") 

-

 

-

event_details = 'Customer {} deleted'.format(customer_id) 

-

utils.audit_trail('delete customer', request.transaction_id, 

-

request.headers, customer_id, 

-

event_details=event_details) 

-

 

-

except ErrorStatus as exception: 

-

LOG.log_exception("CustomerController - Failed to DeleteCustomer", 

-

exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=exception.status_code) 

-

 

-

except Exception as exception: 

-

LOG.log_exception("CustomerController - Failed to DeleteCustomer", 

-

exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@staticmethod 

-

def validate_cust_id(cust_id): 

-

# regex = re.compile('[a-zA-Z]') 

-

# return regex.match(cust_id[0]) 

-

return True 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_users_py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_users_py.html deleted file mode 100644 index 1da00572..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_customer_users_py.html +++ /dev/null @@ -1,583 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/v1/orm/customer/users.py: 86% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

-

185

-

186

-

187

-

188

-

189

-

190

-

191

-

192

-

193

-

194

-

195

-

196

-

197

-

198

-

199

-

200

-

201

-

202

-

203

-

204

-

205

-

206

-

207

-

208

-

209

-

210

-

211

-

212

-

213

-

214

-

215

-

216

-

217

-

218

-

219

-

220

-

221

-

222

-

223

-

224

-

225

-

226

-

227

-

228

-

229

-

230

-

231

-

232

-

233

-

234

-

235

-

236

-

237

-

238

-

239

-

240

-

241

-

242

-

243

-

244

-

245

-

246

- -
-

from pecan import rest, request 

-

from wsmeext.pecan import wsexpose 

-

 

-

from orm_common.utils import utils 

-

from orm_common.utils import api_error_utils as err_utils 

-

 

-

from cms_rest.model.Models import User, UserResultWrapper 

-

from cms_rest.logic.customer_logic import CustomerLogic 

-

from cms_rest.logic.error_base import ErrorStatus, NotFound 

-

from cms_rest.utils import authentication 

-

 

-

from cms_rest.logger import get_logger 

-

LOG = get_logger(__name__) 

-

 

-

 

-

class DefaultUserController(rest.RestController): 

-

 

-

@wsexpose([str], str, rest_content_types='json') 

-

def get(self, customer_id): 

-

return ["This is the users controller ", 

-

"customer id: " + customer_id, 

-

"user " + "default user"] 

-

 

-

@wsexpose(UserResultWrapper, str, body=[User], rest_content_types='json', status_code=200) 

-

def put(self, customer_id, users): # replace default users to customer 

-

LOG.info("DefaultUserController - Replace DefaultUsers (put) customer id {0} users: {1}".format(customer_id, str(users))) 

-

authentication.authorize(request, 'customers:update_default_user') 

-

try: 

-

customer_logic = CustomerLogic() 

-

result = customer_logic.replace_default_users(customer_id, users, request.transaction_id) 

-

LOG.info("DefaultUserController - Replace DefaultUsers (put) Finished well customer id {0} users: {1}".format(customer_id, str(users))) 

-

 

-

except ErrorStatus as exception: 

-

LOG.log_exception("DefaultUserController - Failed to replace default users", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=exception.status_code) 

-

 

-

39 ↛ 40line 39 didn't jump to line 40, because the exception caught by line 39 didn't happen except LookupError as exception: 

-

LOG.log_exception("DefaultUserController - {0}".format(exception.message), exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=404) 

-

 

-

except Exception as exception: 

-

result = UserResultWrapper(transaction_id="Users Not Added", users=[]) 

-

LOG.log_exception("DefaultUserController - Failed to replace default users", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=str(exception)) 

-

 

-

return result 

-

 

-

@wsexpose(UserResultWrapper, str, body=[User], rest_content_types='json', status_code=200) 

-

def post(self, customer_id, users): # add default users to customer 

-

LOG.info("DefaultUserController - Add DefaultUsers (put) customer id {0} users: {1}".format(customer_id, str(users))) 

-

authentication.authorize(request, 'customers:add_default_user') 

-

try: 

-

customer_logic = CustomerLogic() 

-

result = customer_logic.add_default_users(customer_id, users, request.transaction_id) 

-

LOG.info("DefaultUserController - Add DefaultUsers (post) Finished well customer id {0} users: {1}".format( 

-

customer_id, str(users))) 

-

 

-

except ErrorStatus as exception: 

-

LOG.log_exception("DefaultUserController - Failed to add default users", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=exception.status_code) 

-

 

-

70 ↛ 71line 70 didn't jump to line 71, because the exception caught by line 70 didn't happen except LookupError as exception: 

-

LOG.log_exception("DefaultUserController - {0}".format(exception.message), exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=404) 

-

 

-

except Exception as exception: 

-

result = UserResultWrapper(transaction_id="Users Not Added", users=[]) 

-

LOG.log_exception("DefaultUserController - Failed to add default users", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=str(exception)) 

-

 

-

return result 

-

 

-

@wsexpose(None, str, str, status_code=204) 

-

def delete(self, customer_id, user_id): 

-

LOG.info("DefaultUserController - Delete DefaultUsers (delete) customer id {0} user_id: {1}".format(customer_id, user_id)) 

-

authentication.authorize(request, 'customers:delete_default_user') 

-

try: 

-

customer_logic = CustomerLogic() 

-

customer_logic.delete_default_users(customer_id, user_id, request.transaction_id) 

-

LOG.info("DefaultUserController - Delete DefaultUsers (delete) Finished well customer id {0} user_id: {1}".format(customer_id, user_id)) 

-

utils.audit_trail('delete default users', request.transaction_id, request.headers, customer_id) 

-

 

-

except ErrorStatus as exception: 

-

LOG.log_exception("DefaultUserController - Failed to delete default users", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=exception.status_code) 

-

 

-

100 ↛ 101line 100 didn't jump to line 101, because the exception caught by line 100 didn't happen except LookupError as exception: 

-

LOG.log_exception("DefaultUserController - {0}".format(exception.message), exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=404) 

-

 

-

106 ↛ 107line 106 didn't jump to line 107, because the exception caught by line 106 didn't happen except NotFound as e: 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=404) 

-

 

-

except Exception as exception: 

-

LOG.log_exception("DefaultUserController - Failed in Delete default User", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=str(exception)) 

-

 

-

 

-

class UserController(rest.RestController): 

-

 

-

@staticmethod 

-

def _validate(args): 

-

# validate if user didnt provide input json for users 

-

# to prevent wsme to take the input from url params 

-

124 ↛ 125line 124 didn't jump to line 125, because the condition on line 124 was never true if 'users' in args and args['users'] and not request.body: 

-

raise err_utils.get_error(request.transaction_id, 

-

message="bad request, no json body", 

-

status_code=400) 

-

 

-

@wsexpose([str], str, str, rest_content_types='json') 

-

def get(self, customer_id, region_id): 

-

return ["This is the users controller ", 

-

"customer id: " + customer_id, 

-

"region id: " + region_id] 

-

 

-

@wsexpose(UserResultWrapper, str, str, body=[User], rest_content_types='json', status_code=200) 

-

def post(self, customer_id, region_id, users): 

-

self._validate(locals()) # more validations for input 

-

title = "Add users to Region '{}' for customer: '{}', users: {}".format(region_id, customer_id, str(users)) 

-

LOG.info("UserController - {}".format(title)) 

-

authentication.authorize(request, 'customers:add_region_user') 

-

try: 

-

customer_logic = CustomerLogic() 

-

result = customer_logic.add_users(customer_id, region_id, users, request.transaction_id) 

-

LOG.info("UserController - {} Finished well".format(title)) 

-

 

-

event_details = 'Customer {} users: {} added in region {}'.format( 

-

customer_id, [u.id for u in users], region_id) 

-

utils.audit_trail('add users', request.transaction_id, 

-

request.headers, customer_id, 

-

event_details=event_details) 

-

 

-

except ErrorStatus as exception: 

-

LOG.log_exception("DefaultUserController - Failed to {}".format(title), exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=exception.status_code) 

-

 

-

158 ↛ 159line 158 didn't jump to line 159, because the exception caught by line 158 didn't happen except LookupError as exception: 

-

LOG.log_exception("DefaultUserController - {0}".format(exception.message), exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=404) 

-

 

-

except Exception as exception: 

-

result = UserResultWrapper(transaction_id="Users Not Added", users=[]) 

-

LOG.log_exception("UserController - Failed to Add Users (post)", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=str(exception)) 

-

 

-

return result 

-

 

-

@wsexpose(UserResultWrapper, str, str, body=[User], rest_content_types='json', status_code=200) 

-

def put(self, customer_id, region_id, users): 

-

self._validate(locals()) # more validations for input 

-

title = "Replace users to Region '{}' for customer: '{}', users: {}".format(region_id, customer_id, str(users)) 

-

LOG.info("UserController - {}".format(title)) 

-

authentication.authorize(request, 'customers:update_region_user') 

-

try: 

-

customer_logic = CustomerLogic() 

-

result = customer_logic.replace_users(customer_id, region_id, users, request.transaction_id) 

-

LOG.info("UserController - {} Finished well".format(title)) 

-

 

-

event_details = 'Customer {} users: {} updated in region {}'.format( 

-

customer_id, [u.id for u in users], region_id) 

-

utils.audit_trail('replace users', request.transaction_id, 

-

request.headers, customer_id, 

-

event_details=event_details) 

-

 

-

except ErrorStatus as exception: 

-

LOG.log_exception("DefaultUserController - Failed to {}".format(title), exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=exception.status_code) 

-

 

-

196 ↛ 197line 196 didn't jump to line 197, because the exception caught by line 196 didn't happen except LookupError as exception: 

-

LOG.log_exception("DefaultUserController - {0}".format(exception.message), exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=404) 

-

 

-

except Exception as exception: 

-

result = UserResultWrapper(transaction_id="Users Not Replaced", users=[]) 

-

LOG.log_exception("UserController - Failed to Replaced Users (put)", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=str(exception)) 

-

 

-

return result 

-

 

-

@wsexpose(None, str, str, str, status_code=204) 

-

def delete(self, customer_id, region_id, user_id): 

-

LOG.info("UserController - Delete User (delete) customer id {0} region_id: {1} user_id: {2}".format(customer_id, region_id, user_id)) 

-

authentication.authorize(request, 'customers:delete_region_user') 

-

try: 

-

customer_logic = CustomerLogic() 

-

customer_logic.delete_users(customer_id, region_id, user_id, request.transaction_id) 

-

LOG.info("UserController - Delete User (delete) Finished well customer id {0} region_id: {1} user_id: {2}".format(customer_id, region_id, user_id)) 

-

 

-

event_details = 'Customer {} user: {} deleted in region {}'.format( 

-

customer_id, user_id, region_id) 

-

utils.audit_trail('delete users', request.transaction_id, 

-

request.headers, customer_id, 

-

event_details=event_details) 

-

 

-

except ErrorStatus as exception: 

-

LOG.log_exception("DefaultUserController - Failed to delete users", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=exception.status_code) 

-

 

-

231 ↛ 232line 231 didn't jump to line 232, because the exception caught by line 231 didn't happen except LookupError as exception: 

-

LOG.log_exception("DefaultUserController - {0}".format(exception.message), exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exception.message, 

-

status_code=404) 

-

 

-

237 ↛ 238line 237 didn't jump to line 238, because the exception caught by line 237 didn't happen except NotFound as e: 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=404) 

-

 

-

except Exception as exception: 

-

LOG.log_exception("UserController - Failed to Delete User (delete) ", exception) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=str(exception)) 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_logs_py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_logs_py.html deleted file mode 100644 index fe17dd7e..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_logs_py.html +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/v1/orm/logs.py: 35% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

- -
-

import logging 

-

 

-

from pecan import rest 

-

import wsme 

-

from wsmeext.pecan import wsexpose 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class LogChangeResultWSME(wsme.types.DynamicBase): 

-

"""log change result wsme type.""" 

-

 

-

result = wsme.wsattr(str, mandatory=True, default=None) 

-

 

-

def __init__(self, **kwargs): 

-

""""init method.""" 

-

super(LogChangeResult, self).__init__(**kwargs) 

-

 

-

 

-

class LogChangeResult(object): 

-

"""log change result type.""" 

-

 

-

def __init__(self, result): 

-

""""init method.""" 

-

self.result = result 

-

 

-

 

-

class LogsController(rest.RestController): 

-

"""Logs Audit controller.""" 

-

 

-

@wsexpose(LogChangeResultWSME, str, status_code=201, 

-

rest_content_types='json') 

-

def put(self, level): 

-

"""update log level. 

-

 

-

:param level: the log level text name 

-

:return: 

-

""" 

-

 

-

logger.info("Changing log level to [{}]".format(level)) 

-

try: 

-

log_level = logging._levelNames.get(level.upper()) 

-

if log_level is not None: 

-

self._change_log_level(log_level) 

-

result = "Log level changed to {}.".format(level) 

-

logger.info(result) 

-

else: 

-

raise Exception( 

-

"The given log level [{}] doesn't exist.".format(level)) 

-

except Exception as e: 

-

result = "Fail to change log_level. Reason: {}".format( 

-

e.message) 

-

logger.error(result) 

-

return LogChangeResult(result) 

-

 

-

@staticmethod 

-

def _change_log_level(log_level): 

-

path = __name__.split('.') 

-

if len(path) > 0: 

-

root = path[0] 

-

root_logger = logging.getLogger(root) 

-

root_logger.setLevel(log_level) 

-

else: 

-

logger.info("Fail to change log_level to [{}]. " 

-

"the given log level doesn't exist.".format(log_level)) 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_root_py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_root_py.html deleted file mode 100644 index ac73c82f..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_orm_root_py.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/v1/orm/root.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

- -
-

from cms_rest.controllers.v1.orm.customer.root import CustomerController 

-

from cms_rest.controllers.v1.orm.logs import LogsController 

-

from cms_rest.controllers.v1.orm.configuration import ConfigurationController 

-

from pecan.rest import RestController 

-

 

-

 

-

class OrmController(RestController): 

-

configuration = ConfigurationController() 

-

customers = CustomerController() 

-

logs = LogsController() 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_root_py.html b/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_root_py.html deleted file mode 100644 index 1e15fccd..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_controllers_v1_root_py.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/controllers/v1/root.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

- -
-

from cms_rest.controllers.v1.orm.root import OrmController 

-

from pecan.rest import RestController 

-

 

-

 

-

class V1Controller(RestController): 

-

orm = OrmController() 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_logger___init___py.html b/orm/services/customer_manager/htmlcov/cms_rest_logger___init___py.html deleted file mode 100644 index 15956208..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_logger___init___py.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/logger/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

- -
-

import logging 

-

 

-

 

-

def get_logger(name): 

-

logger = logging.getLogger(name) 

-

logger.log_exception = lambda msg, exception: logger.exception(msg + " Exception: " + str(exception)) 

-

 

-

return logger 

-

 

-

__all__ = ['get_logger'] 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_logic___init___py.html b/orm/services/customer_manager/htmlcov/cms_rest_logic___init___py.html deleted file mode 100644 index 2666bf1c..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_logic___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/logic/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_logic_customer_logic_py.html b/orm/services/customer_manager/htmlcov/cms_rest_logic_customer_logic_py.html deleted file mode 100644 index ad4ebeba..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_logic_customer_logic_py.html +++ /dev/null @@ -1,1535 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/logic/customer_logic.py: 81% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

-

185

-

186

-

187

-

188

-

189

-

190

-

191

-

192

-

193

-

194

-

195

-

196

-

197

-

198

-

199

-

200

-

201

-

202

-

203

-

204

-

205

-

206

-

207

-

208

-

209

-

210

-

211

-

212

-

213

-

214

-

215

-

216

-

217

-

218

-

219

-

220

-

221

-

222

-

223

-

224

-

225

-

226

-

227

-

228

-

229

-

230

-

231

-

232

-

233

-

234

-

235

-

236

-

237

-

238

-

239

-

240

-

241

-

242

-

243

-

244

-

245

-

246

-

247

-

248

-

249

-

250

-

251

-

252

-

253

-

254

-

255

-

256

-

257

-

258

-

259

-

260

-

261

-

262

-

263

-

264

-

265

-

266

-

267

-

268

-

269

-

270

-

271

-

272

-

273

-

274

-

275

-

276

-

277

-

278

-

279

-

280

-

281

-

282

-

283

-

284

-

285

-

286

-

287

-

288

-

289

-

290

-

291

-

292

-

293

-

294

-

295

-

296

-

297

-

298

-

299

-

300

-

301

-

302

-

303

-

304

-

305

-

306

-

307

-

308

-

309

-

310

-

311

-

312

-

313

-

314

-

315

-

316

-

317

-

318

-

319

-

320

-

321

-

322

-

323

-

324

-

325

-

326

-

327

-

328

-

329

-

330

-

331

-

332

-

333

-

334

-

335

-

336

-

337

-

338

-

339

-

340

-

341

-

342

-

343

-

344

-

345

-

346

-

347

-

348

-

349

-

350

-

351

-

352

-

353

-

354

-

355

-

356

-

357

-

358

-

359

-

360

-

361

-

362

-

363

-

364

-

365

-

366

-

367

-

368

-

369

-

370

-

371

-

372

-

373

-

374

-

375

-

376

-

377

-

378

-

379

-

380

-

381

-

382

-

383

-

384

-

385

-

386

-

387

-

388

-

389

-

390

-

391

-

392

-

393

-

394

-

395

-

396

-

397

-

398

-

399

-

400

-

401

-

402

-

403

-

404

-

405

-

406

-

407

-

408

-

409

-

410

-

411

-

412

-

413

-

414

-

415

-

416

-

417

-

418

-

419

-

420

-

421

-

422

-

423

-

424

-

425

-

426

-

427

-

428

-

429

-

430

-

431

-

432

-

433

-

434

-

435

-

436

-

437

-

438

-

439

-

440

-

441

-

442

-

443

-

444

-

445

-

446

-

447

-

448

-

449

-

450

-

451

-

452

-

453

-

454

-

455

-

456

-

457

-

458

-

459

-

460

-

461

-

462

-

463

-

464

-

465

-

466

-

467

-

468

-

469

-

470

-

471

-

472

-

473

-

474

-

475

-

476

-

477

-

478

-

479

-

480

-

481

-

482

-

483

-

484

-

485

-

486

-

487

-

488

-

489

-

490

-

491

-

492

-

493

-

494

-

495

-

496

-

497

-

498

-

499

-

500

-

501

-

502

-

503

-

504

-

505

-

506

-

507

-

508

-

509

-

510

-

511

-

512

-

513

-

514

-

515

-

516

-

517

-

518

-

519

-

520

-

521

-

522

-

523

-

524

-

525

-

526

-

527

-

528

-

529

-

530

-

531

-

532

-

533

-

534

-

535

-

536

-

537

-

538

-

539

-

540

-

541

-

542

-

543

-

544

-

545

-

546

-

547

-

548

-

549

-

550

-

551

-

552

-

553

-

554

-

555

-

556

-

557

-

558

-

559

-

560

-

561

-

562

-

563

-

564

-

565

-

566

-

567

-

568

-

569

-

570

-

571

-

572

-

573

-

574

-

575

-

576

-

577

-

578

-

579

-

580

-

581

-

582

-

583

-

584

-

585

-

586

-

587

-

588

-

589

-

590

-

591

-

592

-

593

-

594

-

595

-

596

-

597

-

598

-

599

-

600

-

601

-

602

-

603

-

604

-

605

-

606

-

607

-

608

-

609

-

610

-

611

-

612

-

613

-

614

-

615

-

616

-

617

-

618

-

619

-

620

-

621

-

622

-

623

-

624

-

625

-

626

-

627

-

628

-

629

-

630

-

631

-

632

-

633

-

634

-

635

-

636

-

637

-

638

-

639

-

640

-

641

-

642

-

643

-

644

-

645

-

646

-

647

-

648

-

649

-

650

-

651

-

652

-

653

-

654

-

655

-

656

-

657

-

658

-

659

-

660

-

661

-

662

-

663

-

664

-

665

-

666

-

667

-

668

-

669

-

670

-

671

-

672

-

673

-

674

-

675

-

676

-

677

-

678

-

679

-

680

-

681

-

682

-

683

-

684

-

685

-

686

-

687

-

688

-

689

-

690

-

691

-

692

-

693

-

694

-

695

-

696

-

697

-

698

-

699

-

700

-

701

-

702

-

703

-

704

-

705

-

706

-

707

-

708

-

709

-

710

-

711

-

712

-

713

-

714

-

715

-

716

-

717

-

718

-

719

-

720

-

721

-

722

- -
-

from cms_rest.model.Models import CustomerResultWrapper 

-

from cms_rest.model.Models import RegionResultWrapper 

-

from cms_rest.model.Models import UserResultWrapper 

-

from cms_rest.model.Models import CustomerSummaryResponse, CustomerSummary 

-

from cms_rest.rds_proxy import RdsProxy 

-

from cms_rest.data.data_manager import DataManager 

-

from cms_rest.data.sql_alchemy.models import UserRole 

-

from cms_rest.logic.error_base import ErrorStatus, NotFound, DuplicateEntryError 

-

from cms_rest.data.sql_alchemy.models import CustomerMetadata 

-

from orm_common.utils.cross_api_utils import get_regions_of_group, set_utils_conf 

-

from orm_common.utils import utils 

-

 

-

from pecan import conf, request 

-

 

-

import pecan 

-

import requests 

-

 

-

from cms_rest.logger import get_logger 

-

 

-

LOG = get_logger(__name__) 

-

 

-

 

-

class CustomerLogic(object): 

-

def build_full_customer(self, customer, uuid, datamanager): 

-

sql_customer = datamanager.add_customer(customer, uuid) 

-

 

-

27 ↛ 28line 27 didn't jump to line 28, because the loop on line 27 never started for key, value in customer.metadata.iteritems(): 

-

metadata = CustomerMetadata(field_key=key, field_value=value) 

-

sql_customer.customer_metadata.append(metadata) 

-

 

-

datamanager.add_customer_region(sql_customer.id, -1) 

-

 

-

default_region_users = [] 

-

for user in customer.users: 

-

sql_user = datamanager.add_user(user) 

-

default_region_users.append(sql_user) 

-

sql_user.sql_roles = [] 

-

for role in user.role: 

-

sql_role = datamanager.add_role(role) 

-

sql_user.sql_roles.append(sql_role) 

-

 

-

default_quotas = [] 

-

for quota in customer.defaultQuotas: 

-

sql_quota = datamanager.add_quota(sql_customer.id, -1, quota) 

-

default_quotas.append(sql_quota) 

-

 

-

for sql_user in default_region_users: 

-

48 ↛ 49line 48 didn't jump to line 49, because the loop on line 48 never started for sql_role in sql_user.sql_roles: 

-

datamanager.add_user_role(sql_user.id, sql_role.id, 

-

sql_customer.id, -1) 

-

 

-

self.add_regions_to_db(customer.regions, sql_customer.id, datamanager, customer.users) 

-

return sql_customer 

-

 

-

def add_regions_to_db(self, regions, sql_customer_id, datamanager, default_users=[]): 

-

for region in regions: 

-

users_roles = self.add_user_and_roles_to_db(region.users, default_users, 

-

datamanager) 

-

 

-

# NOTE: if region has no users there is no need to update the 

-

# default users in that region 

-

# if len(region.users) == 0: 

-

# users_roles.extend(self.add_user_and_roles_to_db( 

-

# customer.users, datamanager)) 

-

# else: 

-

# users_roles.extend(self.add_user_and_roles_to_db( 

-

# region.users, datamanager)) 

-

 

-

sql_region = datamanager.add_region(region) 

-

try: 

-

datamanager.add_customer_region(sql_customer_id, sql_region.id) 

-

except Exception as ex: 

-

if hasattr(ex, 'orig') and ex.orig[0] == 1062: 

-

raise DuplicateEntryError( 

-

'Error, duplicate entry, region ' + region.name + ' already associated with customer') 

-

raise ex 

-

 

-

for user_role in users_roles: 

-

datamanager.add_user_role(user_role[0].id, user_role[1].id, 

-

sql_customer_id, sql_region.id) 

-

 

-

82 ↛ 83line 82 didn't jump to line 83, because the loop on line 82 never started for quota in region.quotas: 

-

datamanager.add_quota(sql_customer_id, sql_region.id, quota) 

-

 

-

# NOTE: if region has no quotas there is no need to update 

-

# the default quotas in that region 

-

# if len(region.quotas) == 0: 

-

# for quota in customer.defaultQuotas: 

-

# datamanager.add_quota(sql_customer_id, 

-

# sql_region.id, quota) 

-

# else: 

-

# for quota in region.quotas: 

-

# datamanager.add_quota(sql_customer_id, 

-

# sql_region.id, quota) 

-

 

-

def add_user_and_roles_to_db(self, users, default_users, datamanager): 

-

users_roles = [] 

-

for user in users: 

-

sql_user = datamanager.add_user(user) 

-

for role in user.role: 

-

sql_role = datamanager.add_role(role) 

-

users_roles.append((sql_user, sql_role)) 

-

for de_user in default_users: 

-

sql_user = datamanager.add_user(de_user) 

-

for role in de_user.role: 

-

sql_role = datamanager.add_role(role) 

-

users_roles.append((sql_user, sql_role)) 

-

 

-

return users_roles 

-

 

-

def create_customer(self, customer, uuid, transaction_id): 

-

datamanager = DataManager() 

-

try: 

-

customer.handle_region_group() 

-

sql_customer = self.build_full_customer(customer, uuid, datamanager) 

-

customer_result_wrapper = build_response(uuid, transaction_id, 'create') 

-

 

-

sql_customer = self.add_default_users_to_empty_regions(sql_customer) 

-

119 ↛ 120line 119 didn't jump to line 120, because the condition on line 119 was never true if sql_customer.customer_customer_regions and len(sql_customer.customer_customer_regions) > 1: 

-

customer_dict = sql_customer.get_proxy_dict() 

-

for region in customer_dict["regions"]: 

-

region["action"] = "create" 

-

 

-

datamanager.flush() # i want to get any exception created by this insert 

-

RdsProxy.send_customer_dict(customer_dict, transaction_id, "POST") 

-

else: 

-

LOG.debug("Customer with no regions - wasn't send to RDS Proxy " + str(customer)) 

-

 

-

datamanager.commit() 

-

 

-

except Exception as exp: 

-

LOG.log_exception("CustomerLogic - Failed to CreateCustomer", exp) 

-

datamanager.rollback() 

-

raise 

-

 

-

return customer_result_wrapper 

-

 

-

def update_customer(self, customer, customer_uuid, transaction_id): 

-

datamanager = DataManager() 

-

try: 

-

customer.validate_model('update') 

-

customer_record = datamanager.get_record('customer') 

-

cutomer_id = customer_record.get_customer_id_from_uuid( 

-

customer_uuid) 

-

 

-

sql_customer = customer_record.read_customer_by_uuid(customer_uuid) 

-

147 ↛ 148line 147 didn't jump to line 148, because the condition on line 147 was never true if not sql_customer: 

-

raise ErrorStatus(404, 'customer {0} was not found'.format(customer_uuid)) 

-

old_customer_dict = sql_customer.get_proxy_dict() 

-

customer_record.delete_by_primary_key(cutomer_id) 

-

datamanager.flush() 

-

 

-

sql_customer = self.build_full_customer(customer, customer_uuid, 

-

datamanager) 

-

sql_customer = self.add_default_users_to_empty_regions(sql_customer) 

-

new_customer_dict = sql_customer.get_proxy_dict() 

-

new_customer_dict["regions"] = self.resolve_regions_actions(old_customer_dict["regions"], 

-

new_customer_dict["regions"]) 

-

 

-

customer_result_wrapper = build_response(customer_uuid, transaction_id, 'update') 

-

datamanager.flush() # i want to get any exception created by this insert 

-

162 ↛ 163line 162 didn't jump to line 163, because the condition on line 162 was never true if not len(new_customer_dict['regions']) == 0: 

-

RdsProxy.send_customer_dict(new_customer_dict, transaction_id, "PUT") 

-

datamanager.commit() 

-

 

-

return customer_result_wrapper 

-

 

-

except Exception as exp: 

-

LOG.log_exception("CustomerLogic - Failed to CreateCustomer", exp) 

-

datamanager.rollback() 

-

raise 

-

 

-

def resolve_regions_actions(self, old_regions_dict, new_regions_dict): 

-

174 ↛ 175line 174 didn't jump to line 175, because the loop on line 174 never started for region in new_regions_dict: 

-

old_region = next((r for r in old_regions_dict if r["name"] == region["name"]), None) 

-

if old_region: 

-

region["action"] = "modify" 

-

else: 

-

region["action"] = "create" 

-

 

-

181 ↛ 182line 181 didn't jump to line 182, because the loop on line 181 never started for region in old_regions_dict: 

-

new_region = next((r for r in new_regions_dict if r["name"] == region["name"]), None) 

-

if not new_region: 

-

region["action"] = "delete" 

-

new_regions_dict.append(region) 

-

 

-

return new_regions_dict 

-

 

-

def add_users(self, customer_uuid, region_name, users, transaction_id, p_datamanager=None): 

-

datamanager = None 

-

try: 

-

if p_datamanager is None: 

-

datamanager = DataManager() 

-

datamanager.begin_transaction() 

-

else: 

-

datamanager = p_datamanager 

-

 

-

region_id = datamanager.get_region_id_by_name(region_name) 

-

customer_id = datamanager.get_customer_id_by_uuid(customer_uuid) 

-

 

-

201 ↛ 202line 201 didn't jump to line 202, because the condition on line 201 was never true if customer_id is None: 

-

raise ErrorStatus(404, "customer {} does not exist".format(customer_uuid)) 

-

 

-

204 ↛ 205line 204 didn't jump to line 205, because the condition on line 204 was never true if region_id is None: 

-

raise ErrorStatus(404, "region {} not found".format(region_name)) 

-

 

-

self.add_users_to_db(datamanager, customer_id, region_id, users, adding=True) 

-

 

-

customer_record = datamanager.get_record('customer') 

-

customer = customer_record.read_customer(customer_id) 

-

 

-

timestamp = utils.get_time_human() 

-

datamanager.flush() # i want to get any exception created by this insert 

-

RdsProxy.send_customer(customer, transaction_id, "PUT") 

-

if p_datamanager is None: 

-

datamanager.commit() 

-

 

-

base_link = '{0}{1}/'.format(conf.server.host_ip, 

-

pecan.request.path) 

-

 

-

result_users = [{'id': user.id, 'added': timestamp, 

-

'links': {'self': base_link + user.id}} for user in 

-

users] 

-

user_result_wrapper = UserResultWrapper( 

-

transaction_id=transaction_id, users=result_users) 

-

 

-

return user_result_wrapper 

-

except Exception as exception: 

-

229 ↛ 230line 229 didn't jump to line 230, because the condition on line 229 was never true if 'Duplicate' in exception.message: 

-

raise ErrorStatus(409, exception.message) 

-

datamanager.rollback() 

-

LOG.log_exception("Failed to add_users", exception) 

-

raise exception 

-

 

-

def replace_users(self, customer_uuid, region_name, users, transaction_id): 

-

datamanager = None 

-

try: 

-

datamanager = DataManager() 

-

datamanager.begin_transaction() 

-

 

-

customer_id = datamanager.get_customer_id_by_uuid(customer_uuid) 

-

242 ↛ 243line 242 didn't jump to line 243, because the condition on line 242 was never true if customer_id is None: 

-

raise ErrorStatus(404, "customer {} does not exist".format(customer_uuid)) 

-

 

-

region_id = datamanager.get_region_id_by_name(region_name) 

-

246 ↛ 247line 246 didn't jump to line 247, because the condition on line 246 was never true if region_id is None: 

-

raise ErrorStatus(404, "region {} not found".format(region_name)) 

-

 

-

# delete older default user 

-

user_role_record = datamanager.get_record('user_role') 

-

user_role_record.delete_all_users_from_region(customer_uuid, region_name) # -1 is default region 

-

result = self.add_users(customer_uuid, region_name, users, transaction_id, datamanager) 

-

datamanager.commit() 

-

return result 

-

 

-

except Exception as exception: 

-

datamanager.rollback() 

-

LOG.log_exception("Failed to replace_default_users", exception) 

-

raise 

-

 

-

def add_users_to_db(self, datamanager, customer_id, region_id, users, adding=False): 

-

try: 

-

users_roles = [] 

-

for user in users: 

-

sql_user = datamanager.add_user(user) 

-

for role in user.role: 

-

sql_role = datamanager.add_role(role) 

-

users_roles.append((sql_user, sql_role)) 

-

for user_role in users_roles: 

-

# TODO: change add_use_role to receive sqlalchemy model (UserRole) 

-

datamanager.add_user_role(user_role[0].id, user_role[1].id, 

-

customer_id, region_id, adding) 

-

datamanager.flush() 

-

except Exception as exception: 

-

LOG.log_exception("Failed to add users", exception) 

-

raise 

-

 

-

def delete_users(self, customer_uuid, region_id, user_id, transaction_id): 

-

datamanager = DataManager() 

-

try: 

-

user_role_record = datamanager.get_record('user_role') 

-

 

-

customer = datamanager.get_cusomer_by_uuid(customer_uuid) 

-

284 ↛ 285line 284 didn't jump to line 285, because the condition on line 284 was never true if customer is None: 

-

raise ErrorStatus(404, "customer {} does not exist".format(customer_uuid)) 

-

 

-

result = user_role_record.delete_user_from_region(customer_uuid, 

-

region_id, 

-

user_id) 

-

if result.rowcount == 0: 

-

raise NotFound("user {} is not found".format(user_id)) 

-

 

-

RdsProxy.send_customer(customer, transaction_id, "PUT") 

-

datamanager.commit() 

-

 

-

print "User {0} from region {1} in customer {2} deleted".format( 

-

user_id, region_id, customer_uuid) 

-

except NotFound as e: 

-

datamanager.rollback() 

-

LOG.log_exception("Failed to delete_users, user not found", 

-

e.message) 

-

raise NotFound("Failed to delete users, %s not found" % 

-

e.message) 

-

except Exception as exception: 

-

datamanager.rollback() 

-

LOG.log_exception("Failed to delete_users", exception) 

-

raise exception 

-

 

-

def add_default_users(self, customer_uuid, users, transaction_id, p_datamanager=None): 

-

datamanager = None 

-

try: 

-

if p_datamanager is None: 

-

datamanager = DataManager() 

-

datamanager.begin_transaction() 

-

else: 

-

datamanager = p_datamanager 

-

 

-

customer_id = datamanager.get_customer_id_by_uuid(customer_uuid) 

-

 

-

320 ↛ 321line 320 didn't jump to line 321, because the condition on line 320 was never true if customer_id is None: 

-

raise ErrorStatus(404, "customer {} does not exist".format(customer_uuid)) 

-

 

-

self.add_users_to_db(datamanager, customer_id, -1, users, adding=True) 

-

 

-

customer_record = datamanager.get_record('customer') 

-

customer = customer_record.read_customer(customer_id) 

-

 

-

timestamp = utils.get_time_human() 

-

datamanager.flush() # i want to get any exception created by this insert 

-

330 ↛ 331line 330 didn't jump to line 331, because the condition on line 330 was never true if len(customer.customer_customer_regions) > 1: 

-

RdsProxy.send_customer(customer, transaction_id, "PUT") 

-

 

-

if p_datamanager is None: 

-

datamanager.commit() 

-

 

-

base_link = '{0}{1}/'.format(conf.server.host_ip, 

-

pecan.request.path) 

-

 

-

result_users = [{'id': user.id, 'added': timestamp, 

-

'links': {'self': base_link + user.id}} for user in 

-

users] 

-

user_result_wrapper = UserResultWrapper( 

-

transaction_id=transaction_id, users=result_users) 

-

 

-

return user_result_wrapper 

-

 

-

except Exception as exception: 

-

datamanager.rollback() 

-

349 ↛ 350line 349 didn't jump to line 350, because the condition on line 349 was never true if 'Duplicate' in exception.message: 

-

raise ErrorStatus(409, exception.message) 

-

LOG.log_exception("Failed to add_default_users", exception) 

-

raise 

-

 

-

def replace_default_users(self, customer_uuid, users, transaction_id): 

-

datamanager = None 

-

try: 

-

datamanager = DataManager() 

-

datamanager.begin_transaction() 

-

 

-

customer_id = datamanager.get_customer_id_by_uuid(customer_uuid) 

-

361 ↛ 362line 361 didn't jump to line 362, because the condition on line 361 was never true if customer_id is None: 

-

raise ErrorStatus(404, "customer {} does not exist".format(customer_uuid)) 

-

 

-

# delete older default user 

-

user_role_record = datamanager.get_record('user_role') 

-

user_role_record.delete_all_users_from_region(customer_uuid, -1) # -1 is default region 

-

result = self.add_default_users(customer_uuid, users, transaction_id, datamanager) 

-

datamanager.commit() 

-

return result 

-

 

-

except Exception as exception: 

-

datamanager.rollback() 

-

LOG.log_exception("Failed to replace_default_users", exception) 

-

raise 

-

 

-

def delete_default_users(self, customer_uuid, user_id, transaction_id): 

-

datamanager = DataManager() 

-

try: 

-

customer = datamanager.get_cusomer_by_uuid(customer_uuid) 

-

380 ↛ 381line 380 didn't jump to line 381, because the condition on line 380 was never true if customer is None: 

-

raise ErrorStatus(404, "customer {} does not exist".format(customer_uuid)) 

-

 

-

user_role_record = datamanager.get_record('user_role') 

-

result = user_role_record.delete_user_from_region(customer_uuid, 

-

'DEFAULT', 

-

user_id) 

-

 

-

if result.rowcount == 0: 

-

raise NotFound("user {} is not found".format(user_id)) 

-

 

-

datamanager.commit() 

-

 

-

print "User {0} from region {1} in customer {2} deleted".format( 

-

user_id, 'DEFAULT', customer_uuid) 

-

 

-

except NotFound as e: 

-

datamanager.rollback() 

-

LOG.log_exception("Failed to delete_users, user not found", 

-

e.message) 

-

raise NotFound("Failed to delete users, %s not found" % 

-

e.message) 

-

 

-

except Exception as exp: 

-

datamanager.rollback() 

-

raise exp 

-

 

-

def add_regions(self, customer_uuid, regions, transaction_id): 

-

datamanager = DataManager() 

-

customer_record = datamanager.get_record('customer') 

-

try: 

-

# TODO DataBase action 

-

customer_id = datamanager.get_customer_id_by_uuid(customer_uuid) 

-

413 ↛ 414line 413 didn't jump to line 414, because the condition on line 413 was never true if customer_id is None: 

-

raise ErrorStatus(404, 

-

"customer with id {} does not exist".format( 

-

customer_uuid)) 

-

self.add_regions_to_db(regions, customer_id, datamanager) 

-

 

-

sql_customer = customer_record.read_customer_by_uuid(customer_uuid) 

-

 

-

sql_customer = self.add_default_users_to_empty_regions(sql_customer) 

-

new_customer_dict = sql_customer.get_proxy_dict() 

-

 

-

424 ↛ 425line 424 didn't jump to line 425, because the loop on line 424 never started for region in new_customer_dict["regions"]: 

-

new_region = next((r for r in regions if r.name == region["name"]), None) 

-

if new_region: 

-

region["action"] = "create" 

-

else: 

-

region["action"] = "modify" 

-

 

-

timestamp = utils.get_time_human() 

-

datamanager.flush() # i want to get any exception created by this insert 

-

RdsProxy.send_customer_dict(new_customer_dict, transaction_id, "POST") 

-

datamanager.commit() 

-

 

-

base_link = '{0}{1}/'.format(conf.server.host_ip, 

-

pecan.request.path) 

-

 

-

result_regions = [{'id': region.name, 'added': timestamp, 

-

'links': {'self': base_link + region.name}} for 

-

region in regions] 

-

region_result_wrapper = RegionResultWrapper( 

-

transaction_id=transaction_id, regions=result_regions) 

-

 

-

return region_result_wrapper 

-

except Exception as exp: 

-

datamanager.rollback() 

-

raise 

-

 

-

def replace_regions(self, customer_uuid, regions, transaction_id): 

-

datamanager = DataManager() 

-

customer_record = datamanager.get_record('customer') 

-

customer_region = datamanager.get_record('customer_region') 

-

try: 

-

customer_id = datamanager.get_customer_id_by_uuid(customer_uuid) 

-

456 ↛ 457line 456 didn't jump to line 457, because the condition on line 456 was never true if customer_id is None: 

-

raise ErrorStatus(404, 

-

"customer with id {} does not exist".format( 

-

customer_uuid)) 

-

 

-

old_sql_customer = customer_record.read_customer_by_uuid(customer_uuid) 

-

462 ↛ 463line 462 didn't jump to line 463, because the condition on line 462 was never true if old_sql_customer is None: 

-

raise ErrorStatus(404, 

-

"customer with id {} does not exist".format( 

-

customer_id)) 

-

old_customer_dict = old_sql_customer.get_proxy_dict() 

-

datamanager.session.expire(old_sql_customer) 

-

 

-

customer_region.delete_all_regions_for_customer(customer_id) 

-

 

-

self.add_regions_to_db(regions, customer_id, datamanager) 

-

timestamp = utils.get_time_human() 

-

 

-

new_sql_customer = datamanager.get_cusomer_by_id(customer_id) 

-

 

-

new_sql_customer = self.add_default_users_to_empty_regions(new_sql_customer) 

-

new_customer_dict = new_sql_customer.get_proxy_dict() 

-

 

-

datamanager.flush() # i want to get any exception created by this insert 

-

 

-

new_customer_dict["regions"] = self.resolve_regions_actions(old_customer_dict["regions"], 

-

new_customer_dict["regions"]) 

-

 

-

RdsProxy.send_customer_dict(new_customer_dict, transaction_id, "PUT") 

-

datamanager.commit() 

-

 

-

base_link = '{0}{1}/'.format(conf.server.host_ip, 

-

pecan.request.path) 

-

 

-

result_regions = [{'id': region.name, 'added': timestamp, 

-

'links': {'self': base_link + region.name}} for 

-

region in regions] 

-

region_result_wrapper = RegionResultWrapper( 

-

transaction_id=transaction_id, regions=result_regions) 

-

 

-

return region_result_wrapper 

-

except Exception as exp: 

-

datamanager.rollback() 

-

raise exp 

-

 

-

def delete_region(self, customer_id, region_id, transaction_id): 

-

datamanager = DataManager() 

-

try: 

-

customer_region = datamanager.get_record('customer_region') 

-

 

-

sql_customer = datamanager.get_cusomer_by_uuid(customer_id) 

-

507 ↛ 508line 507 didn't jump to line 508, because the condition on line 507 was never true if sql_customer is None: 

-

raise ErrorStatus(404, 

-

"customer with id {} does not exist".format( 

-

customer_id)) 

-

customer_dict = sql_customer.get_proxy_dict() 

-

 

-

customer_region.delete_region_for_customer(customer_id, region_id) 

-

datamanager.flush() # i want to get any exception created by this insert 

-

 

-

# i want to get any exception created by this insert 

-

datamanager.flush() 

-

 

-

region = next((r.region for r in sql_customer.customer_customer_regions if r.region.name == region_id), None) 

-

520 ↛ 521line 520 didn't jump to line 521, because the condition on line 520 was never true if region: 

-

if region.type == 'group': 

-

set_utils_conf(conf) 

-

regions = get_regions_of_group(region.name) 

-

else: 

-

regions = [region_id] 

-

526 ↛ 527line 526 didn't jump to line 527, because the loop on line 526 never started for region in customer_dict['regions']: 

-

if region['name'] in regions: 

-

region['action'] = 'delete' 

-

 

-

RdsProxy.send_customer_dict(customer_dict, transaction_id, "PUT") 

-

datamanager.commit() 

-

 

-

LOG.debug("Region {0} in customer {1} deleted".format(region_id, 

-

customer_id)) 

-

except Exception as exp: 

-

datamanager.rollback() 

-

raise 

-

 

-

def get_customer(self, customer): 

-

 

-

datamanager = DataManager() 

-

 

-

sql_customer = datamanager.get_cusomer_by_uuid_or_name(customer) 

-

 

-

if not sql_customer: 

-

raise ErrorStatus(404, 'customer: {0} not found'.format(customer)) 

-

 

-

ret_customer = sql_customer.to_wsme() 

-

549 ↛ 564line 549 didn't jump to line 564, because the condition on line 549 was never false if sql_customer.get_real_customer_regions(): 

-

# if we have regions in sql_customer 

-

 

-

resp = requests.get(conf.api.rds_server.base + 

-

conf.api.rds_server.status + 

-

sql_customer.uuid, verify=conf.verify).json() 

-

 

-

for item in ret_customer.regions: 

-

for status in resp['regions']: 

-

558 ↛ 557line 558 didn't jump to line 557, because the condition on line 558 was never false if status['region'] == item.name: 

-

item.status = status['status'] 

-

560 ↛ 561line 560 didn't jump to line 561, because the condition on line 560 was never true if status['error_msg']: 

-

item.error_message = status['error_msg'] 

-

ret_customer.status = resp['status'] 

-

else: 

-

ret_customer.status = 'no regions' 

-

 

-

return ret_customer 

-

 

-

def get_customer_list_by_criteria(self, region, user, starts_with, contains, 

-

metadata): 

-

datamanager = DataManager() 

-

customer_record = datamanager.get_record('customer') 

-

sql_customers = customer_record.get_customers_by_criteria(region=region, 

-

user=user, 

-

starts_with=starts_with, 

-

contains=contains, 

-

metadata=metadata) 

-

 

-

response = CustomerSummaryResponse() 

-

for sql_customer in sql_customers: 

-

# get aggregate status for each customer 

-

customer_status = RdsProxy.get_status(sql_customer.uuid) 

-

customer = CustomerSummary.from_db_model(sql_customer) 

-

583 ↛ 585line 583 didn't jump to line 585, because the condition on line 583 was never false if customer_status.status_code == 200: 

-

customer.status = customer_status.json()['status'] 

-

response.customers.append(customer) 

-

 

-

return response 

-

 

-

def enable(self, customer_uuid, enabled, transaction_id): 

-

try: 

-

datamanager = DataManager() 

-

 

-

customer_record = datamanager.get_record('customer') 

-

sql_customer = customer_record.read_customer_by_uuid(customer_uuid) 

-

 

-

596 ↛ 597line 596 didn't jump to line 597, because the condition on line 596 was never true if not sql_customer: 

-

raise ErrorStatus(404, 'customer: {0} not found'.format(customer_uuid)) 

-

 

-

sql_customer.enabled = 1 if enabled.enabled else 0 

-

 

-

RdsProxy.send_customer(sql_customer, transaction_id, "PUT") 

-

 

-

datamanager.flush() # get any exception created by this action 

-

datamanager.commit() 

-

 

-

except Exception as exp: 

-

datamanager.rollback() 

-

raise exp 

-

 

-

def add_default_users_to_empty_regions(self, sql_customer): 

-

if len(sql_customer.customer_customer_regions) > 0: 

-

for region in sql_customer.customer_customer_regions: 

-

613 ↛ 612line 613 didn't jump to line 612, because the condition on line 613 was never false if region.region_id == -1: 

-

users = region.customer_region_user_roles 

-

 

-

for region in sql_customer.customer_customer_regions: 

-

617 ↛ 616line 617 didn't jump to line 616, because the condition on line 617 was never false if len(region.customer_region_user_roles) == 0: 

-

new_users = [] 

-

619 ↛ 620line 619 didn't jump to line 620, because the loop on line 619 never started for user in users: 

-

u = UserRole() 

-

u.customer_id = region.customer_id 

-

u.region_id = region.region_id 

-

u.user_id = user.user_id 

-

u.role_id = user.role_id 

-

new_users.append(u) 

-

region.customer_region_user_roles = new_users 

-

 

-

return sql_customer 

-

 

-

def delete_customer_by_uuid(self, customer_id): 

-

datamanager = DataManager() 

-

 

-

try: 

-

datamanager.begin_transaction() 

-

customer_record = datamanager.get_record('customer') 

-

 

-

sql_customer = customer_record.read_customer_by_uuid(customer_id) 

-

if sql_customer is None: 

-

# The customer does not exist, so the delete operation is 

-

# considered successful 

-

return 

-

 

-

real_regions = sql_customer.get_real_customer_regions() 

-

if len(real_regions) > 0: 

-

# Do not delete a customer that still has some regions 

-

raise ErrorStatus(405, 

-

"Cannot delete a customer that has regions. " 

-

"Please delete the regions first and then " 

-

"delete the customer.") 

-

else: 

-

expected_status = 'Success' 

-

invalid_status = 'N/A' 

-

# Get status from RDS 

-

resp = RdsProxy.get_status(sql_customer.uuid) 

-

if resp.status_code == 200: 

-

status_resp = resp.json() 

-

if 'status' in status_resp.keys(): 

-

LOG.debug( 

-

'RDS returned status: {}'.format( 

-

status_resp['status'])) 

-

status = status_resp['status'] 

-

else: 

-

# Invalid response from RDS 

-

LOG.error('Response from RDS did not contain status') 

-

status = invalid_status 

-

elif resp.status_code == 404: 

-

# Customer not found in RDS, that means it never had any regions 

-

# So it is OK to delete it 

-

LOG.debug( 

-

'Resource not found in RDS, so it is OK to delete') 

-

status = expected_status 

-

else: 

-

# Invalid status code from RDS 

-

log_message = 'Invalid response code from RDS: {}'.format( 

-

resp.status_code) 

-

log_message = log_message.replace('\n', '_').replace('\r', 

-

'_') 

-

LOG.warning(log_message) 

-

status = invalid_status 

-

 

-

if status == invalid_status: 

-

raise ErrorStatus(500, "Could not get customer status") 

-

elif status != expected_status: 

-

raise ErrorStatus(409, 

-

"The customer has not been deleted " 

-

"successfully from all of its regions " 

-

"(either the deletion failed on one of the " 

-

"regions or it is still in progress)") 

-

 

-

# OK to delete 

-

customer_record.delete_customer_by_uuid(customer_id) 

-

 

-

datamanager.flush() # i want to get any exception created by this delete 

-

datamanager.commit() 

-

except Exception as exp: 

-

LOG.log_exception("CustomerLogic - Failed to delete customer", exp) 

-

datamanager.rollback() 

-

raise 

-

 

-

 

-

def build_response(customer_uuid, transaction_id, context): 

-

""" 

-

this function generate th customer action response JSON 

-

:param customer_uuid: 

-

:param transaction_id: 

-

:param context: create or update 

-

:return: 

-

""" 

-

# The link should point to the customer itself (/v1/orm/customers/{id}) 

-

link_elements = request.url.split('/') 

-

base_link = '/'.join(link_elements) 

-

if context == 'create': 

-

base_link += customer_uuid 

-

 

-

timestamp = utils.get_time_human() 

-

customer_result_wrapper = CustomerResultWrapper( 

-

transaction_id=transaction_id, 

-

id=customer_uuid, 

-

updated=None, 

-

created=timestamp, 

-

links={'self': base_link}) 

-

return customer_result_wrapper 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_logic_error_base_py.html b/orm/services/customer_manager/htmlcov/cms_rest_logic_error_base_py.html deleted file mode 100644 index e89498cc..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_logic_error_base_py.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/logic/error_base.py: 86% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

- -
-

class Error(Exception): 

-

pass 

-

 

-

 

-

class ErrorStatus(Error): 

-

def __init__(self, status_code, message=None): 

-

self.status_code = status_code 

-

self.message = message 

-

 

-

 

-

class NotFound(Error): 

-

def __init__(self, message=None, status_code=404): 

-

self.status_code = status_code 

-

self.message = message 

-

 

-

 

-

class DuplicateEntryError(Error): 

-

def __init__(self, message=None, status_code=409): 

-

self.status_code = status_code 

-

self.message = message 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_logic_metadata_logic_py.html b/orm/services/customer_manager/htmlcov/cms_rest_logic_metadata_logic_py.html deleted file mode 100644 index 881481a3..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_logic_metadata_logic_py.html +++ /dev/null @@ -1,309 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/logic/metadata_logic.py: 15% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

- -
-

from cms_rest.data.sql_alchemy.models import CustomerMetadata 

-

from cms_rest.data.data_manager import DataManager 

-

from cms_rest.rds_proxy import RdsProxy 

-

from cms_rest.model.Models import CustomerResultWrapper 

-

from orm_common.utils import utils 

-

from pecan import request 

-

from pecan import conf 

-

import json 

-

from cms_rest.logger import get_logger 

-

 

-

logger = get_logger(__name__) 

-

 

-

 

-

def add_customer_metadata(customer_uuid, metadata_wrapper, transaction_id): 

-

sql_metadata_collection = map_metadata(customer_uuid, metadata_wrapper) 

-

 

-

datamanager = DataManager() 

-

 

-

try: 

-

customer_record = datamanager.get_record('customer') 

-

sql_customer = customer_record.read_customer_by_uuid(customer_uuid) 

-

if not sql_customer: 

-

logger.error('customer not found, customer uuid: {0}'.format(customer_uuid)) 

-

raise ValueError('customer not found, customer uuid: {0}'.format(customer_uuid)) 

-

 

-

for metadata in sql_metadata_collection: 

-

metadata_match = [m for m in sql_customer.customer_metadata if m.field_key == metadata.field_key] 

-

if len(metadata_match) > 0: 

-

logger.error('Duplicate metadata key, key already exits: {0}'.format(metadata.field_key)) 

-

raise AttributeError('Duplicate metadata key, key already exits: {0}'.format(metadata.field_key)) 

-

 

-

for metadata in sql_metadata_collection: 

-

sql_customer.customer_metadata.append(metadata) 

-

logger.debug('updating metadata {0}'.format(json.dumps(metadata.get_proxy_dict()))) 

-

 

-

logger.debug('finished appending metadata to customer') 

-

if len(sql_customer.customer_customer_regions) > 1: 

-

RdsProxy.send_customer(sql_customer, transaction_id, "PUT") 

-

datamanager.commit() 

-

 

-

customer_result_wrapper = build_response(customer_uuid, transaction_id) 

-

 

-

return customer_result_wrapper 

-

 

-

except Exception as exp: 

-

datamanager.rollback() 

-

raise exp 

-

 

-

 

-

def update_customer_metadata(customer_uuid, metadata_wrapper, transaction_id): 

-

sql_metadata_collection = map_metadata(customer_uuid, metadata_wrapper) 

-

 

-

datamanager = DataManager() 

-

 

-

try: 

-

customer_record = datamanager.get_record('customer') 

-

sql_customer = customer_record.read_customer_by_uuid(customer_uuid) 

-

 

-

if not sql_customer: 

-

logger.error('customer not found, customer uuid: {0}'.format(customer_uuid)) 

-

raise ValueError('customer not found, customer uuid: {0}'.format(customer_uuid)) 

-

 

-

while len(sql_customer.customer_metadata) > 0: 

-

sql_customer.customer_metadata.remove(sql_customer.customer_metadata[0]) 

-

 

-

for metadata in sql_metadata_collection: 

-

sql_customer.customer_metadata.append(metadata) 

-

logger.debug('updating metadata {0}'.format(json.dumps(metadata.get_proxy_dict()))) 

-

 

-

if len(sql_customer.customer_customer_regions) > 1: 

-

RdsProxy.send_customer(sql_customer, transaction_id, "PUT") 

-

datamanager.commit() 

-

 

-

customer_result_wrapper = build_response(customer_uuid, transaction_id) 

-

 

-

return customer_result_wrapper 

-

 

-

except Exception as exp: 

-

datamanager.rollback() 

-

raise exp 

-

 

-

 

-

def map_metadata(customer_id, metadata_wrapper): 

-

sql_metadata_collection = [] 

-

for key, value in metadata_wrapper.metadata.iteritems(): 

-

sql_metadata = CustomerMetadata() 

-

sql_metadata.customer_id = customer_id 

-

sql_metadata.field_key = key 

-

sql_metadata.field_value = value 

-

 

-

sql_metadata_collection.append(sql_metadata) 

-

return sql_metadata_collection 

-

 

-

 

-

def build_response(customer_uuid, transaction_id): 

-

# The link should point to the customer itself (/v1/orm/customers/{id}), 

-

# so the 'metadata' element should be removed. 

-

link_elements = request.url.split('/') 

-

link_elements.remove('metadata') 

-

base_link = '/'.join(link_elements) 

-

 

-

timestamp = utils.get_time_human() 

-

customer_result_wrapper = CustomerResultWrapper( 

-

transaction_id=transaction_id, 

-

id=customer_uuid, 

-

updated=None, 

-

created=timestamp, 

-

links={'self': base_link}) 

-

return customer_result_wrapper 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_model_Model_py.html b/orm/services/customer_manager/htmlcov/cms_rest_model_Model_py.html deleted file mode 100644 index e3a7e21d..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_model_Model_py.html +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/model/Model.py: 86% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

- -
-

import inspect 

-

from wsme import types as wtypes 

-

from wsme.rest.json import tojson 

-

 

-

 

-

class Model(wtypes.DynamicBase): 

-

"""Base class for CMS models. 

-

""" 

-

 

-

def tojson(self): 

-

return tojson(type(self), self) 

-

 

-

""" 

-

def __init__(self, **kwds): 

-

self.fields = list(kwds) 

-

for k, v in kwds.iteritems(): 

-

setattr(self, k, v) 

-

 

-

def as_dict(self): 

-

d = {} 

-

for f in self.fields: 

-

v = getattr(self, f) 

-

if isinstance(v, Model): 

-

v = v.as_dict() 

-

elif isinstance(v, list) and v and isinstance(v[0], Model): 

-

v = [sub.as_dict() for sub in v] 

-

d[f] = v 

-

return d 

-

 

-

def __eq__(self, other): 

-

return self.as_dict() == other.as_dict() 

-

 

-

@classmethod 

-

def get_field_names(cls): 

-

fields = inspect.getargspec(cls.__init__)[0] 

-

return set(fields) - set(["self"]) 

-

 

-

""" 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_model_Models_py.html b/orm/services/customer_manager/htmlcov/cms_rest_model_Models_py.html deleted file mode 100644 index 1f97e481..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_model_Models_py.html +++ /dev/null @@ -1,979 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/model/Models.py: 95% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

-

185

-

186

-

187

-

188

-

189

-

190

-

191

-

192

-

193

-

194

-

195

-

196

-

197

-

198

-

199

-

200

-

201

-

202

-

203

-

204

-

205

-

206

-

207

-

208

-

209

-

210

-

211

-

212

-

213

-

214

-

215

-

216

-

217

-

218

-

219

-

220

-

221

-

222

-

223

-

224

-

225

-

226

-

227

-

228

-

229

-

230

-

231

-

232

-

233

-

234

-

235

-

236

-

237

-

238

-

239

-

240

-

241

-

242

-

243

-

244

-

245

-

246

-

247

-

248

-

249

-

250

-

251

-

252

-

253

-

254

-

255

-

256

-

257

-

258

-

259

-

260

-

261

-

262

-

263

-

264

-

265

-

266

-

267

-

268

-

269

-

270

-

271

-

272

-

273

-

274

-

275

-

276

-

277

-

278

-

279

-

280

-

281

-

282

-

283

-

284

-

285

-

286

-

287

-

288

-

289

-

290

-

291

-

292

-

293

-

294

-

295

-

296

-

297

-

298

-

299

-

300

-

301

-

302

-

303

-

304

-

305

-

306

-

307

-

308

-

309

-

310

-

311

-

312

-

313

-

314

-

315

-

316

-

317

-

318

-

319

-

320

-

321

-

322

-

323

-

324

-

325

-

326

-

327

-

328

-

329

-

330

-

331

-

332

-

333

-

334

-

335

-

336

-

337

-

338

-

339

-

340

-

341

-

342

-

343

-

344

-

345

-

346

-

347

-

348

-

349

-

350

-

351

-

352

-

353

-

354

-

355

-

356

-

357

-

358

-

359

-

360

-

361

-

362

-

363

-

364

-

365

-

366

-

367

-

368

-

369

-

370

-

371

-

372

-

373

-

374

-

375

-

376

-

377

-

378

-

379

-

380

-

381

-

382

-

383

-

384

-

385

-

386

-

387

-

388

-

389

-

390

-

391

-

392

-

393

-

394

-

395

-

396

-

397

-

398

-

399

-

400

-

401

-

402

-

403

-

404

-

405

-

406

-

407

-

408

-

409

-

410

-

411

-

412

-

413

-

414

-

415

-

416

-

417

-

418

-

419

-

420

-

421

-

422

-

423

-

424

-

425

-

426

-

427

-

428

-

429

-

430

-

431

-

432

-

433

-

434

-

435

-

436

-

437

-

438

-

439

-

440

-

441

-

442

-

443

-

444

- -
-

import wsme 

-

from wsme import types as wtypes 

-

from cms_rest.model.Model import Model 

-

from cms_rest.logic.error_base import ErrorStatus 

-

from pecan import conf 

-

from orm_common.utils.cross_api_utils import set_utils_conf, get_regions_of_group 

-

 

-

 

-

class Enabled(Model): 

-

"""enable model the customer 

-

 

-

""" 

-

enabled = wsme.wsattr(bool, mandatory=True) 

-

 

-

def __init__(self, enabled=None): 

-

"""Create a new enables class. 

-

 

-

:param enabled: customer status 

-

""" 

-

self.enabled = enabled 

-

 

-

 

-

class Compute(Model): 

-

"""compute model the customer 

-

 

-

""" 

-

instances = wsme.wsattr(wsme.types.text, mandatory=True) 

-

injected_files = wsme.wsattr(wsme.types.text, mandatory=True, name="injected-files") 

-

key_pairs = wsme.wsattr(wsme.types.text, mandatory=True, name="key-pairs") 

-

ram = wsme.wsattr(wsme.types.text, mandatory=True) 

-

vcpus = wsme.wsattr(wsme.types.text, mandatory=False) 

-

metadata_items = wsme.wsattr(wsme.types.text, mandatory=False, name="metadata-items") 

-

injected_file_content_bytes = wsme.wsattr(wsme.types.text, mandatory=False, name="injected-file-content-bytes") 

-

floating_ips = wsme.wsattr(wsme.types.text, mandatory=False, name="floating-ips") 

-

fixed_ips = wsme.wsattr(wsme.types.text, mandatory=False, name="fixed-ips") 

-

injected_file_path_bytes = wsme.wsattr(wsme.types.text, mandatory=False, name="injected-file-path-bytes") 

-

server_groups = wsme.wsattr(wsme.types.text, mandatory=False, name="server-groups") 

-

server_group_members = wsme.wsattr(wsme.types.text, mandatory=False, name="server-group-members") 

-

 

-

def __init__(self, instances='', injected_files='', key_pairs='', ram='', 

-

vcpus=None, metadata_items=None, injected_file_content_bytes=None, 

-

floating_ips='', fixed_ips='', injected_file_path_bytes='', 

-

server_groups='', server_group_members=''): 

-

""" 

-

Create a new compute instance. 

-

:param instances: 

-

:param injected_files: 

-

:param key_pairs: 

-

:param ram: 

-

:param vcpus: 

-

:param metadata_items: 

-

:param injected_file_content_bytes: 

-

:param floating_ips: 

-

:param fixed_ips: 

-

:param injected_file_path_bytes: 

-

:param server_groups: 

-

:param server_group_members: 

-

""" 

-

self.instances = instances 

-

self.injected_files = injected_files 

-

self.key_pairs = key_pairs 

-

self.ram = ram 

-

if vcpus is None: 

-

self.vcpus = conf.quotas_default_values.compute.vcpus 

-

else: 

-

self.vcpus = vcpus 

-

if metadata_items is None: 

-

self.metadata_items = \ 

-

conf.quotas_default_values.compute.metadata_items 

-

else: 

-

self.metadata_items = metadata_items 

-

if injected_file_content_bytes is None: 

-

self.injected_file_content_bytes = \ 

-

conf.quotas_default_values.compute.injected_file_content_bytes 

-

else: 

-

self.injected_file_content_bytes = injected_file_content_bytes 

-

 

-

self.floating_ips = floating_ips 

-

self.fixed_ips = fixed_ips 

-

self.injected_file_path_bytes = injected_file_path_bytes 

-

self.server_groups = server_groups 

-

self.server_group_members = server_group_members 

-

 

-

 

-

class Storage(Model): 

-

"""storage info model for customer 

-

 

-

""" 

-

gigabytes = wsme.wsattr(wsme.types.text, mandatory=True) 

-

snapshots = wsme.wsattr(wsme.types.text, mandatory=True) 

-

volumes = wsme.wsattr(wsme.types.text, mandatory=True) 

-

 

-

def __init__(self, gigabytes='', snapshots='', volumes=''): 

-

""" 

-

create a new Storage instance. 

-

:param gigabytes: 

-

:param snapshots: 

-

:param volumes: 

-

""" 

-

self.gigabytes = gigabytes 

-

self.snapshots = snapshots 

-

self.volumes = volumes 

-

 

-

 

-

class Network(Model): 

-

"""network model the customer 

-

 

-

""" 

-

floating_ips = wsme.wsattr(wsme.types.text, mandatory=True, name="floating-ips") 

-

networks = wsme.wsattr(wsme.types.text, mandatory=True) 

-

ports = wsme.wsattr(wsme.types.text, mandatory=True) 

-

routers = wsme.wsattr(wsme.types.text, mandatory=True) 

-

subnets = wsme.wsattr(wsme.types.text, mandatory=True) 

-

security_groups = wsme.wsattr(wsme.types.text, mandatory=False, name="security-groups") 

-

security_group_rules = wsme.wsattr(wsme.types.text, mandatory=False, name="security-group-rules") 

-

health_monitor = wsme.wsattr(wsme.types.text, mandatory=False, name="health-monitor") 

-

member = wsme.wsattr(wsme.types.text, mandatory=False) 

-

nat_instance = wsme.wsattr(wsme.types.text, mandatory=False, name="nat-instance") 

-

pool = wsme.wsattr(wsme.types.text, mandatory=False) 

-

route_table = wsme.wsattr(wsme.types.text, mandatory=False, name="route-table") 

-

vip = wsme.wsattr(wsme.types.text, mandatory=False) 

-

 

-

def __init__(self, floating_ips='', networks='', ports='', routers='', 

-

subnets='', security_groups=None, security_group_rules=None, 

-

health_monitor='', member='', nat_instance='', 

-

pool='', route_table='', vip=''): 

-

 

-

""" 

-

Create a new Network instance. 

-

:param floating_ips: num of floating_ips 

-

:param networks: num of networks 

-

:param ports: num of ports 

-

:param routers: num of routers 

-

:param subnets: num of subnets 

-

:param security_groups: security groups 

-

:param security_group_rules: security group rules 

-

:param health_monitor: 

-

:param member: 

-

:param nat_instance: 

-

:param pool: 

-

:param route_table: 

-

:param vip: 

-

""" 

-

self.floating_ips = floating_ips 

-

self.networks = networks 

-

self.ports = ports 

-

self.routers = routers 

-

self.subnets = subnets 

-

if security_groups is None: 

-

self.security_groups = conf.quotas_default_values.network.security_groups 

-

else: 

-

self.security_groups = security_groups 

-

if security_group_rules is None: 

-

self.security_group_rules = conf.quotas_default_values.network.security_group_rules 

-

else: 

-

self.security_group_rules = security_group_rules 

-

 

-

self.health_monitor = health_monitor 

-

self.member = member 

-

self.nat_instance = nat_instance 

-

self.pool = pool 

-

self.route_table = route_table 

-

self.vip = vip 

-

 

-

 

-

class Quota(Model): 

-

"""network model the customer 

-

 

-

""" 

-

compute = wsme.wsattr([Compute], mandatory=False) 

-

storage = wsme.wsattr([Storage], mandatory=False) 

-

network = wsme.wsattr([Network], mandatory=False) 

-

 

-

def __init__(self, compute=None, storage=None, network=None): 

-

"""Create a new compute. 

-

 

-

:param compute: compute quota 

-

:param storage: storage quota 

-

:param network: network quota 

-

""" 

-

self.compute = compute 

-

self.storage = storage 

-

self.network = network 

-

 

-

 

-

class User(Model): 

-

"""user model the customer 

-

 

-

""" 

-

id = wsme.wsattr(wsme.types.text, mandatory=True) 

-

role = wsme.wsattr([str]) 

-

 

-

def __init__(self, id="", role=[]): 

-

"""Create a new compute. 

-

 

-

:param id: user id 

-

:param role: roles this use belong to 

-

""" 

-

self.id = id 

-

self.role = role 

-

 

-

 

-

class Region(Model): 

-

"""network model the customer 

-

 

-

""" 

-

name = wsme.wsattr(wsme.types.text, mandatory=True) 

-

type = wsme.wsattr(wsme.types.text, default="single", mandatory=False) 

-

quotas = wsme.wsattr([Quota], mandatory=False) 

-

users = wsme.wsattr([User], mandatory=False) 

-

status = wsme.wsattr(wsme.types.text, mandatory=False) 

-

error_message = wsme.wsattr(wsme.types.text, mandatory=False) 

-

 

-

def __init__(self, name="", type="single", quotas=[], users=[], status="", 

-

error_message=""): 

-

"""Create a new compute. 

-

 

-

:param name: region name 

-

:param type: region type 

-

:param quotas: quotas ( array of Quota) 

-

:param users: array of users of specific region 

-

:param status: status of creation 

-

:param error_message: error message if status is error 

-

""" 

-

 

-

self.name = name 

-

self.type = type 

-

self.quotas = quotas 

-

self.users = users 

-

self.status = status 

-

231 ↛ 232line 231 didn't jump to line 232, because the condition on line 231 was never true if error_message: 

-

self.error_message = error_message 

-

 

-

 

-

class Customer(Model): 

-

"""customer entity with all it's related data 

-

 

-

""" 

-

description = wsme.wsattr(wsme.types.text, mandatory=True) 

-

enabled = wsme.wsattr(bool, mandatory=True) 

-

name = wsme.wsattr(wsme.types.text, mandatory=True) 

-

metadata = wsme.wsattr(wsme.types.DictType(str, str), mandatory=False) 

-

regions = wsme.wsattr([Region], mandatory=False) 

-

users = wsme.wsattr([User], mandatory=True) 

-

defaultQuotas = wsme.wsattr([Quota], mandatory=True) 

-

status = wsme.wsattr(wsme.types.text, mandatory=False) 

-

custId = wsme.wsattr(wsme.types.text, mandatory=False) 

-

uuid = wsme.wsattr(wsme.types.text, mandatory=False) 

-

 

-

def __init__(self, description="", enabled=False, name="", metadata={}, regions=[], users=[], 

-

defaultQuotas=[], status="", custId="", uuid=None): 

-

"""Create a new Customer. 

-

 

-

:param description: Server name 

-

:param enabled: I don't know 

-

:param status: status of creation 

-

""" 

-

self.description = description 

-

self.enabled = enabled 

-

self.name = name 

-

self.metadata = metadata 

-

self.regions = regions 

-

self.users = users 

-

self.defaultQuotas = defaultQuotas 

-

self.status = status 

-

self.custId = custId 

-

267 ↛ 268line 267 didn't jump to line 268, because the condition on line 267 was never true if uuid is not None: 

-

self.uuid = uuid 

-

 

-

def validate_model(self, context=None): 

-

""" 

-

this function check if the customer model meet the demands 

-

:param context: i.e. 'create 'update' 

-

:return: none 

-

""" 

-

276 ↛ exitline 276 didn't return from function 'validate_model', because the condition on line 276 was never false if context == "update": 

-

277 ↛ 278line 277 didn't jump to line 278, because the loop on line 277 never started for region in self.regions: 

-

if region.type == "group": 

-

raise ErrorStatus(400, "region type is invalid for update, \'group\' can be only in create") 

-

 

-

def handle_region_group(self): 

-

regions_to_add = [] 

-

for region in self.regions[:]: # get copy of it to be able to delete from the origin 

-

if region.type == "group": 

-

group_regions = self.get_regions_for_group(region.name) 

-

if not group_regions: 

-

raise ErrorStatus(404, 'Group {} Not found'.format(region.name)) 

-

for group_region in group_regions: 

-

regions_to_add.append(Region(name=group_region, 

-

type='single', 

-

quotas=region.quotas, 

-

users=region.users)) 

-

self.regions.remove(region) 

-

 

-

self.regions.extend(set(regions_to_add)) # remove duplicates if exist 

-

 

-

def get_regions_for_group(self, group_name): 

-

set_utils_conf(conf) 

-

regions = get_regions_of_group(group_name) 

-

return regions 

-

 

-

 

-

""" Customer Result Handler """ 

-

 

-

 

-

class CustomerResult(Model): 

-

id = wsme.wsattr(wsme.types.text, mandatory=True) 

-

updated = wsme.wsattr(wsme.types.text, mandatory=False) 

-

created = wsme.wsattr(wsme.types.text, mandatory=False) 

-

links = wsme.wsattr({str: str}, mandatory=True) 

-

 

-

def __init__(self, id, links={}, updated=None, created=None): 

-

self.id = id 

-

314 ↛ 315line 314 didn't jump to line 315, because the condition on line 314 was never true if updated: 

-

self.updated = updated 

-

316 ↛ 318line 316 didn't jump to line 318, because the condition on line 316 was never false elif created: 

-

self.created = created 

-

self.links = links 

-

 

-

 

-

class CustomerResultWrapper(Model): 

-

transaction_id = wsme.wsattr(wsme.types.text, mandatory=True) 

-

customer = wsme.wsattr(CustomerResult, mandatory=True) 

-

 

-

def __init__(self, transaction_id, id, links, updated, created): 

-

customer_result = CustomerResult(id, links, updated, created) 

-

self.transaction_id = transaction_id 

-

self.customer = customer_result 

-

 

-

 

-

""" ****************************************************************** """ 

-

 

-

""" User Result Handler """ 

-

 

-

 

-

class UserResult(Model): 

-

id = wsme.wsattr(wsme.types.text, mandatory=True) 

-

added = wsme.wsattr(wsme.types.text, mandatory=False) 

-

links = wsme.wsattr({str: str}, mandatory=True) 

-

 

-

def __init__(self, id=None, added=None, links={}): 

-

self.id = id 

-

self.added = added 

-

self.links = links 

-

 

-

 

-

class UserResultWrapper(Model): 

-

transaction_id = wsme.wsattr(wsme.types.text, mandatory=True) 

-

users = wsme.wsattr([UserResult], mandatory=True) 

-

 

-

def __init__(self, transaction_id, users): 

-

users_result = [UserResult(user['id'], user['added'], user['links']) for user in users] 

-

 

-

self.transaction_id = transaction_id 

-

self.users = users_result 

-

 

-

 

-

class MetadataWrapper(Model): 

-

metadata = wsme.wsattr(wsme.types.DictType(str, str), mandatory=True) 

-

 

-

def __init__(self, metadata={}): 

-

self.metadata = metadata 

-

 

-

 

-

""" ****************************************************************** """ 

-

 

-

""" Region Result Handler """ 

-

 

-

 

-

class RegionResult(Model): 

-

id = wsme.wsattr(wsme.types.text, mandatory=True) 

-

added = wsme.wsattr(wsme.types.text, mandatory=False) 

-

links = wsme.wsattr({str: str}, mandatory=True) 

-

 

-

def __init__(self, id, added=None, links={}): 

-

self.id = id 

-

self.added = added 

-

self.links = links 

-

 

-

 

-

class RegionResultWrapper(Model): 

-

transaction_id = wsme.wsattr(wsme.types.text, mandatory=True) 

-

regions = wsme.wsattr([RegionResult], mandatory=True) 

-

 

-

def __init__(self, transaction_id, regions): 

-

regions_result = [RegionResult(region['id'], region['added'], region['links']) for region in regions] 

-

 

-

self.transaction_id = transaction_id 

-

self.regions = regions_result 

-

 

-

 

-

""" ****************************************************************** """ 

-

 

-

""" CustomerSummary is a DataObject and contains all the fields defined in CustomerSummary structure. """ 

-

 

-

 

-

class CustomerSummary(Model): 

-

name = wsme.wsattr(wsme.types.text) 

-

id = wsme.wsattr(wsme.types.text) 

-

description = wsme.wsattr(wsme.types.text) 

-

enabled = wsme.wsattr(bool, mandatory=True) 

-

num_regions = wsme.wsattr(int, mandatory=True) 

-

status = wsme.wsattr(wtypes.text, mandatory=True) 

-

regions = wsme.wsattr([str], mandatory=True) 

-

 

-

def __init__(self, name='', id='', description='', 

-

enabled=True, status="", regions=[], num_regions=0): 

-

Model.__init__(self) 

-

 

-

self.name = name 

-

self.id = id 

-

self.description = description 

-

self.enabled = enabled 

-

self.num_regions = num_regions 

-

self.status = status 

-

self.regions = regions 

-

 

-

@staticmethod 

-

def from_db_model(sql_customer): 

-

regions = [region.region.name for region in 

-

sql_customer.customer_customer_regions if 

-

region.region_id != -1] 

-

# default region is -1 , check if -1 in customer list if yes it will return (true, flase) equal to (0, 1) 

-

num_regions = len(sql_customer.customer_customer_regions) - (-1 in [region.region_id for region in sql_customer.customer_customer_regions]) 

-

customer = CustomerSummary() 

-

customer.id = sql_customer.uuid 

-

customer.name = sql_customer.name 

-

customer.description = sql_customer.description 

-

customer.enabled = bool(sql_customer.enabled) 

-

customer.num_regions = num_regions 

-

customer.regions = regions 

-

 

-

return customer 

-

 

-

 

-

class CustomerSummaryResponse(Model): 

-

customers = wsme.wsattr([CustomerSummary], mandatory=True) 

-

 

-

def __init__(self): 

-

Model.__init__(self) 

-

self.customers = [] 

-

 

-

 

-

""" ****************************************************************** """ 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_model___init___py.html b/orm/services/customer_manager/htmlcov/cms_rest_model___init___py.html deleted file mode 100644 index eeaf9eca..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_model___init___py.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/model/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

- -
-

from pecan import conf # noqa 

-

 

-

 

-

def init_model(): 

-

""" 

-

This is a stub method which is called at application startup time. 

-

 

-

If you need to bind to a parsed database configuration, set up tables or 

-

ORM classes, or perform any database initialization, this is the 

-

recommended place to do it. 

-

 

-

For more information working with databases, and some common recipes, 

-

see http://pecan.readthedocs.org/en/latest/databases.html 

-

""" 

-

pass 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_rds_proxy_py.html b/orm/services/customer_manager/htmlcov/cms_rest_rds_proxy_py.html deleted file mode 100644 index 524ca8ec..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_rds_proxy_py.html +++ /dev/null @@ -1,303 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/rds_proxy.py: 76% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

- -
-

import pprint 

-

import requests 

-

import json 

-

from pecan import conf 

-

from pecan import request 

-

from cms_rest.logic.error_base import ErrorStatus 

-

from cms_rest.logger import get_logger 

-

 

-

LOG = get_logger(__name__) 

-

headers = {'content-type': 'application/json'} 

-

 

-

 

-

class RdsProxy(object): 

-

 

-

@staticmethod 

-

def get_status(resource_id): 

-

try: 

-

LOG.debug( 

-

"Sending to RDS Server to get status: " + conf.api.rds_server.base + conf.api.rds_server.status + resource_id) 

-

resp = requests.get( 

-

conf.api.rds_server.base + conf.api.rds_server.status + resource_id, 

-

verify=conf.verify) 

-

LOG.debug( 

-

"Sending to RDS Server to get status: " + conf.api.rds_server.base + conf.api.rds_server.status + resource_id) 

-

pp = pprint.PrettyPrinter(width=30) 

-

pretty_text = pp.pformat(resp.json()) 

-

LOG.debug("Response from RDS Server:\n" + pretty_text) 

-

return resp 

-

except Exception as exp: 

-

LOG.log_exception( 

-

"CustomerLogic - Failed to Get status for customer : " + resource_id, 

-

exp) 

-

raise 

-

 

-

@staticmethod 

-

def send_customer(customer, transaction_id, method): # method is "POST" or "PUT" 

-

return RdsProxy.send_customer_dict(customer.get_proxy_dict(), transaction_id, method) 

-

 

-

@staticmethod 

-

def send_customer_dict(customer_dict, transaction_id, method): # method is "POST" or "PUT" 

-

data = { 

-

"service_template": 

-

{ 

-

"resource": { 

-

"resource_type": "customer" 

-

}, 

-

"model": str(json.dumps(customer_dict)), 

-

"tracking": { 

-

"external_id": "", 

-

"tracking_id": transaction_id 

-

} 

-

} 

-

} 

-

 

-

data_to_display = { 

-

"service_template": 

-

{ 

-

"resource": { 

-

"resource_type": "customer" 

-

}, 

-

"model": customer_dict, 

-

"tracking": { 

-

"external_id": "", 

-

"tracking_id": transaction_id 

-

} 

-

} 

-

} 

-

 

-

pp = pprint.PrettyPrinter(width=30) 

-

pretty_text = pp.pformat(data_to_display) 

-

wrapper_json = json.dumps(data) 

-

 

-

headers['X-RANGER-Client'] = request.headers[ 

-

'X-RANGER-Client'] if 'X-RANGER-Client' in request.headers else \ 

-

'NA' 

-

headers['X-RANGER-Requester'] = request.headers[ 

-

'X-RANGER-Requester'] if 'X-RANGER-Requester' in request.headers else \ 

-

'' 

-

 

-

LOG.debug("Wrapper JSON before sending action: {0} to Rds Proxy\n{1}".format(method, pretty_text)) 

-

LOG.info("Sending to RDS Server: " + conf.api.rds_server.base + conf.api.rds_server.resources) 

-

 

-

wrapper_json = json.dumps(data) 

-

 

-

85 ↛ 91line 85 didn't jump to line 91, because the condition on line 85 was never false if method == "POST": 

-

resp = requests.post(conf.api.rds_server.base + conf.api.rds_server.resources, 

-

data=wrapper_json, 

-

headers=headers, 

-

verify=conf.verify) 

-

else: 

-

resp = requests.put(conf.api.rds_server.base + conf.api.rds_server.resources, 

-

data=wrapper_json, 

-

headers=headers, 

-

verify=conf.verify) 

-

if resp.content: 

-

LOG.debug("Response Content from rds server: {0}".format(resp.content)) 

-

 

-

content = resp.content 

-

if resp.content: 

-

content = resp.json() 

-

 

-

if resp.content and 200 <= resp.status_code < 300: 

-

content = resp.json() 

-

return content 

-

 

-

raise ErrorStatus(resp.status_code, content) 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_utils___init___py.html b/orm/services/customer_manager/htmlcov/cms_rest_utils___init___py.html deleted file mode 100644 index 448d1ece..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_utils___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/utils/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/cms_rest_utils_authentication_py.html b/orm/services/customer_manager/htmlcov/cms_rest_utils_authentication_py.html deleted file mode 100644 index be78d7b5..00000000 --- a/orm/services/customer_manager/htmlcov/cms_rest_utils_authentication_py.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - Coverage for cms_rest/utils/authentication.py: 76% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

- -
-

import logging 

-

from keystone_utils import tokens 

-

from orm_common.policy import policy 

-

from pecan import conf 

-

 

-

from orm_common.utils import api_error_utils as err_utils 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

def authorize(request, action): 

-

if not _is_authorization_enabled(conf): 

-

return 

-

 

-

auth_region = request.headers.get('X-Auth-Region') 

-

if not auth_region: 

-

raise err_utils.get_error('N/A', message='X-Auth-Region is missing', 

-

status_code=401) 

-

policy.authorize(action, request, conf) 

-

 

-

 

-

def _is_authorization_enabled(app_conf): 

-

return app_conf.authentication.enabled 

-

 

-

 

-

def _get_token_conf(app_conf): 

-

mech_id = app_conf.authentication.mech_id 

-

mech_password = app_conf.authentication.mech_pass 

-

rms_url = app_conf.authentication.rms_url 

-

tenant_name = app_conf.authentication.tenant_name 

-

keystone_version = app_conf.authentication.keystone_version 

-

conf = tokens.TokenConf(mech_id, mech_password, rms_url, tenant_name, 

-

keystone_version) 

-

return conf 

-

 

-

 

-

def check_permissions(app_conf, token_to_validate, lcp_id): 

-

logger.debug("Check permissions...start") 

-

token_role = app_conf.authentication.token_role 

-

try: 

-

if _is_authorization_enabled(app_conf): 

-

41 ↛ 48line 41 didn't jump to line 48, because the condition on line 41 was never false if token_to_validate is not None and lcp_id is not None and str(token_to_validate).strip() != '' and str(lcp_id).strip() != '': 

-

token_conf = _get_token_conf(app_conf) 

-

logger.debug("Authorization: validating token=[{}] on lcp_id=[{}]".format(token_to_validate, lcp_id)) 

-

is_permitted = tokens.is_token_valid(token_to_validate, lcp_id, token_conf, token_role, app_conf.authentication.role_location) 

-

logger.debug("Authorization: The token=[{}] on lcp_id=[{}] is [{}]" 

-

.format(token_to_validate, lcp_id, "valid" if is_permitted else "invalid")) 

-

else: 

-

raise Exception("Token=[{}] and/or Region=[{}] are empty/none.".format(token_to_validate, lcp_id)) 

-

else: 

-

logger.debug("The authentication service is disabled. No authentication is needed.") 

-

is_permitted = True 

-

except Exception as e: 

-

msg = "Fail to validate request. due to {}.".format(e.message) 

-

logger.error(msg) 

-

logger.exception(e) 

-

is_permitted = False 

-

logger.debug("Check permissions...end") 

-

return is_permitted 

- -
-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/coverage_html.js b/orm/services/customer_manager/htmlcov/coverage_html.js deleted file mode 100644 index f6f5de20..00000000 --- a/orm/services/customer_manager/htmlcov/coverage_html.js +++ /dev/null @@ -1,584 +0,0 @@ -// Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 -// For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt - -// Coverage.py HTML report browser code. -/*jslint browser: true, sloppy: true, vars: true, plusplus: true, maxerr: 50, indent: 4 */ -/*global coverage: true, document, window, $ */ - -coverage = {}; - -// Find all the elements with shortkey_* class, and use them to assign a shortcut key. -coverage.assign_shortkeys = function () { - $("*[class*='shortkey_']").each(function (i, e) { - $.each($(e).attr("class").split(" "), function (i, c) { - if (/^shortkey_/.test(c)) { - $(document).bind('keydown', c.substr(9), function () { - $(e).click(); - }); - } - }); - }); -}; - -// Create the events for the help panel. -coverage.wire_up_help_panel = function () { - $("#keyboard_icon").click(function () { - // Show the help panel, and position it so the keyboard icon in the - // panel is in the same place as the keyboard icon in the header. - $(".help_panel").show(); - var koff = $("#keyboard_icon").offset(); - var poff = $("#panel_icon").position(); - $(".help_panel").offset({ - top: koff.top-poff.top, - left: koff.left-poff.left - }); - }); - $("#panel_icon").click(function () { - $(".help_panel").hide(); - }); -}; - -// Create the events for the filter box. -coverage.wire_up_filter = function () { - // Cache elements. - var table = $("table.index"); - var table_rows = table.find("tbody tr"); - var table_row_names = table_rows.find("td.name a"); - var no_rows = $("#no_rows"); - - // Create a duplicate table footer that we can modify with dynamic summed values. - var table_footer = $("table.index tfoot tr"); - var table_dynamic_footer = table_footer.clone(); - table_dynamic_footer.attr('class', 'total_dynamic hidden'); - table_footer.after(table_dynamic_footer); - - // Observe filter keyevents. - $("#filter").on("keyup change", $.debounce(150, function (event) { - var filter_value = $(this).val(); - - if (filter_value === "") { - // Filter box is empty, remove all filtering. - table_rows.removeClass("hidden"); - - // Show standard footer, hide dynamic footer. - table_footer.removeClass("hidden"); - table_dynamic_footer.addClass("hidden"); - - // Hide placeholder, show table. - if (no_rows.length > 0) { - no_rows.hide(); - } - table.show(); - - } - else { - // Filter table items by value. - var hidden = 0; - var shown = 0; - - // Hide / show elements. - $.each(table_row_names, function () { - var element = $(this).parents("tr"); - - if ($(this).text().indexOf(filter_value) === -1) { - // hide - element.addClass("hidden"); - hidden++; - } - else { - // show - element.removeClass("hidden"); - shown++; - } - }); - - // Show placeholder if no rows will be displayed. - if (no_rows.length > 0) { - if (shown === 0) { - // Show placeholder, hide table. - no_rows.show(); - table.hide(); - } - else { - // Hide placeholder, show table. - no_rows.hide(); - table.show(); - } - } - - // Manage dynamic header: - if (hidden > 0) { - // Calculate new dynamic sum values based on visible rows. - for (var column = 2; column < 20; column++) { - // Calculate summed value. - var cells = table_rows.find('td:nth-child(' + column + ')'); - if (!cells.length) { - // No more columns...! - break; - } - - var sum = 0, numer = 0, denom = 0; - $.each(cells.filter(':visible'), function () { - var ratio = $(this).data("ratio"); - if (ratio) { - var splitted = ratio.split(" "); - numer += parseInt(splitted[0], 10); - denom += parseInt(splitted[1], 10); - } - else { - sum += parseInt(this.innerHTML, 10); - } - }); - - // Get footer cell element. - var footer_cell = table_dynamic_footer.find('td:nth-child(' + column + ')'); - - // Set value into dynamic footer cell element. - if (cells[0].innerHTML.indexOf('%') > -1) { - // Percentage columns use the numerator and denominator, - // and adapt to the number of decimal places. - var match = /\.([0-9]+)/.exec(cells[0].innerHTML); - var places = 0; - if (match) { - places = match[1].length; - } - var pct = numer * 100 / denom; - footer_cell.text(pct.toFixed(places) + '%'); - } - else { - footer_cell.text(sum); - } - } - - // Hide standard footer, show dynamic footer. - table_footer.addClass("hidden"); - table_dynamic_footer.removeClass("hidden"); - } - else { - // Show standard footer, hide dynamic footer. - table_footer.removeClass("hidden"); - table_dynamic_footer.addClass("hidden"); - } - } - })); - - // Trigger change event on setup, to force filter on page refresh - // (filter value may still be present). - $("#filter").trigger("change"); -}; - -// Loaded on index.html -coverage.index_ready = function ($) { - // Look for a cookie containing previous sort settings: - var sort_list = []; - var cookie_name = "COVERAGE_INDEX_SORT"; - var i; - - // This almost makes it worth installing the jQuery cookie plugin: - if (document.cookie.indexOf(cookie_name) > -1) { - var cookies = document.cookie.split(";"); - for (i = 0; i < cookies.length; i++) { - var parts = cookies[i].split("="); - - if ($.trim(parts[0]) === cookie_name && parts[1]) { - sort_list = eval("[[" + parts[1] + "]]"); - break; - } - } - } - - // Create a new widget which exists only to save and restore - // the sort order: - $.tablesorter.addWidget({ - id: "persistentSort", - - // Format is called by the widget before displaying: - format: function (table) { - if (table.config.sortList.length === 0 && sort_list.length > 0) { - // This table hasn't been sorted before - we'll use - // our stored settings: - $(table).trigger('sorton', [sort_list]); - } - else { - // This is not the first load - something has - // already defined sorting so we'll just update - // our stored value to match: - sort_list = table.config.sortList; - } - } - }); - - // Configure our tablesorter to handle the variable number of - // columns produced depending on report options: - var headers = []; - var col_count = $("table.index > thead > tr > th").length; - - headers[0] = { sorter: 'text' }; - for (i = 1; i < col_count-1; i++) { - headers[i] = { sorter: 'digit' }; - } - headers[col_count-1] = { sorter: 'percent' }; - - // Enable the table sorter: - $("table.index").tablesorter({ - widgets: ['persistentSort'], - headers: headers - }); - - coverage.assign_shortkeys(); - coverage.wire_up_help_panel(); - coverage.wire_up_filter(); - - // Watch for page unload events so we can save the final sort settings: - $(window).unload(function () { - document.cookie = cookie_name + "=" + sort_list.toString() + "; path=/"; - }); -}; - -// -- pyfile stuff -- - -coverage.pyfile_ready = function ($) { - // If we're directed to a particular line number, highlight the line. - var frag = location.hash; - if (frag.length > 2 && frag[1] === 'n') { - $(frag).addClass('highlight'); - coverage.set_sel(parseInt(frag.substr(2), 10)); - } - else { - coverage.set_sel(0); - } - - $(document) - .bind('keydown', 'j', coverage.to_next_chunk_nicely) - .bind('keydown', 'k', coverage.to_prev_chunk_nicely) - .bind('keydown', '0', coverage.to_top) - .bind('keydown', '1', coverage.to_first_chunk) - ; - - $(".button_toggle_run").click(function (evt) {coverage.toggle_lines(evt.target, "run");}); - $(".button_toggle_exc").click(function (evt) {coverage.toggle_lines(evt.target, "exc");}); - $(".button_toggle_mis").click(function (evt) {coverage.toggle_lines(evt.target, "mis");}); - $(".button_toggle_par").click(function (evt) {coverage.toggle_lines(evt.target, "par");}); - - coverage.assign_shortkeys(); - coverage.wire_up_help_panel(); - - coverage.init_scroll_markers(); - - // Rebuild scroll markers after window high changing - $(window).resize(coverage.resize_scroll_markers); -}; - -coverage.toggle_lines = function (btn, cls) { - btn = $(btn); - var hide = "hide_"+cls; - if (btn.hasClass(hide)) { - $("#source ."+cls).removeClass(hide); - btn.removeClass(hide); - } - else { - $("#source ."+cls).addClass(hide); - btn.addClass(hide); - } -}; - -// Return the nth line div. -coverage.line_elt = function (n) { - return $("#t" + n); -}; - -// Return the nth line number div. -coverage.num_elt = function (n) { - return $("#n" + n); -}; - -// Return the container of all the code. -coverage.code_container = function () { - return $(".linenos"); -}; - -// Set the selection. b and e are line numbers. -coverage.set_sel = function (b, e) { - // The first line selected. - coverage.sel_begin = b; - // The next line not selected. - coverage.sel_end = (e === undefined) ? b+1 : e; -}; - -coverage.to_top = function () { - coverage.set_sel(0, 1); - coverage.scroll_window(0); -}; - -coverage.to_first_chunk = function () { - coverage.set_sel(0, 1); - coverage.to_next_chunk(); -}; - -coverage.is_transparent = function (color) { - // Different browsers return different colors for "none". - return color === "transparent" || color === "rgba(0, 0, 0, 0)"; -}; - -coverage.to_next_chunk = function () { - var c = coverage; - - // Find the start of the next colored chunk. - var probe = c.sel_end; - var color, probe_line; - while (true) { - probe_line = c.line_elt(probe); - if (probe_line.length === 0) { - return; - } - color = probe_line.css("background-color"); - if (!c.is_transparent(color)) { - break; - } - probe++; - } - - // There's a next chunk, `probe` points to it. - var begin = probe; - - // Find the end of this chunk. - var next_color = color; - while (next_color === color) { - probe++; - probe_line = c.line_elt(probe); - next_color = probe_line.css("background-color"); - } - c.set_sel(begin, probe); - c.show_selection(); -}; - -coverage.to_prev_chunk = function () { - var c = coverage; - - // Find the end of the prev colored chunk. - var probe = c.sel_begin-1; - var probe_line = c.line_elt(probe); - if (probe_line.length === 0) { - return; - } - var color = probe_line.css("background-color"); - while (probe > 0 && c.is_transparent(color)) { - probe--; - probe_line = c.line_elt(probe); - if (probe_line.length === 0) { - return; - } - color = probe_line.css("background-color"); - } - - // There's a prev chunk, `probe` points to its last line. - var end = probe+1; - - // Find the beginning of this chunk. - var prev_color = color; - while (prev_color === color) { - probe--; - probe_line = c.line_elt(probe); - prev_color = probe_line.css("background-color"); - } - c.set_sel(probe+1, end); - c.show_selection(); -}; - -// Return the line number of the line nearest pixel position pos -coverage.line_at_pos = function (pos) { - var l1 = coverage.line_elt(1), - l2 = coverage.line_elt(2), - result; - if (l1.length && l2.length) { - var l1_top = l1.offset().top, - line_height = l2.offset().top - l1_top, - nlines = (pos - l1_top) / line_height; - if (nlines < 1) { - result = 1; - } - else { - result = Math.ceil(nlines); - } - } - else { - result = 1; - } - return result; -}; - -// Returns 0, 1, or 2: how many of the two ends of the selection are on -// the screen right now? -coverage.selection_ends_on_screen = function () { - if (coverage.sel_begin === 0) { - return 0; - } - - var top = coverage.line_elt(coverage.sel_begin); - var next = coverage.line_elt(coverage.sel_end-1); - - return ( - (top.isOnScreen() ? 1 : 0) + - (next.isOnScreen() ? 1 : 0) - ); -}; - -coverage.to_next_chunk_nicely = function () { - coverage.finish_scrolling(); - if (coverage.selection_ends_on_screen() === 0) { - // The selection is entirely off the screen: select the top line on - // the screen. - var win = $(window); - coverage.select_line_or_chunk(coverage.line_at_pos(win.scrollTop())); - } - coverage.to_next_chunk(); -}; - -coverage.to_prev_chunk_nicely = function () { - coverage.finish_scrolling(); - if (coverage.selection_ends_on_screen() === 0) { - var win = $(window); - coverage.select_line_or_chunk(coverage.line_at_pos(win.scrollTop() + win.height())); - } - coverage.to_prev_chunk(); -}; - -// Select line number lineno, or if it is in a colored chunk, select the -// entire chunk -coverage.select_line_or_chunk = function (lineno) { - var c = coverage; - var probe_line = c.line_elt(lineno); - if (probe_line.length === 0) { - return; - } - var the_color = probe_line.css("background-color"); - if (!c.is_transparent(the_color)) { - // The line is in a highlighted chunk. - // Search backward for the first line. - var probe = lineno; - var color = the_color; - while (probe > 0 && color === the_color) { - probe--; - probe_line = c.line_elt(probe); - if (probe_line.length === 0) { - break; - } - color = probe_line.css("background-color"); - } - var begin = probe + 1; - - // Search forward for the last line. - probe = lineno; - color = the_color; - while (color === the_color) { - probe++; - probe_line = c.line_elt(probe); - color = probe_line.css("background-color"); - } - - coverage.set_sel(begin, probe); - } - else { - coverage.set_sel(lineno); - } -}; - -coverage.show_selection = function () { - var c = coverage; - - // Highlight the lines in the chunk - c.code_container().find(".highlight").removeClass("highlight"); - for (var probe = c.sel_begin; probe > 0 && probe < c.sel_end; probe++) { - c.num_elt(probe).addClass("highlight"); - } - - c.scroll_to_selection(); -}; - -coverage.scroll_to_selection = function () { - // Scroll the page if the chunk isn't fully visible. - if (coverage.selection_ends_on_screen() < 2) { - // Need to move the page. The html,body trick makes it scroll in all - // browsers, got it from http://stackoverflow.com/questions/3042651 - var top = coverage.line_elt(coverage.sel_begin); - var top_pos = parseInt(top.offset().top, 10); - coverage.scroll_window(top_pos - 30); - } -}; - -coverage.scroll_window = function (to_pos) { - $("html,body").animate({scrollTop: to_pos}, 200); -}; - -coverage.finish_scrolling = function () { - $("html,body").stop(true, true); -}; - -coverage.init_scroll_markers = function () { - var c = coverage; - // Init some variables - c.lines_len = $('td.text p').length; - c.body_h = $('body').height(); - c.header_h = $('div#header').height(); - c.missed_lines = $('td.text p.mis, td.text p.par'); - - // Build html - c.resize_scroll_markers(); -}; - -coverage.resize_scroll_markers = function () { - var c = coverage, - min_line_height = 3, - max_line_height = 10, - visible_window_h = $(window).height(); - - $('#scroll_marker').remove(); - // Don't build markers if the window has no scroll bar. - if (c.body_h <= visible_window_h) { - return; - } - - $("body").append("
 
"); - var scroll_marker = $('#scroll_marker'), - marker_scale = scroll_marker.height() / c.body_h, - line_height = scroll_marker.height() / c.lines_len; - - // Line height must be between the extremes. - if (line_height > min_line_height) { - if (line_height > max_line_height) { - line_height = max_line_height; - } - } - else { - line_height = min_line_height; - } - - var previous_line = -99, - last_mark, - last_top; - - c.missed_lines.each(function () { - var line_top = Math.round($(this).offset().top * marker_scale), - id_name = $(this).attr('id'), - line_number = parseInt(id_name.substring(1, id_name.length)); - - if (line_number === previous_line + 1) { - // If this solid missed block just make previous mark higher. - last_mark.css({ - 'height': line_top + line_height - last_top - }); - } - else { - // Add colored line in scroll_marker block. - scroll_marker.append('
'); - last_mark = $('#m' + line_number); - last_mark.css({ - 'height': line_height, - 'top': line_top - }); - last_top = line_top; - } - - previous_line = line_number; - }); -}; diff --git a/orm/services/customer_manager/htmlcov/index.html b/orm/services/customer_manager/htmlcov/index.html deleted file mode 100644 index db1c2411..00000000 --- a/orm/services/customer_manager/htmlcov/index.html +++ /dev/null @@ -1,440 +0,0 @@ - - - - - - - - Coverage report - - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- n - s - m - x - - b - p - - c   change column sorting -

-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Modulestatementsmissingexcludedbranchespartialcoverage
Total141720303125582%
cms_rest/__init__.py00000100%
cms_rest/app.py22302183%
cms_rest/controllers/__init__.py00000100%
cms_rest/controllers/root.py10100090%
cms_rest/controllers/v1/__init__.py00000100%
cms_rest/controllers/v1/base.py16400075%
cms_rest/controllers/v1/orm/__init__.py00000100%
cms_rest/controllers/v1/orm/configuration.py140000100%
cms_rest/controllers/v1/orm/customer/__init__.py00000100%
cms_rest/controllers/v1/orm/customer/enabled.py33302091%
cms_rest/controllers/v1/orm/customer/metadata.py5200160100%
cms_rest/controllers/v1/orm/customer/regions.py753012294%
cms_rest/controllers/v1/orm/customer/root.py1113014197%
cms_rest/controllers/v1/orm/customer/users.py13815030986%
cms_rest/controllers/v1/orm/logs.py332004035%
cms_rest/controllers/v1/orm/root.py80000100%
cms_rest/controllers/v1/root.py40000100%
cms_rest/logger/__init__.py60020100%
cms_rest/logic/__init__.py00000100%
cms_rest/logic/customer_logic.py4666401623481%
cms_rest/logic/error_base.py14200086%
cms_rest/logic/metadata_logic.py7460020015%
cms_rest/model/Model.py7100086%
cms_rest/model/Models.py2415032695%
cms_rest/model/__init__.py30000100%
cms_rest/rds_proxy.py471208176%
cms_rest/utils/__init__.py00000100%
cms_rest/utils/authentication.py43708176%
- -

- No items found using the specified filter. -

-
- - - - - diff --git a/orm/services/customer_manager/htmlcov/jquery.ba-throttle-debounce.min.js b/orm/services/customer_manager/htmlcov/jquery.ba-throttle-debounce.min.js deleted file mode 100644 index 648fe5d3..00000000 --- a/orm/services/customer_manager/htmlcov/jquery.ba-throttle-debounce.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * jQuery throttle / debounce - v1.1 - 3/7/2010 - * http://benalman.com/projects/jquery-throttle-debounce-plugin/ - * - * Copyright (c) 2010 "Cowboy" Ben Alman - * Dual licensed under the MIT and GPL licenses. - * http://benalman.com/about/license/ - */ -(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); diff --git a/orm/services/customer_manager/htmlcov/jquery.hotkeys.js b/orm/services/customer_manager/htmlcov/jquery.hotkeys.js deleted file mode 100644 index 73c552fc..00000000 --- a/orm/services/customer_manager/htmlcov/jquery.hotkeys.js +++ /dev/null @@ -1,100 +0,0 @@ -/* - * jQuery Hotkeys Plugin - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * - * Based upon the plugin by Tzury Bar Yochay: - * http://github.com/tzuryby/hotkeys - * - * Original idea by: - * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ -*/ - -(function(jQuery){ - - jQuery.hotkeys = { - version: "0.8", - - specialKeys: { - 8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause", - 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home", - 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del", - 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7", - 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/", - 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8", - 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 188: ",", 190: ".", - 191: "/", 224: "meta" - }, - - shiftNums: { - "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&", - "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<", - ".": ">", "/": "?", "\\": "|" - } - }; - - function keyHandler( handleObj ) { - // Only care when a possible input has been specified - if ( typeof handleObj.data !== "string" ) { - return; - } - - var origHandler = handleObj.handler, - keys = handleObj.data.toLowerCase().split(" "); - - handleObj.handler = function( event ) { - // Don't fire in text-accepting inputs that we didn't directly bind to - if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) || - event.target.type === "text" || $(event.target).prop('contenteditable') == 'true' )) { - return; - } - - // Keypress represents characters, not special keys - var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ], - character = String.fromCharCode( event.which ).toLowerCase(), - key, modif = "", possible = {}; - - // check combinations (alt|ctrl|shift+anything) - if ( event.altKey && special !== "alt" ) { - modif += "alt+"; - } - - if ( event.ctrlKey && special !== "ctrl" ) { - modif += "ctrl+"; - } - - // TODO: Need to make sure this works consistently across platforms - if ( event.metaKey && !event.ctrlKey && special !== "meta" ) { - modif += "meta+"; - } - - if ( event.shiftKey && special !== "shift" ) { - modif += "shift+"; - } - - if ( special ) { - possible[ modif + special ] = true; - - } else { - possible[ modif + character ] = true; - possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true; - - // "$" can be triggered as "Shift+4" or "Shift+$" or just "$" - if ( modif === "shift+" ) { - possible[ jQuery.hotkeys.shiftNums[ character ] ] = true; - } - } - - for ( var i = 0, l = keys.length; i < l; i++ ) { - if ( possible[ keys[i] ] ) { - return origHandler.apply( this, arguments ); - } - } - }; - } - - jQuery.each([ "keydown", "keyup", "keypress" ], function() { - jQuery.event.special[ this ] = { add: keyHandler }; - }); - -})( jQuery ); diff --git a/orm/services/customer_manager/htmlcov/jquery.isonscreen.js b/orm/services/customer_manager/htmlcov/jquery.isonscreen.js deleted file mode 100644 index 0182ebd2..00000000 --- a/orm/services/customer_manager/htmlcov/jquery.isonscreen.js +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) 2010 - * @author Laurence Wheway - * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) - * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. - * - * @version 1.2.0 - */ -(function($) { - jQuery.extend({ - isOnScreen: function(box, container) { - //ensure numbers come in as intgers (not strings) and remove 'px' is it's there - for(var i in box){box[i] = parseFloat(box[i])}; - for(var i in container){container[i] = parseFloat(container[i])}; - - if(!container){ - container = { - left: $(window).scrollLeft(), - top: $(window).scrollTop(), - width: $(window).width(), - height: $(window).height() - } - } - - if( box.left+box.width-container.left > 0 && - box.left < container.width+container.left && - box.top+box.height-container.top > 0 && - box.top < container.height+container.top - ) return true; - return false; - } - }) - - - jQuery.fn.isOnScreen = function (container) { - for(var i in container){container[i] = parseFloat(container[i])}; - - if(!container){ - container = { - left: $(window).scrollLeft(), - top: $(window).scrollTop(), - width: $(window).width(), - height: $(window).height() - } - } - - if( $(this).offset().left+$(this).width()-container.left > 0 && - $(this).offset().left < container.width+container.left && - $(this).offset().top+$(this).height()-container.top > 0 && - $(this).offset().top < container.height+container.top - ) return true; - return false; - } -})(jQuery); diff --git a/orm/services/customer_manager/htmlcov/jquery.min.js b/orm/services/customer_manager/htmlcov/jquery.min.js deleted file mode 100644 index 0d2eab26..00000000 --- a/orm/services/customer_manager/htmlcov/jquery.min.js +++ /dev/null @@ -1,9404 +0,0 @@ -/*! - * jQuery JavaScript Library v1.7.2 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Fri Jul 5 14:07:58 UTC 2013 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context ? context.ownerDocument || context : document ); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.7.2", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.add( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.fireWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).off( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery.Callbacks( "once memory" ); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array, i ) { - var len; - - if ( array ) { - if ( indexOf ) { - return indexOf.call( array, elem, i ); - } - - len = array.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in array && array[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, pass ) { - var exec, - bulk = key == null, - i = 0, - length = elems.length; - - // Sets many values - if ( key && typeof key === "object" ) { - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); - } - chainable = 1; - - // Sets one value - } else if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = pass === undefined && jQuery.isFunction( value ); - - if ( bulk ) { - // Bulk operations only iterate when executing function values - if ( exec ) { - exec = fn; - fn = function( elem, key, value ) { - return exec.call( jQuery( elem ), value ); - }; - - // Otherwise they run against the entire set - } else { - fn.call( elems, value ); - fn = null; - } - } - - if ( fn ) { - for (; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - } - - chainable = 1; - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -// String to Object flags format cache -var flagsCache = {}; - -// Convert String-formatted flags into Object-formatted ones and store in cache -function createFlags( flags ) { - var object = flagsCache[ flags ] = {}, - i, length; - flags = flags.split( /\s+/ ); - for ( i = 0, length = flags.length; i < length; i++ ) { - object[ flags[i] ] = true; - } - return object; -} - -/* - * Create a callback list using the following parameters: - * - * flags: an optional list of space-separated flags that will change how - * the callback list behaves - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible flags: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( flags ) { - - // Convert flags from String-formatted to Object-formatted - // (we check in cache first) - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; - - var // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = [], - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Add one or several callbacks to the list - add = function( args ) { - var i, - length, - elem, - type, - actual; - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - // Inspect recursively - add( elem ); - } else if ( type === "function" ) { - // Add if not in unique mode and callback is not in - if ( !flags.unique || !self.has( elem ) ) { - list.push( elem ); - } - } - } - }, - // Fire callbacks - fire = function( context, args ) { - args = args || []; - memory = !flags.memory || [ context, args ]; - fired = true; - firing = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { - memory = true; // Mark as halted - break; - } - } - firing = false; - if ( list ) { - if ( !flags.once ) { - if ( stack && stack.length ) { - memory = stack.shift(); - self.fireWith( memory[ 0 ], memory[ 1 ] ); - } - } else if ( memory === true ) { - self.disable(); - } else { - list = []; - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - var length = list.length; - add( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away, unless previous - // firing was halted (stopOnFalse) - } else if ( memory && memory !== true ) { - firingStart = length; - fire( memory[ 0 ], memory[ 1 ] ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - var args = arguments, - argIndex = 0, - argLength = args.length; - for ( ; argIndex < argLength ; argIndex++ ) { - for ( var i = 0; i < list.length; i++ ) { - if ( args[ argIndex ] === list[ i ] ) { - // Handle firingIndex and firingLength - if ( firing ) { - if ( i <= firingLength ) { - firingLength--; - if ( i <= firingIndex ) { - firingIndex--; - } - } - } - // Remove the element - list.splice( i--, 1 ); - // If we have some unicity property then - // we only need to do this once - if ( flags.unique ) { - break; - } - } - } - } - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - if ( list ) { - var i = 0, - length = list.length; - for ( ; i < length; i++ ) { - if ( fn === list[ i ] ) { - return true; - } - } - } - return false; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory || memory === true ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( stack ) { - if ( firing ) { - if ( !flags.once ) { - stack.push( [ context, args ] ); - } - } else if ( !( flags.once && memory ) ) { - fire( context, args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - - - -var // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - - Deferred: function( func ) { - var doneList = jQuery.Callbacks( "once memory" ), - failList = jQuery.Callbacks( "once memory" ), - progressList = jQuery.Callbacks( "memory" ), - state = "pending", - lists = { - resolve: doneList, - reject: failList, - notify: progressList - }, - promise = { - done: doneList.add, - fail: failList.add, - progress: progressList.add, - - state: function() { - return state; - }, - - // Deprecated - isResolved: doneList.fired, - isRejected: failList.fired, - - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); - return this; - }, - always: function() { - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); - return this; - }, - pipe: function( fnDone, fnFail, fnProgress ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ], - progress: [ fnProgress, "notify" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - obj = promise; - } else { - for ( var key in promise ) { - obj[ key ] = promise[ key ]; - } - } - return obj; - } - }, - deferred = promise.promise({}), - key; - - for ( key in lists ) { - deferred[ key ] = lists[ key ].fire; - deferred[ key + "With" ] = lists[ key ].fireWith; - } - - // Handle state - deferred.done( function() { - state = "resolved"; - }, failList.disable, progressList.lock ).fail( function() { - state = "rejected"; - }, doneList.disable, progressList.lock ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = sliceDeferred.call( arguments, 0 ), - i = 0, - length = args.length, - pValues = new Array( length ), - count = length, - pCount = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(), - promise = deferred.promise(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - deferred.resolveWith( deferred, args ); - } - }; - } - function progressFunc( i ) { - return function( value ) { - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - deferred.notifyWith( promise, pValues ); - }; - } - if ( length > 1 ) { - for ( ; i < length; i++ ) { - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return promise; - } -}); - - - - -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - fragment, - tds, - events, - eventName, - i, - isSupported, - div = document.createElement( "div" ), - documentElement = document.documentElement; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - pixelMargin: true - }; - - // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead - jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat"); - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for ( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight, - paddingMarginBorderVisibility, paddingMarginBorder, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - paddingMarginBorder = "padding:0;margin:0;border:"; - positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;"; - paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;"; - style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;"; - html = "
" + - "" + - "
"; - - container = document.createElement("div"); - container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
t
"; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - div.innerHTML = ""; - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.innerHTML = ""; - div.style.width = div.style.padding = "1px"; - div.style.border = 0; - div.style.overflow = "hidden"; - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = "block"; - div.style.overflow = "visible"; - div.innerHTML = "
"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - } - - div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - if ( window.getComputedStyle ) { - div.style.marginTop = "1%"; - support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%"; - } - - if ( typeof container.style.zoom !== "undefined" ) { - container.style.zoom = 1; - } - - body.removeChild( container ); - marginDiv = div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, part, attr, name, l, - elem = this[0], - i = 0, - data = null; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attr = elem.attributes; - for ( l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split( ".", 2 ); - parts[1] = parts[1] ? "." + parts[1] : ""; - part = parts[1] + "!"; - - return jQuery.access( this, function( value ) { - - if ( value === undefined ) { - data = this.triggerHandler( "getData" + part, [ parts[0] ] ); - - // Try to fetch any internally stored data first - if ( data === undefined && elem ) { - data = jQuery.data( elem, key ); - data = dataAttr( elem, key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } - - parts[1] = value; - this.each(function() { - var self = jQuery( this ); - - self.triggerHandler( "setData" + part, parts ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + part, parts ); - }); - }, null, value, arguments.length > 1, null, false ); - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise( object ); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, isBool, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - isBool = rboolean.test( name ); - - // See #9699 for explanation of this approach (setting first, then removal) - // Do not do this for boolean attributes (see #10870) - if ( !isBool ) { - jQuery.attr( elem, name, "" ); - } - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( isBool && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true, - coords: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, - rhoverHack = /(?:^|\s)hover(\.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: selector && quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - special = jQuery.event.special[ event.type ] || {}, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers that should run if there are delegated events - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - - // Don't process events on disabled elements (#6911, #8165) - if ( cur.disabled !== true ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { // && selector != null - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparison -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - /* falls through */ - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} -// Expose origPOS -// "global" as in regardless of relation to brackets/parens -Expr.match.globalPOS = origPOS; - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

"; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
"; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.globalPOS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /]", "i"), - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /\/(java|ecma)script/i, - rcleanScript = /^\s*", "" ], - legend: [ 1, "
", "
" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - col: [ 2, "", "
" ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- n - s - m - x - - c   change column sorting -

-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Modulestatementsmissingexcludedcoverage
Total1287160088%
rms/__init__.py000100%
rms/controllers/__init__.py000100%
rms/controllers/configuration.py1700100%
rms/controllers/lcp_controller.py5600100%
rms/controllers/logs.py362094%
rms/controllers/root.py121092%
rms/controllers/v2/__init__.py000100%
rms/controllers/v2/orm/__init__.py000100%
rms/controllers/v2/orm/resources/__init__.py000100%
rms/controllers/v2/orm/resources/groups.py12422082%
rms/controllers/v2/orm/resources/metadata.py8519078%
rms/controllers/v2/orm/resources/regions.py1875097%
rms/controllers/v2/orm/resources/status.py473094%
rms/controllers/v2/orm/root.py500100%
rms/controllers/v2/root.py300100%
rms/external_mock/__init__.py000100%
rms/external_mock/audit_client/__init__.py000100%
rms/external_mock/audit_client/api/__init__.py000100%
rms/external_mock/audit_client/api/audit.py4400%
rms/external_mock/keystone_utils/__init__.py000100%
rms/external_mock/keystone_utils/tokens.py51080%
rms/external_mock/orm_common/__init__.py000100%
rms/external_mock/orm_common/policy/__init__.py000100%
rms/external_mock/orm_common/policy/policy.py62067%
rms/external_mock/orm_common/utils/__init__.py000100%
rms/external_mock/orm_common/utils/api_error_utils.py21050%
rms/external_mock/orm_common/utils/utils.py61083%
rms/model/__init__.py300100%
rms/model/model.py1007093%
rms/model/url_parm.py634094%
rms/services/__init__.py000100%
rms/services/error_base.py182089%
rms/services/services.py17055068%
rms/storage/__init__.py000100%
rms/storage/base_data_manager.py2400100%
rms/storage/data_manager_factory.py1200100%
rms/storage/my_sql/__init__.py000100%
rms/storage/my_sql/data_manager.py27031089%
rms/utils/__init__.py000100%
rms/utils/authentication.py3200100%
- -

- No items found using the specified filter. -

-
- - - - - diff --git a/orm/services/region_manager/cover/jquery.ba-throttle-debounce.min.js b/orm/services/region_manager/cover/jquery.ba-throttle-debounce.min.js deleted file mode 100644 index 648fe5d3..00000000 --- a/orm/services/region_manager/cover/jquery.ba-throttle-debounce.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * jQuery throttle / debounce - v1.1 - 3/7/2010 - * http://benalman.com/projects/jquery-throttle-debounce-plugin/ - * - * Copyright (c) 2010 "Cowboy" Ben Alman - * Dual licensed under the MIT and GPL licenses. - * http://benalman.com/about/license/ - */ -(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); diff --git a/orm/services/region_manager/cover/jquery.hotkeys.js b/orm/services/region_manager/cover/jquery.hotkeys.js deleted file mode 100644 index 09b21e03..00000000 --- a/orm/services/region_manager/cover/jquery.hotkeys.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * jQuery Hotkeys Plugin - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * - * Based upon the plugin by Tzury Bar Yochay: - * http://github.com/tzuryby/hotkeys - * - * Original idea by: - * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ -*/ - -(function(jQuery){ - - jQuery.hotkeys = { - version: "0.8", - - specialKeys: { - 8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause", - 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home", - 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del", - 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7", - 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/", - 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8", - 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta" - }, - - shiftNums: { - "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&", - "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<", - ".": ">", "/": "?", "\\": "|" - } - }; - - function keyHandler( handleObj ) { - // Only care when a possible input has been specified - if ( typeof handleObj.data !== "string" ) { - return; - } - - var origHandler = handleObj.handler, - keys = handleObj.data.toLowerCase().split(" "); - - handleObj.handler = function( event ) { - // Don't fire in text-accepting inputs that we didn't directly bind to - if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) || - event.target.type === "text") ) { - return; - } - - // Keypress represents characters, not special keys - var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ], - character = String.fromCharCode( event.which ).toLowerCase(), - key, modif = "", possible = {}; - - // check combinations (alt|ctrl|shift+anything) - if ( event.altKey && special !== "alt" ) { - modif += "alt+"; - } - - if ( event.ctrlKey && special !== "ctrl" ) { - modif += "ctrl+"; - } - - // TODO: Need to make sure this works consistently across platforms - if ( event.metaKey && !event.ctrlKey && special !== "meta" ) { - modif += "meta+"; - } - - if ( event.shiftKey && special !== "shift" ) { - modif += "shift+"; - } - - if ( special ) { - possible[ modif + special ] = true; - - } else { - possible[ modif + character ] = true; - possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true; - - // "$" can be triggered as "Shift+4" or "Shift+$" or just "$" - if ( modif === "shift+" ) { - possible[ jQuery.hotkeys.shiftNums[ character ] ] = true; - } - } - - for ( var i = 0, l = keys.length; i < l; i++ ) { - if ( possible[ keys[i] ] ) { - return origHandler.apply( this, arguments ); - } - } - }; - } - - jQuery.each([ "keydown", "keyup", "keypress" ], function() { - jQuery.event.special[ this ] = { add: keyHandler }; - }); - -})( jQuery ); diff --git a/orm/services/region_manager/cover/jquery.isonscreen.js b/orm/services/region_manager/cover/jquery.isonscreen.js deleted file mode 100644 index 0182ebd2..00000000 --- a/orm/services/region_manager/cover/jquery.isonscreen.js +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) 2010 - * @author Laurence Wheway - * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) - * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. - * - * @version 1.2.0 - */ -(function($) { - jQuery.extend({ - isOnScreen: function(box, container) { - //ensure numbers come in as intgers (not strings) and remove 'px' is it's there - for(var i in box){box[i] = parseFloat(box[i])}; - for(var i in container){container[i] = parseFloat(container[i])}; - - if(!container){ - container = { - left: $(window).scrollLeft(), - top: $(window).scrollTop(), - width: $(window).width(), - height: $(window).height() - } - } - - if( box.left+box.width-container.left > 0 && - box.left < container.width+container.left && - box.top+box.height-container.top > 0 && - box.top < container.height+container.top - ) return true; - return false; - } - }) - - - jQuery.fn.isOnScreen = function (container) { - for(var i in container){container[i] = parseFloat(container[i])}; - - if(!container){ - container = { - left: $(window).scrollLeft(), - top: $(window).scrollTop(), - width: $(window).width(), - height: $(window).height() - } - } - - if( $(this).offset().left+$(this).width()-container.left > 0 && - $(this).offset().left < container.width+container.left && - $(this).offset().top+$(this).height()-container.top > 0 && - $(this).offset().top < container.height+container.top - ) return true; - return false; - } -})(jQuery); diff --git a/orm/services/region_manager/cover/jquery.min.js b/orm/services/region_manager/cover/jquery.min.js deleted file mode 100644 index 0d2eab26..00000000 --- a/orm/services/region_manager/cover/jquery.min.js +++ /dev/null @@ -1,9404 +0,0 @@ -/*! - * jQuery JavaScript Library v1.7.2 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Fri Jul 5 14:07:58 UTC 2013 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context ? context.ownerDocument || context : document ); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.7.2", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.add( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.fireWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).off( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery.Callbacks( "once memory" ); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array, i ) { - var len; - - if ( array ) { - if ( indexOf ) { - return indexOf.call( array, elem, i ); - } - - len = array.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in array && array[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, pass ) { - var exec, - bulk = key == null, - i = 0, - length = elems.length; - - // Sets many values - if ( key && typeof key === "object" ) { - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); - } - chainable = 1; - - // Sets one value - } else if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = pass === undefined && jQuery.isFunction( value ); - - if ( bulk ) { - // Bulk operations only iterate when executing function values - if ( exec ) { - exec = fn; - fn = function( elem, key, value ) { - return exec.call( jQuery( elem ), value ); - }; - - // Otherwise they run against the entire set - } else { - fn.call( elems, value ); - fn = null; - } - } - - if ( fn ) { - for (; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - } - - chainable = 1; - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -// String to Object flags format cache -var flagsCache = {}; - -// Convert String-formatted flags into Object-formatted ones and store in cache -function createFlags( flags ) { - var object = flagsCache[ flags ] = {}, - i, length; - flags = flags.split( /\s+/ ); - for ( i = 0, length = flags.length; i < length; i++ ) { - object[ flags[i] ] = true; - } - return object; -} - -/* - * Create a callback list using the following parameters: - * - * flags: an optional list of space-separated flags that will change how - * the callback list behaves - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible flags: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( flags ) { - - // Convert flags from String-formatted to Object-formatted - // (we check in cache first) - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; - - var // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = [], - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Add one or several callbacks to the list - add = function( args ) { - var i, - length, - elem, - type, - actual; - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - // Inspect recursively - add( elem ); - } else if ( type === "function" ) { - // Add if not in unique mode and callback is not in - if ( !flags.unique || !self.has( elem ) ) { - list.push( elem ); - } - } - } - }, - // Fire callbacks - fire = function( context, args ) { - args = args || []; - memory = !flags.memory || [ context, args ]; - fired = true; - firing = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { - memory = true; // Mark as halted - break; - } - } - firing = false; - if ( list ) { - if ( !flags.once ) { - if ( stack && stack.length ) { - memory = stack.shift(); - self.fireWith( memory[ 0 ], memory[ 1 ] ); - } - } else if ( memory === true ) { - self.disable(); - } else { - list = []; - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - var length = list.length; - add( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away, unless previous - // firing was halted (stopOnFalse) - } else if ( memory && memory !== true ) { - firingStart = length; - fire( memory[ 0 ], memory[ 1 ] ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - var args = arguments, - argIndex = 0, - argLength = args.length; - for ( ; argIndex < argLength ; argIndex++ ) { - for ( var i = 0; i < list.length; i++ ) { - if ( args[ argIndex ] === list[ i ] ) { - // Handle firingIndex and firingLength - if ( firing ) { - if ( i <= firingLength ) { - firingLength--; - if ( i <= firingIndex ) { - firingIndex--; - } - } - } - // Remove the element - list.splice( i--, 1 ); - // If we have some unicity property then - // we only need to do this once - if ( flags.unique ) { - break; - } - } - } - } - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - if ( list ) { - var i = 0, - length = list.length; - for ( ; i < length; i++ ) { - if ( fn === list[ i ] ) { - return true; - } - } - } - return false; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory || memory === true ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( stack ) { - if ( firing ) { - if ( !flags.once ) { - stack.push( [ context, args ] ); - } - } else if ( !( flags.once && memory ) ) { - fire( context, args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - - - -var // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - - Deferred: function( func ) { - var doneList = jQuery.Callbacks( "once memory" ), - failList = jQuery.Callbacks( "once memory" ), - progressList = jQuery.Callbacks( "memory" ), - state = "pending", - lists = { - resolve: doneList, - reject: failList, - notify: progressList - }, - promise = { - done: doneList.add, - fail: failList.add, - progress: progressList.add, - - state: function() { - return state; - }, - - // Deprecated - isResolved: doneList.fired, - isRejected: failList.fired, - - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); - return this; - }, - always: function() { - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); - return this; - }, - pipe: function( fnDone, fnFail, fnProgress ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ], - progress: [ fnProgress, "notify" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - obj = promise; - } else { - for ( var key in promise ) { - obj[ key ] = promise[ key ]; - } - } - return obj; - } - }, - deferred = promise.promise({}), - key; - - for ( key in lists ) { - deferred[ key ] = lists[ key ].fire; - deferred[ key + "With" ] = lists[ key ].fireWith; - } - - // Handle state - deferred.done( function() { - state = "resolved"; - }, failList.disable, progressList.lock ).fail( function() { - state = "rejected"; - }, doneList.disable, progressList.lock ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = sliceDeferred.call( arguments, 0 ), - i = 0, - length = args.length, - pValues = new Array( length ), - count = length, - pCount = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(), - promise = deferred.promise(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - deferred.resolveWith( deferred, args ); - } - }; - } - function progressFunc( i ) { - return function( value ) { - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - deferred.notifyWith( promise, pValues ); - }; - } - if ( length > 1 ) { - for ( ; i < length; i++ ) { - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return promise; - } -}); - - - - -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - fragment, - tds, - events, - eventName, - i, - isSupported, - div = document.createElement( "div" ), - documentElement = document.documentElement; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - pixelMargin: true - }; - - // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead - jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat"); - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for ( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight, - paddingMarginBorderVisibility, paddingMarginBorder, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - paddingMarginBorder = "padding:0;margin:0;border:"; - positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;"; - paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;"; - style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;"; - html = "
" + - "" + - "
"; - - container = document.createElement("div"); - container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
t
"; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - div.innerHTML = ""; - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.innerHTML = ""; - div.style.width = div.style.padding = "1px"; - div.style.border = 0; - div.style.overflow = "hidden"; - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = "block"; - div.style.overflow = "visible"; - div.innerHTML = "
"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - } - - div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - if ( window.getComputedStyle ) { - div.style.marginTop = "1%"; - support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%"; - } - - if ( typeof container.style.zoom !== "undefined" ) { - container.style.zoom = 1; - } - - body.removeChild( container ); - marginDiv = div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, part, attr, name, l, - elem = this[0], - i = 0, - data = null; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attr = elem.attributes; - for ( l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split( ".", 2 ); - parts[1] = parts[1] ? "." + parts[1] : ""; - part = parts[1] + "!"; - - return jQuery.access( this, function( value ) { - - if ( value === undefined ) { - data = this.triggerHandler( "getData" + part, [ parts[0] ] ); - - // Try to fetch any internally stored data first - if ( data === undefined && elem ) { - data = jQuery.data( elem, key ); - data = dataAttr( elem, key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } - - parts[1] = value; - this.each(function() { - var self = jQuery( this ); - - self.triggerHandler( "setData" + part, parts ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + part, parts ); - }); - }, null, value, arguments.length > 1, null, false ); - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise( object ); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, isBool, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - isBool = rboolean.test( name ); - - // See #9699 for explanation of this approach (setting first, then removal) - // Do not do this for boolean attributes (see #10870) - if ( !isBool ) { - jQuery.attr( elem, name, "" ); - } - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( isBool && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true, - coords: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, - rhoverHack = /(?:^|\s)hover(\.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: selector && quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - special = jQuery.event.special[ event.type ] || {}, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers that should run if there are delegated events - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - - // Don't process events on disabled elements (#6911, #8165) - if ( cur.disabled !== true ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { // && selector != null - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparison -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - /* falls through */ - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} -// Expose origPOS -// "global" as in regardless of relation to brackets/parens -Expr.match.globalPOS = origPOS; - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

"; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
"; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.globalPOS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /]", "i"), - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /\/(java|ecma)script/i, - rcleanScript = /^\s*", "" ], - legend: [ 1, "
", "
" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - col: [ 2, "", "
" ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers___init___py.html b/orm/services/region_manager/cover/rms_controllers___init___py.html deleted file mode 100644 index e9a4bb7f..00000000 --- a/orm/services/region_manager/cover/rms_controllers___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers_configuration_py.html b/orm/services/region_manager/cover/rms_controllers_configuration_py.html deleted file mode 100644 index 5fd6bb6f..00000000 --- a/orm/services/region_manager/cover/rms_controllers_configuration_py.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/configuration.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

- -
-

"""Configuration rest API input module.""" 

-

 

-

import logging 

-

 

-

from orm_common.utils import utils 

-

 

-

from pecan import conf 

-

from pecan import request 

-

from pecan import rest 

-

from wsmeext.pecan import wsexpose 

-

 

-

from rms.utils import authentication 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class ConfigurationController(rest.RestController): 

-

"""Configuration controller.""" 

-

 

-

@wsexpose(str, str, status_code=200) 

-

def get(self, dump_to_log='false'): 

-

"""get method. 

-

 

-

:param dump_to_log: A boolean string that says whether the 

-

configuration should be written to log 

-

:return: A pretty string that contains the service's configuration 

-

""" 

-

logger.info("Get configuration...") 

-

authentication.authorize(request, 'configuration:get') 

-

 

-

dump = dump_to_log.lower() == 'true' 

-

utils.set_utils_conf(conf) 

-

result = utils.report_config(conf, dump, logger) 

-

return result 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers_lcp_controller_py.html b/orm/services/region_manager/cover/rms_controllers_lcp_controller_py.html deleted file mode 100644 index 90c29c78..00000000 --- a/orm/services/region_manager/cover/rms_controllers_lcp_controller_py.html +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/lcp_controller.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

- -
-

import logging 

-

 

-

from pecan import rest, request 

-

from pecan import conf 

-

 

-

from wsme import types as wtypes 

-

from wsmeext.pecan import wsexpose 

-

from rms.model import url_parm 

-

from rms.services.error_base import ErrorStatus 

-

from rms.services import services 

-

from rms.utils import authentication 

-

 

-

from orm_common.utils import api_error_utils as err_utils 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class LcpController(rest.RestController): 

-

 

-

@wsexpose(wtypes.text, rest_content_types='json') 

-

def get_all(self): 

-

""" 

-

This function is called when receiving /lcp without a parameter. 

-

parameter: 

-

None. 

-

return: entire list of lcp. 

-

""" 

-

logger.info('Received a GET request for all LCPs') 

-

authentication.authorize(request, 'lcp:get_all') 

-

 

-

zones = [] 

-

 

-

try: 

-

zones = get_zones() 

-

logger.debug('Returning LCP list: %s' % (zones,)) 

-

return zones 

-

 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(wtypes.text, str, rest_content_types='json') 

-

def get_one(self, lcp_id): 

-

 

-

logger.info('Received a GET request for LCP %s' % (id,)) 

-

authentication.authorize(request, 'lcp:get_one') 

-

 

-

zones = [] 

-

try: 

-

 

-

zones = get_zones() 

-

 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

for zone in zones: 

-

if zone["id"] == lcp_id: 

-

logger.debug('Returning: %s' % (zone,)) 

-

return zone 

-

 

-

error_msg = 'LCP %s not found' % (lcp_id,) 

-

logger.info(error_msg) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=error_msg, 

-

status_code=404) 

-

 

-

 

-

def get_zones(): 

-

""" 

-

This function returns the lcp list from CSV file. 

-

parameter: 

-

None. 

-

return: 

-

zone list in json format. 

-

""" 

-

logger.debug('Enter get_zones function') 

-

result = [] 

-

 

-

try: 

-

url_args = url_parm.UrlParms() 

-

zones = services.get_regions_data(url_args) 

-

 

-

for zone in zones.regions: 

-

result.append(build_zone_response(zone)) 

-

 

-

logger.debug("Available regions: {}".format(', '.join( 

-

[region["zone_name"] for region in result]))) 

-

 

-

except ErrorStatus as e: 

-

logger.debug(e.message) 

-

finally: 

-

return result 

-

 

-

 

-

def build_zone_response(zone): 

-

 

-

end_points_dict = {"identity": "", 

-

"dashboard": "", 

-

"ord": ""} 

-

for end_point in zone.endpoints: 

-

end_points_dict[end_point.type] = end_point.publicurl 

-

 

-

return dict( 

-

zone_name=zone.name, 

-

id=zone.id, 

-

status="1" if zone.status == "functional" else "0", 

-

design_type=zone.design_type, 

-

location_type=zone.location_type, 

-

vLCP_name=zone.vlcp_name, 

-

AIC_version=zone.ranger_agent_version, 

-

OS_version=zone.open_stack_version, 

-

keystone_EP=end_points_dict["identity"], 

-

horizon_EP=end_points_dict["dashboard"], 

-

ORD_EP=end_points_dict["ord"] 

-

) 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers_logs_py.html b/orm/services/region_manager/cover/rms_controllers_logs_py.html deleted file mode 100644 index 51ddc2a1..00000000 --- a/orm/services/region_manager/cover/rms_controllers_logs_py.html +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/logs.py: 94% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

- -
-

import logging 

-

from pecan import rest, request 

-

import wsme 

-

from wsmeext.pecan import wsexpose 

-

 

-

from orm_common.utils import api_error_utils as err_utils 

-

 

-

from rms.utils import authentication 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class LogChangeResultWSME(wsme.types.DynamicBase): 

-

"""log change result wsme type.""" 

-

 

-

result = wsme.wsattr(str, mandatory=True, default=None) 

-

 

-

def __init__(self, **kwargs): 

-

""""init method.""" 

-

super(LogChangeResult, self).__init__(**kwargs) 

-

 

-

 

-

class LogChangeResult(object): 

-

"""log change result type.""" 

-

 

-

def __init__(self, result): 

-

""""init method.""" 

-

self.result = result 

-

 

-

 

-

class LogsController(rest.RestController): 

-

"""Logs Audit controller.""" 

-

 

-

@wsexpose(LogChangeResultWSME, str, status_code=201, 

-

rest_content_types='json') 

-

def put(self, level): 

-

"""update log level. 

-

 

-

:param level: the log level text name 

-

:return: 

-

""" 

-

 

-

logger.info("Changing log level to [{}]".format(level)) 

-

authentication.authorize(request, 'log:update') 

-

 

-

try: 

-

log_level = logging._levelNames.get(level.upper()) 

-

if log_level is not None: 

-

self._change_log_level(log_level) 

-

result = "Log level changed to {}.".format(level) 

-

logger.info(result) 

-

else: 

-

raise Exception( 

-

"The given log level [{}] doesn't exist.".format(level)) 

-

 

-

return LogChangeResult(result) 

-

 

-

except Exception as exception: 

-

logger.error("Fail to change log_level. Reason: {}".format( 

-

exception.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@staticmethod 

-

def _change_log_level(log_level): 

-

path = __name__.split('.') 

-

if len(path) > 0: 

-

root = path[0] 

-

root_logger = logging.getLogger(root) 

-

root_logger.setLevel(log_level) 

-

else: 

-

logger.info("Fail to change log_level to [{}]. " 

-

"the given log level doesn't exist.".format(log_level)) 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers_root_py.html b/orm/services/region_manager/cover/rms_controllers_root_py.html deleted file mode 100644 index 9a9cdf4b..00000000 --- a/orm/services/region_manager/cover/rms_controllers_root_py.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/root.py: 92% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

- -
-

from pecan import expose 

-

from lcp_controller import LcpController 

-

from logs import LogsController 

-

from configuration import ConfigurationController 

-

from rms.controllers.v2 import root 

-

 

-

 

-

class RootController(object): 

-

lcp = LcpController() 

-

logs = LogsController() 

-

configuration = ConfigurationController() 

-

v2 = root.V2Controller() 

-

 

-

@expose(template='json') 

-

def _default(self): 

-

""" 

-

Method to handle GET / 

-

parameters: None 

-

return: dict describing lcp rest version information 

-

""" 

-

return { 

-

"versions": { 

-

"values": [ 

-

{ 

-

"status": "stable", 

-

"id": "v2", 

-

"links": [ 

-

{ 

-

"href": "http://localhost:8789/" 

-

} 

-

] 

-

} 

-

] 

-

} 

-

} 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers_v2___init___py.html b/orm/services/region_manager/cover/rms_controllers_v2___init___py.html deleted file mode 100644 index bf5cfb53..00000000 --- a/orm/services/region_manager/cover/rms_controllers_v2___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

- -
-

"""orm package.""" 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers_v2_orm___init___py.html b/orm/services/region_manager/cover/rms_controllers_v2_orm___init___py.html deleted file mode 100644 index 40a61780..00000000 --- a/orm/services/region_manager/cover/rms_controllers_v2_orm___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

- -
-

"""resource package.""" 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers_v2_orm_resources___init___py.html b/orm/services/region_manager/cover/rms_controllers_v2_orm_resources___init___py.html deleted file mode 100644 index 80509395..00000000 --- a/orm/services/region_manager/cover/rms_controllers_v2_orm_resources___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/resources/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

- -
-

"""orm package.""" 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers_v2_orm_resources_groups_py.html b/orm/services/region_manager/cover/rms_controllers_v2_orm_resources_groups_py.html deleted file mode 100644 index 76366806..00000000 --- a/orm/services/region_manager/cover/rms_controllers_v2_orm_resources_groups_py.html +++ /dev/null @@ -1,597 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/resources/groups.py: 82% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

-

185

-

186

-

187

-

188

-

189

-

190

-

191

-

192

-

193

-

194

-

195

-

196

-

197

-

198

-

199

-

200

-

201

-

202

-

203

-

204

-

205

-

206

-

207

-

208

-

209

-

210

-

211

-

212

-

213

-

214

-

215

-

216

-

217

-

218

-

219

-

220

-

221

-

222

-

223

-

224

-

225

-

226

-

227

-

228

-

229

-

230

-

231

-

232

-

233

-

234

-

235

-

236

-

237

-

238

-

239

-

240

-

241

-

242

-

243

-

244

-

245

-

246

-

247

-

248

-

249

-

250

-

251

-

252

-

253

-

254

- -
-

"""rest module.""" 

-

import logging 

-

import time 

-

import wsme 

-

 

-

from orm_common.utils import api_error_utils as err_utils 

-

from orm_common.utils import utils 

-

 

-

from rms.services import error_base 

-

from rms.services import services as GroupService 

-

from rms.utils import authentication 

-

from pecan import rest, request 

-

from wsme import types as wtypes 

-

from wsmeext.pecan import wsexpose 

-

from rms.model import model as PythonModel 

-

 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class Groups(wtypes.DynamicBase): 

-

"""main json header.""" 

-

 

-

id = wsme.wsattr(wtypes.text, mandatory=True) 

-

name = wsme.wsattr(wtypes.text, mandatory=True) 

-

description = wsme.wsattr(wtypes.text, mandatory=True) 

-

regions = wsme.wsattr([str], mandatory=True) 

-

 

-

def __init__(self, id=None, name=None, description=None, regions=[]): 

-

"""init function. 

-

 

-

:param regions: 

-

:return: 

-

""" 

-

self.id = id 

-

self.name = name 

-

self.description = description 

-

self.regions = regions 

-

 

-

def _to_python_obj(self): 

-

obj = PythonModel.Groups() 

-

obj.id = self.id 

-

obj.name = self.name 

-

obj.description = self.description 

-

obj.regions = self.regions 

-

return obj 

-

 

-

 

-

class GroupWrapper(wtypes.DynamicBase): 

-

"""main cotain lis of groups.""" 

-

 

-

groups = wsme.wsattr([Groups], mandatory=True) 

-

 

-

def __init__(self, groups=[]): 

-

""" 

-

 

-

:param group: 

-

""" 

-

self.groups = groups 

-

 

-

 

-

class OutputResource(wtypes.DynamicBase): 

-

"""class method returned json body.""" 

-

 

-

id = wsme.wsattr(wtypes.text, mandatory=True) 

-

name = wsme.wsattr(wtypes.text, mandatory=True) 

-

created = wsme.wsattr(wtypes.text, mandatory=True) 

-

links = wsme.wsattr({str: str}, mandatory=True) 

-

 

-

def __init__(self, id=None, name=None, created=None, links={}): 

-

"""init function. 

-

 

-

:param id: 

-

:param created: 

-

:param links: 

-

""" 

-

self.id = id 

-

self.name = name 

-

self.created = created 

-

self.links = links 

-

 

-

 

-

class Result(wtypes.DynamicBase): 

-

"""class method json headers.""" 

-

 

-

group = wsme.wsattr(OutputResource, mandatory=True) 

-

 

-

def __init__(self, group=OutputResource()): 

-

"""init dunction. 

-

 

-

:param group: The created group 

-

""" 

-

self.group = group 

-

 

-

 

-

class GroupsController(rest.RestController): 

-

"""controller get resource.""" 

-

 

-

@wsexpose(Groups, str, status_code=200, 

-

rest_content_types='json') 

-

def get(self, id=None): 

-

"""Handle get request. 

-

 

-

:param id: Group ID 

-

:return: 200 OK on success, 404 Not Found otherwise. 

-

""" 

-

logger.info("Entered Get Group: id = {}".format(id)) 

-

authentication.authorize(request, 'group:get_one') 

-

 

-

try: 

-

 

-

result = GroupService.get_groups_data(id) 

-

logger.debug('Returning group, regions: {}'.format(result.regions)) 

-

return result 

-

 

-

except error_base.NotFoundError as e: 

-

logger.error("GroupsController - Group not found") 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=404) 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(GroupWrapper, status_code=200, rest_content_types='json') 

-

def get_all(self): 

-

logger.info("gett all groups") 

-

authentication.authorize(request, 'group:get_all') 

-

try: 

-

 

-

logger.debug("api-get all groups") 

-

groups_wrraper = GroupService.get_all_groups() 

-

logger.debug("got groups {}".format(groups_wrraper)) 

-

 

-

except Exception as exp: 

-

logger.error("api--fail to get all groups") 

-

logger.exception(exp) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

return groups_wrraper 

-

 

-

@wsexpose(Result, body=Groups, status_code=201, rest_content_types='json') 

-

def post(self, group_input): 

-

"""Handle post request. 

-

 

-

:param group_input: json data 

-

:return: 201 created on success, 409 otherwise. 

-

""" 

-

logger.info("Entered Create Group") 

-

logger.debug("id = {}, name = {}, description = {}, regions = {}".format( 

-

group_input.id, 

-

group_input.name, 

-

group_input.description, 

-

group_input.regions)) 

-

authentication.authorize(request, 'group:create') 

-

 

-

try: 

-

# May raise an exception which will return status code 400 

-

GroupService.create_group_in_db(group_input.id, 

-

group_input.name, 

-

group_input.description, 

-

group_input.regions) 

-

logger.debug("Group created successfully in DB") 

-

 

-

# Create the group output data with the correct timestamp and link 

-

group = OutputResource(group_input.id, 

-

group_input.name, 

-

repr(int(time.time() * 1000)), 

-

{'self': '{}/v2/orm/groups/{}'.format( 

-

request.application_url, 

-

group_input.id)}) 

-

 

-

event_details = 'Region group {} {} created with regions: {}'.format( 

-

group_input.id, group_input.name, group_input.regions) 

-

utils.audit_trail('create group', request.transaction_id, 

-

request.headers, group_input.id, 

-

event_details=event_details) 

-

return Result(group) 

-

 

-

except error_base.ErrorStatus as e: 

-

logger.error("GroupsController - {}".format(e.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=e.status_code) 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(None, str, status_code=204, rest_content_types='json') 

-

def delete(self, group_id): 

-

logger.info("delete group") 

-

authentication.authorize(request, 'group:delete') 

-

 

-

try: 

-

 

-

logger.debug("delete group with id {}".format(group_id)) 

-

GroupService.delete_group(group_id) 

-

logger.debug("done") 

-

 

-

event_details = 'Region group {} deleted'.format(group_id) 

-

utils.audit_trail('delete group', request.transaction_id, 

-

request.headers, group_id, 

-

event_details=event_details) 

-

 

-

except Exception as exp: 

-

 

-

logger.exception("fail to delete group :- {}".format(exp)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exp.message) 

-

return 

-

 

-

@wsexpose(Result, str, body=Groups, status_code=201, 

-

rest_content_types='json') 

-

def put(self, group_id, group): 

-

logger.info("update group") 

-

authentication.authorize(request, 'group:update') 

-

 

-

try: 

-

logger.debug("update group - id {}".format(group_id)) 

-

result = GroupService.update_group(group, group_id) 

-

logger.debug("group updated to :- {}".format(result)) 

-

 

-

# build result 

-

group_result = OutputResource(result.id, result.name, 

-

repr(int(time.time() * 1000)), { 

-

'self': '{}/v2/orm/groups/{}'.format( 

-

request.application_url, 

-

result.id)}) 

-

 

-

event_details = 'Region group {} {} updated with regions: {}'.format( 

-

group_id, group.name, group.regions) 

-

utils.audit_trail('update group', request.transaction_id, 

-

request.headers, group_id, 

-

event_details=event_details) 

-

 

-

except error_base.ErrorStatus as exp: 

-

logger.error("group to update not found {}".format(exp)) 

-

logger.exception(exp) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exp.message, 

-

status_code=exp.status_code) 

-

except Exception as exp: 

-

logger.error("fail to update groupt -- id {}".format(group_id)) 

-

logger.exception(exp) 

-

raise 

-

 

-

return Result(group_result) 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers_v2_orm_resources_metadata_py.html b/orm/services/region_manager/cover/rms_controllers_v2_orm_resources_metadata_py.html deleted file mode 100644 index fcb8e1ed..00000000 --- a/orm/services/region_manager/cover/rms_controllers_v2_orm_resources_metadata_py.html +++ /dev/null @@ -1,437 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/resources/metadata.py: 78% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

- -
-

import json 

-

 

-

import logging 

-

 

-

from pecan import rest, request 

-

import wsme 

-

from wsme import types as wtypes 

-

from wsmeext.pecan import wsexpose 

-

 

-

from rms.services import error_base 

-

from rms.services import services as RegionService 

-

 

-

from rms.utils import authentication 

-

 

-

from orm_common.utils import api_error_utils as err_utils 

-

from orm_common.utils import utils 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class MetaData(wtypes.DynamicBase): 

-

"""main json header.""" 

-

 

-

metadata = wsme.wsattr({str: [str]}, mandatory=True) 

-

 

-

def __init__(self, metadata={}): 

-

"""init function. 

-

 

-

:param regions: 

-

:return: 

-

""" 

-

self.metadata = metadata 

-

 

-

 

-

class RegionMetadataController(rest.RestController): 

-

 

-

@wsexpose(MetaData, str, status_code=200, rest_content_types='json') 

-

def get(self, region_id): 

-

logger.info("Get metadata for region id: {}".format(region_id)) 

-

authentication.authorize(request, 'metadata:get') 

-

 

-

try: 

-

region = RegionService.get_region_by_id_or_name(region_id) 

-

logger.debug("Got region metadata: {}".format(region.metadata)) 

-

return MetaData(region.metadata) 

-

 

-

except error_base.ErrorStatus as exp: 

-

logger.error("RegionsController - {}".format(exp.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exp.message, 

-

status_code=exp.status_code) 

-

except Exception as exp: 

-

logger.exception(exp.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exp.message) 

-

 

-

@wsexpose(MetaData, str, body=MetaData, status_code=201, 

-

rest_content_types='json') 

-

def post(self, region_id, metadata_input): 

-

"""Handle post request. 

-

:param region_id: region_id to add metadata to. 

-

:param metadata_input: json data 

-

:return: 201 created on success, 409 duplicate entry, 404 not found 

-

""" 

-

logger.info("Entered Create region metadata") 

-

logger.debug("Got metadata: {}".format(metadata_input)) 

-

authentication.authorize(request, 'metadata:create') 

-

 

-

try: 

-

self._validate_request_input() 

-

# May raise an exception which will return status code 400 

-

result = RegionService.add_region_metadata(region_id, 

-

metadata_input.metadata) 

-

logger.debug("Metadata was successfully added to " 

-

"region: {}. New metadata: {}".format(region_id, result)) 

-

 

-

event_details = 'Region {} metadata added'.format(region_id) 

-

utils.audit_trail('create metadata', request.transaction_id, 

-

request.headers, region_id, 

-

event_details=event_details) 

-

return MetaData(result) 

-

 

-

except error_base.ErrorStatus as e: 

-

logger.error(e.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=e.status_code) 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(MetaData, str, body=MetaData, status_code=201, 

-

rest_content_types='json') 

-

def put(self, region_id, metadata_input): 

-

"""Handle put request. 

-

:param region_id: region_id to update metadata to. 

-

:param metadata_input: json data 

-

:return: 201 created on success, 404 not found 

-

""" 

-

logger.info("Entered update region metadata") 

-

logger.debug("Got metadata: {}".format(metadata_input)) 

-

authentication.authorize(request, 'metadata:update') 

-

 

-

try: 

-

self._validate_request_input() 

-

# May raise an exception which will return status code 400 

-

result = RegionService.update_region_metadata(region_id, 

-

metadata_input.metadata) 

-

logger.debug("Metadata was successfully added to " 

-

"region: {}. New metadata: {}".format(region_id, result)) 

-

 

-

event_details = 'Region {} metadata updated'.format(region_id) 

-

utils.audit_trail('update metadata', request.transaction_id, 

-

request.headers, region_id, 

-

event_details=event_details) 

-

return MetaData(result) 

-

 

-

except error_base.ErrorStatus as e: 

-

logger.error(e.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=e.status_code) 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(None, str, str, status_code=204, rest_content_types='json') 

-

def delete(self, region_id, metadata_key): 

-

"""Handle delete request. 

-

:param region_id: region_id to update metadata to. 

-

:param metadata_key: metadata key to be deleted 

-

:return: 204 deleted 

-

""" 

-

logger.info("Entered delete region metadata with " 

-

"key: {}".format(metadata_key)) 

-

authentication.authorize(request, 'metadata:delete') 

-

 

-

try: 

-

# May raise an exception which will return status code 400 

-

result = RegionService.delete_metadata_from_region(region_id, 

-

metadata_key) 

-

logger.debug("Metadata was successfully deleted.") 

-

 

-

event_details = 'Region {} metadata {} deleted'.format( 

-

region_id, metadata_key) 

-

utils.audit_trail('delete metadata', request.transaction_id, 

-

request.headers, region_id, 

-

event_details=event_details) 

-

 

-

except error_base.ErrorStatus as e: 

-

logger.error(e.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=e.status_code) 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

def _validate_request_input(self): 

-

data_dict = json.loads(request.body) 

-

logger.debug("Got {}".format(data_dict)) 

-

for k, v in data_dict['metadata'].iteritems(): 

-

if isinstance(v, basestring): 

-

logger.error("Invalid json. value type list is expected, " 

-

"received string, for metadata key {}".format(k)) 

-

raise error_base.ErrorStatus(400, "Invalid json. Expecting list " 

-

"of metadata values, got string") 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers_v2_orm_resources_regions_py.html b/orm/services/region_manager/cover/rms_controllers_v2_orm_resources_regions_py.html deleted file mode 100644 index 02014699..00000000 --- a/orm/services/region_manager/cover/rms_controllers_v2_orm_resources_regions_py.html +++ /dev/null @@ -1,819 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/resources/regions.py: 97% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

-

185

-

186

-

187

-

188

-

189

-

190

-

191

-

192

-

193

-

194

-

195

-

196

-

197

-

198

-

199

-

200

-

201

-

202

-

203

-

204

-

205

-

206

-

207

-

208

-

209

-

210

-

211

-

212

-

213

-

214

-

215

-

216

-

217

-

218

-

219

-

220

-

221

-

222

-

223

-

224

-

225

-

226

-

227

-

228

-

229

-

230

-

231

-

232

-

233

-

234

-

235

-

236

-

237

-

238

-

239

-

240

-

241

-

242

-

243

-

244

-

245

-

246

-

247

-

248

-

249

-

250

-

251

-

252

-

253

-

254

-

255

-

256

-

257

-

258

-

259

-

260

-

261

-

262

-

263

-

264

-

265

-

266

-

267

-

268

-

269

-

270

-

271

-

272

-

273

-

274

-

275

-

276

-

277

-

278

-

279

-

280

-

281

-

282

-

283

-

284

-

285

-

286

-

287

-

288

-

289

-

290

-

291

-

292

-

293

-

294

-

295

-

296

-

297

-

298

-

299

-

300

-

301

-

302

-

303

-

304

-

305

-

306

-

307

-

308

-

309

-

310

-

311

-

312

-

313

-

314

-

315

-

316

-

317

-

318

-

319

-

320

-

321

-

322

-

323

-

324

-

325

-

326

-

327

-

328

-

329

-

330

-

331

-

332

-

333

-

334

-

335

-

336

-

337

-

338

-

339

-

340

-

341

-

342

-

343

-

344

-

345

-

346

-

347

-

348

-

349

-

350

-

351

-

352

-

353

-

354

-

355

-

356

-

357

-

358

-

359

-

360

-

361

-

362

-

363

-

364

-

365

- -
-

"""rest module.""" 

-

import logging 

-

 

-

from pecan import rest, request 

-

import wsme 

-

from wsme import types as wtypes 

-

from wsmeext.pecan import wsexpose 

-

 

-

from rms.model import url_parm 

-

from rms.model import model as PythonModel 

-

from rms.services import error_base 

-

from rms.services import services as RegionService 

-

 

-

from rms.controllers.v2.orm.resources.metadata import RegionMetadataController 

-

from rms.controllers.v2.orm.resources.status import RegionStatusController 

-

 

-

from rms.utils import authentication 

-

 

-

from orm_common.policy import policy 

-

from orm_common.utils import api_error_utils as err_utils 

-

from orm_common.utils import utils 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class Address(wtypes.DynamicBase): 

-

"""wsme class for address json.""" 

-

 

-

country = wsme.wsattr(wtypes.text, mandatory=True) 

-

state = wsme.wsattr(wtypes.text, mandatory=True) 

-

city = wsme.wsattr(wtypes.text, mandatory=True) 

-

street = wsme.wsattr(wtypes.text, mandatory=True) 

-

zip = wsme.wsattr(wtypes.text, mandatory=True) 

-

 

-

def __init__(self, country=None, state=None, city=None, 

-

street=None, zip=None): 

-

""" 

-

 

-

:param country: 

-

:param state: 

-

:param city: 

-

:param street: 

-

:param zip: 

-

""" 

-

self.country = country 

-

self.state = state 

-

self.city = city 

-

self.street = street 

-

self.zip = zip 

-

 

-

def _to_clean_python_obj(self): 

-

obj = PythonModel.Address() 

-

obj.country = self.country 

-

obj.state = self.state 

-

obj.city = self.city 

-

obj.street = self.street 

-

obj.zip = self.zip 

-

return obj 

-

 

-

 

-

class EndPoint(wtypes.DynamicBase): 

-

"""class method endpoints body.""" 

-

 

-

publicurl = wsme.wsattr(wtypes.text, mandatory=True, name="publicURL") 

-

type = wsme.wsattr(wtypes.text, mandatory=True) 

-

 

-

def __init__(self, publicurl=None, type=None): 

-

"""init function. 

-

 

-

:param publicURL: field 

-

:param typee: field 

-

:return: 

-

""" 

-

self.type = type 

-

self.publicurl = publicurl 

-

 

-

def _to_clean_python_obj(self): 

-

obj = PythonModel.EndPoint() 

-

obj.publicurl = self.publicurl 

-

obj.type = self.type 

-

return obj 

-

 

-

 

-

class RegionsData(wtypes.DynamicBase): 

-

"""class method json header.""" 

-

 

-

status = wsme.wsattr(wtypes.text, mandatory=True) 

-

id = wsme.wsattr(wtypes.text, mandatory=True) 

-

name = wsme.wsattr(wtypes.text, mandatory=False) 

-

ranger_agent_version = wsme.wsattr(wtypes.text, mandatory=True, name="rangerAgentVersion") 

-

open_stack_version = wsme.wsattr(wtypes.text, mandatory=True, name="OSVersion") 

-

clli = wsme.wsattr(wtypes.text, mandatory=True, name="CLLI") 

-

metadata = wsme.wsattr({str: [str]}, mandatory=True) 

-

endpoints = wsme.wsattr([EndPoint], mandatory=True) 

-

address = wsme.wsattr(Address, mandatory=True) 

-

design_type = wsme.wsattr(wtypes.text, mandatory=True, name="designType") 

-

location_type = wsme.wsattr(wtypes.text, mandatory=True, name="locationType") 

-

vlcp_name = wsme.wsattr(wtypes.text, mandatory=True, name="vlcpName") 

-

is_ecomp = wsme.wsattr(bool, mandatory=False, name="is_ecomp", 

-

default=False) 

-

is_ssp = wsme.wsattr(bool, mandatory=False, name="is_ssp", 

-

default=False) 

-

purpose_of_region = wsme.wsattr(wtypes.text, mandatory=True, name="purpose_of_region") 

-

 

-

def __init__(self, status=None, id=None, name=None, clli=None, design_type=None, 

-

location_type=None, vlcp_name=None, open_stack_version=None, 

-

address=Address(), ranger_agent_version=None, metadata={}, 

-

endpoint=[EndPoint()], is_ecomp=False, is_ssp=False, 

-

purpose_of_region=None): 

-

""" 

-

 

-

:param status: 

-

:param id: 

-

:param name: 

-

:param clli: 

-

:param design_type: 

-

:param location_type: 

-

:param vlcp_name: 

-

:param open_stack_version: 

-

:param address: 

-

:param ranger_agent_version: 

-

:param metadata: 

-

:param endpoint: 

-

:param is_ecomp: 

-

:param is_ssp: 

-

:param purpose_of_region 

-

""" 

-

self.status = status 

-

self.id = id 

-

self.name = self.id 

-

self.clli = clli 

-

self.ranger_agent_version = ranger_agent_version 

-

self.metadata = metadata 

-

self.endpoint = endpoint 

-

self.design_type = design_type 

-

self.location_type = location_type 

-

self.vlcp_name = vlcp_name 

-

self.address = address 

-

self.open_stack_version = open_stack_version 

-

self.is_ecomp = is_ecomp 

-

self.is_ssp = is_ssp 

-

self.purpose_of_region = purpose_of_region 

-

 

-

def _to_clean_python_obj(self): 

-

obj = PythonModel.RegionData() 

-

obj.endpoints = [] 

-

obj.status = self.status 

-

obj.id = self.id 

-

obj.name = self.name 

-

obj.ranger_agent_version = self.ranger_agent_version 

-

obj.clli = self.clli 

-

obj.metadata = self.metadata 

-

for endpoint in self.endpoints: 

-

obj.endpoints.append(endpoint._to_clean_python_obj()) 

-

obj.address = self.address._to_clean_python_obj() 

-

obj.design_type = self.design_type 

-

obj.location_type = self.location_type 

-

obj.vlcp_name = self.vlcp_name 

-

obj.open_stack_version = self.open_stack_version 

-

obj.is_ecomp = self.is_ecomp 

-

obj.is_ssp = self.is_ssp 

-

obj.purpose_of_region = self.purpose_of_region 

-

return obj 

-

 

-

 

-

class Regions(wtypes.DynamicBase): 

-

"""main json header.""" 

-

 

-

regions = wsme.wsattr([RegionsData], mandatory=True) 

-

 

-

def __init__(self, regions=[RegionsData()]): 

-

"""init function. 

-

 

-

:param regions: 

-

:return: 

-

""" 

-

self.regions = regions 

-

 

-

 

-

class RegionsController(rest.RestController): 

-

"""controller get resource.""" 

-

metadata = RegionMetadataController() 

-

status = RegionStatusController() 

-

 

-

@wsexpose(Regions, str, str, [str], str, str, str, str, str, str, str, 

-

str, str, str, str, str, str, status_code=200, rest_content_types='json') 

-

def get_all(self, type=None, status=None, metadata=None, rangerAgentVersion=None, 

-

clli=None, regionname=None, osversion=None, valet=None, 

-

state=None, country=None, city=None, street=None, zip=None, 

-

is_ecomp=False, is_ssp=False, purpose_of_region=None): 

-

"""get regions. 

-

 

-

:param type: query field 

-

:param status: query field 

-

:param metadata: query field 

-

:param rangerAgentVersion: query field 

-

:param clli: query field 

-

:param regionname: query field 

-

:param osversion: query field 

-

:param valet: query field 

-

:param state: query field 

-

:param country: query field 

-

:param city: query field 

-

:param street: query field 

-

:param zip: query field 

-

:param is_ecomp: query field 

-

:param is_ssp: query field 

-

:param purpose_of_region: query field 

-

:return: json from db 

-

:exception: EntityNotFoundError 404 

-

""" 

-

logger.info("Entered Get Regions") 

-

authentication.authorize(request, 'region:get_all') 

-

 

-

url_args = {'type': type, 'status': status, 'metadata': metadata, 

-

'rangerAgentVersion': rangerAgentVersion, 'clli': clli, 'regionname': regionname, 

-

'osversion': osversion, 'valet': valet, 'state': state, 

-

'country': country, 'city': city, 'street': street, 'zip': zip, 

-

'is_ecomp': is_ecomp, 'is_ssp': is_ssp, 

-

'purpose_of_region': purpose_of_region} 

-

logger.debug("Parameters: {}".format(str(url_args))) 

-

 

-

try: 

-

url_args = url_parm.UrlParms(**url_args) 

-

 

-

result = RegionService.get_regions_data(url_args) 

-

 

-

logger.debug("Returning regions: {}".format(', '.join( 

-

[region.name for region in result.regions]))) 

-

 

-

return result 

-

 

-

except error_base.ErrorStatus as e: 

-

logger.error("RegionsController {}".format(e.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=e.status_code) 

-

 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

message=exception.message) 

-

 

-

@wsexpose(RegionsData, str, status_code=200, rest_content_types='json') 

-

def get_one(self, id_or_name): 

-

logger.info("API: Entered get region by id or name: {}".format(id_or_name)) 

-

authentication.authorize(request, 'region:get_one') 

-

 

-

try: 

-

result = RegionService.get_region_by_id_or_name(id_or_name) 

-

logger.debug("API: Got region {} success: {}".format(id_or_name, result)) 

-

except error_base.ErrorStatus as exp: 

-

logger.error("RegionsController {}".format(exp.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exp.message, 

-

status_code=exp.status_code) 

-

except Exception as exp: 

-

logger.exception(exp.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exp.message) 

-

 

-

return result 

-

 

-

@wsexpose(RegionsData, body=RegionsData, status_code=201, rest_content_types='json') 

-

def post(self, full_region_input): 

-

logger.info("API: CreateRegion") 

-

authentication.authorize(request, 'region:create') 

-

 

-

try: 

-

logger.debug("API: create region .. data = : {}".format(full_region_input)) 

-

result = RegionService.create_full_region(full_region_input) 

-

logger.debug("API: region created : {}".format(result)) 

-

 

-

event_details = 'Region {} {} created: AICversion {}, OSversion {}, CLLI {}'.format( 

-

full_region_input.name, full_region_input.design_type, 

-

full_region_input.ranger_agent_version, 

-

full_region_input.open_stack_version, full_region_input.clli) 

-

utils.audit_trail('create region', request.transaction_id, 

-

request.headers, full_region_input.id, 

-

event_details=event_details) 

-

except error_base.InputValueError as exp: 

-

logger.exception("Error in save region {}".format(exp.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=exp.status_code, 

-

message=exp.message) 

-

 

-

except error_base.ConflictError as exp: 

-

logger.exception("Conflict error {}".format(exp.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exp.message, 

-

status_code=exp.status_code) 

-

 

-

except Exception as exp: 

-

logger.exception("Error in creating region .. reason:- {}".format(exp)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

message=exp.message) 

-

 

-

return result 

-

 

-

@wsexpose(None, str, rest_content_types='json', status_code=204) 

-

def delete(self, region_id): 

-

logger.info("Delete Region") 

-

authentication.authorize(request, 'region:delete') 

-

 

-

try: 

-

 

-

logger.debug("delete region {}".format(region_id)) 

-

result = RegionService.delete_region(region_id) 

-

logger.debug("region deleted") 

-

 

-

event_details = 'Region {} deleted'.format(region_id) 

-

utils.audit_trail('delete region', request.transaction_id, 

-

request.headers, region_id, 

-

event_details=event_details) 

-

 

-

except Exception as exp: 

-

logger.exception( 

-

"error in deleting region .. reason:- {}".format(exp)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

message=exp.message) 

-

return 

-

 

-

@wsexpose(RegionsData, str, body=RegionsData, status_code=201, 

-

rest_content_types='json') 

-

def put(self, region_id, region): 

-

logger.info("API: update region") 

-

authentication.authorize(request, 'region:update') 

-

 

-

try: 

-

 

-

logger.debug( 

-

"region to update {} with{}".format(region_id, region)) 

-

result = RegionService.update_region(region_id, region) 

-

logger.debug("API: region {} updated".format(region_id)) 

-

 

-

event_details = 'Region {} {} modified: AICversion {}, OSversion {}, CLLI {}'.format( 

-

region.name, region.design_type, region.ranger_agent_version, 

-

region.open_stack_version, region.clli) 

-

utils.audit_trail('update region', request.transaction_id, 

-

request.headers, region_id, 

-

event_details=event_details) 

-

 

-

except error_base.NotFoundError as exp: 

-

logger.exception("region {} not found".format(region_id)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=exp.status_code, 

-

message=exp.message) 

-

 

-

except error_base.InputValueError as exp: 

-

logger.exception("not valid input {}".format(exp.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=exp.status_code, 

-

message=exp.message) 

-

except Exception as exp: 

-

logger.exception( 

-

"API: error in updating region {}.. reason:- {}".format(region_id, 

-

exp)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

message=exp.message) 

-

return result 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers_v2_orm_resources_status_py.html b/orm/services/region_manager/cover/rms_controllers_v2_orm_resources_status_py.html deleted file mode 100644 index f719798a..00000000 --- a/orm/services/region_manager/cover/rms_controllers_v2_orm_resources_status_py.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/resources/status.py: 94% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

- -
-

import logging 

-

 

-

import pecan 

-

from pecan import rest, request, conf 

-

 

-

import wsme 

-

from wsme import types as wtypes 

-

from wsmeext.pecan import wsexpose 

-

 

-

from orm_common.utils import api_error_utils as err_utils 

-

from orm_common.utils import utils 

-

 

-

from rms.services import error_base 

-

from rms.services import services as RegionService 

-

from rms.utils import authentication 

-

 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class RegionStatus(wtypes.DynamicBase): 

-

"""main json header.""" 

-

 

-

status = wsme.wsattr(str, mandatory=True) 

-

links = wsme.wsattr({str: str}, mandatory=False) 

-

 

-

def __init__(self, status=None, links=None): 

-

""" 

-

RegionStatus wrapper 

-

:param status: 

-

""" 

-

self.status = status 

-

self.links = links 

-

 

-

 

-

class RegionStatusController(rest.RestController): 

-

 

-

@wsexpose(RegionStatus, str, body=RegionStatus, status_code=201, 

-

rest_content_types='json') 

-

def put(self, region_id, new_status): 

-

""" 

-

Handle put request to modify region status 

-

:param region_id: 

-

:param new_status: 

-

:return: 200 for updated, 404 for region not found 

-

400 invalid status 

-

""" 

-

logger.info("Entered update region status") 

-

logger.debug("Got status: {}".format(new_status.status)) 

-

 

-

authentication.authorize(request, 'status:put') 

-

 

-

try: 

-

allowed_status = conf.region_options.allowed_status_values[:] 

-

 

-

if new_status.status not in allowed_status: 

-

logger.error("Invalid status. Region status " 

-

"must be one of {}".format(allowed_status)) 

-

raise error_base.InputValueError( 

-

message="Invalid status. Region status " 

-

"must be one of {}".format(allowed_status)) 

-

 

-

# May raise an exception which will return status code 400 

-

status = RegionService.update_region_status(region_id, new_status.status) 

-

base_link = 'https://{0}:{1}{2}'.format(conf.server.host, conf.server.port, 

-

pecan.request.path) 

-

link = {'self': base_link} 

-

 

-

logger.debug("Region status for region id {}, was successfully " 

-

"changed to: {}.".format(region_id, new_status.status)) 

-

 

-

event_details = 'Region {} status updated to {}'.format( 

-

region_id, new_status.status) 

-

utils.audit_trail('Update status', request.transaction_id, 

-

request.headers, region_id, 

-

event_details=event_details) 

-

 

-

return RegionStatus(status, link) 

-

 

-

except error_base.ErrorStatus as e: 

-

logger.error(e.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=e.status_code) 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(str, str, rest_content_types='json') 

-

def get(self, region_id): 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=405) 

-

 

-

@wsexpose(RegionStatus, str, body=RegionStatus, status_code=200, 

-

rest_content_types='json') 

-

def post(self, region_id, status): 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=405) 

-

 

-

@wsexpose(str, str, rest_content_types='json') 

-

def delete(self, region_id): 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=405) 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers_v2_orm_root_py.html b/orm/services/region_manager/cover/rms_controllers_v2_orm_root_py.html deleted file mode 100644 index df7c358c..00000000 --- a/orm/services/region_manager/cover/rms_controllers_v2_orm_root_py.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/root.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

- -
-

"""ORM controller module.""" 

-

from rms.controllers.v2.orm.resources import groups 

-

from rms.controllers.v2.orm.resources import regions 

-

 

-

 

-

class OrmController(object): 

-

"""ORM controller class.""" 

-

 

-

regions = regions.RegionsController() 

-

groups = groups.GroupsController() 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_controllers_v2_root_py.html b/orm/services/region_manager/cover/rms_controllers_v2_root_py.html deleted file mode 100644 index addd8179..00000000 --- a/orm/services/region_manager/cover/rms_controllers_v2_root_py.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/root.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

- -
-

"""V2 root controller module.""" 

-

from rms.controllers.v2.orm import root 

-

 

-

 

-

class V2Controller(object): 

-

"""V2 root controller class.""" 

-

 

-

orm = root.OrmController() 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_external_mock___init___py.html b/orm/services/region_manager/cover/rms_external_mock___init___py.html deleted file mode 100644 index 301a20c8..00000000 --- a/orm/services/region_manager/cover/rms_external_mock___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_external_mock_audit_client___init___py.html b/orm/services/region_manager/cover/rms_external_mock_audit_client___init___py.html deleted file mode 100644 index 0ba1d066..00000000 --- a/orm/services/region_manager/cover/rms_external_mock_audit_client___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/audit_client/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_external_mock_audit_client_api___init___py.html b/orm/services/region_manager/cover/rms_external_mock_audit_client_api___init___py.html deleted file mode 100644 index 9415cc4a..00000000 --- a/orm/services/region_manager/cover/rms_external_mock_audit_client_api___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/audit_client/api/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_external_mock_audit_client_api_audit_py.html b/orm/services/region_manager/cover/rms_external_mock_audit_client_api_audit_py.html deleted file mode 100644 index 92fe9996..00000000 --- a/orm/services/region_manager/cover/rms_external_mock_audit_client_api_audit_py.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/audit_client/api/audit.py: 0% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

- -
-

def audit(*args, **kwargs): 

-

pass 

-

 

-

 

-

def init(*args, **kwargs): 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_external_mock_keystone_utils___init___py.html b/orm/services/region_manager/cover/rms_external_mock_keystone_utils___init___py.html deleted file mode 100644 index c91da3f1..00000000 --- a/orm/services/region_manager/cover/rms_external_mock_keystone_utils___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/keystone_utils/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_external_mock_keystone_utils_tokens_py.html b/orm/services/region_manager/cover/rms_external_mock_keystone_utils_tokens_py.html deleted file mode 100644 index b833593b..00000000 --- a/orm/services/region_manager/cover/rms_external_mock_keystone_utils_tokens_py.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/keystone_utils/tokens.py: 80% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

- -
-

def get_token_user(*a, **k): 

-

pass 

-

 

-

 

-

class TokenConf(object): 

-

def __init__(self, *a, **kw): 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_external_mock_orm_common___init___py.html b/orm/services/region_manager/cover/rms_external_mock_orm_common___init___py.html deleted file mode 100644 index 9d0575ed..00000000 --- a/orm/services/region_manager/cover/rms_external_mock_orm_common___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/orm_common/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_external_mock_orm_common_policy___init___py.html b/orm/services/region_manager/cover/rms_external_mock_orm_common_policy___init___py.html deleted file mode 100644 index 4367b302..00000000 --- a/orm/services/region_manager/cover/rms_external_mock_orm_common_policy___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/orm_common/policy/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_external_mock_orm_common_policy_policy_py.html b/orm/services/region_manager/cover/rms_external_mock_orm_common_policy_policy_py.html deleted file mode 100644 index 972d1dcf..00000000 --- a/orm/services/region_manager/cover/rms_external_mock_orm_common_policy_policy_py.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/orm_common/policy/policy.py: 67% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

- -
-

def init(*a, **kw): 

-

pass 

-

 

-

 

-

def enforce(*a, **kw): 

-

pass 

-

 

-

 

-

def authorize(*a, **kw): 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_external_mock_orm_common_utils___init___py.html b/orm/services/region_manager/cover/rms_external_mock_orm_common_utils___init___py.html deleted file mode 100644 index e339ed1a..00000000 --- a/orm/services/region_manager/cover/rms_external_mock_orm_common_utils___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/orm_common/utils/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_external_mock_orm_common_utils_api_error_utils_py.html b/orm/services/region_manager/cover/rms_external_mock_orm_common_utils_api_error_utils_py.html deleted file mode 100644 index 9979bae3..00000000 --- a/orm/services/region_manager/cover/rms_external_mock_orm_common_utils_api_error_utils_py.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/orm_common/utils/api_error_utils.py: 50% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

- -
-

def get_error(*args, **kwargs): 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_external_mock_orm_common_utils_utils_py.html b/orm/services/region_manager/cover/rms_external_mock_orm_common_utils_utils_py.html deleted file mode 100644 index fa2be4b5..00000000 --- a/orm/services/region_manager/cover/rms_external_mock_orm_common_utils_utils_py.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/orm_common/utils/utils.py: 83% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

- -
-

"""Utils module mock.""" 

-

 

-

 

-

def report_config(conf, dump=False): 

-

"""Mock report_config function.""" 

-

pass 

-

 

-

 

-

def set_utils_conf(conf): 

-

"""Mock set_utils_conf function.""" 

-

pass 

-

 

-

 

-

def audit_trail(*args, **kwargs): 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_model___init___py.html b/orm/services/region_manager/cover/rms_model___init___py.html deleted file mode 100644 index dd0a069f..00000000 --- a/orm/services/region_manager/cover/rms_model___init___py.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - Coverage for rms/model/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

- -
-

from pecan import conf # noqa 

-

 

-

 

-

def init_model(): 

-

""" 

-

This is a stub method which is called at application startup time. 

-

 

-

If you need to bind to a parsed database configuration, set up tables or 

-

ORM classes, or perform any database initialization, this is the 

-

recommended place to do it. 

-

 

-

For more information working with databases, and some common recipes, 

-

see http://pecan.readthedocs.org/en/latest/databases.html 

-

""" 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_model_model_py.html b/orm/services/region_manager/cover/rms_model_model_py.html deleted file mode 100644 index d4a4be2a..00000000 --- a/orm/services/region_manager/cover/rms_model_model_py.html +++ /dev/null @@ -1,475 +0,0 @@ - - - - - - - - - - - Coverage for rms/model/model.py: 93% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

-

185

-

186

-

187

-

188

-

189

-

190

-

191

-

192

-

193

- -
-

"""model module.""" 

-

from rms.services import error_base 

-

from pecan import conf 

-

 

-

 

-

class Address(object): 

-

"""address class.""" 

-

 

-

def __init__(self, country=None, state=None, city=None, 

-

street=None, zip=None): 

-

""" 

-

 

-

:param country: 

-

:param state: 

-

:param city: 

-

:param street: 

-

:param zip: 

-

""" 

-

self.country = country 

-

self.state = state 

-

self.city = city 

-

self.street = street 

-

self.zip = zip 

-

 

-

 

-

class EndPoint(object): 

-

"""class method endpoints body.""" 

-

 

-

def __init__(self, publicurl=None, type=None): 

-

"""init function. 

-

 

-

:param public_url: field 

-

:param type: field 

-

:return: 

-

""" 

-

self.type = type 

-

self.publicurl = publicurl 

-

 

-

 

-

class RegionData(object): 

-

"""class method json header.""" 

-

 

-

def __init__(self, status=None, id=None, name=None, clli=None, 

-

ranger_agent_version=None, design_type=None, location_type=None, 

-

vlcp_name=None, open_stack_version=None, 

-

address=Address(), is_ecomp=None, is_ssp=None, 

-

purpose_of_region=None, metadata={}, endpoints=[EndPoint()]): 

-

""" 

-

 

-

:param status: 

-

:param id: 

-

:param name: 

-

:param clli: 

-

:param ranger_agent_version: 

-

:param design_type: 

-

:param location_type: 

-

:param vlcp_name: 

-

:param open_stack_version: 

-

:param address: 

-

:param is_ecomp 

-

:param is_ssp 

-

:param purpose_of_region 

-

:param metadata: 

-

:param endpoints: 

-

""" 

-

self.status = status 

-

self.id = id 

-

# make id and name always the same 

-

self.name = self.id 

-

self.clli = clli 

-

self.ranger_agent_version = ranger_agent_version 

-

self.metadata = metadata 

-

self.endpoints = endpoints 

-

self.design_type = design_type 

-

self.location_type = location_type 

-

self.vlcp_name = vlcp_name 

-

self.open_stack_version = open_stack_version 

-

self.address = address 

-

self.is_ecomp = is_ecomp 

-

self.is_ssp = is_ssp 

-

self.purpose_of_region = purpose_of_region 

-

 

-

def _validate_end_points(self, endpoints_types_must_have): 

-

ep_duplicate = [] 

-

for endpoint in self.endpoints: 

-

if endpoint.type not in ep_duplicate: 

-

ep_duplicate.append(endpoint.type) 

-

else: 

-

raise error_base.InputValueError( 

-

message="Invalid endpoints. Duplicate endpoint " 

-

"type {}".format(endpoint.type)) 

-

try: 

-

endpoints_types_must_have.remove(endpoint.type) 

-

except: 

-

pass 

-

if len(endpoints_types_must_have) > 0: 

-

raise error_base.InputValueError( 

-

message="Invalid endpoints. Endpoint type '{}' " 

-

"is missing".format(endpoints_types_must_have)) 

-

 

-

def _validate_status(self, allowed_status): 

-

if self.status not in allowed_status: 

-

raise error_base.InputValueError( 

-

message="Invalid status. Region status must be " 

-

"one of {}".format(allowed_status)) 

-

return 

-

 

-

def _validate_model(self): 

-

allowed_status = conf.region_options.allowed_status_values[:] 

-

endpoints_types_must_have = conf.region_options.endpoints_types_must_have[:] 

-

self._validate_status(allowed_status) 

-

self._validate_end_points(endpoints_types_must_have) 

-

return 

-

 

-

def _to_db_model_dict(self): 

-

end_points = [] 

-

 

-

for endpoint in self.endpoints: 

-

ep = {} 

-

ep['type'] = endpoint.type 

-

ep['url'] = endpoint.publicurl 

-

end_points.append(ep) 

-

 

-

db_model_dict = {} 

-

db_model_dict['region_id'] = self.id 

-

db_model_dict['name'] = self.name 

-

db_model_dict['address_state'] = self.address.state 

-

db_model_dict['address_country'] = self.address.country 

-

db_model_dict['address_city'] = self.address.city 

-

db_model_dict['address_street'] = self.address.street 

-

db_model_dict['address_zip'] = self.address.zip 

-

db_model_dict['region_status'] = self.status 

-

db_model_dict['ranger_agent_version'] = self.ranger_agent_version 

-

db_model_dict['open_stack_version'] = self.open_stack_version 

-

db_model_dict['design_type'] = self.design_type 

-

db_model_dict['location_type'] = self.location_type 

-

db_model_dict['vlcp_name'] = self.location_type 

-

db_model_dict['clli'] = self.clli 

-

db_model_dict['is_ecomp'] = self.is_ecomp * 1 

-

db_model_dict['is_ssp'] = self.is_ssp * 1 

-

db_model_dict['purpose_of_region'] = self.purpose_of_region 

-

db_model_dict['end_point_list'] = end_points 

-

db_model_dict['meta_data_dict'] = self.metadata 

-

return db_model_dict 

-

 

-

 

-

class Regions(object): 

-

"""main json header.""" 

-

 

-

def __init__(self, regions=[RegionData()]): 

-

"""init function. 

-

 

-

:param regions: 

-

:return: 

-

""" 

-

self.regions = regions 

-

 

-

 

-

class Groups(object): 

-

"""main json header.""" 

-

 

-

def __init__(self, id=None, name=None, 

-

description=None, regions=[]): 

-

"""init function. 

-

 

-

:param regions: 

-

:return: 

-

""" 

-

self.id = id 

-

self.name = name 

-

self.description = description 

-

self.regions = regions 

-

 

-

def _to_db_model_dict(self): 

-

db_dict = {} 

-

db_dict['group_name'] = self.name 

-

db_dict['group_description'] = self.description 

-

db_dict['group_regions'] = self.regions 

-

return db_dict 

-

 

-

 

-

class GroupsWrraper(object): 

-

"""list of groups.""" 

-

 

-

def __init__(self, groups=None): 

-

""" 

-

 

-

:param groups: 

-

""" 

-

if groups is None: 

-

self.groups = [] 

-

else: 

-

self.groups = groups 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_model_url_parm_py.html b/orm/services/region_manager/cover/rms_model_url_parm_py.html deleted file mode 100644 index c8234f07..00000000 --- a/orm/services/region_manager/cover/rms_model_url_parm_py.html +++ /dev/null @@ -1,307 +0,0 @@ - - - - - - - - - - - Coverage for rms/model/url_parm.py: 94% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

- -
-

"""module.""" 

-

 

-

 

-

class UrlParms(object): 

-

"""class method.""" 

-

 

-

def __init__(self, type=None, status=None, metadata=None, rangerAgentVersion=None, 

-

clli=None, regionname=None, osversion=None, valet=None, 

-

state=None, country=None, city=None, street=None, zip=None, 

-

is_ecomp=None, is_ssp=None, purpose_of_region=None): 

-

"""init method. 

-

 

-

:param type: 

-

:param status: 

-

:param metadata: 

-

:param rangerAgentVersion: 

-

:param clli: 

-

:param regionname: 

-

:param osversion: 

-

:param valet: 

-

:param state: 

-

:param country: 

-

:param city: 

-

:param street: 

-

:param zip: 

-

""" 

-

if type: 

-

self.location_type = type 

-

if status: 

-

self.region_status = status 

-

if metadata: 

-

self.metadata = metadata 

-

if rangerAgentVersion: 

-

self.ranger_agent_version = rangerAgentVersion 

-

if clli: 

-

self.clli = clli 

-

if regionname: 

-

self.name = regionname 

-

if osversion: 

-

self.open_stack_version = osversion 

-

if valet: 

-

self.valet = valet 

-

if state: 

-

self.address_state = state 

-

if country: 

-

self.address_country = country 

-

if city: 

-

self.address_city = city 

-

if street: 

-

self.address_street = street 

-

if zip: 

-

self.address_zip = zip 

-

if is_ecomp: 

-

self.is_ecomp = is_ecomp 

-

if is_ssp: 

-

self.is_ssp = is_ssp 

-

if purpose_of_region: 

-

self.purpose_of_region 

-

 

-

def _build_query(self): 

-

"""nuild db query. 

-

 

-

:return: 

-

""" 

-

metadatadict = None 

-

regiondict = None 

-

if self.__dict__: 

-

metadatadict = self._build_metadata_dict() 

-

regiondict = self._build_region_dict() 

-

return regiondict, metadatadict, None 

-

 

-

def _build_metadata_dict(self): 

-

"""meta_data dict. 

-

 

-

:return: metadata dict 

-

""" 

-

metadata = None 

-

if 'metadata' in self.__dict__: 

-

metadata = {'ref_keys': [], 'meta_data_pairs': [], 

-

'meta_data_keys': []} 

-

for metadata_item in self.metadata: 

-

if ':' in metadata_item: 

-

key = metadata_item.split(':')[0] 

-

metadata['ref_keys'].append(key) 

-

metadata['meta_data_pairs'].\ 

-

append({'metadata_key': key, 

-

'metadata_value': metadata_item.split(':')[1]}) 

-

else: 

-

metadata['meta_data_keys'].append(metadata_item) 

-

# Now clean irrelevant values 

-

keys_list = [] 

-

for item in metadata['meta_data_keys']: 

-

if item not in metadata['ref_keys']: 

-

keys_list.append(item) 

-

 

-

metadata['meta_data_keys'] = keys_list 

-

 

-

return metadata 

-

 

-

def _build_region_dict(self): 

-

"""region dict. 

-

 

-

:return:regin dict 

-

""" 

-

regiondict = {} 

-

for key, value in self.__dict__.items(): 

-

if key != 'metadata': 

-

regiondict[key] = value 

-

return regiondict 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_services___init___py.html b/orm/services/region_manager/cover/rms_services___init___py.html deleted file mode 100644 index 430566d0..00000000 --- a/orm/services/region_manager/cover/rms_services___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for rms/services/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

- -
-

"""services package.""" 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_services_error_base_py.html b/orm/services/region_manager/cover/rms_services_error_base_py.html deleted file mode 100644 index 3488d3a4..00000000 --- a/orm/services/region_manager/cover/rms_services_error_base_py.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - Coverage for rms/services/error_base.py: 89% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

- -
-

"""Exceptions module.""" 

-

 

-

 

-

class Error(Exception): 

-

pass 

-

 

-

 

-

class ErrorStatus(Error): 

-

 

-

def __init__(self, status_code, message=""): 

-

self.status_code = status_code 

-

self.message = message 

-

 

-

 

-

class NotFoundError(ErrorStatus): 

-

 

-

def __init__(self, status_code=404, message="Not found"): 

-

self.status_code = status_code 

-

self.message = message 

-

 

-

 

-

class ConflictError(ErrorStatus): 

-

 

-

def __init__(self, status_code=409, message="Conflict error"): 

-

self.status_code = status_code 

-

self.message = message 

-

 

-

 

-

class InputValueError(ErrorStatus): 

-

 

-

def __init__(self, status_code=400, message="value not allowed"): 

-

self.status_code = status_code 

-

self.message = message 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_services_services_py.html b/orm/services/region_manager/cover/rms_services_services_py.html deleted file mode 100644 index 0192f62f..00000000 --- a/orm/services/region_manager/cover/rms_services_services_py.html +++ /dev/null @@ -1,661 +0,0 @@ - - - - - - - - - - - Coverage for rms/services/services.py: 68% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

-

185

-

186

-

187

-

188

-

189

-

190

-

191

-

192

-

193

-

194

-

195

-

196

-

197

-

198

-

199

-

200

-

201

-

202

-

203

-

204

-

205

-

206

-

207

-

208

-

209

-

210

-

211

-

212

-

213

-

214

-

215

-

216

-

217

-

218

-

219

-

220

-

221

-

222

-

223

-

224

-

225

-

226

-

227

-

228

-

229

-

230

-

231

-

232

-

233

-

234

-

235

-

236

-

237

-

238

-

239

-

240

-

241

-

242

-

243

-

244

-

245

-

246

-

247

-

248

-

249

-

250

-

251

-

252

-

253

-

254

-

255

-

256

-

257

-

258

-

259

-

260

-

261

-

262

-

263

-

264

-

265

-

266

-

267

-

268

-

269

-

270

-

271

-

272

-

273

-

274

-

275

-

276

-

277

-

278

-

279

-

280

-

281

-

282

-

283

-

284

-

285

-

286

- -
-

"""DB actions wrapper module.""" 

-

import logging 

-

from rms.model.model import Groups 

-

from rms.model.model import Regions 

-

from rms.services import error_base 

-

from rms.storage import base_data_manager 

-

from rms.storage import data_manager_factory 

-

 

-

LOG = logging.getLogger(__name__) 

-

 

-

 

-

def get_regions_data(url_parms): 

-

"""get region from db. 

-

 

-

:param url_parms: the parameters got in the url to make the query 

-

:return: region model for json output 

-

:raise: NoContentError( status code 404) 

-

""" 

-

region_dict, metadata_dict, end_point = url_parms._build_query() 

-

db = data_manager_factory.get_data_manager() 

-

regions = db.get_regions(region_dict, metadata_dict, end_point) 

-

if not regions: 

-

raise error_base.NotFoundError(message="No regions found for the given search parameters") 

-

return Regions(regions) 

-

 

-

 

-

def get_region_by_id_or_name(region_id_or_name): 

-

""" 

-

 

-

:param region_id_or_name: 

-

:return: region object (wsme format) 

-

""" 

-

LOG.debug("LOGIC:- get region data by id or name {}".format(region_id_or_name)) 

-

try: 

-

db = data_manager_factory.get_data_manager() 

-

region = db.get_region_by_id_or_name(region_id_or_name) 

-

 

-

if not region: 

-

raise error_base.NotFoundError(message="Region {} not found".format(region_id_or_name)) 

-

 

-

except Exception as exp: 

-

LOG.exception("error in get region by id/name") 

-

raise 

-

 

-

return region 

-

 

-

 

-

def update_region(region_id, region): 

-

""" 

-

:param region: 

-

:return: 

-

""" 

-

LOG.debug("logic:- update region {}".format(region)) 

-

try: 

-

 

-

region = region._to_clean_python_obj() 

-

region._validate_model() 

-

region_dict = region._to_db_model_dict() 

-

 

-

db = data_manager_factory.get_data_manager() 

-

db.update_region(region_to_update=region_id, **region_dict) 

-

LOG.debug("region {} updated".format(region_id)) 

-

result = get_region_by_id_or_name(region_id) 

-

 

-

except error_base.NotFoundError as exp: 

-

LOG.exception("fail to update region {}".format(exp.message)) 

-

raise 

-

except Exception as exp: 

-

LOG.exception("fail to update region {}".format(exp)) 

-

raise 

-

return result 

-

 

-

 

-

def delete_region(region_id): 

-

""" 

-

 

-

:param region_id: 

-

:return: 

-

""" 

-

LOG.debug("logic:- delete region {}".format(region_id)) 

-

try: 

-

db = data_manager_factory.get_data_manager() 

-

db.delete_region(region_id) 

-

LOG.debug("region deleted") 

-

except Exception as exp: 

-

LOG.exception("fail to delete region {}".format(exp)) 

-

raise 

-

return 

-

 

-

 

-

def create_full_region(full_region): 

-

"""create region logic. 

-

 

-

:param full_region obj: 

-

:return: 

-

:raise: input value error(status code 400) 

-

""" 

-

LOG.debug("logic:- save region ") 

-

try: 

-

 

-

full_region = full_region._to_clean_python_obj() 

-

full_region._validate_model() 

-

 

-

full_region_db_dict = full_region._to_db_model_dict() 

-

LOG.debug("region to save {}".format(full_region_db_dict)) 

-

db = data_manager_factory.get_data_manager() 

-

db.add_region(**full_region_db_dict) 

-

LOG.debug("region added") 

-

result = get_region_by_id_or_name(full_region.id) 

-

 

-

except error_base.InputValueError as exp: 

-

LOG.exception("error in save region {}".format(exp.message)) 

-

raise 

-

except base_data_manager.DuplicateEntryError as exp: 

-

LOG.exception("error in save region {}".format(exp.message)) 

-

raise error_base.ConflictError(message=exp.message) 

-

except Exception as exp: 

-

LOG.exception("error in save region {}".format(exp.message)) 

-

raise 

-

 

-

return result 

-

 

-

 

-

def add_region_metadata(region_id, metadata_dict): 

-

LOG.debug("Add metadata: {} to region id : {}".format(metadata_dict, 

-

region_id)) 

-

try: 

-

db = data_manager_factory.get_data_manager() 

-

result = db.add_meta_data_to_region(region_id, metadata_dict) 

-

if not result: 

-

raise error_base.NotFoundError(message="Region {} not found".format(region_id)) 

-

else: 

-

return result.metadata 

-

 

-

except Exception as exp: 

-

LOG.exception("Error getting metadata for region id:".format(region_id)) 

-

raise 

-

 

-

 

-

def update_region_metadata(region_id, metadata_dict): 

-

LOG.debug("Update metadata to region id : {}. " 

-

"New metadata: {}".format(region_id, metadata_dict)) 

-

try: 

-

db = data_manager_factory.get_data_manager() 

-

result = db.update_region_meta_data(region_id, metadata_dict) 

-

if not result: 

-

raise error_base.NotFoundError(message="Region {} not " 

-

"found".format(region_id)) 

-

else: 

-

return result.metadata 

-

 

-

except Exception as exp: 

-

LOG.exception("Error getting metadata for region id:".format(region_id)) 

-

raise 

-

 

-

 

-

def delete_metadata_from_region(region_id, metadata_key): 

-

LOG.info("Delete metadata key: {} from region id : {}." 

-

.format(metadata_key, region_id)) 

-

try: 

-

db = data_manager_factory.get_data_manager() 

-

db.delete_region_metadata(region_id, metadata_key) 

-

 

-

except Exception as exp: 

-

LOG.exception("Error getting metadata for region id:".format(region_id)) 

-

raise 

-

 

-

 

-

def get_groups_data(name): 

-

"""get group from db. 

-

 

-

:param name: groupe name 

-

:return: groupe object with its regions 

-

:raise: NoContentError( status code 404) 

-

""" 

-

db = data_manager_factory.get_data_manager() 

-

groups = db.get_group(name) 

-

if not groups: 

-

raise error_base.NotFoundError(message="Group {} not found".format(name)) 

-

return Groups(**groups) 

-

 

-

 

-

def get_all_groups(): 

-

""" 

-

 

-

:return: 

-

""" 

-

try: 

-

LOG.debug("logic - get all groups") 

-

db = data_manager_factory.get_data_manager() 

-

all_groups = db.get_all_groups() 

-

LOG.debug("logic - got all groups {}".format(all_groups)) 

-

 

-

except Exception as exp: 

-

LOG.error("fail to get all groups") 

-

LOG.exception(exp) 

-

raise 

-

 

-

return all_groups 

-

 

-

 

-

def delete_group(group_id): 

-

""" 

-

 

-

:param group_id: 

-

:return: 

-

""" 

-

LOG.debug("delete group logic") 

-

try: 

-

 

-

db = data_manager_factory.get_data_manager() 

-

LOG.debug("delete group id {} from db".format(group_id)) 

-

db.delete_group(group_id) 

-

 

-

except Exception as exp: 

-

LOG.exception(exp) 

-

raise 

-

return 

-

 

-

 

-

def create_group_in_db(group_id, group_name, description, regions): 

-

"""Create a region group in the database. 

-

 

-

:param group_id: The ID of the group to create 

-

:param group_name: The name of the group to create 

-

:param description: The group description 

-

:param regions: A list of regions inside the group 

-

:raise: GroupExistsError (status code 400) if the group already exists 

-

""" 

-

try: 

-

manager = data_manager_factory.get_data_manager() 

-

manager.add_group(group_id, group_name, description, regions) 

-

except error_base.ConflictError: 

-

LOG.exception("Group {} already exists".format(group_id)) 

-

raise error_base.ConflictError( 

-

message="Group {} already exists".format(group_id)) 

-

except error_base.InputValueError: 

-

LOG.exception("Some of the regions not found") 

-

raise error_base.NotFoundError( 

-

message="Some of the regions not found") 

-

 

-

 

-

def update_group(group, group_id): 

-

result = None 

-

LOG.debug("update group logic") 

-

try: 

-

group = group._to_python_obj() 

-

db_manager = data_manager_factory.get_data_manager() 

-

LOG.debug("update group to {}".format(group._to_db_model_dict())) 

-

db_manager.update_group(group_id=group_id, **group._to_db_model_dict()) 

-

LOG.debug("group updated") 

-

# make sure it updated 

-

groups = db_manager.get_group(group_id) 

-

 

-

except error_base.NotFoundError: 

-

LOG.error("Group {} not found") 

-

raise 

-

except error_base.InputValueError: 

-

LOG.exception("Some of the regions not found") 

-

raise error_base.NotFoundError( 

-

message="Some of the regions not found") 

-

except Exception as exp: 

-

LOG.error("Failed to update group {}".format(group.group_id)) 

-

LOG.exception(exp) 

-

raise 

-

 

-

return Groups(**groups) 

-

 

-

 

-

def update_region_status(region_id, new_status): 

-

"""Update region. 

-

 

-

:param region_id: 

-

:param new_status: 

-

:return: 

-

""" 

-

LOG.debug("Update region id: {} status to: {}".format(region_id, 

-

new_status)) 

-

try: 

-

db = data_manager_factory.get_data_manager() 

-

result = db.update_region_status(region_id, new_status) 

-

return result 

-

 

-

except Exception as exp: 

-

LOG.exception("Error updating status for region id:".format(region_id)) 

-

raise 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_storage___init___py.html b/orm/services/region_manager/cover/rms_storage___init___py.html deleted file mode 100644 index b9e43969..00000000 --- a/orm/services/region_manager/cover/rms_storage___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/storage/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_storage_base_data_manager_py.html b/orm/services/region_manager/cover/rms_storage_base_data_manager_py.html deleted file mode 100644 index c3b0d045..00000000 --- a/orm/services/region_manager/cover/rms_storage_base_data_manager_py.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - - - - - - - - Coverage for rms/storage/base_data_manager.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

- -
-

 

-

class BaseDataManager(object): 

-

 

-

def __init__(self, url, 

-

max_retries, 

-

retry_interval): 

-

pass 

-

 

-

def add_region(self, 

-

region_id, 

-

name, 

-

address_state, 

-

address_country, 

-

address_city, 

-

address_street, 

-

address_zip, 

-

region_status, 

-

ranger_agent_version, 

-

open_stack_version, 

-

design_type, 

-

location_type, 

-

vlcp_name, 

-

clli, 

-

description, 

-

meta_data_list, 

-

end_point_list, 

-

is_ecomp, 

-

is_ssp, 

-

purpose_of_region): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

""" 

-

def delete_region(self, 

-

region_id): 

-

raise NotImplementedError("Please Implement this method") 

-

""" 

-

 

-

def get_regions(self, 

-

region_filters_dict, 

-

meta_data_dict, 

-

end_point_dict): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

def get_all_regions(self): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

""" 

-

def add_meta_data_to_region(self, 

-

region_id, 

-

key, 

-

value, 

-

description): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

def remove_meta_data_from_region(self, 

-

region_id, 

-

key): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

def add_end_point_to_region(self, 

-

region_id, 

-

end_point_type, 

-

end_point_url, 

-

description): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

def remove_end_point_from_region(self, 

-

region_id, 

-

end_point_type): 

-

raise NotImplementedError("Please Implement this method") 

-

""" 

-

 

-

def add_group(self, 

-

group_id, 

-

group_name, 

-

group_description, 

-

region_ids_list): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

""" 

-

def delete_group(self, 

-

group_name): 

-

raise NotImplementedError("Please Implement this method") 

-

""" 

-

 

-

def get_group(self, group_id): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

def get_all_groups(self): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

""" 

-

def add_region_to_group(self, 

-

group_id, 

-

region_id): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

def remove_region_from_group(self, 

-

group_id, 

-

region_id): 

-

raise NotImplementedError("Please Implement this method") 

-

""" 

-

 

-

 

-

class SQLDBError(Exception): 

-

pass 

-

 

-

 

-

class EntityNotFound(Exception): 

-

"""if item not found in DB.""" 

-

pass 

-

 

-

 

-

class DuplicateEntryError(Exception): 

-

"""A group already exists.""" 

-

pass 

-

 

-

 

-

class InputValueError(Exception): 

-

""" unvalid input from user""" 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_storage_data_manager_factory_py.html b/orm/services/region_manager/cover/rms_storage_data_manager_factory_py.html deleted file mode 100644 index 87d1ef0d..00000000 --- a/orm/services/region_manager/cover/rms_storage_data_manager_factory_py.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - Coverage for rms/storage/data_manager_factory.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

- -
-

import logging 

-

 

-

from pecan import conf 

-

 

-

from rms.storage.my_sql.data_manager import DataManager 

-

 

-

LOG = logging.getLogger(__name__) 

-

 

-

 

-

def get_data_manager(): 

-

try: 

-

dm = DataManager(url=conf.database.url, 

-

max_retries=conf.database.max_retries, 

-

retries_interval=conf.database.retries_interval) 

-

return dm 

-

except Exception: 

-

nagios_message = "CRITICAL|CONDB001 - Could not establish " \ 

-

"database connection" 

-

LOG.error(nagios_message) 

-

raise Exception("Could not establish database connection") 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_storage_my_sql___init___py.html b/orm/services/region_manager/cover/rms_storage_my_sql___init___py.html deleted file mode 100644 index a6e95539..00000000 --- a/orm/services/region_manager/cover/rms_storage_my_sql___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/storage/my_sql/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_storage_my_sql_data_manager_py.html b/orm/services/region_manager/cover/rms_storage_my_sql_data_manager_py.html deleted file mode 100644 index 589a433b..00000000 --- a/orm/services/region_manager/cover/rms_storage_my_sql_data_manager_py.html +++ /dev/null @@ -1,1147 +0,0 @@ - - - - - - - - - - - Coverage for rms/storage/my_sql/data_manager.py: 89% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

-

185

-

186

-

187

-

188

-

189

-

190

-

191

-

192

-

193

-

194

-

195

-

196

-

197

-

198

-

199

-

200

-

201

-

202

-

203

-

204

-

205

-

206

-

207

-

208

-

209

-

210

-

211

-

212

-

213

-

214

-

215

-

216

-

217

-

218

-

219

-

220

-

221

-

222

-

223

-

224

-

225

-

226

-

227

-

228

-

229

-

230

-

231

-

232

-

233

-

234

-

235

-

236

-

237

-

238

-

239

-

240

-

241

-

242

-

243

-

244

-

245

-

246

-

247

-

248

-

249

-

250

-

251

-

252

-

253

-

254

-

255

-

256

-

257

-

258

-

259

-

260

-

261

-

262

-

263

-

264

-

265

-

266

-

267

-

268

-

269

-

270

-

271

-

272

-

273

-

274

-

275

-

276

-

277

-

278

-

279

-

280

-

281

-

282

-

283

-

284

-

285

-

286

-

287

-

288

-

289

-

290

-

291

-

292

-

293

-

294

-

295

-

296

-

297

-

298

-

299

-

300

-

301

-

302

-

303

-

304

-

305

-

306

-

307

-

308

-

309

-

310

-

311

-

312

-

313

-

314

-

315

-

316

-

317

-

318

-

319

-

320

-

321

-

322

-

323

-

324

-

325

-

326

-

327

-

328

-

329

-

330

-

331

-

332

-

333

-

334

-

335

-

336

-

337

-

338

-

339

-

340

-

341

-

342

-

343

-

344

-

345

-

346

-

347

-

348

-

349

-

350

-

351

-

352

-

353

-

354

-

355

-

356

-

357

-

358

-

359

-

360

-

361

-

362

-

363

-

364

-

365

-

366

-

367

-

368

-

369

-

370

-

371

-

372

-

373

-

374

-

375

-

376

-

377

-

378

-

379

-

380

-

381

-

382

-

383

-

384

-

385

-

386

-

387

-

388

-

389

-

390

-

391

-

392

-

393

-

394

-

395

-

396

-

397

-

398

-

399

-

400

-

401

-

402

-

403

-

404

-

405

-

406

-

407

-

408

-

409

-

410

-

411

-

412

-

413

-

414

-

415

-

416

-

417

-

418

-

419

-

420

-

421

-

422

-

423

-

424

-

425

-

426

-

427

-

428

-

429

-

430

-

431

-

432

-

433

-

434

-

435

-

436

-

437

-

438

-

439

-

440

-

441

-

442

-

443

-

444

-

445

-

446

-

447

-

448

-

449

-

450

-

451

-

452

-

453

-

454

-

455

-

456

-

457

-

458

-

459

-

460

-

461

-

462

-

463

-

464

-

465

-

466

-

467

-

468

-

469

-

470

-

471

-

472

-

473

-

474

-

475

-

476

-

477

-

478

-

479

-

480

-

481

-

482

-

483

-

484

-

485

-

486

-

487

-

488

-

489

-

490

-

491

-

492

-

493

-

494

-

495

-

496

-

497

-

498

-

499

-

500

-

501

-

502

-

503

-

504

-

505

-

506

-

507

-

508

-

509

-

510

-

511

-

512

-

513

-

514

-

515

-

516

-

517

-

518

-

519

-

520

-

521

-

522

-

523

-

524

-

525

-

526

-

527

-

528

-

529

- -
-

import logging 

-

 

-

import oslo_db 

-

from oslo_db.sqlalchemy import session as db_session 

-

from sqlalchemy.ext.declarative.api import declarative_base 

-

from sqlalchemy.sql import or_ 

-

 

-

from rms.services import error_base as ServiceBase 

-

from data_models import Region, RegionEndPoint, Group 

-

from data_models import RegionMetaData, GroupRegion 

-

from rms.services import error_base 

-

from rms.storage.base_data_manager import BaseDataManager, DuplicateEntryError, EntityNotFound 

-

from rms.model import model as PythonModels 

-

 

-

Base = declarative_base() 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class DataManager(BaseDataManager): 

-

 

-

def __init__(self, url, max_retries, retries_interval): 

-

self._engine_facade = db_session.EngineFacade(url, 

-

max_retries=max_retries, 

-

retry_interval=retries_interval) 

-

 

-

def add_region(self, 

-

region_id, 

-

name, 

-

address_state, 

-

address_country, 

-

address_city, 

-

address_street, 

-

address_zip, 

-

region_status, 

-

ranger_agent_version, 

-

open_stack_version, 

-

design_type, 

-

location_type, 

-

vlcp_name, 

-

clli, 

-

# a list of dictionaries of format 

-

# {"type":"", "url":"", "description":"" 

-

end_point_list, 

-

# a dictionary of key,value pairs 

-

# {"key":"value", } 

-

meta_data_dict, 

-

is_ecomp, 

-

is_ssp, 

-

purpose_of_region="", 

-

description=""): 

-

""" add a new region to the `region` table 

-

add also the regions give meta_data and end_points to the `region_end_point` and 

-

`region_meta_data` tables if given. 

-

handle duplicate errors if raised""" 

-

try: 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

region = Region(region_id=region_id, 

-

name=name, 

-

address_state=address_state, 

-

address_country=address_country, 

-

address_city=address_city, 

-

address_street=address_street, 

-

address_zip=address_zip, 

-

region_status=region_status, 

-

ranger_agent_version=ranger_agent_version, 

-

open_stack_version=open_stack_version, 

-

design_type=design_type, 

-

location_type=location_type, 

-

vlcp_name=vlcp_name, 

-

clli=clli, 

-

description=description, 

-

is_ecomp=is_ecomp * 1, 

-

is_ssp=is_ssp * 1, 

-

purpose_of_region=purpose_of_region) 

-

 

-

if end_point_list is not None: 

-

for end_point in end_point_list: 

-

region_end_point = RegionEndPoint( 

-

end_point_type=end_point["type"], 

-

public_url=end_point["url"]) 

-

region.end_points.append(region_end_point) 

-

 

-

if meta_data_dict is not None: 

-

for k, v in meta_data_dict.iteritems(): 

-

for list_item in v: 

-

region.meta_data.append( 

-

RegionMetaData(region_id=region_id, 

-

meta_data_key=k, 

-

meta_data_value=list_item)) 

-

 

-

session.add(region) 

-

except oslo_db.exception.DBDuplicateEntry as e: 

-

logger.warning("Duplicate entry: {}".format(str(e))) 

-

raise DuplicateEntryError("Region {} already " 

-

"exist".format(region_id)) 

-

 

-

def update_region(self, 

-

region_to_update, 

-

region_id, 

-

name, 

-

address_state, 

-

address_country, 

-

address_city, 

-

address_street, 

-

address_zip, 

-

region_status, 

-

ranger_agent_version, 

-

open_stack_version, 

-

design_type, 

-

location_type, 

-

vlcp_name, 

-

clli, 

-

# a list of dictionaries of format 

-

# {"type":"", "url":"", "description":"" 

-

end_point_list, 

-

# a list of dictionaries of format 

-

# {"key":"", "value":"", "description":"" 

-

meta_data_dict, 

-

is_ecomp, 

-

is_ssp, 

-

purpose_of_region="", 

-

description=""): 

-

""" add a new region to the `region` table 

-

add also the regions give meta_data and end_points to the `region_end_point` and 

-

`region_meta_data` tables if given. 

-

handle duplicate errors if raised""" 

-

try: 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

# remove all childs as with update need to replace them 

-

session.query(RegionMetaData).filter_by(region_id=region_to_update).delete() 

-

session.query(RegionEndPoint).filter_by(region_id=region_to_update).delete() 

-

 

-

record = session.query(Region).filter_by(region_id=region_to_update).first() 

-

if record is not None: 

-

# record.region_id = region_id # ignore id and name when update 

-

# record.name = name 

-

record.address_state = address_state 

-

record.address_country = address_country 

-

record.address_city = address_city 

-

record.address_street = address_street 

-

record.address_zip = address_zip 

-

record.region_status = region_status 

-

record.ranger_agent_version = ranger_agent_version 

-

record.open_stack_version = open_stack_version 

-

record.design_type = design_type 

-

record.location_type = location_type 

-

record.vlcp_name = vlcp_name 

-

record.clli = clli 

-

record.description = description 

-

record.is_ecomp = is_ecomp * 1 

-

record.is_ssp = is_ssp * 1 

-

record.purpose_of_region = purpose_of_region 

-

 

-

if end_point_list is not None: 

-

for end_point in end_point_list: 

-

region_end_point = RegionEndPoint( 

-

end_point_type=end_point["type"], 

-

public_url=end_point["url"] 

-

) 

-

record.end_points.append(region_end_point) 

-

 

-

if meta_data_dict is not None: 

-

for k, v in meta_data_dict.iteritems(): 

-

for list_item in v: 

-

record.meta_data.append( 

-

RegionMetaData(region_id=region_id, 

-

meta_data_key=k, 

-

meta_data_value=list_item)) 

-

else: 

-

raise EntityNotFound("Region {} not found".format( 

-

region_to_update)) 

-

except EntityNotFound as exp: 

-

logger.exception( 

-

"fail to update entity with id {} not found".format( 

-

region_to_update)) 

-

raise ServiceBase.NotFoundError(message=exp.message) 

-

except Exception as exp: 

-

logger.exception("fail to update region {}".format(str(exp))) 

-

raise 

-

 

-

def delete_region(self, region_id): 

-

# delete a region from `region` table and also the region's 

-

# entries from `region_meta_data` and `region_end_points` tables 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

session.query(Region).filter_by(region_id=region_id).delete() 

-

 

-

def get_all_regions(self): 

-

return self.get_regions(None, None, None) 

-

 

-

def get_regions(self, 

-

region_filters_dict, 

-

meta_data_dict, 

-

end_point_dict): 

-

logger.debug("Get regions") 

-

records_model = [] 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

records = session.query(Region) 

-

if region_filters_dict is not None: 

-

records = records.filter_by(**region_filters_dict) 

-

 

-

if meta_data_dict is not None: 

-

regions = self._get_regions_for_meta_data_dict(meta_data_dict, 

-

session) 

-

query = [] 

-

query.append((Region.region_id.in_(regions))) 

-

records = records.filter(*query) 

-

 

-

if end_point_dict is not None: 

-

records = records.join(RegionEndPoint).\ 

-

filter_by(**end_point_dict) 

-

if records is not None: 

-

for record in records: 

-

records_model.append(record.to_wsme()) 

-

return records_model 

-

 

-

def _get_regions_for_meta_data_dict(self, meta_data_dict, session): 

-

result_lists = [] 

-

for key in meta_data_dict['meta_data_keys']: 

-

md_q = session.query(RegionMetaData). \ 

-

filter(RegionMetaData.meta_data_key == key).all() 

-

temp_result_list = [] 

-

if md_q is not None: 

-

for record in md_q: 

-

temp_result_list.append(record.region_id) 

-

result_lists.append(set(temp_result_list)) 

-

logger.debug(set(temp_result_list)) 

-

for item in meta_data_dict['meta_data_pairs']: 

-

md_q = session.query(RegionMetaData). \ 

-

filter(RegionMetaData.meta_data_key == item['metadata_key'], 

-

RegionMetaData.meta_data_value == item['metadata_value']).all() 

-

temp_result_list = [] 

-

if md_q is not None: 

-

for record in md_q: 

-

temp_result_list.append(record.region_id) 

-

result_lists.append(set(temp_result_list)) 

-

logger.debug(set(temp_result_list)) 

-

 

-

result = [] 

-

if result_lists: 

-

result = result_lists[0] 

-

for l in result_lists: 

-

result = result.intersection(l) 

-

else: 

-

result = None 

-

logger.debug(result) 

-

return result 

-

 

-

def get_region_by_id_or_name(self, region_id_or_name): 

-

logger.debug("Get region by id or name: {}".format(region_id_or_name)) 

-

try: 

-

 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

record = session.query(Region) 

-

record = record.filter(or_(Region.region_id == region_id_or_name, 

-

Region.name == region_id_or_name)) 

-

if record.first(): 

-

return record.first().to_wsme() 

-

return None 

-

 

-

except Exception as exp: 

-

logger.exception("DB error filtering by id/name") 

-

raise 

-

 

-

def add_meta_data_to_region(self, region_id, 

-

metadata_dict): 

-

""" 

-

:param region_id: 

-

:param metadata_dict: 

-

:return: 

-

""" 

-

session = self._engine_facade.get_session() 

-

try: 

-

with session.begin(): 

-

record = session.query(Region).\ 

-

filter_by(region_id=region_id).first() 

-

 

-

if record is not None: 

-

region_metadata = [] 

-

for k, v in metadata_dict.iteritems(): 

-

for list_item in v: 

-

region_metadata.append(RegionMetaData(region_id=region_id, 

-

meta_data_key=k, 

-

meta_data_value=list_item)) 

-

session.add_all(region_metadata) 

-

return record.to_wsme() 

-

else: 

-

logger.error("Region {} does not exist. " 

-

"Meta Data was not added!".format(region_id)) 

-

return None 

-

 

-

except oslo_db.exception.DBDuplicateEntry as e: 

-

logger.warning("Duplicate entry: {}".format(str(e))) 

-

raise error_base.ConflictError(message="Duplicate metadata value " 

-

"in region {}".format(region_id)) 

-

 

-

def update_region_meta_data(self, region_id, 

-

metadata_dict): 

-

""" 

-

Replace existing metadata for given region_id 

-

:param region_id: 

-

:param metadata_dict: 

-

:return: 

-

""" 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

 

-

record = session.query(Region). \ 

-

filter_by(region_id=region_id).first() 

-

if not record: 

-

msg = "Region {} not found".format(region_id) 

-

logger.info(msg) 

-

raise error_base.NotFoundError(message=msg) 

-

 

-

session.query(RegionMetaData).\ 

-

filter_by(region_id=region_id).delete() 

-

 

-

region_metadata = [] 

-

for k, v in metadata_dict.iteritems(): 

-

for list_item in v: 

-

region_metadata.append(RegionMetaData(region_id=region_id, 

-

meta_data_key=k, 

-

meta_data_value=list_item)) 

-

 

-

session.add_all(region_metadata) 

-

return record.to_wsme() 

-

 

-

def delete_region_metadata(self, region_id, key): 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

record = session.query(Region). \ 

-

filter_by(region_id=region_id).first() 

-

 

-

if not record: 

-

msg = "Region {} not found".format(region_id) 

-

logger.info(msg) 

-

raise error_base.NotFoundError(message=msg) 

-

 

-

session.query(RegionMetaData).filter_by(region_id=region_id, 

-

meta_data_key=key).delete() 

-

 

-

def update_region_status(self, region_id, region_status): 

-

try: 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

 

-

record = session.query(Region).filter_by(region_id=region_id).first() 

-

if record is not None: 

-

record.region_status = region_status 

-

else: 

-

msg = "Region {} not found".format(region_id) 

-

logger.info(msg) 

-

raise error_base.NotFoundError(message=msg) 

-

return record.region_status 

-

 

-

except Exception as exp: 

-

logger.exception("failed to update region {}".format(str(exp))) 

-

raise 

-

""" 

-

def add_end_point_to_region(self, 

-

region_id, 

-

end_point_type, 

-

end_point_url, 

-

description): 

-

session = self._engine_facade.get_session() 

-

try: 

-

with session.begin(): 

-

record = session.query(Region).filter_by(region_id=region_id).\ 

-

first() 

-

if record is not None: 

-

session.add( 

-

RegionEndPoint(region_id=region_id, 

-

end_point_type=end_point_type, 

-

public_url=end_point_url, 

-

description=description)) 

-

else: 

-

logger.error("Region {} does not exist. " 

-

"End point was not added !".format(region_id)) 

-

 

-

except oslo_db.exception.DBDuplicateEntry as e: 

-

logger.warning("Duplicate entry: {}".format(str(e))) 

-

raise SQLDBError("Duplicate entry error") 

-

 

-

def remove_end_point_from_region(self, 

-

region_id, 

-

end_point_type): 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

session.query(Region).filter_by(region_id=region_id, 

-

end_point_type=end_point_type).\ 

-

delete() 

-

""" 

-

 

-

# Handle group management operations 

-

def add_group(self, 

-

group_id, 

-

group_name, 

-

group_description, 

-

region_ids_list): 

-

session = self._engine_facade.get_session() 

-

try: 

-

with session.begin(): 

-

session.add(Group(group_id=group_id, 

-

name=group_name, 

-

description=group_description)) 

-

 

-

session.flush() # add the groupe if not rollback 

-

 

-

if region_ids_list is not None: 

-

group_regions = [] 

-

for region_id in region_ids_list: 

-

group_regions.append(GroupRegion(group_id=group_id, 

-

region_id=region_id)) 

-

session.add_all(group_regions) 

-

except oslo_db.exception.DBReferenceError as e: 

-

logger.error("Reference error: {}".format(str(e))) 

-

raise error_base.InputValueError("Reference error") 

-

except oslo_db.exception.DBDuplicateEntry as e: 

-

logger.error("Duplicate entry: {}".format(str(e))) 

-

raise error_base.ConflictError("Duplicate entry error") 

-

 

-

def delete_group(self, group_id): 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

session.query(Group).filter_by(group_id=group_id).delete() 

-

 

-

def get_all_groups(self): 

-

logger.debug("DB- Get all groups") 

-

records_model = PythonModels.GroupsWrraper() 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

groups = session.query(Group) 

-

for a_group in groups: 

-

group_model = PythonModels.Groups() 

-

group_model.id = a_group.group_id 

-

group_model.name = a_group.name 

-

group_model.description = a_group.description 

-

regions = [] 

-

group_regions = session.query(GroupRegion).\ 

-

filter_by(group_id=a_group.group_id) 

-

for group_region in group_regions: 

-

regions.append(group_region.region_id) 

-

 

-

group_model.regions = regions 

-

records_model.groups.append(group_model) 

-

return records_model 

-

 

-

def update_group(self, group_id, group_name, group_description, 

-

group_regions): 

-

try: 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

# in update scenario delete all child records 

-

session.query(GroupRegion).filter_by( 

-

group_id=group_id).delete() 

-

 

-

group_record = session.query(Group).filter_by( 

-

group_id=group_id).first() 

-

if group_record is None: 

-

raise error_base.NotFoundError( 

-

message="Group {} not found".format(group_id)) 

-

# only desc and regions can be changed 

-

group_record.description = group_description 

-

group_record.name = group_name 

-

regions = [] 

-

for region_id in group_regions: 

-

regions.append(GroupRegion(region_id=region_id, 

-

group_id=group_id)) 

-

session.add_all(regions) 

-

 

-

except error_base.NotFoundError as exp: 

-

logger.error(exp.message) 

-

raise 

-

except oslo_db.exception.DBReferenceError as e: 

-

logger.error("Reference error: {}".format(str(e))) 

-

raise error_base.InputValueError("Reference error") 

-

except Exception as exp: 

-

logger.error("failed to update group {}".format(group_id)) 

-

logger.exception(exp) 

-

raise 

-

return 

-

 

-

def get_group(self, group_id): 

-

logger.debug("Get group by name") 

-

group_model = None 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

a_group = session.query(Group).filter_by(group_id=group_id)\ 

-

.first() 

-

if a_group is not None: 

-

group_model = {"id": a_group.group_id, 

-

"name": a_group.name, 

-

"description": a_group.description} 

-

regions = [] 

-

group_regions = session.query(GroupRegion). \ 

-

filter_by(group_id=a_group.group_id) 

-

for group_region in group_regions: 

-

regions.append(group_region.region_id) 

-

group_model["regions"] = regions 

-

return group_model 

-

 

-

""" 

-

def add_region_to_group(self, 

-

group_id, 

-

region_id): 

-

session = self._engine_facade.get_session() 

-

try: 

-

with session.begin(): 

-

session.add(GroupRegion(group_id=group_id, 

-

region_id=region_id)) 

-

except oslo_db.exception.DBReferenceError as e: 

-

logger.error("Refernce error: {}".format(str(e))) 

-

raise SQLDBError("Reference error") 

-

except oslo_db.exception.DBDuplicateEntry as e: 

-

logger.error("Duplicate entry: {}".format(str(e))) 

-

raise SQLDBError("Duplicate entry error") 

-

 

-

def remove_region_from_group(self, 

-

group_id, 

-

region_id): 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

session.query(GroupRegion).filter_by(group_id=group_id, 

-

region_id=region_id).delete() 

-

""" 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_utils___init___py.html b/orm/services/region_manager/cover/rms_utils___init___py.html deleted file mode 100644 index e9506082..00000000 --- a/orm/services/region_manager/cover/rms_utils___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/utils/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/cover/rms_utils_authentication_py.html b/orm/services/region_manager/cover/rms_utils_authentication_py.html deleted file mode 100644 index 70124848..00000000 --- a/orm/services/region_manager/cover/rms_utils_authentication_py.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - Coverage for rms/utils/authentication.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

- -
-

import logging 

-

 

-

from keystone_utils import tokens 

-

from orm_common.policy import policy 

-

from orm_common.utils import api_error_utils as err_utils 

-

 

-

from pecan import conf 

-

 

-

from rms.services import services as RegionService 

-

 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

def _get_keystone_ep(auth_region): 

-

result = RegionService.get_region_by_id_or_name(auth_region) 

-

for ep in result.endpoints: 

-

if ep.type == 'identity': 

-

return ep.publicurl 

-

 

-

# Keystone EP not found 

-

return None 

-

 

-

 

-

def authorize(request, action): 

-

if not _is_authorization_enabled(conf): 

-

return 

-

 

-

auth_region = request.headers.get('X-Auth-Region') 

-

try: 

-

keystone_ep = _get_keystone_ep(auth_region) 

-

except Exception: 

-

# Failed to find Keystone EP - we'll set it to None instead of failing 

-

# because the rule might be to let everyone pass 

-

keystone_ep = None 

-

 

-

policy.authorize(action, request, conf, keystone_ep=keystone_ep) 

-

 

-

 

-

def _is_authorization_enabled(app_conf): 

-

return app_conf.authentication.enabled 

-

 

-

 

-

def get_token_conf(app_conf): 

-

mech_id = app_conf.authentication.mech_id 

-

mech_password = app_conf.authentication.mech_pass 

-

# RMS URL is not necessary since this service is RMS 

-

rms_url = '' 

-

tenant_name = app_conf.authentication.tenant_name 

-

keystone_version = app_conf.authentication.keystone_version 

-

conf = tokens.TokenConf(mech_id, mech_password, rms_url, tenant_name, 

-

keystone_version) 

-

return conf 

- -
-
- - - - - diff --git a/orm/services/region_manager/cover/status.json b/orm/services/region_manager/cover/status.json deleted file mode 100644 index ae70bd7f..00000000 --- a/orm/services/region_manager/cover/status.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"rms_controllers_v2_orm_resources___init___py":{"index":{"relative_filename":"rms/controllers/v2/orm/resources/__init__.py","html_filename":"rms_controllers_v2_orm_resources___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"103b3a1826780f920626a4f622bcee7c"},"rms___init___py":{"index":{"relative_filename":"rms/__init__.py","html_filename":"rms___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_external_mock_audit_client_api___init___py":{"index":{"relative_filename":"rms/external_mock/audit_client/api/__init__.py","html_filename":"rms_external_mock_audit_client_api___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"19a064df3967067a2ec86c467e92d140"},"rms_controllers_lcp_controller_py":{"index":{"relative_filename":"rms/controllers/lcp_controller.py","html_filename":"rms_controllers_lcp_controller_py.html","nums":[1,56,0,0,0,0,0]},"hash":"a032e4765d0af628116fb4a525003601"},"rms_utils_authentication_py":{"index":{"relative_filename":"rms/utils/authentication.py","html_filename":"rms_utils_authentication_py.html","nums":[1,32,0,0,0,0,0]},"hash":"9816983ff8e57e8d1a9ed68b7c30ff50"},"rms_external_mock_orm_common___init___py":{"index":{"relative_filename":"rms/external_mock/orm_common/__init__.py","html_filename":"rms_external_mock_orm_common___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_model___init___py":{"index":{"relative_filename":"rms/model/__init__.py","html_filename":"rms_model___init___py.html","nums":[1,3,0,0,0,0,0]},"hash":"cf7982d8674fcb1858c46e0ed829f1e2"},"rms_storage_my_sql___init___py":{"index":{"relative_filename":"rms/storage/my_sql/__init__.py","html_filename":"rms_storage_my_sql___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_model_url_parm_py":{"index":{"relative_filename":"rms/model/url_parm.py","html_filename":"rms_model_url_parm_py.html","nums":[1,63,0,4,0,0,0]},"hash":"554a5d26967309c0321bb2d5ca4de2d0"},"rms_controllers_root_py":{"index":{"relative_filename":"rms/controllers/root.py","html_filename":"rms_controllers_root_py.html","nums":[1,12,0,1,0,0,0]},"hash":"22b13e705390f352b9e7a78c2f83d7b9"},"rms_external_mock_keystone_utils___init___py":{"index":{"relative_filename":"rms/external_mock/keystone_utils/__init__.py","html_filename":"rms_external_mock_keystone_utils___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_controllers_v2_orm_resources_groups_py":{"index":{"relative_filename":"rms/controllers/v2/orm/resources/groups.py","html_filename":"rms_controllers_v2_orm_resources_groups_py.html","nums":[1,124,0,22,0,0,0]},"hash":"38e755d11e73209da31ce4c4faff8d49"},"rms_controllers_v2_orm_resources_status_py":{"index":{"relative_filename":"rms/controllers/v2/orm/resources/status.py","html_filename":"rms_controllers_v2_orm_resources_status_py.html","nums":[1,47,0,3,0,0,0]},"hash":"afc1e6ecd339095ff57e6b9c7c9c819d"},"rms_services_error_base_py":{"index":{"relative_filename":"rms/services/error_base.py","html_filename":"rms_services_error_base_py.html","nums":[1,18,0,2,0,0,0]},"hash":"9cf5cf89d59dd8f73527b7bec0f6f11d"},"rms_external_mock_orm_common_policy_policy_py":{"index":{"relative_filename":"rms/external_mock/orm_common/policy/policy.py","html_filename":"rms_external_mock_orm_common_policy_policy_py.html","nums":[1,6,0,2,0,0,0]},"hash":"7ea56b6475a95231ec2271c5fb347853"},"rms_storage___init___py":{"index":{"relative_filename":"rms/storage/__init__.py","html_filename":"rms_storage___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_external_mock_orm_common_policy___init___py":{"index":{"relative_filename":"rms/external_mock/orm_common/policy/__init__.py","html_filename":"rms_external_mock_orm_common_policy___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_controllers_v2_orm___init___py":{"index":{"relative_filename":"rms/controllers/v2/orm/__init__.py","html_filename":"rms_controllers_v2_orm___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"f820fd7cab97fc8512bec0556f3f002c"},"rms_controllers_v2___init___py":{"index":{"relative_filename":"rms/controllers/v2/__init__.py","html_filename":"rms_controllers_v2___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"103b3a1826780f920626a4f622bcee7c"},"rms_controllers_v2_orm_resources_regions_py":{"index":{"relative_filename":"rms/controllers/v2/orm/resources/regions.py","html_filename":"rms_controllers_v2_orm_resources_regions_py.html","nums":[1,187,0,5,0,0,0]},"hash":"31c3b8e26317be7b0c19896d4f008617"},"rms_model_model_py":{"index":{"relative_filename":"rms/model/model.py","html_filename":"rms_model_model_py.html","nums":[1,100,0,7,0,0,0]},"hash":"29463d225fbe8d7a76bd2c96fc854ea9"},"rms_external_mock_orm_common_utils_utils_py":{"index":{"relative_filename":"rms/external_mock/orm_common/utils/utils.py","html_filename":"rms_external_mock_orm_common_utils_utils_py.html","nums":[1,6,0,1,0,0,0]},"hash":"3fd1f8e4472126ea5ccdbf31e97d61ea"},"rms_services___init___py":{"index":{"relative_filename":"rms/services/__init__.py","html_filename":"rms_services___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"8ac99c36cc7a0f004e5b32bd37a07666"},"rms_controllers_configuration_py":{"index":{"relative_filename":"rms/controllers/configuration.py","html_filename":"rms_controllers_configuration_py.html","nums":[1,17,0,0,0,0,0]},"hash":"b26d7e4d8662a3399ee6bfcca7910f6a"},"rms_storage_data_manager_factory_py":{"index":{"relative_filename":"rms/storage/data_manager_factory.py","html_filename":"rms_storage_data_manager_factory_py.html","nums":[1,12,0,0,0,0,0]},"hash":"187c41f6ce3b54925ae87043fbd31c9d"},"rms_storage_base_data_manager_py":{"index":{"relative_filename":"rms/storage/base_data_manager.py","html_filename":"rms_storage_base_data_manager_py.html","nums":[1,24,0,0,0,0,0]},"hash":"161f32081cdb26e50f07e76b8b1a9a5d"},"rms_controllers_v2_orm_resources_metadata_py":{"index":{"relative_filename":"rms/controllers/v2/orm/resources/metadata.py","html_filename":"rms_controllers_v2_orm_resources_metadata_py.html","nums":[1,85,0,19,0,0,0]},"hash":"7bb73ee1f834e6f8998371ce19f77ade"},"rms_external_mock___init___py":{"index":{"relative_filename":"rms/external_mock/__init__.py","html_filename":"rms_external_mock___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"19a064df3967067a2ec86c467e92d140"},"rms_storage_my_sql_data_manager_py":{"index":{"relative_filename":"rms/storage/my_sql/data_manager.py","html_filename":"rms_storage_my_sql_data_manager_py.html","nums":[1,270,0,31,0,0,0]},"hash":"5a1cbfe3ec7b9c95011d5586e27057cb"},"rms_external_mock_keystone_utils_tokens_py":{"index":{"relative_filename":"rms/external_mock/keystone_utils/tokens.py","html_filename":"rms_external_mock_keystone_utils_tokens_py.html","nums":[1,5,0,1,0,0,0]},"hash":"9e3b83a68d18e91870ada743cc6e8aaf"},"rms_controllers_v2_root_py":{"index":{"relative_filename":"rms/controllers/v2/root.py","html_filename":"rms_controllers_v2_root_py.html","nums":[1,3,0,0,0,0,0]},"hash":"a6ab4c4b9cc373374c0cdf71e05f92b2"},"rms_external_mock_orm_common_utils_api_error_utils_py":{"index":{"relative_filename":"rms/external_mock/orm_common/utils/api_error_utils.py","html_filename":"rms_external_mock_orm_common_utils_api_error_utils_py.html","nums":[1,2,0,1,0,0,0]},"hash":"5b097d36789f1b7dea3d91b3b8d3718a"},"rms_services_services_py":{"index":{"relative_filename":"rms/services/services.py","html_filename":"rms_services_services_py.html","nums":[1,170,0,55,0,0,0]},"hash":"ee882c9e5fa6c871e813a62a7126e7f8"},"rms_external_mock_audit_client_api_audit_py":{"index":{"relative_filename":"rms/external_mock/audit_client/api/audit.py","html_filename":"rms_external_mock_audit_client_api_audit_py.html","nums":[1,4,0,4,0,0,0]},"hash":"b0c363258cf77b3628c98037bd768ab4"},"rms_controllers___init___py":{"index":{"relative_filename":"rms/controllers/__init__.py","html_filename":"rms_controllers___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_controllers_logs_py":{"index":{"relative_filename":"rms/controllers/logs.py","html_filename":"rms_controllers_logs_py.html","nums":[1,36,0,2,0,0,0]},"hash":"8e5e06cf27f60958af7f39bc4c28a5b9"},"rms_external_mock_audit_client___init___py":{"index":{"relative_filename":"rms/external_mock/audit_client/__init__.py","html_filename":"rms_external_mock_audit_client___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"19a064df3967067a2ec86c467e92d140"},"rms_controllers_v2_orm_root_py":{"index":{"relative_filename":"rms/controllers/v2/orm/root.py","html_filename":"rms_controllers_v2_orm_root_py.html","nums":[1,5,0,0,0,0,0]},"hash":"7d9f45649dfaa9de7107f13e60452b2e"},"rms_external_mock_orm_common_utils___init___py":{"index":{"relative_filename":"rms/external_mock/orm_common/utils/__init__.py","html_filename":"rms_external_mock_orm_common_utils___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_utils___init___py":{"index":{"relative_filename":"rms/utils/__init__.py","html_filename":"rms_utils___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"}},"version":"4.3.4","settings":"952e86a4dc73f0a7bf1b5052a0d6c45a","format":1} \ No newline at end of file diff --git a/orm/services/region_manager/cover/style.css b/orm/services/region_manager/cover/style.css deleted file mode 100644 index 86b82091..00000000 --- a/orm/services/region_manager/cover/style.css +++ /dev/null @@ -1,375 +0,0 @@ -/* Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 */ -/* For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt */ - -/* CSS styles for coverage.py. */ - -/* Page-wide styles */ -html, body, h1, h2, h3, p, table, td, th { - margin: 0; - padding: 0; - border: 0; - outline: 0; - font-weight: inherit; - font-style: inherit; - font-size: 100%; - font-family: inherit; - vertical-align: baseline; - } - -/* Set baseline grid to 16 pt. */ -body { - font-family: georgia, serif; - font-size: 1em; - } - -html>body { - font-size: 16px; - } - -/* Set base font size to 12/16 */ -p { - font-size: .75em; /* 12/16 */ - line-height: 1.33333333em; /* 16/12 */ - } - -table { - border-collapse: collapse; - } -td { - vertical-align: top; -} -table tr.hidden { - display: none !important; - } - -p#no_rows { - display: none; - font-size: 1.2em; - } - -a.nav { - text-decoration: none; - color: inherit; - } -a.nav:hover { - text-decoration: underline; - color: inherit; - } - -/* Page structure */ -#header { - background: #f8f8f8; - width: 100%; - border-bottom: 1px solid #eee; - } - -#source { - padding: 1em; - font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; - } - -.indexfile #footer { - margin: 1em 3em; - } - -.pyfile #footer { - margin: 1em 1em; - } - -#footer .content { - padding: 0; - font-size: 85%; - font-family: verdana, sans-serif; - color: #666666; - font-style: italic; - } - -#index { - margin: 1em 0 0 3em; - } - -/* Header styles */ -#header .content { - padding: 1em 3em; - } - -h1 { - font-size: 1.25em; - display: inline-block; -} - -#filter_container { - display: inline-block; - float: right; - margin: 0 2em 0 0; -} -#filter_container input { - width: 10em; -} - -h2.stats { - margin-top: .5em; - font-size: 1em; -} -.stats span { - border: 1px solid; - padding: .1em .25em; - margin: 0 .1em; - cursor: pointer; - border-color: #999 #ccc #ccc #999; -} -.stats span.hide_run, .stats span.hide_exc, -.stats span.hide_mis, .stats span.hide_par, -.stats span.par.hide_run.hide_par { - border-color: #ccc #999 #999 #ccc; -} -.stats span.par.hide_run { - border-color: #999 #ccc #ccc #999; -} - -.stats span.run { - background: #ddffdd; -} -.stats span.exc { - background: #eeeeee; -} -.stats span.mis { - background: #ffdddd; -} -.stats span.hide_run { - background: #eeffee; -} -.stats span.hide_exc { - background: #f5f5f5; -} -.stats span.hide_mis { - background: #ffeeee; -} -.stats span.par { - background: #ffffaa; -} -.stats span.hide_par { - background: #ffffcc; -} - -/* Help panel */ -#keyboard_icon { - float: right; - margin: 5px; - cursor: pointer; -} - -.help_panel { - position: absolute; - background: #ffffcc; - padding: .5em; - border: 1px solid #883; - display: none; -} - -.indexfile .help_panel { - width: 20em; height: 4em; -} - -.pyfile .help_panel { - width: 16em; height: 8em; -} - -.help_panel .legend { - font-style: italic; - margin-bottom: 1em; -} - -#panel_icon { - float: right; - cursor: pointer; -} - -.keyhelp { - margin: .75em; -} - -.keyhelp .key { - border: 1px solid black; - border-color: #888 #333 #333 #888; - padding: .1em .35em; - font-family: monospace; - font-weight: bold; - background: #eee; -} - -/* Source file styles */ -.linenos p { - text-align: right; - margin: 0; - padding: 0 .5em; - color: #999999; - font-family: verdana, sans-serif; - font-size: .625em; /* 10/16 */ - line-height: 1.6em; /* 16/10 */ - } -.linenos p.highlight { - background: #ffdd00; - } -.linenos p a { - text-decoration: none; - color: #999999; - } -.linenos p a:hover { - text-decoration: underline; - color: #999999; - } - -td.text { - width: 100%; - } -.text p { - margin: 0; - padding: 0 0 0 .5em; - border-left: 2px solid #ffffff; - white-space: pre; - position: relative; - } - -.text p.mis { - background: #ffdddd; - border-left: 2px solid #ff0000; - } -.text p.run, .text p.run.hide_par { - background: #ddffdd; - border-left: 2px solid #00ff00; - } -.text p.exc { - background: #eeeeee; - border-left: 2px solid #808080; - } -.text p.par, .text p.par.hide_run { - background: #ffffaa; - border-left: 2px solid #eeee99; - } -.text p.hide_run, .text p.hide_exc, .text p.hide_mis, .text p.hide_par, -.text p.hide_run.hide_par { - background: inherit; - } - -.text span.annotate { - font-family: georgia; - color: #666; - float: right; - padding-right: .5em; - } -.text p.hide_par span.annotate { - display: none; - } -.text span.annotate.long { - display: none; - } -.text p:hover span.annotate.long { - display: block; - max-width: 50%; - white-space: normal; - float: right; - position: absolute; - top: 1.75em; - right: 1em; - width: 30em; - height: auto; - color: #333; - background: #ffffcc; - border: 1px solid #888; - padding: .25em .5em; - z-index: 999; - border-radius: .2em; - box-shadow: #cccccc .2em .2em .2em; - } - -/* Syntax coloring */ -.text .com { - color: green; - font-style: italic; - line-height: 1px; - } -.text .key { - font-weight: bold; - line-height: 1px; - } -.text .str { - color: #000080; - } - -/* index styles */ -#index td, #index th { - text-align: right; - width: 5em; - padding: .25em .5em; - border-bottom: 1px solid #eee; - } -#index th { - font-style: italic; - color: #333; - border-bottom: 1px solid #ccc; - cursor: pointer; - } -#index th:hover { - background: #eee; - border-bottom: 1px solid #999; - } -#index td.left, #index th.left { - padding-left: 0; - } -#index td.right, #index th.right { - padding-right: 0; - } -#index th.headerSortDown, #index th.headerSortUp { - border-bottom: 1px solid #000; - white-space: nowrap; - background: #eee; - } -#index th.headerSortDown:after { - content: " ↓"; -} -#index th.headerSortUp:after { - content: " ↑"; -} -#index td.name, #index th.name { - text-align: left; - width: auto; - } -#index td.name a { - text-decoration: none; - color: #000; - } -#index tr.total, -#index tr.total_dynamic { - } -#index tr.total td, -#index tr.total_dynamic td { - font-weight: bold; - border-top: 1px solid #ccc; - border-bottom: none; - } -#index tr.file:hover { - background: #eeeeee; - } -#index tr.file:hover td.name { - text-decoration: underline; - color: #000; - } - -/* scroll marker styles */ -#scroll_marker { - position: fixed; - right: 0; - top: 0; - width: 16px; - height: 100%; - background: white; - border-left: 1px solid #eee; - } - -#scroll_marker .marker { - background: #eedddd; - position: absolute; - min-height: 3px; - width: 100%; - } diff --git a/orm/services/region_manager/htmlcov/coverage_html.js b/orm/services/region_manager/htmlcov/coverage_html.js deleted file mode 100644 index f6f5de20..00000000 --- a/orm/services/region_manager/htmlcov/coverage_html.js +++ /dev/null @@ -1,584 +0,0 @@ -// Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 -// For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt - -// Coverage.py HTML report browser code. -/*jslint browser: true, sloppy: true, vars: true, plusplus: true, maxerr: 50, indent: 4 */ -/*global coverage: true, document, window, $ */ - -coverage = {}; - -// Find all the elements with shortkey_* class, and use them to assign a shortcut key. -coverage.assign_shortkeys = function () { - $("*[class*='shortkey_']").each(function (i, e) { - $.each($(e).attr("class").split(" "), function (i, c) { - if (/^shortkey_/.test(c)) { - $(document).bind('keydown', c.substr(9), function () { - $(e).click(); - }); - } - }); - }); -}; - -// Create the events for the help panel. -coverage.wire_up_help_panel = function () { - $("#keyboard_icon").click(function () { - // Show the help panel, and position it so the keyboard icon in the - // panel is in the same place as the keyboard icon in the header. - $(".help_panel").show(); - var koff = $("#keyboard_icon").offset(); - var poff = $("#panel_icon").position(); - $(".help_panel").offset({ - top: koff.top-poff.top, - left: koff.left-poff.left - }); - }); - $("#panel_icon").click(function () { - $(".help_panel").hide(); - }); -}; - -// Create the events for the filter box. -coverage.wire_up_filter = function () { - // Cache elements. - var table = $("table.index"); - var table_rows = table.find("tbody tr"); - var table_row_names = table_rows.find("td.name a"); - var no_rows = $("#no_rows"); - - // Create a duplicate table footer that we can modify with dynamic summed values. - var table_footer = $("table.index tfoot tr"); - var table_dynamic_footer = table_footer.clone(); - table_dynamic_footer.attr('class', 'total_dynamic hidden'); - table_footer.after(table_dynamic_footer); - - // Observe filter keyevents. - $("#filter").on("keyup change", $.debounce(150, function (event) { - var filter_value = $(this).val(); - - if (filter_value === "") { - // Filter box is empty, remove all filtering. - table_rows.removeClass("hidden"); - - // Show standard footer, hide dynamic footer. - table_footer.removeClass("hidden"); - table_dynamic_footer.addClass("hidden"); - - // Hide placeholder, show table. - if (no_rows.length > 0) { - no_rows.hide(); - } - table.show(); - - } - else { - // Filter table items by value. - var hidden = 0; - var shown = 0; - - // Hide / show elements. - $.each(table_row_names, function () { - var element = $(this).parents("tr"); - - if ($(this).text().indexOf(filter_value) === -1) { - // hide - element.addClass("hidden"); - hidden++; - } - else { - // show - element.removeClass("hidden"); - shown++; - } - }); - - // Show placeholder if no rows will be displayed. - if (no_rows.length > 0) { - if (shown === 0) { - // Show placeholder, hide table. - no_rows.show(); - table.hide(); - } - else { - // Hide placeholder, show table. - no_rows.hide(); - table.show(); - } - } - - // Manage dynamic header: - if (hidden > 0) { - // Calculate new dynamic sum values based on visible rows. - for (var column = 2; column < 20; column++) { - // Calculate summed value. - var cells = table_rows.find('td:nth-child(' + column + ')'); - if (!cells.length) { - // No more columns...! - break; - } - - var sum = 0, numer = 0, denom = 0; - $.each(cells.filter(':visible'), function () { - var ratio = $(this).data("ratio"); - if (ratio) { - var splitted = ratio.split(" "); - numer += parseInt(splitted[0], 10); - denom += parseInt(splitted[1], 10); - } - else { - sum += parseInt(this.innerHTML, 10); - } - }); - - // Get footer cell element. - var footer_cell = table_dynamic_footer.find('td:nth-child(' + column + ')'); - - // Set value into dynamic footer cell element. - if (cells[0].innerHTML.indexOf('%') > -1) { - // Percentage columns use the numerator and denominator, - // and adapt to the number of decimal places. - var match = /\.([0-9]+)/.exec(cells[0].innerHTML); - var places = 0; - if (match) { - places = match[1].length; - } - var pct = numer * 100 / denom; - footer_cell.text(pct.toFixed(places) + '%'); - } - else { - footer_cell.text(sum); - } - } - - // Hide standard footer, show dynamic footer. - table_footer.addClass("hidden"); - table_dynamic_footer.removeClass("hidden"); - } - else { - // Show standard footer, hide dynamic footer. - table_footer.removeClass("hidden"); - table_dynamic_footer.addClass("hidden"); - } - } - })); - - // Trigger change event on setup, to force filter on page refresh - // (filter value may still be present). - $("#filter").trigger("change"); -}; - -// Loaded on index.html -coverage.index_ready = function ($) { - // Look for a cookie containing previous sort settings: - var sort_list = []; - var cookie_name = "COVERAGE_INDEX_SORT"; - var i; - - // This almost makes it worth installing the jQuery cookie plugin: - if (document.cookie.indexOf(cookie_name) > -1) { - var cookies = document.cookie.split(";"); - for (i = 0; i < cookies.length; i++) { - var parts = cookies[i].split("="); - - if ($.trim(parts[0]) === cookie_name && parts[1]) { - sort_list = eval("[[" + parts[1] + "]]"); - break; - } - } - } - - // Create a new widget which exists only to save and restore - // the sort order: - $.tablesorter.addWidget({ - id: "persistentSort", - - // Format is called by the widget before displaying: - format: function (table) { - if (table.config.sortList.length === 0 && sort_list.length > 0) { - // This table hasn't been sorted before - we'll use - // our stored settings: - $(table).trigger('sorton', [sort_list]); - } - else { - // This is not the first load - something has - // already defined sorting so we'll just update - // our stored value to match: - sort_list = table.config.sortList; - } - } - }); - - // Configure our tablesorter to handle the variable number of - // columns produced depending on report options: - var headers = []; - var col_count = $("table.index > thead > tr > th").length; - - headers[0] = { sorter: 'text' }; - for (i = 1; i < col_count-1; i++) { - headers[i] = { sorter: 'digit' }; - } - headers[col_count-1] = { sorter: 'percent' }; - - // Enable the table sorter: - $("table.index").tablesorter({ - widgets: ['persistentSort'], - headers: headers - }); - - coverage.assign_shortkeys(); - coverage.wire_up_help_panel(); - coverage.wire_up_filter(); - - // Watch for page unload events so we can save the final sort settings: - $(window).unload(function () { - document.cookie = cookie_name + "=" + sort_list.toString() + "; path=/"; - }); -}; - -// -- pyfile stuff -- - -coverage.pyfile_ready = function ($) { - // If we're directed to a particular line number, highlight the line. - var frag = location.hash; - if (frag.length > 2 && frag[1] === 'n') { - $(frag).addClass('highlight'); - coverage.set_sel(parseInt(frag.substr(2), 10)); - } - else { - coverage.set_sel(0); - } - - $(document) - .bind('keydown', 'j', coverage.to_next_chunk_nicely) - .bind('keydown', 'k', coverage.to_prev_chunk_nicely) - .bind('keydown', '0', coverage.to_top) - .bind('keydown', '1', coverage.to_first_chunk) - ; - - $(".button_toggle_run").click(function (evt) {coverage.toggle_lines(evt.target, "run");}); - $(".button_toggle_exc").click(function (evt) {coverage.toggle_lines(evt.target, "exc");}); - $(".button_toggle_mis").click(function (evt) {coverage.toggle_lines(evt.target, "mis");}); - $(".button_toggle_par").click(function (evt) {coverage.toggle_lines(evt.target, "par");}); - - coverage.assign_shortkeys(); - coverage.wire_up_help_panel(); - - coverage.init_scroll_markers(); - - // Rebuild scroll markers after window high changing - $(window).resize(coverage.resize_scroll_markers); -}; - -coverage.toggle_lines = function (btn, cls) { - btn = $(btn); - var hide = "hide_"+cls; - if (btn.hasClass(hide)) { - $("#source ."+cls).removeClass(hide); - btn.removeClass(hide); - } - else { - $("#source ."+cls).addClass(hide); - btn.addClass(hide); - } -}; - -// Return the nth line div. -coverage.line_elt = function (n) { - return $("#t" + n); -}; - -// Return the nth line number div. -coverage.num_elt = function (n) { - return $("#n" + n); -}; - -// Return the container of all the code. -coverage.code_container = function () { - return $(".linenos"); -}; - -// Set the selection. b and e are line numbers. -coverage.set_sel = function (b, e) { - // The first line selected. - coverage.sel_begin = b; - // The next line not selected. - coverage.sel_end = (e === undefined) ? b+1 : e; -}; - -coverage.to_top = function () { - coverage.set_sel(0, 1); - coverage.scroll_window(0); -}; - -coverage.to_first_chunk = function () { - coverage.set_sel(0, 1); - coverage.to_next_chunk(); -}; - -coverage.is_transparent = function (color) { - // Different browsers return different colors for "none". - return color === "transparent" || color === "rgba(0, 0, 0, 0)"; -}; - -coverage.to_next_chunk = function () { - var c = coverage; - - // Find the start of the next colored chunk. - var probe = c.sel_end; - var color, probe_line; - while (true) { - probe_line = c.line_elt(probe); - if (probe_line.length === 0) { - return; - } - color = probe_line.css("background-color"); - if (!c.is_transparent(color)) { - break; - } - probe++; - } - - // There's a next chunk, `probe` points to it. - var begin = probe; - - // Find the end of this chunk. - var next_color = color; - while (next_color === color) { - probe++; - probe_line = c.line_elt(probe); - next_color = probe_line.css("background-color"); - } - c.set_sel(begin, probe); - c.show_selection(); -}; - -coverage.to_prev_chunk = function () { - var c = coverage; - - // Find the end of the prev colored chunk. - var probe = c.sel_begin-1; - var probe_line = c.line_elt(probe); - if (probe_line.length === 0) { - return; - } - var color = probe_line.css("background-color"); - while (probe > 0 && c.is_transparent(color)) { - probe--; - probe_line = c.line_elt(probe); - if (probe_line.length === 0) { - return; - } - color = probe_line.css("background-color"); - } - - // There's a prev chunk, `probe` points to its last line. - var end = probe+1; - - // Find the beginning of this chunk. - var prev_color = color; - while (prev_color === color) { - probe--; - probe_line = c.line_elt(probe); - prev_color = probe_line.css("background-color"); - } - c.set_sel(probe+1, end); - c.show_selection(); -}; - -// Return the line number of the line nearest pixel position pos -coverage.line_at_pos = function (pos) { - var l1 = coverage.line_elt(1), - l2 = coverage.line_elt(2), - result; - if (l1.length && l2.length) { - var l1_top = l1.offset().top, - line_height = l2.offset().top - l1_top, - nlines = (pos - l1_top) / line_height; - if (nlines < 1) { - result = 1; - } - else { - result = Math.ceil(nlines); - } - } - else { - result = 1; - } - return result; -}; - -// Returns 0, 1, or 2: how many of the two ends of the selection are on -// the screen right now? -coverage.selection_ends_on_screen = function () { - if (coverage.sel_begin === 0) { - return 0; - } - - var top = coverage.line_elt(coverage.sel_begin); - var next = coverage.line_elt(coverage.sel_end-1); - - return ( - (top.isOnScreen() ? 1 : 0) + - (next.isOnScreen() ? 1 : 0) - ); -}; - -coverage.to_next_chunk_nicely = function () { - coverage.finish_scrolling(); - if (coverage.selection_ends_on_screen() === 0) { - // The selection is entirely off the screen: select the top line on - // the screen. - var win = $(window); - coverage.select_line_or_chunk(coverage.line_at_pos(win.scrollTop())); - } - coverage.to_next_chunk(); -}; - -coverage.to_prev_chunk_nicely = function () { - coverage.finish_scrolling(); - if (coverage.selection_ends_on_screen() === 0) { - var win = $(window); - coverage.select_line_or_chunk(coverage.line_at_pos(win.scrollTop() + win.height())); - } - coverage.to_prev_chunk(); -}; - -// Select line number lineno, or if it is in a colored chunk, select the -// entire chunk -coverage.select_line_or_chunk = function (lineno) { - var c = coverage; - var probe_line = c.line_elt(lineno); - if (probe_line.length === 0) { - return; - } - var the_color = probe_line.css("background-color"); - if (!c.is_transparent(the_color)) { - // The line is in a highlighted chunk. - // Search backward for the first line. - var probe = lineno; - var color = the_color; - while (probe > 0 && color === the_color) { - probe--; - probe_line = c.line_elt(probe); - if (probe_line.length === 0) { - break; - } - color = probe_line.css("background-color"); - } - var begin = probe + 1; - - // Search forward for the last line. - probe = lineno; - color = the_color; - while (color === the_color) { - probe++; - probe_line = c.line_elt(probe); - color = probe_line.css("background-color"); - } - - coverage.set_sel(begin, probe); - } - else { - coverage.set_sel(lineno); - } -}; - -coverage.show_selection = function () { - var c = coverage; - - // Highlight the lines in the chunk - c.code_container().find(".highlight").removeClass("highlight"); - for (var probe = c.sel_begin; probe > 0 && probe < c.sel_end; probe++) { - c.num_elt(probe).addClass("highlight"); - } - - c.scroll_to_selection(); -}; - -coverage.scroll_to_selection = function () { - // Scroll the page if the chunk isn't fully visible. - if (coverage.selection_ends_on_screen() < 2) { - // Need to move the page. The html,body trick makes it scroll in all - // browsers, got it from http://stackoverflow.com/questions/3042651 - var top = coverage.line_elt(coverage.sel_begin); - var top_pos = parseInt(top.offset().top, 10); - coverage.scroll_window(top_pos - 30); - } -}; - -coverage.scroll_window = function (to_pos) { - $("html,body").animate({scrollTop: to_pos}, 200); -}; - -coverage.finish_scrolling = function () { - $("html,body").stop(true, true); -}; - -coverage.init_scroll_markers = function () { - var c = coverage; - // Init some variables - c.lines_len = $('td.text p').length; - c.body_h = $('body').height(); - c.header_h = $('div#header').height(); - c.missed_lines = $('td.text p.mis, td.text p.par'); - - // Build html - c.resize_scroll_markers(); -}; - -coverage.resize_scroll_markers = function () { - var c = coverage, - min_line_height = 3, - max_line_height = 10, - visible_window_h = $(window).height(); - - $('#scroll_marker').remove(); - // Don't build markers if the window has no scroll bar. - if (c.body_h <= visible_window_h) { - return; - } - - $("body").append("
 
"); - var scroll_marker = $('#scroll_marker'), - marker_scale = scroll_marker.height() / c.body_h, - line_height = scroll_marker.height() / c.lines_len; - - // Line height must be between the extremes. - if (line_height > min_line_height) { - if (line_height > max_line_height) { - line_height = max_line_height; - } - } - else { - line_height = min_line_height; - } - - var previous_line = -99, - last_mark, - last_top; - - c.missed_lines.each(function () { - var line_top = Math.round($(this).offset().top * marker_scale), - id_name = $(this).attr('id'), - line_number = parseInt(id_name.substring(1, id_name.length)); - - if (line_number === previous_line + 1) { - // If this solid missed block just make previous mark higher. - last_mark.css({ - 'height': line_top + line_height - last_top - }); - } - else { - // Add colored line in scroll_marker block. - scroll_marker.append('
'); - last_mark = $('#m' + line_number); - last_mark.css({ - 'height': line_height, - 'top': line_top - }); - last_top = line_top; - } - - previous_line = line_number; - }); -}; diff --git a/orm/services/region_manager/htmlcov/index.html b/orm/services/region_manager/htmlcov/index.html deleted file mode 100644 index 672002e7..00000000 --- a/orm/services/region_manager/htmlcov/index.html +++ /dev/null @@ -1,455 +0,0 @@ - - - - - - - - Coverage report - - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- n - s - m - x - - c   change column sorting -

-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Modulestatementsmissingexcludedcoverage
Total1287160088%
rms/__init__.py000100%
rms/controllers/__init__.py000100%
rms/controllers/configuration.py1700100%
rms/controllers/lcp_controller.py5600100%
rms/controllers/logs.py362094%
rms/controllers/root.py121092%
rms/controllers/v2/__init__.py000100%
rms/controllers/v2/orm/__init__.py000100%
rms/controllers/v2/orm/resources/__init__.py000100%
rms/controllers/v2/orm/resources/groups.py12422082%
rms/controllers/v2/orm/resources/metadata.py8519078%
rms/controllers/v2/orm/resources/regions.py1875097%
rms/controllers/v2/orm/resources/status.py473094%
rms/controllers/v2/orm/root.py500100%
rms/controllers/v2/root.py300100%
rms/external_mock/__init__.py000100%
rms/external_mock/audit_client/__init__.py000100%
rms/external_mock/audit_client/api/__init__.py000100%
rms/external_mock/audit_client/api/audit.py4400%
rms/external_mock/keystone_utils/__init__.py000100%
rms/external_mock/keystone_utils/tokens.py51080%
rms/external_mock/orm_common/__init__.py000100%
rms/external_mock/orm_common/policy/__init__.py000100%
rms/external_mock/orm_common/policy/policy.py62067%
rms/external_mock/orm_common/utils/__init__.py000100%
rms/external_mock/orm_common/utils/api_error_utils.py21050%
rms/external_mock/orm_common/utils/utils.py61083%
rms/model/__init__.py300100%
rms/model/model.py1007093%
rms/model/url_parm.py634094%
rms/services/__init__.py000100%
rms/services/error_base.py182089%
rms/services/services.py17055068%
rms/storage/__init__.py000100%
rms/storage/base_data_manager.py2400100%
rms/storage/data_manager_factory.py1200100%
rms/storage/my_sql/__init__.py000100%
rms/storage/my_sql/data_manager.py27031089%
rms/utils/__init__.py000100%
rms/utils/authentication.py3200100%
- -

- No items found using the specified filter. -

-
- - - - - diff --git a/orm/services/region_manager/htmlcov/jquery.ba-throttle-debounce.min.js b/orm/services/region_manager/htmlcov/jquery.ba-throttle-debounce.min.js deleted file mode 100644 index 648fe5d3..00000000 --- a/orm/services/region_manager/htmlcov/jquery.ba-throttle-debounce.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * jQuery throttle / debounce - v1.1 - 3/7/2010 - * http://benalman.com/projects/jquery-throttle-debounce-plugin/ - * - * Copyright (c) 2010 "Cowboy" Ben Alman - * Dual licensed under the MIT and GPL licenses. - * http://benalman.com/about/license/ - */ -(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); diff --git a/orm/services/region_manager/htmlcov/jquery.hotkeys.js b/orm/services/region_manager/htmlcov/jquery.hotkeys.js deleted file mode 100644 index 09b21e03..00000000 --- a/orm/services/region_manager/htmlcov/jquery.hotkeys.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * jQuery Hotkeys Plugin - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * - * Based upon the plugin by Tzury Bar Yochay: - * http://github.com/tzuryby/hotkeys - * - * Original idea by: - * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ -*/ - -(function(jQuery){ - - jQuery.hotkeys = { - version: "0.8", - - specialKeys: { - 8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause", - 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home", - 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del", - 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7", - 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/", - 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8", - 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta" - }, - - shiftNums: { - "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&", - "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<", - ".": ">", "/": "?", "\\": "|" - } - }; - - function keyHandler( handleObj ) { - // Only care when a possible input has been specified - if ( typeof handleObj.data !== "string" ) { - return; - } - - var origHandler = handleObj.handler, - keys = handleObj.data.toLowerCase().split(" "); - - handleObj.handler = function( event ) { - // Don't fire in text-accepting inputs that we didn't directly bind to - if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) || - event.target.type === "text") ) { - return; - } - - // Keypress represents characters, not special keys - var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ], - character = String.fromCharCode( event.which ).toLowerCase(), - key, modif = "", possible = {}; - - // check combinations (alt|ctrl|shift+anything) - if ( event.altKey && special !== "alt" ) { - modif += "alt+"; - } - - if ( event.ctrlKey && special !== "ctrl" ) { - modif += "ctrl+"; - } - - // TODO: Need to make sure this works consistently across platforms - if ( event.metaKey && !event.ctrlKey && special !== "meta" ) { - modif += "meta+"; - } - - if ( event.shiftKey && special !== "shift" ) { - modif += "shift+"; - } - - if ( special ) { - possible[ modif + special ] = true; - - } else { - possible[ modif + character ] = true; - possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true; - - // "$" can be triggered as "Shift+4" or "Shift+$" or just "$" - if ( modif === "shift+" ) { - possible[ jQuery.hotkeys.shiftNums[ character ] ] = true; - } - } - - for ( var i = 0, l = keys.length; i < l; i++ ) { - if ( possible[ keys[i] ] ) { - return origHandler.apply( this, arguments ); - } - } - }; - } - - jQuery.each([ "keydown", "keyup", "keypress" ], function() { - jQuery.event.special[ this ] = { add: keyHandler }; - }); - -})( jQuery ); diff --git a/orm/services/region_manager/htmlcov/jquery.isonscreen.js b/orm/services/region_manager/htmlcov/jquery.isonscreen.js deleted file mode 100644 index 0182ebd2..00000000 --- a/orm/services/region_manager/htmlcov/jquery.isonscreen.js +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) 2010 - * @author Laurence Wheway - * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) - * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. - * - * @version 1.2.0 - */ -(function($) { - jQuery.extend({ - isOnScreen: function(box, container) { - //ensure numbers come in as intgers (not strings) and remove 'px' is it's there - for(var i in box){box[i] = parseFloat(box[i])}; - for(var i in container){container[i] = parseFloat(container[i])}; - - if(!container){ - container = { - left: $(window).scrollLeft(), - top: $(window).scrollTop(), - width: $(window).width(), - height: $(window).height() - } - } - - if( box.left+box.width-container.left > 0 && - box.left < container.width+container.left && - box.top+box.height-container.top > 0 && - box.top < container.height+container.top - ) return true; - return false; - } - }) - - - jQuery.fn.isOnScreen = function (container) { - for(var i in container){container[i] = parseFloat(container[i])}; - - if(!container){ - container = { - left: $(window).scrollLeft(), - top: $(window).scrollTop(), - width: $(window).width(), - height: $(window).height() - } - } - - if( $(this).offset().left+$(this).width()-container.left > 0 && - $(this).offset().left < container.width+container.left && - $(this).offset().top+$(this).height()-container.top > 0 && - $(this).offset().top < container.height+container.top - ) return true; - return false; - } -})(jQuery); diff --git a/orm/services/region_manager/htmlcov/jquery.min.js b/orm/services/region_manager/htmlcov/jquery.min.js deleted file mode 100644 index 0d2eab26..00000000 --- a/orm/services/region_manager/htmlcov/jquery.min.js +++ /dev/null @@ -1,9404 +0,0 @@ -/*! - * jQuery JavaScript Library v1.7.2 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Fri Jul 5 14:07:58 UTC 2013 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context ? context.ownerDocument || context : document ); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.7.2", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.add( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.fireWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).off( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery.Callbacks( "once memory" ); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array, i ) { - var len; - - if ( array ) { - if ( indexOf ) { - return indexOf.call( array, elem, i ); - } - - len = array.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in array && array[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, pass ) { - var exec, - bulk = key == null, - i = 0, - length = elems.length; - - // Sets many values - if ( key && typeof key === "object" ) { - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); - } - chainable = 1; - - // Sets one value - } else if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = pass === undefined && jQuery.isFunction( value ); - - if ( bulk ) { - // Bulk operations only iterate when executing function values - if ( exec ) { - exec = fn; - fn = function( elem, key, value ) { - return exec.call( jQuery( elem ), value ); - }; - - // Otherwise they run against the entire set - } else { - fn.call( elems, value ); - fn = null; - } - } - - if ( fn ) { - for (; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - } - - chainable = 1; - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -// String to Object flags format cache -var flagsCache = {}; - -// Convert String-formatted flags into Object-formatted ones and store in cache -function createFlags( flags ) { - var object = flagsCache[ flags ] = {}, - i, length; - flags = flags.split( /\s+/ ); - for ( i = 0, length = flags.length; i < length; i++ ) { - object[ flags[i] ] = true; - } - return object; -} - -/* - * Create a callback list using the following parameters: - * - * flags: an optional list of space-separated flags that will change how - * the callback list behaves - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible flags: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( flags ) { - - // Convert flags from String-formatted to Object-formatted - // (we check in cache first) - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; - - var // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = [], - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Add one or several callbacks to the list - add = function( args ) { - var i, - length, - elem, - type, - actual; - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - // Inspect recursively - add( elem ); - } else if ( type === "function" ) { - // Add if not in unique mode and callback is not in - if ( !flags.unique || !self.has( elem ) ) { - list.push( elem ); - } - } - } - }, - // Fire callbacks - fire = function( context, args ) { - args = args || []; - memory = !flags.memory || [ context, args ]; - fired = true; - firing = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { - memory = true; // Mark as halted - break; - } - } - firing = false; - if ( list ) { - if ( !flags.once ) { - if ( stack && stack.length ) { - memory = stack.shift(); - self.fireWith( memory[ 0 ], memory[ 1 ] ); - } - } else if ( memory === true ) { - self.disable(); - } else { - list = []; - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - var length = list.length; - add( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away, unless previous - // firing was halted (stopOnFalse) - } else if ( memory && memory !== true ) { - firingStart = length; - fire( memory[ 0 ], memory[ 1 ] ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - var args = arguments, - argIndex = 0, - argLength = args.length; - for ( ; argIndex < argLength ; argIndex++ ) { - for ( var i = 0; i < list.length; i++ ) { - if ( args[ argIndex ] === list[ i ] ) { - // Handle firingIndex and firingLength - if ( firing ) { - if ( i <= firingLength ) { - firingLength--; - if ( i <= firingIndex ) { - firingIndex--; - } - } - } - // Remove the element - list.splice( i--, 1 ); - // If we have some unicity property then - // we only need to do this once - if ( flags.unique ) { - break; - } - } - } - } - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - if ( list ) { - var i = 0, - length = list.length; - for ( ; i < length; i++ ) { - if ( fn === list[ i ] ) { - return true; - } - } - } - return false; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory || memory === true ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( stack ) { - if ( firing ) { - if ( !flags.once ) { - stack.push( [ context, args ] ); - } - } else if ( !( flags.once && memory ) ) { - fire( context, args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - - - -var // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - - Deferred: function( func ) { - var doneList = jQuery.Callbacks( "once memory" ), - failList = jQuery.Callbacks( "once memory" ), - progressList = jQuery.Callbacks( "memory" ), - state = "pending", - lists = { - resolve: doneList, - reject: failList, - notify: progressList - }, - promise = { - done: doneList.add, - fail: failList.add, - progress: progressList.add, - - state: function() { - return state; - }, - - // Deprecated - isResolved: doneList.fired, - isRejected: failList.fired, - - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); - return this; - }, - always: function() { - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); - return this; - }, - pipe: function( fnDone, fnFail, fnProgress ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ], - progress: [ fnProgress, "notify" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - obj = promise; - } else { - for ( var key in promise ) { - obj[ key ] = promise[ key ]; - } - } - return obj; - } - }, - deferred = promise.promise({}), - key; - - for ( key in lists ) { - deferred[ key ] = lists[ key ].fire; - deferred[ key + "With" ] = lists[ key ].fireWith; - } - - // Handle state - deferred.done( function() { - state = "resolved"; - }, failList.disable, progressList.lock ).fail( function() { - state = "rejected"; - }, doneList.disable, progressList.lock ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = sliceDeferred.call( arguments, 0 ), - i = 0, - length = args.length, - pValues = new Array( length ), - count = length, - pCount = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(), - promise = deferred.promise(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - deferred.resolveWith( deferred, args ); - } - }; - } - function progressFunc( i ) { - return function( value ) { - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - deferred.notifyWith( promise, pValues ); - }; - } - if ( length > 1 ) { - for ( ; i < length; i++ ) { - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return promise; - } -}); - - - - -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - fragment, - tds, - events, - eventName, - i, - isSupported, - div = document.createElement( "div" ), - documentElement = document.documentElement; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - pixelMargin: true - }; - - // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead - jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat"); - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for ( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight, - paddingMarginBorderVisibility, paddingMarginBorder, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - paddingMarginBorder = "padding:0;margin:0;border:"; - positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;"; - paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;"; - style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;"; - html = "
" + - "" + - "
"; - - container = document.createElement("div"); - container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
t
"; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - div.innerHTML = ""; - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.innerHTML = ""; - div.style.width = div.style.padding = "1px"; - div.style.border = 0; - div.style.overflow = "hidden"; - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = "block"; - div.style.overflow = "visible"; - div.innerHTML = "
"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - } - - div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - if ( window.getComputedStyle ) { - div.style.marginTop = "1%"; - support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%"; - } - - if ( typeof container.style.zoom !== "undefined" ) { - container.style.zoom = 1; - } - - body.removeChild( container ); - marginDiv = div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, part, attr, name, l, - elem = this[0], - i = 0, - data = null; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attr = elem.attributes; - for ( l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split( ".", 2 ); - parts[1] = parts[1] ? "." + parts[1] : ""; - part = parts[1] + "!"; - - return jQuery.access( this, function( value ) { - - if ( value === undefined ) { - data = this.triggerHandler( "getData" + part, [ parts[0] ] ); - - // Try to fetch any internally stored data first - if ( data === undefined && elem ) { - data = jQuery.data( elem, key ); - data = dataAttr( elem, key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } - - parts[1] = value; - this.each(function() { - var self = jQuery( this ); - - self.triggerHandler( "setData" + part, parts ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + part, parts ); - }); - }, null, value, arguments.length > 1, null, false ); - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise( object ); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, isBool, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - isBool = rboolean.test( name ); - - // See #9699 for explanation of this approach (setting first, then removal) - // Do not do this for boolean attributes (see #10870) - if ( !isBool ) { - jQuery.attr( elem, name, "" ); - } - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( isBool && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true, - coords: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, - rhoverHack = /(?:^|\s)hover(\.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: selector && quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - special = jQuery.event.special[ event.type ] || {}, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers that should run if there are delegated events - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - - // Don't process events on disabled elements (#6911, #8165) - if ( cur.disabled !== true ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { // && selector != null - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparison -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - /* falls through */ - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} -// Expose origPOS -// "global" as in regardless of relation to brackets/parens -Expr.match.globalPOS = origPOS; - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

"; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
"; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.globalPOS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /]", "i"), - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /\/(java|ecma)script/i, - rcleanScript = /^\s*", "" ], - legend: [ 1, "
", "
" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - col: [ 2, "", "
" ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers___init___py.html b/orm/services/region_manager/htmlcov/rms_controllers___init___py.html deleted file mode 100644 index e9a4bb7f..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers_configuration_py.html b/orm/services/region_manager/htmlcov/rms_controllers_configuration_py.html deleted file mode 100644 index 5fd6bb6f..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers_configuration_py.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/configuration.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

- -
-

"""Configuration rest API input module.""" 

-

 

-

import logging 

-

 

-

from orm_common.utils import utils 

-

 

-

from pecan import conf 

-

from pecan import request 

-

from pecan import rest 

-

from wsmeext.pecan import wsexpose 

-

 

-

from rms.utils import authentication 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class ConfigurationController(rest.RestController): 

-

"""Configuration controller.""" 

-

 

-

@wsexpose(str, str, status_code=200) 

-

def get(self, dump_to_log='false'): 

-

"""get method. 

-

 

-

:param dump_to_log: A boolean string that says whether the 

-

configuration should be written to log 

-

:return: A pretty string that contains the service's configuration 

-

""" 

-

logger.info("Get configuration...") 

-

authentication.authorize(request, 'configuration:get') 

-

 

-

dump = dump_to_log.lower() == 'true' 

-

utils.set_utils_conf(conf) 

-

result = utils.report_config(conf, dump, logger) 

-

return result 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers_lcp_controller_py.html b/orm/services/region_manager/htmlcov/rms_controllers_lcp_controller_py.html deleted file mode 100644 index 90c29c78..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers_lcp_controller_py.html +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/lcp_controller.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

- -
-

import logging 

-

 

-

from pecan import rest, request 

-

from pecan import conf 

-

 

-

from wsme import types as wtypes 

-

from wsmeext.pecan import wsexpose 

-

from rms.model import url_parm 

-

from rms.services.error_base import ErrorStatus 

-

from rms.services import services 

-

from rms.utils import authentication 

-

 

-

from orm_common.utils import api_error_utils as err_utils 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class LcpController(rest.RestController): 

-

 

-

@wsexpose(wtypes.text, rest_content_types='json') 

-

def get_all(self): 

-

""" 

-

This function is called when receiving /lcp without a parameter. 

-

parameter: 

-

None. 

-

return: entire list of lcp. 

-

""" 

-

logger.info('Received a GET request for all LCPs') 

-

authentication.authorize(request, 'lcp:get_all') 

-

 

-

zones = [] 

-

 

-

try: 

-

zones = get_zones() 

-

logger.debug('Returning LCP list: %s' % (zones,)) 

-

return zones 

-

 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(wtypes.text, str, rest_content_types='json') 

-

def get_one(self, lcp_id): 

-

 

-

logger.info('Received a GET request for LCP %s' % (id,)) 

-

authentication.authorize(request, 'lcp:get_one') 

-

 

-

zones = [] 

-

try: 

-

 

-

zones = get_zones() 

-

 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

for zone in zones: 

-

if zone["id"] == lcp_id: 

-

logger.debug('Returning: %s' % (zone,)) 

-

return zone 

-

 

-

error_msg = 'LCP %s not found' % (lcp_id,) 

-

logger.info(error_msg) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=error_msg, 

-

status_code=404) 

-

 

-

 

-

def get_zones(): 

-

""" 

-

This function returns the lcp list from CSV file. 

-

parameter: 

-

None. 

-

return: 

-

zone list in json format. 

-

""" 

-

logger.debug('Enter get_zones function') 

-

result = [] 

-

 

-

try: 

-

url_args = url_parm.UrlParms() 

-

zones = services.get_regions_data(url_args) 

-

 

-

for zone in zones.regions: 

-

result.append(build_zone_response(zone)) 

-

 

-

logger.debug("Available regions: {}".format(', '.join( 

-

[region["zone_name"] for region in result]))) 

-

 

-

except ErrorStatus as e: 

-

logger.debug(e.message) 

-

finally: 

-

return result 

-

 

-

 

-

def build_zone_response(zone): 

-

 

-

end_points_dict = {"identity": "", 

-

"dashboard": "", 

-

"ord": ""} 

-

for end_point in zone.endpoints: 

-

end_points_dict[end_point.type] = end_point.publicurl 

-

 

-

return dict( 

-

zone_name=zone.name, 

-

id=zone.id, 

-

status="1" if zone.status == "functional" else "0", 

-

design_type=zone.design_type, 

-

location_type=zone.location_type, 

-

vLCP_name=zone.vlcp_name, 

-

AIC_version=zone.ranger_agent_version, 

-

OS_version=zone.open_stack_version, 

-

keystone_EP=end_points_dict["identity"], 

-

horizon_EP=end_points_dict["dashboard"], 

-

ORD_EP=end_points_dict["ord"] 

-

) 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers_logs_py.html b/orm/services/region_manager/htmlcov/rms_controllers_logs_py.html deleted file mode 100644 index 51ddc2a1..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers_logs_py.html +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/logs.py: 94% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

- -
-

import logging 

-

from pecan import rest, request 

-

import wsme 

-

from wsmeext.pecan import wsexpose 

-

 

-

from orm_common.utils import api_error_utils as err_utils 

-

 

-

from rms.utils import authentication 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class LogChangeResultWSME(wsme.types.DynamicBase): 

-

"""log change result wsme type.""" 

-

 

-

result = wsme.wsattr(str, mandatory=True, default=None) 

-

 

-

def __init__(self, **kwargs): 

-

""""init method.""" 

-

super(LogChangeResult, self).__init__(**kwargs) 

-

 

-

 

-

class LogChangeResult(object): 

-

"""log change result type.""" 

-

 

-

def __init__(self, result): 

-

""""init method.""" 

-

self.result = result 

-

 

-

 

-

class LogsController(rest.RestController): 

-

"""Logs Audit controller.""" 

-

 

-

@wsexpose(LogChangeResultWSME, str, status_code=201, 

-

rest_content_types='json') 

-

def put(self, level): 

-

"""update log level. 

-

 

-

:param level: the log level text name 

-

:return: 

-

""" 

-

 

-

logger.info("Changing log level to [{}]".format(level)) 

-

authentication.authorize(request, 'log:update') 

-

 

-

try: 

-

log_level = logging._levelNames.get(level.upper()) 

-

if log_level is not None: 

-

self._change_log_level(log_level) 

-

result = "Log level changed to {}.".format(level) 

-

logger.info(result) 

-

else: 

-

raise Exception( 

-

"The given log level [{}] doesn't exist.".format(level)) 

-

 

-

return LogChangeResult(result) 

-

 

-

except Exception as exception: 

-

logger.error("Fail to change log_level. Reason: {}".format( 

-

exception.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@staticmethod 

-

def _change_log_level(log_level): 

-

path = __name__.split('.') 

-

if len(path) > 0: 

-

root = path[0] 

-

root_logger = logging.getLogger(root) 

-

root_logger.setLevel(log_level) 

-

else: 

-

logger.info("Fail to change log_level to [{}]. " 

-

"the given log level doesn't exist.".format(log_level)) 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers_root_py.html b/orm/services/region_manager/htmlcov/rms_controllers_root_py.html deleted file mode 100644 index 9a9cdf4b..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers_root_py.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/root.py: 92% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

- -
-

from pecan import expose 

-

from lcp_controller import LcpController 

-

from logs import LogsController 

-

from configuration import ConfigurationController 

-

from rms.controllers.v2 import root 

-

 

-

 

-

class RootController(object): 

-

lcp = LcpController() 

-

logs = LogsController() 

-

configuration = ConfigurationController() 

-

v2 = root.V2Controller() 

-

 

-

@expose(template='json') 

-

def _default(self): 

-

""" 

-

Method to handle GET / 

-

parameters: None 

-

return: dict describing lcp rest version information 

-

""" 

-

return { 

-

"versions": { 

-

"values": [ 

-

{ 

-

"status": "stable", 

-

"id": "v2", 

-

"links": [ 

-

{ 

-

"href": "http://localhost:8789/" 

-

} 

-

] 

-

} 

-

] 

-

} 

-

} 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers_v2___init___py.html b/orm/services/region_manager/htmlcov/rms_controllers_v2___init___py.html deleted file mode 100644 index bf5cfb53..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers_v2___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

- -
-

"""orm package.""" 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm___init___py.html b/orm/services/region_manager/htmlcov/rms_controllers_v2_orm___init___py.html deleted file mode 100644 index 40a61780..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

- -
-

"""resource package.""" 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources___init___py.html b/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources___init___py.html deleted file mode 100644 index 80509395..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/resources/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

- -
-

"""orm package.""" 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources_groups_py.html b/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources_groups_py.html deleted file mode 100644 index 76366806..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources_groups_py.html +++ /dev/null @@ -1,597 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/resources/groups.py: 82% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

-

185

-

186

-

187

-

188

-

189

-

190

-

191

-

192

-

193

-

194

-

195

-

196

-

197

-

198

-

199

-

200

-

201

-

202

-

203

-

204

-

205

-

206

-

207

-

208

-

209

-

210

-

211

-

212

-

213

-

214

-

215

-

216

-

217

-

218

-

219

-

220

-

221

-

222

-

223

-

224

-

225

-

226

-

227

-

228

-

229

-

230

-

231

-

232

-

233

-

234

-

235

-

236

-

237

-

238

-

239

-

240

-

241

-

242

-

243

-

244

-

245

-

246

-

247

-

248

-

249

-

250

-

251

-

252

-

253

-

254

- -
-

"""rest module.""" 

-

import logging 

-

import time 

-

import wsme 

-

 

-

from orm_common.utils import api_error_utils as err_utils 

-

from orm_common.utils import utils 

-

 

-

from rms.services import error_base 

-

from rms.services import services as GroupService 

-

from rms.utils import authentication 

-

from pecan import rest, request 

-

from wsme import types as wtypes 

-

from wsmeext.pecan import wsexpose 

-

from rms.model import model as PythonModel 

-

 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class Groups(wtypes.DynamicBase): 

-

"""main json header.""" 

-

 

-

id = wsme.wsattr(wtypes.text, mandatory=True) 

-

name = wsme.wsattr(wtypes.text, mandatory=True) 

-

description = wsme.wsattr(wtypes.text, mandatory=True) 

-

regions = wsme.wsattr([str], mandatory=True) 

-

 

-

def __init__(self, id=None, name=None, description=None, regions=[]): 

-

"""init function. 

-

 

-

:param regions: 

-

:return: 

-

""" 

-

self.id = id 

-

self.name = name 

-

self.description = description 

-

self.regions = regions 

-

 

-

def _to_python_obj(self): 

-

obj = PythonModel.Groups() 

-

obj.id = self.id 

-

obj.name = self.name 

-

obj.description = self.description 

-

obj.regions = self.regions 

-

return obj 

-

 

-

 

-

class GroupWrapper(wtypes.DynamicBase): 

-

"""main cotain lis of groups.""" 

-

 

-

groups = wsme.wsattr([Groups], mandatory=True) 

-

 

-

def __init__(self, groups=[]): 

-

""" 

-

 

-

:param group: 

-

""" 

-

self.groups = groups 

-

 

-

 

-

class OutputResource(wtypes.DynamicBase): 

-

"""class method returned json body.""" 

-

 

-

id = wsme.wsattr(wtypes.text, mandatory=True) 

-

name = wsme.wsattr(wtypes.text, mandatory=True) 

-

created = wsme.wsattr(wtypes.text, mandatory=True) 

-

links = wsme.wsattr({str: str}, mandatory=True) 

-

 

-

def __init__(self, id=None, name=None, created=None, links={}): 

-

"""init function. 

-

 

-

:param id: 

-

:param created: 

-

:param links: 

-

""" 

-

self.id = id 

-

self.name = name 

-

self.created = created 

-

self.links = links 

-

 

-

 

-

class Result(wtypes.DynamicBase): 

-

"""class method json headers.""" 

-

 

-

group = wsme.wsattr(OutputResource, mandatory=True) 

-

 

-

def __init__(self, group=OutputResource()): 

-

"""init dunction. 

-

 

-

:param group: The created group 

-

""" 

-

self.group = group 

-

 

-

 

-

class GroupsController(rest.RestController): 

-

"""controller get resource.""" 

-

 

-

@wsexpose(Groups, str, status_code=200, 

-

rest_content_types='json') 

-

def get(self, id=None): 

-

"""Handle get request. 

-

 

-

:param id: Group ID 

-

:return: 200 OK on success, 404 Not Found otherwise. 

-

""" 

-

logger.info("Entered Get Group: id = {}".format(id)) 

-

authentication.authorize(request, 'group:get_one') 

-

 

-

try: 

-

 

-

result = GroupService.get_groups_data(id) 

-

logger.debug('Returning group, regions: {}'.format(result.regions)) 

-

return result 

-

 

-

except error_base.NotFoundError as e: 

-

logger.error("GroupsController - Group not found") 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=404) 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(GroupWrapper, status_code=200, rest_content_types='json') 

-

def get_all(self): 

-

logger.info("gett all groups") 

-

authentication.authorize(request, 'group:get_all') 

-

try: 

-

 

-

logger.debug("api-get all groups") 

-

groups_wrraper = GroupService.get_all_groups() 

-

logger.debug("got groups {}".format(groups_wrraper)) 

-

 

-

except Exception as exp: 

-

logger.error("api--fail to get all groups") 

-

logger.exception(exp) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

return groups_wrraper 

-

 

-

@wsexpose(Result, body=Groups, status_code=201, rest_content_types='json') 

-

def post(self, group_input): 

-

"""Handle post request. 

-

 

-

:param group_input: json data 

-

:return: 201 created on success, 409 otherwise. 

-

""" 

-

logger.info("Entered Create Group") 

-

logger.debug("id = {}, name = {}, description = {}, regions = {}".format( 

-

group_input.id, 

-

group_input.name, 

-

group_input.description, 

-

group_input.regions)) 

-

authentication.authorize(request, 'group:create') 

-

 

-

try: 

-

# May raise an exception which will return status code 400 

-

GroupService.create_group_in_db(group_input.id, 

-

group_input.name, 

-

group_input.description, 

-

group_input.regions) 

-

logger.debug("Group created successfully in DB") 

-

 

-

# Create the group output data with the correct timestamp and link 

-

group = OutputResource(group_input.id, 

-

group_input.name, 

-

repr(int(time.time() * 1000)), 

-

{'self': '{}/v2/orm/groups/{}'.format( 

-

request.application_url, 

-

group_input.id)}) 

-

 

-

event_details = 'Region group {} {} created with regions: {}'.format( 

-

group_input.id, group_input.name, group_input.regions) 

-

utils.audit_trail('create group', request.transaction_id, 

-

request.headers, group_input.id, 

-

event_details=event_details) 

-

return Result(group) 

-

 

-

except error_base.ErrorStatus as e: 

-

logger.error("GroupsController - {}".format(e.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=e.status_code) 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(None, str, status_code=204, rest_content_types='json') 

-

def delete(self, group_id): 

-

logger.info("delete group") 

-

authentication.authorize(request, 'group:delete') 

-

 

-

try: 

-

 

-

logger.debug("delete group with id {}".format(group_id)) 

-

GroupService.delete_group(group_id) 

-

logger.debug("done") 

-

 

-

event_details = 'Region group {} deleted'.format(group_id) 

-

utils.audit_trail('delete group', request.transaction_id, 

-

request.headers, group_id, 

-

event_details=event_details) 

-

 

-

except Exception as exp: 

-

 

-

logger.exception("fail to delete group :- {}".format(exp)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exp.message) 

-

return 

-

 

-

@wsexpose(Result, str, body=Groups, status_code=201, 

-

rest_content_types='json') 

-

def put(self, group_id, group): 

-

logger.info("update group") 

-

authentication.authorize(request, 'group:update') 

-

 

-

try: 

-

logger.debug("update group - id {}".format(group_id)) 

-

result = GroupService.update_group(group, group_id) 

-

logger.debug("group updated to :- {}".format(result)) 

-

 

-

# build result 

-

group_result = OutputResource(result.id, result.name, 

-

repr(int(time.time() * 1000)), { 

-

'self': '{}/v2/orm/groups/{}'.format( 

-

request.application_url, 

-

result.id)}) 

-

 

-

event_details = 'Region group {} {} updated with regions: {}'.format( 

-

group_id, group.name, group.regions) 

-

utils.audit_trail('update group', request.transaction_id, 

-

request.headers, group_id, 

-

event_details=event_details) 

-

 

-

except error_base.ErrorStatus as exp: 

-

logger.error("group to update not found {}".format(exp)) 

-

logger.exception(exp) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exp.message, 

-

status_code=exp.status_code) 

-

except Exception as exp: 

-

logger.error("fail to update groupt -- id {}".format(group_id)) 

-

logger.exception(exp) 

-

raise 

-

 

-

return Result(group_result) 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources_metadata_py.html b/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources_metadata_py.html deleted file mode 100644 index fcb8e1ed..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources_metadata_py.html +++ /dev/null @@ -1,437 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/resources/metadata.py: 78% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

- -
-

import json 

-

 

-

import logging 

-

 

-

from pecan import rest, request 

-

import wsme 

-

from wsme import types as wtypes 

-

from wsmeext.pecan import wsexpose 

-

 

-

from rms.services import error_base 

-

from rms.services import services as RegionService 

-

 

-

from rms.utils import authentication 

-

 

-

from orm_common.utils import api_error_utils as err_utils 

-

from orm_common.utils import utils 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class MetaData(wtypes.DynamicBase): 

-

"""main json header.""" 

-

 

-

metadata = wsme.wsattr({str: [str]}, mandatory=True) 

-

 

-

def __init__(self, metadata={}): 

-

"""init function. 

-

 

-

:param regions: 

-

:return: 

-

""" 

-

self.metadata = metadata 

-

 

-

 

-

class RegionMetadataController(rest.RestController): 

-

 

-

@wsexpose(MetaData, str, status_code=200, rest_content_types='json') 

-

def get(self, region_id): 

-

logger.info("Get metadata for region id: {}".format(region_id)) 

-

authentication.authorize(request, 'metadata:get') 

-

 

-

try: 

-

region = RegionService.get_region_by_id_or_name(region_id) 

-

logger.debug("Got region metadata: {}".format(region.metadata)) 

-

return MetaData(region.metadata) 

-

 

-

except error_base.ErrorStatus as exp: 

-

logger.error("RegionsController - {}".format(exp.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exp.message, 

-

status_code=exp.status_code) 

-

except Exception as exp: 

-

logger.exception(exp.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exp.message) 

-

 

-

@wsexpose(MetaData, str, body=MetaData, status_code=201, 

-

rest_content_types='json') 

-

def post(self, region_id, metadata_input): 

-

"""Handle post request. 

-

:param region_id: region_id to add metadata to. 

-

:param metadata_input: json data 

-

:return: 201 created on success, 409 duplicate entry, 404 not found 

-

""" 

-

logger.info("Entered Create region metadata") 

-

logger.debug("Got metadata: {}".format(metadata_input)) 

-

authentication.authorize(request, 'metadata:create') 

-

 

-

try: 

-

self._validate_request_input() 

-

# May raise an exception which will return status code 400 

-

result = RegionService.add_region_metadata(region_id, 

-

metadata_input.metadata) 

-

logger.debug("Metadata was successfully added to " 

-

"region: {}. New metadata: {}".format(region_id, result)) 

-

 

-

event_details = 'Region {} metadata added'.format(region_id) 

-

utils.audit_trail('create metadata', request.transaction_id, 

-

request.headers, region_id, 

-

event_details=event_details) 

-

return MetaData(result) 

-

 

-

except error_base.ErrorStatus as e: 

-

logger.error(e.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=e.status_code) 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(MetaData, str, body=MetaData, status_code=201, 

-

rest_content_types='json') 

-

def put(self, region_id, metadata_input): 

-

"""Handle put request. 

-

:param region_id: region_id to update metadata to. 

-

:param metadata_input: json data 

-

:return: 201 created on success, 404 not found 

-

""" 

-

logger.info("Entered update region metadata") 

-

logger.debug("Got metadata: {}".format(metadata_input)) 

-

authentication.authorize(request, 'metadata:update') 

-

 

-

try: 

-

self._validate_request_input() 

-

# May raise an exception which will return status code 400 

-

result = RegionService.update_region_metadata(region_id, 

-

metadata_input.metadata) 

-

logger.debug("Metadata was successfully added to " 

-

"region: {}. New metadata: {}".format(region_id, result)) 

-

 

-

event_details = 'Region {} metadata updated'.format(region_id) 

-

utils.audit_trail('update metadata', request.transaction_id, 

-

request.headers, region_id, 

-

event_details=event_details) 

-

return MetaData(result) 

-

 

-

except error_base.ErrorStatus as e: 

-

logger.error(e.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=e.status_code) 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(None, str, str, status_code=204, rest_content_types='json') 

-

def delete(self, region_id, metadata_key): 

-

"""Handle delete request. 

-

:param region_id: region_id to update metadata to. 

-

:param metadata_key: metadata key to be deleted 

-

:return: 204 deleted 

-

""" 

-

logger.info("Entered delete region metadata with " 

-

"key: {}".format(metadata_key)) 

-

authentication.authorize(request, 'metadata:delete') 

-

 

-

try: 

-

# May raise an exception which will return status code 400 

-

result = RegionService.delete_metadata_from_region(region_id, 

-

metadata_key) 

-

logger.debug("Metadata was successfully deleted.") 

-

 

-

event_details = 'Region {} metadata {} deleted'.format( 

-

region_id, metadata_key) 

-

utils.audit_trail('delete metadata', request.transaction_id, 

-

request.headers, region_id, 

-

event_details=event_details) 

-

 

-

except error_base.ErrorStatus as e: 

-

logger.error(e.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=e.status_code) 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

def _validate_request_input(self): 

-

data_dict = json.loads(request.body) 

-

logger.debug("Got {}".format(data_dict)) 

-

for k, v in data_dict['metadata'].iteritems(): 

-

if isinstance(v, basestring): 

-

logger.error("Invalid json. value type list is expected, " 

-

"received string, for metadata key {}".format(k)) 

-

raise error_base.ErrorStatus(400, "Invalid json. Expecting list " 

-

"of metadata values, got string") 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources_regions_py.html b/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources_regions_py.html deleted file mode 100644 index 02014699..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources_regions_py.html +++ /dev/null @@ -1,819 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/resources/regions.py: 97% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

-

185

-

186

-

187

-

188

-

189

-

190

-

191

-

192

-

193

-

194

-

195

-

196

-

197

-

198

-

199

-

200

-

201

-

202

-

203

-

204

-

205

-

206

-

207

-

208

-

209

-

210

-

211

-

212

-

213

-

214

-

215

-

216

-

217

-

218

-

219

-

220

-

221

-

222

-

223

-

224

-

225

-

226

-

227

-

228

-

229

-

230

-

231

-

232

-

233

-

234

-

235

-

236

-

237

-

238

-

239

-

240

-

241

-

242

-

243

-

244

-

245

-

246

-

247

-

248

-

249

-

250

-

251

-

252

-

253

-

254

-

255

-

256

-

257

-

258

-

259

-

260

-

261

-

262

-

263

-

264

-

265

-

266

-

267

-

268

-

269

-

270

-

271

-

272

-

273

-

274

-

275

-

276

-

277

-

278

-

279

-

280

-

281

-

282

-

283

-

284

-

285

-

286

-

287

-

288

-

289

-

290

-

291

-

292

-

293

-

294

-

295

-

296

-

297

-

298

-

299

-

300

-

301

-

302

-

303

-

304

-

305

-

306

-

307

-

308

-

309

-

310

-

311

-

312

-

313

-

314

-

315

-

316

-

317

-

318

-

319

-

320

-

321

-

322

-

323

-

324

-

325

-

326

-

327

-

328

-

329

-

330

-

331

-

332

-

333

-

334

-

335

-

336

-

337

-

338

-

339

-

340

-

341

-

342

-

343

-

344

-

345

-

346

-

347

-

348

-

349

-

350

-

351

-

352

-

353

-

354

-

355

-

356

-

357

-

358

-

359

-

360

-

361

-

362

-

363

-

364

-

365

- -
-

"""rest module.""" 

-

import logging 

-

 

-

from pecan import rest, request 

-

import wsme 

-

from wsme import types as wtypes 

-

from wsmeext.pecan import wsexpose 

-

 

-

from rms.model import url_parm 

-

from rms.model import model as PythonModel 

-

from rms.services import error_base 

-

from rms.services import services as RegionService 

-

 

-

from rms.controllers.v2.orm.resources.metadata import RegionMetadataController 

-

from rms.controllers.v2.orm.resources.status import RegionStatusController 

-

 

-

from rms.utils import authentication 

-

 

-

from orm_common.policy import policy 

-

from orm_common.utils import api_error_utils as err_utils 

-

from orm_common.utils import utils 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class Address(wtypes.DynamicBase): 

-

"""wsme class for address json.""" 

-

 

-

country = wsme.wsattr(wtypes.text, mandatory=True) 

-

state = wsme.wsattr(wtypes.text, mandatory=True) 

-

city = wsme.wsattr(wtypes.text, mandatory=True) 

-

street = wsme.wsattr(wtypes.text, mandatory=True) 

-

zip = wsme.wsattr(wtypes.text, mandatory=True) 

-

 

-

def __init__(self, country=None, state=None, city=None, 

-

street=None, zip=None): 

-

""" 

-

 

-

:param country: 

-

:param state: 

-

:param city: 

-

:param street: 

-

:param zip: 

-

""" 

-

self.country = country 

-

self.state = state 

-

self.city = city 

-

self.street = street 

-

self.zip = zip 

-

 

-

def _to_clean_python_obj(self): 

-

obj = PythonModel.Address() 

-

obj.country = self.country 

-

obj.state = self.state 

-

obj.city = self.city 

-

obj.street = self.street 

-

obj.zip = self.zip 

-

return obj 

-

 

-

 

-

class EndPoint(wtypes.DynamicBase): 

-

"""class method endpoints body.""" 

-

 

-

publicurl = wsme.wsattr(wtypes.text, mandatory=True, name="publicURL") 

-

type = wsme.wsattr(wtypes.text, mandatory=True) 

-

 

-

def __init__(self, publicurl=None, type=None): 

-

"""init function. 

-

 

-

:param publicURL: field 

-

:param typee: field 

-

:return: 

-

""" 

-

self.type = type 

-

self.publicurl = publicurl 

-

 

-

def _to_clean_python_obj(self): 

-

obj = PythonModel.EndPoint() 

-

obj.publicurl = self.publicurl 

-

obj.type = self.type 

-

return obj 

-

 

-

 

-

class RegionsData(wtypes.DynamicBase): 

-

"""class method json header.""" 

-

 

-

status = wsme.wsattr(wtypes.text, mandatory=True) 

-

id = wsme.wsattr(wtypes.text, mandatory=True) 

-

name = wsme.wsattr(wtypes.text, mandatory=False) 

-

ranger_agent_version = wsme.wsattr(wtypes.text, mandatory=True, name="rangerAgentVersion") 

-

open_stack_version = wsme.wsattr(wtypes.text, mandatory=True, name="OSVersion") 

-

clli = wsme.wsattr(wtypes.text, mandatory=True, name="CLLI") 

-

metadata = wsme.wsattr({str: [str]}, mandatory=True) 

-

endpoints = wsme.wsattr([EndPoint], mandatory=True) 

-

address = wsme.wsattr(Address, mandatory=True) 

-

design_type = wsme.wsattr(wtypes.text, mandatory=True, name="designType") 

-

location_type = wsme.wsattr(wtypes.text, mandatory=True, name="locationType") 

-

vlcp_name = wsme.wsattr(wtypes.text, mandatory=True, name="vlcpName") 

-

is_ecomp = wsme.wsattr(bool, mandatory=False, name="is_ecomp", 

-

default=False) 

-

is_ssp = wsme.wsattr(bool, mandatory=False, name="is_ssp", 

-

default=False) 

-

purpose_of_region = wsme.wsattr(wtypes.text, mandatory=True, name="purpose_of_region") 

-

 

-

def __init__(self, status=None, id=None, name=None, clli=None, design_type=None, 

-

location_type=None, vlcp_name=None, open_stack_version=None, 

-

address=Address(), ranger_agent_version=None, metadata={}, 

-

endpoint=[EndPoint()], is_ecomp=False, is_ssp=False, 

-

purpose_of_region=None): 

-

""" 

-

 

-

:param status: 

-

:param id: 

-

:param name: 

-

:param clli: 

-

:param design_type: 

-

:param location_type: 

-

:param vlcp_name: 

-

:param open_stack_version: 

-

:param address: 

-

:param ranger_agent_version: 

-

:param metadata: 

-

:param endpoint: 

-

:param is_ecomp: 

-

:param is_ssp: 

-

:param purpose_of_region 

-

""" 

-

self.status = status 

-

self.id = id 

-

self.name = self.id 

-

self.clli = clli 

-

self.ranger_agent_version = ranger_agent_version 

-

self.metadata = metadata 

-

self.endpoint = endpoint 

-

self.design_type = design_type 

-

self.location_type = location_type 

-

self.vlcp_name = vlcp_name 

-

self.address = address 

-

self.open_stack_version = open_stack_version 

-

self.is_ecomp = is_ecomp 

-

self.is_ssp = is_ssp 

-

self.purpose_of_region = purpose_of_region 

-

 

-

def _to_clean_python_obj(self): 

-

obj = PythonModel.RegionData() 

-

obj.endpoints = [] 

-

obj.status = self.status 

-

obj.id = self.id 

-

obj.name = self.name 

-

obj.ranger_agent_version = self.ranger_agent_version 

-

obj.clli = self.clli 

-

obj.metadata = self.metadata 

-

for endpoint in self.endpoints: 

-

obj.endpoints.append(endpoint._to_clean_python_obj()) 

-

obj.address = self.address._to_clean_python_obj() 

-

obj.design_type = self.design_type 

-

obj.location_type = self.location_type 

-

obj.vlcp_name = self.vlcp_name 

-

obj.open_stack_version = self.open_stack_version 

-

obj.is_ecomp = self.is_ecomp 

-

obj.is_ssp = self.is_ssp 

-

obj.purpose_of_region = self.purpose_of_region 

-

return obj 

-

 

-

 

-

class Regions(wtypes.DynamicBase): 

-

"""main json header.""" 

-

 

-

regions = wsme.wsattr([RegionsData], mandatory=True) 

-

 

-

def __init__(self, regions=[RegionsData()]): 

-

"""init function. 

-

 

-

:param regions: 

-

:return: 

-

""" 

-

self.regions = regions 

-

 

-

 

-

class RegionsController(rest.RestController): 

-

"""controller get resource.""" 

-

metadata = RegionMetadataController() 

-

status = RegionStatusController() 

-

 

-

@wsexpose(Regions, str, str, [str], str, str, str, str, str, str, str, 

-

str, str, str, str, str, str, status_code=200, rest_content_types='json') 

-

def get_all(self, type=None, status=None, metadata=None, rangerAgentVersion=None, 

-

clli=None, regionname=None, osversion=None, valet=None, 

-

state=None, country=None, city=None, street=None, zip=None, 

-

is_ecomp=False, is_ssp=False, purpose_of_region=None): 

-

"""get regions. 

-

 

-

:param type: query field 

-

:param status: query field 

-

:param metadata: query field 

-

:param rangerAgentVersion: query field 

-

:param clli: query field 

-

:param regionname: query field 

-

:param osversion: query field 

-

:param valet: query field 

-

:param state: query field 

-

:param country: query field 

-

:param city: query field 

-

:param street: query field 

-

:param zip: query field 

-

:param is_ecomp: query field 

-

:param is_ssp: query field 

-

:param purpose_of_region: query field 

-

:return: json from db 

-

:exception: EntityNotFoundError 404 

-

""" 

-

logger.info("Entered Get Regions") 

-

authentication.authorize(request, 'region:get_all') 

-

 

-

url_args = {'type': type, 'status': status, 'metadata': metadata, 

-

'rangerAgentVersion': rangerAgentVersion, 'clli': clli, 'regionname': regionname, 

-

'osversion': osversion, 'valet': valet, 'state': state, 

-

'country': country, 'city': city, 'street': street, 'zip': zip, 

-

'is_ecomp': is_ecomp, 'is_ssp': is_ssp, 

-

'purpose_of_region': purpose_of_region} 

-

logger.debug("Parameters: {}".format(str(url_args))) 

-

 

-

try: 

-

url_args = url_parm.UrlParms(**url_args) 

-

 

-

result = RegionService.get_regions_data(url_args) 

-

 

-

logger.debug("Returning regions: {}".format(', '.join( 

-

[region.name for region in result.regions]))) 

-

 

-

return result 

-

 

-

except error_base.ErrorStatus as e: 

-

logger.error("RegionsController {}".format(e.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=e.status_code) 

-

 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

message=exception.message) 

-

 

-

@wsexpose(RegionsData, str, status_code=200, rest_content_types='json') 

-

def get_one(self, id_or_name): 

-

logger.info("API: Entered get region by id or name: {}".format(id_or_name)) 

-

authentication.authorize(request, 'region:get_one') 

-

 

-

try: 

-

result = RegionService.get_region_by_id_or_name(id_or_name) 

-

logger.debug("API: Got region {} success: {}".format(id_or_name, result)) 

-

except error_base.ErrorStatus as exp: 

-

logger.error("RegionsController {}".format(exp.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exp.message, 

-

status_code=exp.status_code) 

-

except Exception as exp: 

-

logger.exception(exp.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exp.message) 

-

 

-

return result 

-

 

-

@wsexpose(RegionsData, body=RegionsData, status_code=201, rest_content_types='json') 

-

def post(self, full_region_input): 

-

logger.info("API: CreateRegion") 

-

authentication.authorize(request, 'region:create') 

-

 

-

try: 

-

logger.debug("API: create region .. data = : {}".format(full_region_input)) 

-

result = RegionService.create_full_region(full_region_input) 

-

logger.debug("API: region created : {}".format(result)) 

-

 

-

event_details = 'Region {} {} created: AICversion {}, OSversion {}, CLLI {}'.format( 

-

full_region_input.name, full_region_input.design_type, 

-

full_region_input.ranger_agent_version, 

-

full_region_input.open_stack_version, full_region_input.clli) 

-

utils.audit_trail('create region', request.transaction_id, 

-

request.headers, full_region_input.id, 

-

event_details=event_details) 

-

except error_base.InputValueError as exp: 

-

logger.exception("Error in save region {}".format(exp.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=exp.status_code, 

-

message=exp.message) 

-

 

-

except error_base.ConflictError as exp: 

-

logger.exception("Conflict error {}".format(exp.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=exp.message, 

-

status_code=exp.status_code) 

-

 

-

except Exception as exp: 

-

logger.exception("Error in creating region .. reason:- {}".format(exp)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

message=exp.message) 

-

 

-

return result 

-

 

-

@wsexpose(None, str, rest_content_types='json', status_code=204) 

-

def delete(self, region_id): 

-

logger.info("Delete Region") 

-

authentication.authorize(request, 'region:delete') 

-

 

-

try: 

-

 

-

logger.debug("delete region {}".format(region_id)) 

-

result = RegionService.delete_region(region_id) 

-

logger.debug("region deleted") 

-

 

-

event_details = 'Region {} deleted'.format(region_id) 

-

utils.audit_trail('delete region', request.transaction_id, 

-

request.headers, region_id, 

-

event_details=event_details) 

-

 

-

except Exception as exp: 

-

logger.exception( 

-

"error in deleting region .. reason:- {}".format(exp)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

message=exp.message) 

-

return 

-

 

-

@wsexpose(RegionsData, str, body=RegionsData, status_code=201, 

-

rest_content_types='json') 

-

def put(self, region_id, region): 

-

logger.info("API: update region") 

-

authentication.authorize(request, 'region:update') 

-

 

-

try: 

-

 

-

logger.debug( 

-

"region to update {} with{}".format(region_id, region)) 

-

result = RegionService.update_region(region_id, region) 

-

logger.debug("API: region {} updated".format(region_id)) 

-

 

-

event_details = 'Region {} {} modified: AICversion {}, OSversion {}, CLLI {}'.format( 

-

region.name, region.design_type, region.ranger_agent_version, 

-

region.open_stack_version, region.clli) 

-

utils.audit_trail('update region', request.transaction_id, 

-

request.headers, region_id, 

-

event_details=event_details) 

-

 

-

except error_base.NotFoundError as exp: 

-

logger.exception("region {} not found".format(region_id)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=exp.status_code, 

-

message=exp.message) 

-

 

-

except error_base.InputValueError as exp: 

-

logger.exception("not valid input {}".format(exp.message)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=exp.status_code, 

-

message=exp.message) 

-

except Exception as exp: 

-

logger.exception( 

-

"API: error in updating region {}.. reason:- {}".format(region_id, 

-

exp)) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

message=exp.message) 

-

return result 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources_status_py.html b/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources_status_py.html deleted file mode 100644 index f719798a..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_resources_status_py.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/resources/status.py: 94% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

- -
-

import logging 

-

 

-

import pecan 

-

from pecan import rest, request, conf 

-

 

-

import wsme 

-

from wsme import types as wtypes 

-

from wsmeext.pecan import wsexpose 

-

 

-

from orm_common.utils import api_error_utils as err_utils 

-

from orm_common.utils import utils 

-

 

-

from rms.services import error_base 

-

from rms.services import services as RegionService 

-

from rms.utils import authentication 

-

 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class RegionStatus(wtypes.DynamicBase): 

-

"""main json header.""" 

-

 

-

status = wsme.wsattr(str, mandatory=True) 

-

links = wsme.wsattr({str: str}, mandatory=False) 

-

 

-

def __init__(self, status=None, links=None): 

-

""" 

-

RegionStatus wrapper 

-

:param status: 

-

""" 

-

self.status = status 

-

self.links = links 

-

 

-

 

-

class RegionStatusController(rest.RestController): 

-

 

-

@wsexpose(RegionStatus, str, body=RegionStatus, status_code=201, 

-

rest_content_types='json') 

-

def put(self, region_id, new_status): 

-

""" 

-

Handle put request to modify region status 

-

:param region_id: 

-

:param new_status: 

-

:return: 200 for updated, 404 for region not found 

-

400 invalid status 

-

""" 

-

logger.info("Entered update region status") 

-

logger.debug("Got status: {}".format(new_status.status)) 

-

 

-

authentication.authorize(request, 'status:put') 

-

 

-

try: 

-

allowed_status = conf.region_options.allowed_status_values[:] 

-

 

-

if new_status.status not in allowed_status: 

-

logger.error("Invalid status. Region status " 

-

"must be one of {}".format(allowed_status)) 

-

raise error_base.InputValueError( 

-

message="Invalid status. Region status " 

-

"must be one of {}".format(allowed_status)) 

-

 

-

# May raise an exception which will return status code 400 

-

status = RegionService.update_region_status(region_id, new_status.status) 

-

base_link = 'https://{0}:{1}{2}'.format(conf.server.host, conf.server.port, 

-

pecan.request.path) 

-

link = {'self': base_link} 

-

 

-

logger.debug("Region status for region id {}, was successfully " 

-

"changed to: {}.".format(region_id, new_status.status)) 

-

 

-

event_details = 'Region {} status updated to {}'.format( 

-

region_id, new_status.status) 

-

utils.audit_trail('Update status', request.transaction_id, 

-

request.headers, region_id, 

-

event_details=event_details) 

-

 

-

return RegionStatus(status, link) 

-

 

-

except error_base.ErrorStatus as e: 

-

logger.error(e.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

message=e.message, 

-

status_code=e.status_code) 

-

except Exception as exception: 

-

logger.error(exception.message) 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=500, 

-

error_details=exception.message) 

-

 

-

@wsexpose(str, str, rest_content_types='json') 

-

def get(self, region_id): 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=405) 

-

 

-

@wsexpose(RegionStatus, str, body=RegionStatus, status_code=200, 

-

rest_content_types='json') 

-

def post(self, region_id, status): 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=405) 

-

 

-

@wsexpose(str, str, rest_content_types='json') 

-

def delete(self, region_id): 

-

raise err_utils.get_error(request.transaction_id, 

-

status_code=405) 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_root_py.html b/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_root_py.html deleted file mode 100644 index df7c358c..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers_v2_orm_root_py.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/orm/root.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

- -
-

"""ORM controller module.""" 

-

from rms.controllers.v2.orm.resources import groups 

-

from rms.controllers.v2.orm.resources import regions 

-

 

-

 

-

class OrmController(object): 

-

"""ORM controller class.""" 

-

 

-

regions = regions.RegionsController() 

-

groups = groups.GroupsController() 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_controllers_v2_root_py.html b/orm/services/region_manager/htmlcov/rms_controllers_v2_root_py.html deleted file mode 100644 index addd8179..00000000 --- a/orm/services/region_manager/htmlcov/rms_controllers_v2_root_py.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - Coverage for rms/controllers/v2/root.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

- -
-

"""V2 root controller module.""" 

-

from rms.controllers.v2.orm import root 

-

 

-

 

-

class V2Controller(object): 

-

"""V2 root controller class.""" 

-

 

-

orm = root.OrmController() 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_external_mock___init___py.html b/orm/services/region_manager/htmlcov/rms_external_mock___init___py.html deleted file mode 100644 index 301a20c8..00000000 --- a/orm/services/region_manager/htmlcov/rms_external_mock___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_external_mock_audit_client___init___py.html b/orm/services/region_manager/htmlcov/rms_external_mock_audit_client___init___py.html deleted file mode 100644 index 0ba1d066..00000000 --- a/orm/services/region_manager/htmlcov/rms_external_mock_audit_client___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/audit_client/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_external_mock_audit_client_api___init___py.html b/orm/services/region_manager/htmlcov/rms_external_mock_audit_client_api___init___py.html deleted file mode 100644 index 9415cc4a..00000000 --- a/orm/services/region_manager/htmlcov/rms_external_mock_audit_client_api___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/audit_client/api/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_external_mock_audit_client_api_audit_py.html b/orm/services/region_manager/htmlcov/rms_external_mock_audit_client_api_audit_py.html deleted file mode 100644 index 92fe9996..00000000 --- a/orm/services/region_manager/htmlcov/rms_external_mock_audit_client_api_audit_py.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/audit_client/api/audit.py: 0% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

- -
-

def audit(*args, **kwargs): 

-

pass 

-

 

-

 

-

def init(*args, **kwargs): 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_external_mock_keystone_utils___init___py.html b/orm/services/region_manager/htmlcov/rms_external_mock_keystone_utils___init___py.html deleted file mode 100644 index c91da3f1..00000000 --- a/orm/services/region_manager/htmlcov/rms_external_mock_keystone_utils___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/keystone_utils/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_external_mock_keystone_utils_tokens_py.html b/orm/services/region_manager/htmlcov/rms_external_mock_keystone_utils_tokens_py.html deleted file mode 100644 index b833593b..00000000 --- a/orm/services/region_manager/htmlcov/rms_external_mock_keystone_utils_tokens_py.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/keystone_utils/tokens.py: 80% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

- -
-

def get_token_user(*a, **k): 

-

pass 

-

 

-

 

-

class TokenConf(object): 

-

def __init__(self, *a, **kw): 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_external_mock_orm_common___init___py.html b/orm/services/region_manager/htmlcov/rms_external_mock_orm_common___init___py.html deleted file mode 100644 index 9d0575ed..00000000 --- a/orm/services/region_manager/htmlcov/rms_external_mock_orm_common___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/orm_common/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_policy___init___py.html b/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_policy___init___py.html deleted file mode 100644 index 4367b302..00000000 --- a/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_policy___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/orm_common/policy/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_policy_policy_py.html b/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_policy_policy_py.html deleted file mode 100644 index 972d1dcf..00000000 --- a/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_policy_policy_py.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/orm_common/policy/policy.py: 67% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

- -
-

def init(*a, **kw): 

-

pass 

-

 

-

 

-

def enforce(*a, **kw): 

-

pass 

-

 

-

 

-

def authorize(*a, **kw): 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_utils___init___py.html b/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_utils___init___py.html deleted file mode 100644 index e339ed1a..00000000 --- a/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_utils___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/orm_common/utils/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_utils_api_error_utils_py.html b/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_utils_api_error_utils_py.html deleted file mode 100644 index 9979bae3..00000000 --- a/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_utils_api_error_utils_py.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/orm_common/utils/api_error_utils.py: 50% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

- -
-

def get_error(*args, **kwargs): 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_utils_utils_py.html b/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_utils_utils_py.html deleted file mode 100644 index fa2be4b5..00000000 --- a/orm/services/region_manager/htmlcov/rms_external_mock_orm_common_utils_utils_py.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - Coverage for rms/external_mock/orm_common/utils/utils.py: 83% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

- -
-

"""Utils module mock.""" 

-

 

-

 

-

def report_config(conf, dump=False): 

-

"""Mock report_config function.""" 

-

pass 

-

 

-

 

-

def set_utils_conf(conf): 

-

"""Mock set_utils_conf function.""" 

-

pass 

-

 

-

 

-

def audit_trail(*args, **kwargs): 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_model___init___py.html b/orm/services/region_manager/htmlcov/rms_model___init___py.html deleted file mode 100644 index dd0a069f..00000000 --- a/orm/services/region_manager/htmlcov/rms_model___init___py.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - Coverage for rms/model/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

- -
-

from pecan import conf # noqa 

-

 

-

 

-

def init_model(): 

-

""" 

-

This is a stub method which is called at application startup time. 

-

 

-

If you need to bind to a parsed database configuration, set up tables or 

-

ORM classes, or perform any database initialization, this is the 

-

recommended place to do it. 

-

 

-

For more information working with databases, and some common recipes, 

-

see http://pecan.readthedocs.org/en/latest/databases.html 

-

""" 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_model_model_py.html b/orm/services/region_manager/htmlcov/rms_model_model_py.html deleted file mode 100644 index d4a4be2a..00000000 --- a/orm/services/region_manager/htmlcov/rms_model_model_py.html +++ /dev/null @@ -1,475 +0,0 @@ - - - - - - - - - - - Coverage for rms/model/model.py: 93% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

-

185

-

186

-

187

-

188

-

189

-

190

-

191

-

192

-

193

- -
-

"""model module.""" 

-

from rms.services import error_base 

-

from pecan import conf 

-

 

-

 

-

class Address(object): 

-

"""address class.""" 

-

 

-

def __init__(self, country=None, state=None, city=None, 

-

street=None, zip=None): 

-

""" 

-

 

-

:param country: 

-

:param state: 

-

:param city: 

-

:param street: 

-

:param zip: 

-

""" 

-

self.country = country 

-

self.state = state 

-

self.city = city 

-

self.street = street 

-

self.zip = zip 

-

 

-

 

-

class EndPoint(object): 

-

"""class method endpoints body.""" 

-

 

-

def __init__(self, publicurl=None, type=None): 

-

"""init function. 

-

 

-

:param public_url: field 

-

:param type: field 

-

:return: 

-

""" 

-

self.type = type 

-

self.publicurl = publicurl 

-

 

-

 

-

class RegionData(object): 

-

"""class method json header.""" 

-

 

-

def __init__(self, status=None, id=None, name=None, clli=None, 

-

ranger_agent_version=None, design_type=None, location_type=None, 

-

vlcp_name=None, open_stack_version=None, 

-

address=Address(), is_ecomp=None, is_ssp=None, 

-

purpose_of_region=None, metadata={}, endpoints=[EndPoint()]): 

-

""" 

-

 

-

:param status: 

-

:param id: 

-

:param name: 

-

:param clli: 

-

:param ranger_agent_version: 

-

:param design_type: 

-

:param location_type: 

-

:param vlcp_name: 

-

:param open_stack_version: 

-

:param address: 

-

:param is_ecomp 

-

:param is_ssp 

-

:param purpose_of_region 

-

:param metadata: 

-

:param endpoints: 

-

""" 

-

self.status = status 

-

self.id = id 

-

# make id and name always the same 

-

self.name = self.id 

-

self.clli = clli 

-

self.ranger_agent_version = ranger_agent_version 

-

self.metadata = metadata 

-

self.endpoints = endpoints 

-

self.design_type = design_type 

-

self.location_type = location_type 

-

self.vlcp_name = vlcp_name 

-

self.open_stack_version = open_stack_version 

-

self.address = address 

-

self.is_ecomp = is_ecomp 

-

self.is_ssp = is_ssp 

-

self.purpose_of_region = purpose_of_region 

-

 

-

def _validate_end_points(self, endpoints_types_must_have): 

-

ep_duplicate = [] 

-

for endpoint in self.endpoints: 

-

if endpoint.type not in ep_duplicate: 

-

ep_duplicate.append(endpoint.type) 

-

else: 

-

raise error_base.InputValueError( 

-

message="Invalid endpoints. Duplicate endpoint " 

-

"type {}".format(endpoint.type)) 

-

try: 

-

endpoints_types_must_have.remove(endpoint.type) 

-

except: 

-

pass 

-

if len(endpoints_types_must_have) > 0: 

-

raise error_base.InputValueError( 

-

message="Invalid endpoints. Endpoint type '{}' " 

-

"is missing".format(endpoints_types_must_have)) 

-

 

-

def _validate_status(self, allowed_status): 

-

if self.status not in allowed_status: 

-

raise error_base.InputValueError( 

-

message="Invalid status. Region status must be " 

-

"one of {}".format(allowed_status)) 

-

return 

-

 

-

def _validate_model(self): 

-

allowed_status = conf.region_options.allowed_status_values[:] 

-

endpoints_types_must_have = conf.region_options.endpoints_types_must_have[:] 

-

self._validate_status(allowed_status) 

-

self._validate_end_points(endpoints_types_must_have) 

-

return 

-

 

-

def _to_db_model_dict(self): 

-

end_points = [] 

-

 

-

for endpoint in self.endpoints: 

-

ep = {} 

-

ep['type'] = endpoint.type 

-

ep['url'] = endpoint.publicurl 

-

end_points.append(ep) 

-

 

-

db_model_dict = {} 

-

db_model_dict['region_id'] = self.id 

-

db_model_dict['name'] = self.name 

-

db_model_dict['address_state'] = self.address.state 

-

db_model_dict['address_country'] = self.address.country 

-

db_model_dict['address_city'] = self.address.city 

-

db_model_dict['address_street'] = self.address.street 

-

db_model_dict['address_zip'] = self.address.zip 

-

db_model_dict['region_status'] = self.status 

-

db_model_dict['ranger_agent_version'] = self.ranger_agent_version 

-

db_model_dict['open_stack_version'] = self.open_stack_version 

-

db_model_dict['design_type'] = self.design_type 

-

db_model_dict['location_type'] = self.location_type 

-

db_model_dict['vlcp_name'] = self.location_type 

-

db_model_dict['clli'] = self.clli 

-

db_model_dict['is_ecomp'] = self.is_ecomp * 1 

-

db_model_dict['is_ssp'] = self.is_ssp * 1 

-

db_model_dict['purpose_of_region'] = self.purpose_of_region 

-

db_model_dict['end_point_list'] = end_points 

-

db_model_dict['meta_data_dict'] = self.metadata 

-

return db_model_dict 

-

 

-

 

-

class Regions(object): 

-

"""main json header.""" 

-

 

-

def __init__(self, regions=[RegionData()]): 

-

"""init function. 

-

 

-

:param regions: 

-

:return: 

-

""" 

-

self.regions = regions 

-

 

-

 

-

class Groups(object): 

-

"""main json header.""" 

-

 

-

def __init__(self, id=None, name=None, 

-

description=None, regions=[]): 

-

"""init function. 

-

 

-

:param regions: 

-

:return: 

-

""" 

-

self.id = id 

-

self.name = name 

-

self.description = description 

-

self.regions = regions 

-

 

-

def _to_db_model_dict(self): 

-

db_dict = {} 

-

db_dict['group_name'] = self.name 

-

db_dict['group_description'] = self.description 

-

db_dict['group_regions'] = self.regions 

-

return db_dict 

-

 

-

 

-

class GroupsWrraper(object): 

-

"""list of groups.""" 

-

 

-

def __init__(self, groups=None): 

-

""" 

-

 

-

:param groups: 

-

""" 

-

if groups is None: 

-

self.groups = [] 

-

else: 

-

self.groups = groups 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_model_url_parm_py.html b/orm/services/region_manager/htmlcov/rms_model_url_parm_py.html deleted file mode 100644 index c8234f07..00000000 --- a/orm/services/region_manager/htmlcov/rms_model_url_parm_py.html +++ /dev/null @@ -1,307 +0,0 @@ - - - - - - - - - - - Coverage for rms/model/url_parm.py: 94% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

- -
-

"""module.""" 

-

 

-

 

-

class UrlParms(object): 

-

"""class method.""" 

-

 

-

def __init__(self, type=None, status=None, metadata=None, rangerAgentVersion=None, 

-

clli=None, regionname=None, osversion=None, valet=None, 

-

state=None, country=None, city=None, street=None, zip=None, 

-

is_ecomp=None, is_ssp=None, purpose_of_region=None): 

-

"""init method. 

-

 

-

:param type: 

-

:param status: 

-

:param metadata: 

-

:param rangerAgentVersion: 

-

:param clli: 

-

:param regionname: 

-

:param osversion: 

-

:param valet: 

-

:param state: 

-

:param country: 

-

:param city: 

-

:param street: 

-

:param zip: 

-

""" 

-

if type: 

-

self.location_type = type 

-

if status: 

-

self.region_status = status 

-

if metadata: 

-

self.metadata = metadata 

-

if rangerAgentVersion: 

-

self.ranger_agent_version = rangerAgentVersion 

-

if clli: 

-

self.clli = clli 

-

if regionname: 

-

self.name = regionname 

-

if osversion: 

-

self.open_stack_version = osversion 

-

if valet: 

-

self.valet = valet 

-

if state: 

-

self.address_state = state 

-

if country: 

-

self.address_country = country 

-

if city: 

-

self.address_city = city 

-

if street: 

-

self.address_street = street 

-

if zip: 

-

self.address_zip = zip 

-

if is_ecomp: 

-

self.is_ecomp = is_ecomp 

-

if is_ssp: 

-

self.is_ssp = is_ssp 

-

if purpose_of_region: 

-

self.purpose_of_region 

-

 

-

def _build_query(self): 

-

"""nuild db query. 

-

 

-

:return: 

-

""" 

-

metadatadict = None 

-

regiondict = None 

-

if self.__dict__: 

-

metadatadict = self._build_metadata_dict() 

-

regiondict = self._build_region_dict() 

-

return regiondict, metadatadict, None 

-

 

-

def _build_metadata_dict(self): 

-

"""meta_data dict. 

-

 

-

:return: metadata dict 

-

""" 

-

metadata = None 

-

if 'metadata' in self.__dict__: 

-

metadata = {'ref_keys': [], 'meta_data_pairs': [], 

-

'meta_data_keys': []} 

-

for metadata_item in self.metadata: 

-

if ':' in metadata_item: 

-

key = metadata_item.split(':')[0] 

-

metadata['ref_keys'].append(key) 

-

metadata['meta_data_pairs'].\ 

-

append({'metadata_key': key, 

-

'metadata_value': metadata_item.split(':')[1]}) 

-

else: 

-

metadata['meta_data_keys'].append(metadata_item) 

-

# Now clean irrelevant values 

-

keys_list = [] 

-

for item in metadata['meta_data_keys']: 

-

if item not in metadata['ref_keys']: 

-

keys_list.append(item) 

-

 

-

metadata['meta_data_keys'] = keys_list 

-

 

-

return metadata 

-

 

-

def _build_region_dict(self): 

-

"""region dict. 

-

 

-

:return:regin dict 

-

""" 

-

regiondict = {} 

-

for key, value in self.__dict__.items(): 

-

if key != 'metadata': 

-

regiondict[key] = value 

-

return regiondict 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_services___init___py.html b/orm/services/region_manager/htmlcov/rms_services___init___py.html deleted file mode 100644 index 430566d0..00000000 --- a/orm/services/region_manager/htmlcov/rms_services___init___py.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - Coverage for rms/services/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

- -
-

"""services package.""" 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_services_error_base_py.html b/orm/services/region_manager/htmlcov/rms_services_error_base_py.html deleted file mode 100644 index 3488d3a4..00000000 --- a/orm/services/region_manager/htmlcov/rms_services_error_base_py.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - Coverage for rms/services/error_base.py: 89% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

- -
-

"""Exceptions module.""" 

-

 

-

 

-

class Error(Exception): 

-

pass 

-

 

-

 

-

class ErrorStatus(Error): 

-

 

-

def __init__(self, status_code, message=""): 

-

self.status_code = status_code 

-

self.message = message 

-

 

-

 

-

class NotFoundError(ErrorStatus): 

-

 

-

def __init__(self, status_code=404, message="Not found"): 

-

self.status_code = status_code 

-

self.message = message 

-

 

-

 

-

class ConflictError(ErrorStatus): 

-

 

-

def __init__(self, status_code=409, message="Conflict error"): 

-

self.status_code = status_code 

-

self.message = message 

-

 

-

 

-

class InputValueError(ErrorStatus): 

-

 

-

def __init__(self, status_code=400, message="value not allowed"): 

-

self.status_code = status_code 

-

self.message = message 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_services_services_py.html b/orm/services/region_manager/htmlcov/rms_services_services_py.html deleted file mode 100644 index 0192f62f..00000000 --- a/orm/services/region_manager/htmlcov/rms_services_services_py.html +++ /dev/null @@ -1,661 +0,0 @@ - - - - - - - - - - - Coverage for rms/services/services.py: 68% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

-

185

-

186

-

187

-

188

-

189

-

190

-

191

-

192

-

193

-

194

-

195

-

196

-

197

-

198

-

199

-

200

-

201

-

202

-

203

-

204

-

205

-

206

-

207

-

208

-

209

-

210

-

211

-

212

-

213

-

214

-

215

-

216

-

217

-

218

-

219

-

220

-

221

-

222

-

223

-

224

-

225

-

226

-

227

-

228

-

229

-

230

-

231

-

232

-

233

-

234

-

235

-

236

-

237

-

238

-

239

-

240

-

241

-

242

-

243

-

244

-

245

-

246

-

247

-

248

-

249

-

250

-

251

-

252

-

253

-

254

-

255

-

256

-

257

-

258

-

259

-

260

-

261

-

262

-

263

-

264

-

265

-

266

-

267

-

268

-

269

-

270

-

271

-

272

-

273

-

274

-

275

-

276

-

277

-

278

-

279

-

280

-

281

-

282

-

283

-

284

-

285

-

286

- -
-

"""DB actions wrapper module.""" 

-

import logging 

-

from rms.model.model import Groups 

-

from rms.model.model import Regions 

-

from rms.services import error_base 

-

from rms.storage import base_data_manager 

-

from rms.storage import data_manager_factory 

-

 

-

LOG = logging.getLogger(__name__) 

-

 

-

 

-

def get_regions_data(url_parms): 

-

"""get region from db. 

-

 

-

:param url_parms: the parameters got in the url to make the query 

-

:return: region model for json output 

-

:raise: NoContentError( status code 404) 

-

""" 

-

region_dict, metadata_dict, end_point = url_parms._build_query() 

-

db = data_manager_factory.get_data_manager() 

-

regions = db.get_regions(region_dict, metadata_dict, end_point) 

-

if not regions: 

-

raise error_base.NotFoundError(message="No regions found for the given search parameters") 

-

return Regions(regions) 

-

 

-

 

-

def get_region_by_id_or_name(region_id_or_name): 

-

""" 

-

 

-

:param region_id_or_name: 

-

:return: region object (wsme format) 

-

""" 

-

LOG.debug("LOGIC:- get region data by id or name {}".format(region_id_or_name)) 

-

try: 

-

db = data_manager_factory.get_data_manager() 

-

region = db.get_region_by_id_or_name(region_id_or_name) 

-

 

-

if not region: 

-

raise error_base.NotFoundError(message="Region {} not found".format(region_id_or_name)) 

-

 

-

except Exception as exp: 

-

LOG.exception("error in get region by id/name") 

-

raise 

-

 

-

return region 

-

 

-

 

-

def update_region(region_id, region): 

-

""" 

-

:param region: 

-

:return: 

-

""" 

-

LOG.debug("logic:- update region {}".format(region)) 

-

try: 

-

 

-

region = region._to_clean_python_obj() 

-

region._validate_model() 

-

region_dict = region._to_db_model_dict() 

-

 

-

db = data_manager_factory.get_data_manager() 

-

db.update_region(region_to_update=region_id, **region_dict) 

-

LOG.debug("region {} updated".format(region_id)) 

-

result = get_region_by_id_or_name(region_id) 

-

 

-

except error_base.NotFoundError as exp: 

-

LOG.exception("fail to update region {}".format(exp.message)) 

-

raise 

-

except Exception as exp: 

-

LOG.exception("fail to update region {}".format(exp)) 

-

raise 

-

return result 

-

 

-

 

-

def delete_region(region_id): 

-

""" 

-

 

-

:param region_id: 

-

:return: 

-

""" 

-

LOG.debug("logic:- delete region {}".format(region_id)) 

-

try: 

-

db = data_manager_factory.get_data_manager() 

-

db.delete_region(region_id) 

-

LOG.debug("region deleted") 

-

except Exception as exp: 

-

LOG.exception("fail to delete region {}".format(exp)) 

-

raise 

-

return 

-

 

-

 

-

def create_full_region(full_region): 

-

"""create region logic. 

-

 

-

:param full_region obj: 

-

:return: 

-

:raise: input value error(status code 400) 

-

""" 

-

LOG.debug("logic:- save region ") 

-

try: 

-

 

-

full_region = full_region._to_clean_python_obj() 

-

full_region._validate_model() 

-

 

-

full_region_db_dict = full_region._to_db_model_dict() 

-

LOG.debug("region to save {}".format(full_region_db_dict)) 

-

db = data_manager_factory.get_data_manager() 

-

db.add_region(**full_region_db_dict) 

-

LOG.debug("region added") 

-

result = get_region_by_id_or_name(full_region.id) 

-

 

-

except error_base.InputValueError as exp: 

-

LOG.exception("error in save region {}".format(exp.message)) 

-

raise 

-

except base_data_manager.DuplicateEntryError as exp: 

-

LOG.exception("error in save region {}".format(exp.message)) 

-

raise error_base.ConflictError(message=exp.message) 

-

except Exception as exp: 

-

LOG.exception("error in save region {}".format(exp.message)) 

-

raise 

-

 

-

return result 

-

 

-

 

-

def add_region_metadata(region_id, metadata_dict): 

-

LOG.debug("Add metadata: {} to region id : {}".format(metadata_dict, 

-

region_id)) 

-

try: 

-

db = data_manager_factory.get_data_manager() 

-

result = db.add_meta_data_to_region(region_id, metadata_dict) 

-

if not result: 

-

raise error_base.NotFoundError(message="Region {} not found".format(region_id)) 

-

else: 

-

return result.metadata 

-

 

-

except Exception as exp: 

-

LOG.exception("Error getting metadata for region id:".format(region_id)) 

-

raise 

-

 

-

 

-

def update_region_metadata(region_id, metadata_dict): 

-

LOG.debug("Update metadata to region id : {}. " 

-

"New metadata: {}".format(region_id, metadata_dict)) 

-

try: 

-

db = data_manager_factory.get_data_manager() 

-

result = db.update_region_meta_data(region_id, metadata_dict) 

-

if not result: 

-

raise error_base.NotFoundError(message="Region {} not " 

-

"found".format(region_id)) 

-

else: 

-

return result.metadata 

-

 

-

except Exception as exp: 

-

LOG.exception("Error getting metadata for region id:".format(region_id)) 

-

raise 

-

 

-

 

-

def delete_metadata_from_region(region_id, metadata_key): 

-

LOG.info("Delete metadata key: {} from region id : {}." 

-

.format(metadata_key, region_id)) 

-

try: 

-

db = data_manager_factory.get_data_manager() 

-

db.delete_region_metadata(region_id, metadata_key) 

-

 

-

except Exception as exp: 

-

LOG.exception("Error getting metadata for region id:".format(region_id)) 

-

raise 

-

 

-

 

-

def get_groups_data(name): 

-

"""get group from db. 

-

 

-

:param name: groupe name 

-

:return: groupe object with its regions 

-

:raise: NoContentError( status code 404) 

-

""" 

-

db = data_manager_factory.get_data_manager() 

-

groups = db.get_group(name) 

-

if not groups: 

-

raise error_base.NotFoundError(message="Group {} not found".format(name)) 

-

return Groups(**groups) 

-

 

-

 

-

def get_all_groups(): 

-

""" 

-

 

-

:return: 

-

""" 

-

try: 

-

LOG.debug("logic - get all groups") 

-

db = data_manager_factory.get_data_manager() 

-

all_groups = db.get_all_groups() 

-

LOG.debug("logic - got all groups {}".format(all_groups)) 

-

 

-

except Exception as exp: 

-

LOG.error("fail to get all groups") 

-

LOG.exception(exp) 

-

raise 

-

 

-

return all_groups 

-

 

-

 

-

def delete_group(group_id): 

-

""" 

-

 

-

:param group_id: 

-

:return: 

-

""" 

-

LOG.debug("delete group logic") 

-

try: 

-

 

-

db = data_manager_factory.get_data_manager() 

-

LOG.debug("delete group id {} from db".format(group_id)) 

-

db.delete_group(group_id) 

-

 

-

except Exception as exp: 

-

LOG.exception(exp) 

-

raise 

-

return 

-

 

-

 

-

def create_group_in_db(group_id, group_name, description, regions): 

-

"""Create a region group in the database. 

-

 

-

:param group_id: The ID of the group to create 

-

:param group_name: The name of the group to create 

-

:param description: The group description 

-

:param regions: A list of regions inside the group 

-

:raise: GroupExistsError (status code 400) if the group already exists 

-

""" 

-

try: 

-

manager = data_manager_factory.get_data_manager() 

-

manager.add_group(group_id, group_name, description, regions) 

-

except error_base.ConflictError: 

-

LOG.exception("Group {} already exists".format(group_id)) 

-

raise error_base.ConflictError( 

-

message="Group {} already exists".format(group_id)) 

-

except error_base.InputValueError: 

-

LOG.exception("Some of the regions not found") 

-

raise error_base.NotFoundError( 

-

message="Some of the regions not found") 

-

 

-

 

-

def update_group(group, group_id): 

-

result = None 

-

LOG.debug("update group logic") 

-

try: 

-

group = group._to_python_obj() 

-

db_manager = data_manager_factory.get_data_manager() 

-

LOG.debug("update group to {}".format(group._to_db_model_dict())) 

-

db_manager.update_group(group_id=group_id, **group._to_db_model_dict()) 

-

LOG.debug("group updated") 

-

# make sure it updated 

-

groups = db_manager.get_group(group_id) 

-

 

-

except error_base.NotFoundError: 

-

LOG.error("Group {} not found") 

-

raise 

-

except error_base.InputValueError: 

-

LOG.exception("Some of the regions not found") 

-

raise error_base.NotFoundError( 

-

message="Some of the regions not found") 

-

except Exception as exp: 

-

LOG.error("Failed to update group {}".format(group.group_id)) 

-

LOG.exception(exp) 

-

raise 

-

 

-

return Groups(**groups) 

-

 

-

 

-

def update_region_status(region_id, new_status): 

-

"""Update region. 

-

 

-

:param region_id: 

-

:param new_status: 

-

:return: 

-

""" 

-

LOG.debug("Update region id: {} status to: {}".format(region_id, 

-

new_status)) 

-

try: 

-

db = data_manager_factory.get_data_manager() 

-

result = db.update_region_status(region_id, new_status) 

-

return result 

-

 

-

except Exception as exp: 

-

LOG.exception("Error updating status for region id:".format(region_id)) 

-

raise 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_storage___init___py.html b/orm/services/region_manager/htmlcov/rms_storage___init___py.html deleted file mode 100644 index b9e43969..00000000 --- a/orm/services/region_manager/htmlcov/rms_storage___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/storage/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_storage_base_data_manager_py.html b/orm/services/region_manager/htmlcov/rms_storage_base_data_manager_py.html deleted file mode 100644 index c3b0d045..00000000 --- a/orm/services/region_manager/htmlcov/rms_storage_base_data_manager_py.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - - - - - - - - Coverage for rms/storage/base_data_manager.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

- -
-

 

-

class BaseDataManager(object): 

-

 

-

def __init__(self, url, 

-

max_retries, 

-

retry_interval): 

-

pass 

-

 

-

def add_region(self, 

-

region_id, 

-

name, 

-

address_state, 

-

address_country, 

-

address_city, 

-

address_street, 

-

address_zip, 

-

region_status, 

-

ranger_agent_version, 

-

open_stack_version, 

-

design_type, 

-

location_type, 

-

vlcp_name, 

-

clli, 

-

description, 

-

meta_data_list, 

-

end_point_list, 

-

is_ecomp, 

-

is_ssp, 

-

purpose_of_region): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

""" 

-

def delete_region(self, 

-

region_id): 

-

raise NotImplementedError("Please Implement this method") 

-

""" 

-

 

-

def get_regions(self, 

-

region_filters_dict, 

-

meta_data_dict, 

-

end_point_dict): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

def get_all_regions(self): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

""" 

-

def add_meta_data_to_region(self, 

-

region_id, 

-

key, 

-

value, 

-

description): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

def remove_meta_data_from_region(self, 

-

region_id, 

-

key): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

def add_end_point_to_region(self, 

-

region_id, 

-

end_point_type, 

-

end_point_url, 

-

description): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

def remove_end_point_from_region(self, 

-

region_id, 

-

end_point_type): 

-

raise NotImplementedError("Please Implement this method") 

-

""" 

-

 

-

def add_group(self, 

-

group_id, 

-

group_name, 

-

group_description, 

-

region_ids_list): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

""" 

-

def delete_group(self, 

-

group_name): 

-

raise NotImplementedError("Please Implement this method") 

-

""" 

-

 

-

def get_group(self, group_id): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

def get_all_groups(self): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

""" 

-

def add_region_to_group(self, 

-

group_id, 

-

region_id): 

-

raise NotImplementedError("Please Implement this method") 

-

 

-

def remove_region_from_group(self, 

-

group_id, 

-

region_id): 

-

raise NotImplementedError("Please Implement this method") 

-

""" 

-

 

-

 

-

class SQLDBError(Exception): 

-

pass 

-

 

-

 

-

class EntityNotFound(Exception): 

-

"""if item not found in DB.""" 

-

pass 

-

 

-

 

-

class DuplicateEntryError(Exception): 

-

"""A group already exists.""" 

-

pass 

-

 

-

 

-

class InputValueError(Exception): 

-

""" unvalid input from user""" 

-

pass 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_storage_data_manager_factory_py.html b/orm/services/region_manager/htmlcov/rms_storage_data_manager_factory_py.html deleted file mode 100644 index 87d1ef0d..00000000 --- a/orm/services/region_manager/htmlcov/rms_storage_data_manager_factory_py.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - Coverage for rms/storage/data_manager_factory.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

- -
-

import logging 

-

 

-

from pecan import conf 

-

 

-

from rms.storage.my_sql.data_manager import DataManager 

-

 

-

LOG = logging.getLogger(__name__) 

-

 

-

 

-

def get_data_manager(): 

-

try: 

-

dm = DataManager(url=conf.database.url, 

-

max_retries=conf.database.max_retries, 

-

retries_interval=conf.database.retries_interval) 

-

return dm 

-

except Exception: 

-

nagios_message = "CRITICAL|CONDB001 - Could not establish " \ 

-

"database connection" 

-

LOG.error(nagios_message) 

-

raise Exception("Could not establish database connection") 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_storage_my_sql___init___py.html b/orm/services/region_manager/htmlcov/rms_storage_my_sql___init___py.html deleted file mode 100644 index a6e95539..00000000 --- a/orm/services/region_manager/htmlcov/rms_storage_my_sql___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/storage/my_sql/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_storage_my_sql_data_manager_py.html b/orm/services/region_manager/htmlcov/rms_storage_my_sql_data_manager_py.html deleted file mode 100644 index 589a433b..00000000 --- a/orm/services/region_manager/htmlcov/rms_storage_my_sql_data_manager_py.html +++ /dev/null @@ -1,1147 +0,0 @@ - - - - - - - - - - - Coverage for rms/storage/my_sql/data_manager.py: 89% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

-

54

-

55

-

56

-

57

-

58

-

59

-

60

-

61

-

62

-

63

-

64

-

65

-

66

-

67

-

68

-

69

-

70

-

71

-

72

-

73

-

74

-

75

-

76

-

77

-

78

-

79

-

80

-

81

-

82

-

83

-

84

-

85

-

86

-

87

-

88

-

89

-

90

-

91

-

92

-

93

-

94

-

95

-

96

-

97

-

98

-

99

-

100

-

101

-

102

-

103

-

104

-

105

-

106

-

107

-

108

-

109

-

110

-

111

-

112

-

113

-

114

-

115

-

116

-

117

-

118

-

119

-

120

-

121

-

122

-

123

-

124

-

125

-

126

-

127

-

128

-

129

-

130

-

131

-

132

-

133

-

134

-

135

-

136

-

137

-

138

-

139

-

140

-

141

-

142

-

143

-

144

-

145

-

146

-

147

-

148

-

149

-

150

-

151

-

152

-

153

-

154

-

155

-

156

-

157

-

158

-

159

-

160

-

161

-

162

-

163

-

164

-

165

-

166

-

167

-

168

-

169

-

170

-

171

-

172

-

173

-

174

-

175

-

176

-

177

-

178

-

179

-

180

-

181

-

182

-

183

-

184

-

185

-

186

-

187

-

188

-

189

-

190

-

191

-

192

-

193

-

194

-

195

-

196

-

197

-

198

-

199

-

200

-

201

-

202

-

203

-

204

-

205

-

206

-

207

-

208

-

209

-

210

-

211

-

212

-

213

-

214

-

215

-

216

-

217

-

218

-

219

-

220

-

221

-

222

-

223

-

224

-

225

-

226

-

227

-

228

-

229

-

230

-

231

-

232

-

233

-

234

-

235

-

236

-

237

-

238

-

239

-

240

-

241

-

242

-

243

-

244

-

245

-

246

-

247

-

248

-

249

-

250

-

251

-

252

-

253

-

254

-

255

-

256

-

257

-

258

-

259

-

260

-

261

-

262

-

263

-

264

-

265

-

266

-

267

-

268

-

269

-

270

-

271

-

272

-

273

-

274

-

275

-

276

-

277

-

278

-

279

-

280

-

281

-

282

-

283

-

284

-

285

-

286

-

287

-

288

-

289

-

290

-

291

-

292

-

293

-

294

-

295

-

296

-

297

-

298

-

299

-

300

-

301

-

302

-

303

-

304

-

305

-

306

-

307

-

308

-

309

-

310

-

311

-

312

-

313

-

314

-

315

-

316

-

317

-

318

-

319

-

320

-

321

-

322

-

323

-

324

-

325

-

326

-

327

-

328

-

329

-

330

-

331

-

332

-

333

-

334

-

335

-

336

-

337

-

338

-

339

-

340

-

341

-

342

-

343

-

344

-

345

-

346

-

347

-

348

-

349

-

350

-

351

-

352

-

353

-

354

-

355

-

356

-

357

-

358

-

359

-

360

-

361

-

362

-

363

-

364

-

365

-

366

-

367

-

368

-

369

-

370

-

371

-

372

-

373

-

374

-

375

-

376

-

377

-

378

-

379

-

380

-

381

-

382

-

383

-

384

-

385

-

386

-

387

-

388

-

389

-

390

-

391

-

392

-

393

-

394

-

395

-

396

-

397

-

398

-

399

-

400

-

401

-

402

-

403

-

404

-

405

-

406

-

407

-

408

-

409

-

410

-

411

-

412

-

413

-

414

-

415

-

416

-

417

-

418

-

419

-

420

-

421

-

422

-

423

-

424

-

425

-

426

-

427

-

428

-

429

-

430

-

431

-

432

-

433

-

434

-

435

-

436

-

437

-

438

-

439

-

440

-

441

-

442

-

443

-

444

-

445

-

446

-

447

-

448

-

449

-

450

-

451

-

452

-

453

-

454

-

455

-

456

-

457

-

458

-

459

-

460

-

461

-

462

-

463

-

464

-

465

-

466

-

467

-

468

-

469

-

470

-

471

-

472

-

473

-

474

-

475

-

476

-

477

-

478

-

479

-

480

-

481

-

482

-

483

-

484

-

485

-

486

-

487

-

488

-

489

-

490

-

491

-

492

-

493

-

494

-

495

-

496

-

497

-

498

-

499

-

500

-

501

-

502

-

503

-

504

-

505

-

506

-

507

-

508

-

509

-

510

-

511

-

512

-

513

-

514

-

515

-

516

-

517

-

518

-

519

-

520

-

521

-

522

-

523

-

524

-

525

-

526

-

527

-

528

-

529

- -
-

import logging 

-

 

-

import oslo_db 

-

from oslo_db.sqlalchemy import session as db_session 

-

from sqlalchemy.ext.declarative.api import declarative_base 

-

from sqlalchemy.sql import or_ 

-

 

-

from rms.services import error_base as ServiceBase 

-

from data_models import Region, RegionEndPoint, Group 

-

from data_models import RegionMetaData, GroupRegion 

-

from rms.services import error_base 

-

from rms.storage.base_data_manager import BaseDataManager, DuplicateEntryError, EntityNotFound 

-

from rms.model import model as PythonModels 

-

 

-

Base = declarative_base() 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

class DataManager(BaseDataManager): 

-

 

-

def __init__(self, url, max_retries, retries_interval): 

-

self._engine_facade = db_session.EngineFacade(url, 

-

max_retries=max_retries, 

-

retry_interval=retries_interval) 

-

 

-

def add_region(self, 

-

region_id, 

-

name, 

-

address_state, 

-

address_country, 

-

address_city, 

-

address_street, 

-

address_zip, 

-

region_status, 

-

ranger_agent_version, 

-

open_stack_version, 

-

design_type, 

-

location_type, 

-

vlcp_name, 

-

clli, 

-

# a list of dictionaries of format 

-

# {"type":"", "url":"", "description":"" 

-

end_point_list, 

-

# a dictionary of key,value pairs 

-

# {"key":"value", } 

-

meta_data_dict, 

-

is_ecomp, 

-

is_ssp, 

-

purpose_of_region="", 

-

description=""): 

-

""" add a new region to the `region` table 

-

add also the regions give meta_data and end_points to the `region_end_point` and 

-

`region_meta_data` tables if given. 

-

handle duplicate errors if raised""" 

-

try: 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

region = Region(region_id=region_id, 

-

name=name, 

-

address_state=address_state, 

-

address_country=address_country, 

-

address_city=address_city, 

-

address_street=address_street, 

-

address_zip=address_zip, 

-

region_status=region_status, 

-

ranger_agent_version=ranger_agent_version, 

-

open_stack_version=open_stack_version, 

-

design_type=design_type, 

-

location_type=location_type, 

-

vlcp_name=vlcp_name, 

-

clli=clli, 

-

description=description, 

-

is_ecomp=is_ecomp * 1, 

-

is_ssp=is_ssp * 1, 

-

purpose_of_region=purpose_of_region) 

-

 

-

if end_point_list is not None: 

-

for end_point in end_point_list: 

-

region_end_point = RegionEndPoint( 

-

end_point_type=end_point["type"], 

-

public_url=end_point["url"]) 

-

region.end_points.append(region_end_point) 

-

 

-

if meta_data_dict is not None: 

-

for k, v in meta_data_dict.iteritems(): 

-

for list_item in v: 

-

region.meta_data.append( 

-

RegionMetaData(region_id=region_id, 

-

meta_data_key=k, 

-

meta_data_value=list_item)) 

-

 

-

session.add(region) 

-

except oslo_db.exception.DBDuplicateEntry as e: 

-

logger.warning("Duplicate entry: {}".format(str(e))) 

-

raise DuplicateEntryError("Region {} already " 

-

"exist".format(region_id)) 

-

 

-

def update_region(self, 

-

region_to_update, 

-

region_id, 

-

name, 

-

address_state, 

-

address_country, 

-

address_city, 

-

address_street, 

-

address_zip, 

-

region_status, 

-

ranger_agent_version, 

-

open_stack_version, 

-

design_type, 

-

location_type, 

-

vlcp_name, 

-

clli, 

-

# a list of dictionaries of format 

-

# {"type":"", "url":"", "description":"" 

-

end_point_list, 

-

# a list of dictionaries of format 

-

# {"key":"", "value":"", "description":"" 

-

meta_data_dict, 

-

is_ecomp, 

-

is_ssp, 

-

purpose_of_region="", 

-

description=""): 

-

""" add a new region to the `region` table 

-

add also the regions give meta_data and end_points to the `region_end_point` and 

-

`region_meta_data` tables if given. 

-

handle duplicate errors if raised""" 

-

try: 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

# remove all childs as with update need to replace them 

-

session.query(RegionMetaData).filter_by(region_id=region_to_update).delete() 

-

session.query(RegionEndPoint).filter_by(region_id=region_to_update).delete() 

-

 

-

record = session.query(Region).filter_by(region_id=region_to_update).first() 

-

if record is not None: 

-

# record.region_id = region_id # ignore id and name when update 

-

# record.name = name 

-

record.address_state = address_state 

-

record.address_country = address_country 

-

record.address_city = address_city 

-

record.address_street = address_street 

-

record.address_zip = address_zip 

-

record.region_status = region_status 

-

record.ranger_agent_version = ranger_agent_version 

-

record.open_stack_version = open_stack_version 

-

record.design_type = design_type 

-

record.location_type = location_type 

-

record.vlcp_name = vlcp_name 

-

record.clli = clli 

-

record.description = description 

-

record.is_ecomp = is_ecomp * 1 

-

record.is_ssp = is_ssp * 1 

-

record.purpose_of_region = purpose_of_region 

-

 

-

if end_point_list is not None: 

-

for end_point in end_point_list: 

-

region_end_point = RegionEndPoint( 

-

end_point_type=end_point["type"], 

-

public_url=end_point["url"] 

-

) 

-

record.end_points.append(region_end_point) 

-

 

-

if meta_data_dict is not None: 

-

for k, v in meta_data_dict.iteritems(): 

-

for list_item in v: 

-

record.meta_data.append( 

-

RegionMetaData(region_id=region_id, 

-

meta_data_key=k, 

-

meta_data_value=list_item)) 

-

else: 

-

raise EntityNotFound("Region {} not found".format( 

-

region_to_update)) 

-

except EntityNotFound as exp: 

-

logger.exception( 

-

"fail to update entity with id {} not found".format( 

-

region_to_update)) 

-

raise ServiceBase.NotFoundError(message=exp.message) 

-

except Exception as exp: 

-

logger.exception("fail to update region {}".format(str(exp))) 

-

raise 

-

 

-

def delete_region(self, region_id): 

-

# delete a region from `region` table and also the region's 

-

# entries from `region_meta_data` and `region_end_points` tables 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

session.query(Region).filter_by(region_id=region_id).delete() 

-

 

-

def get_all_regions(self): 

-

return self.get_regions(None, None, None) 

-

 

-

def get_regions(self, 

-

region_filters_dict, 

-

meta_data_dict, 

-

end_point_dict): 

-

logger.debug("Get regions") 

-

records_model = [] 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

records = session.query(Region) 

-

if region_filters_dict is not None: 

-

records = records.filter_by(**region_filters_dict) 

-

 

-

if meta_data_dict is not None: 

-

regions = self._get_regions_for_meta_data_dict(meta_data_dict, 

-

session) 

-

query = [] 

-

query.append((Region.region_id.in_(regions))) 

-

records = records.filter(*query) 

-

 

-

if end_point_dict is not None: 

-

records = records.join(RegionEndPoint).\ 

-

filter_by(**end_point_dict) 

-

if records is not None: 

-

for record in records: 

-

records_model.append(record.to_wsme()) 

-

return records_model 

-

 

-

def _get_regions_for_meta_data_dict(self, meta_data_dict, session): 

-

result_lists = [] 

-

for key in meta_data_dict['meta_data_keys']: 

-

md_q = session.query(RegionMetaData). \ 

-

filter(RegionMetaData.meta_data_key == key).all() 

-

temp_result_list = [] 

-

if md_q is not None: 

-

for record in md_q: 

-

temp_result_list.append(record.region_id) 

-

result_lists.append(set(temp_result_list)) 

-

logger.debug(set(temp_result_list)) 

-

for item in meta_data_dict['meta_data_pairs']: 

-

md_q = session.query(RegionMetaData). \ 

-

filter(RegionMetaData.meta_data_key == item['metadata_key'], 

-

RegionMetaData.meta_data_value == item['metadata_value']).all() 

-

temp_result_list = [] 

-

if md_q is not None: 

-

for record in md_q: 

-

temp_result_list.append(record.region_id) 

-

result_lists.append(set(temp_result_list)) 

-

logger.debug(set(temp_result_list)) 

-

 

-

result = [] 

-

if result_lists: 

-

result = result_lists[0] 

-

for l in result_lists: 

-

result = result.intersection(l) 

-

else: 

-

result = None 

-

logger.debug(result) 

-

return result 

-

 

-

def get_region_by_id_or_name(self, region_id_or_name): 

-

logger.debug("Get region by id or name: {}".format(region_id_or_name)) 

-

try: 

-

 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

record = session.query(Region) 

-

record = record.filter(or_(Region.region_id == region_id_or_name, 

-

Region.name == region_id_or_name)) 

-

if record.first(): 

-

return record.first().to_wsme() 

-

return None 

-

 

-

except Exception as exp: 

-

logger.exception("DB error filtering by id/name") 

-

raise 

-

 

-

def add_meta_data_to_region(self, region_id, 

-

metadata_dict): 

-

""" 

-

:param region_id: 

-

:param metadata_dict: 

-

:return: 

-

""" 

-

session = self._engine_facade.get_session() 

-

try: 

-

with session.begin(): 

-

record = session.query(Region).\ 

-

filter_by(region_id=region_id).first() 

-

 

-

if record is not None: 

-

region_metadata = [] 

-

for k, v in metadata_dict.iteritems(): 

-

for list_item in v: 

-

region_metadata.append(RegionMetaData(region_id=region_id, 

-

meta_data_key=k, 

-

meta_data_value=list_item)) 

-

session.add_all(region_metadata) 

-

return record.to_wsme() 

-

else: 

-

logger.error("Region {} does not exist. " 

-

"Meta Data was not added!".format(region_id)) 

-

return None 

-

 

-

except oslo_db.exception.DBDuplicateEntry as e: 

-

logger.warning("Duplicate entry: {}".format(str(e))) 

-

raise error_base.ConflictError(message="Duplicate metadata value " 

-

"in region {}".format(region_id)) 

-

 

-

def update_region_meta_data(self, region_id, 

-

metadata_dict): 

-

""" 

-

Replace existing metadata for given region_id 

-

:param region_id: 

-

:param metadata_dict: 

-

:return: 

-

""" 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

 

-

record = session.query(Region). \ 

-

filter_by(region_id=region_id).first() 

-

if not record: 

-

msg = "Region {} not found".format(region_id) 

-

logger.info(msg) 

-

raise error_base.NotFoundError(message=msg) 

-

 

-

session.query(RegionMetaData).\ 

-

filter_by(region_id=region_id).delete() 

-

 

-

region_metadata = [] 

-

for k, v in metadata_dict.iteritems(): 

-

for list_item in v: 

-

region_metadata.append(RegionMetaData(region_id=region_id, 

-

meta_data_key=k, 

-

meta_data_value=list_item)) 

-

 

-

session.add_all(region_metadata) 

-

return record.to_wsme() 

-

 

-

def delete_region_metadata(self, region_id, key): 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

record = session.query(Region). \ 

-

filter_by(region_id=region_id).first() 

-

 

-

if not record: 

-

msg = "Region {} not found".format(region_id) 

-

logger.info(msg) 

-

raise error_base.NotFoundError(message=msg) 

-

 

-

session.query(RegionMetaData).filter_by(region_id=region_id, 

-

meta_data_key=key).delete() 

-

 

-

def update_region_status(self, region_id, region_status): 

-

try: 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

 

-

record = session.query(Region).filter_by(region_id=region_id).first() 

-

if record is not None: 

-

record.region_status = region_status 

-

else: 

-

msg = "Region {} not found".format(region_id) 

-

logger.info(msg) 

-

raise error_base.NotFoundError(message=msg) 

-

return record.region_status 

-

 

-

except Exception as exp: 

-

logger.exception("failed to update region {}".format(str(exp))) 

-

raise 

-

""" 

-

def add_end_point_to_region(self, 

-

region_id, 

-

end_point_type, 

-

end_point_url, 

-

description): 

-

session = self._engine_facade.get_session() 

-

try: 

-

with session.begin(): 

-

record = session.query(Region).filter_by(region_id=region_id).\ 

-

first() 

-

if record is not None: 

-

session.add( 

-

RegionEndPoint(region_id=region_id, 

-

end_point_type=end_point_type, 

-

public_url=end_point_url, 

-

description=description)) 

-

else: 

-

logger.error("Region {} does not exist. " 

-

"End point was not added !".format(region_id)) 

-

 

-

except oslo_db.exception.DBDuplicateEntry as e: 

-

logger.warning("Duplicate entry: {}".format(str(e))) 

-

raise SQLDBError("Duplicate entry error") 

-

 

-

def remove_end_point_from_region(self, 

-

region_id, 

-

end_point_type): 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

session.query(Region).filter_by(region_id=region_id, 

-

end_point_type=end_point_type).\ 

-

delete() 

-

""" 

-

 

-

# Handle group management operations 

-

def add_group(self, 

-

group_id, 

-

group_name, 

-

group_description, 

-

region_ids_list): 

-

session = self._engine_facade.get_session() 

-

try: 

-

with session.begin(): 

-

session.add(Group(group_id=group_id, 

-

name=group_name, 

-

description=group_description)) 

-

 

-

session.flush() # add the groupe if not rollback 

-

 

-

if region_ids_list is not None: 

-

group_regions = [] 

-

for region_id in region_ids_list: 

-

group_regions.append(GroupRegion(group_id=group_id, 

-

region_id=region_id)) 

-

session.add_all(group_regions) 

-

except oslo_db.exception.DBReferenceError as e: 

-

logger.error("Reference error: {}".format(str(e))) 

-

raise error_base.InputValueError("Reference error") 

-

except oslo_db.exception.DBDuplicateEntry as e: 

-

logger.error("Duplicate entry: {}".format(str(e))) 

-

raise error_base.ConflictError("Duplicate entry error") 

-

 

-

def delete_group(self, group_id): 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

session.query(Group).filter_by(group_id=group_id).delete() 

-

 

-

def get_all_groups(self): 

-

logger.debug("DB- Get all groups") 

-

records_model = PythonModels.GroupsWrraper() 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

groups = session.query(Group) 

-

for a_group in groups: 

-

group_model = PythonModels.Groups() 

-

group_model.id = a_group.group_id 

-

group_model.name = a_group.name 

-

group_model.description = a_group.description 

-

regions = [] 

-

group_regions = session.query(GroupRegion).\ 

-

filter_by(group_id=a_group.group_id) 

-

for group_region in group_regions: 

-

regions.append(group_region.region_id) 

-

 

-

group_model.regions = regions 

-

records_model.groups.append(group_model) 

-

return records_model 

-

 

-

def update_group(self, group_id, group_name, group_description, 

-

group_regions): 

-

try: 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

# in update scenario delete all child records 

-

session.query(GroupRegion).filter_by( 

-

group_id=group_id).delete() 

-

 

-

group_record = session.query(Group).filter_by( 

-

group_id=group_id).first() 

-

if group_record is None: 

-

raise error_base.NotFoundError( 

-

message="Group {} not found".format(group_id)) 

-

# only desc and regions can be changed 

-

group_record.description = group_description 

-

group_record.name = group_name 

-

regions = [] 

-

for region_id in group_regions: 

-

regions.append(GroupRegion(region_id=region_id, 

-

group_id=group_id)) 

-

session.add_all(regions) 

-

 

-

except error_base.NotFoundError as exp: 

-

logger.error(exp.message) 

-

raise 

-

except oslo_db.exception.DBReferenceError as e: 

-

logger.error("Reference error: {}".format(str(e))) 

-

raise error_base.InputValueError("Reference error") 

-

except Exception as exp: 

-

logger.error("failed to update group {}".format(group_id)) 

-

logger.exception(exp) 

-

raise 

-

return 

-

 

-

def get_group(self, group_id): 

-

logger.debug("Get group by name") 

-

group_model = None 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

a_group = session.query(Group).filter_by(group_id=group_id)\ 

-

.first() 

-

if a_group is not None: 

-

group_model = {"id": a_group.group_id, 

-

"name": a_group.name, 

-

"description": a_group.description} 

-

regions = [] 

-

group_regions = session.query(GroupRegion). \ 

-

filter_by(group_id=a_group.group_id) 

-

for group_region in group_regions: 

-

regions.append(group_region.region_id) 

-

group_model["regions"] = regions 

-

return group_model 

-

 

-

""" 

-

def add_region_to_group(self, 

-

group_id, 

-

region_id): 

-

session = self._engine_facade.get_session() 

-

try: 

-

with session.begin(): 

-

session.add(GroupRegion(group_id=group_id, 

-

region_id=region_id)) 

-

except oslo_db.exception.DBReferenceError as e: 

-

logger.error("Refernce error: {}".format(str(e))) 

-

raise SQLDBError("Reference error") 

-

except oslo_db.exception.DBDuplicateEntry as e: 

-

logger.error("Duplicate entry: {}".format(str(e))) 

-

raise SQLDBError("Duplicate entry error") 

-

 

-

def remove_region_from_group(self, 

-

group_id, 

-

region_id): 

-

session = self._engine_facade.get_session() 

-

with session.begin(): 

-

session.query(GroupRegion).filter_by(group_id=group_id, 

-

region_id=region_id).delete() 

-

""" 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_utils___init___py.html b/orm/services/region_manager/htmlcov/rms_utils___init___py.html deleted file mode 100644 index e9506082..00000000 --- a/orm/services/region_manager/htmlcov/rms_utils___init___py.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - Coverage for rms/utils/__init__.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
- - - -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/rms_utils_authentication_py.html b/orm/services/region_manager/htmlcov/rms_utils_authentication_py.html deleted file mode 100644 index 70124848..00000000 --- a/orm/services/region_manager/htmlcov/rms_utils_authentication_py.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - Coverage for rms/utils/authentication.py: 100% - - - - - - - - - - - - -
- Hide keyboard shortcuts -

Hot-keys on this page

-
-

- r - m - x - p   toggle line displays -

-

- j - k   next/prev highlighted chunk -

-

- 0   (zero) top of page -

-

- 1   (one) first highlighted chunk -

-
-
- -
- - - - - -
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-

13

-

14

-

15

-

16

-

17

-

18

-

19

-

20

-

21

-

22

-

23

-

24

-

25

-

26

-

27

-

28

-

29

-

30

-

31

-

32

-

33

-

34

-

35

-

36

-

37

-

38

-

39

-

40

-

41

-

42

-

43

-

44

-

45

-

46

-

47

-

48

-

49

-

50

-

51

-

52

-

53

- -
-

import logging 

-

 

-

from keystone_utils import tokens 

-

from orm_common.policy import policy 

-

from orm_common.utils import api_error_utils as err_utils 

-

 

-

from pecan import conf 

-

 

-

from rms.services import services as RegionService 

-

 

-

 

-

logger = logging.getLogger(__name__) 

-

 

-

 

-

def _get_keystone_ep(auth_region): 

-

result = RegionService.get_region_by_id_or_name(auth_region) 

-

for ep in result.endpoints: 

-

if ep.type == 'identity': 

-

return ep.publicurl 

-

 

-

# Keystone EP not found 

-

return None 

-

 

-

 

-

def authorize(request, action): 

-

if not _is_authorization_enabled(conf): 

-

return 

-

 

-

auth_region = request.headers.get('X-Auth-Region') 

-

try: 

-

keystone_ep = _get_keystone_ep(auth_region) 

-

except Exception: 

-

# Failed to find Keystone EP - we'll set it to None instead of failing 

-

# because the rule might be to let everyone pass 

-

keystone_ep = None 

-

 

-

policy.authorize(action, request, conf, keystone_ep=keystone_ep) 

-

 

-

 

-

def _is_authorization_enabled(app_conf): 

-

return app_conf.authentication.enabled 

-

 

-

 

-

def get_token_conf(app_conf): 

-

mech_id = app_conf.authentication.mech_id 

-

mech_password = app_conf.authentication.mech_pass 

-

# RMS URL is not necessary since this service is RMS 

-

rms_url = '' 

-

tenant_name = app_conf.authentication.tenant_name 

-

keystone_version = app_conf.authentication.keystone_version 

-

conf = tokens.TokenConf(mech_id, mech_password, rms_url, tenant_name, 

-

keystone_version) 

-

return conf 

- -
-
- - - - - diff --git a/orm/services/region_manager/htmlcov/status.json b/orm/services/region_manager/htmlcov/status.json deleted file mode 100644 index 1ce63b3c..00000000 --- a/orm/services/region_manager/htmlcov/status.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"rms_controllers_v2_orm_resources___init___py":{"index":{"relative_filename":"rms/controllers/v2/orm/resources/__init__.py","html_filename":"rms_controllers_v2_orm_resources___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"103b3a1826780f920626a4f622bcee7c"},"rms___init___py":{"index":{"relative_filename":"rms/__init__.py","html_filename":"rms___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_external_mock_audit_client_api___init___py":{"index":{"relative_filename":"rms/external_mock/audit_client/api/__init__.py","html_filename":"rms_external_mock_audit_client_api___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"19a064df3967067a2ec86c467e92d140"},"rms_controllers_lcp_controller_py":{"index":{"relative_filename":"rms/controllers/lcp_controller.py","html_filename":"rms_controllers_lcp_controller_py.html","nums":[1,56,0,0,0,0,0]},"hash":"a032e4765d0af628116fb4a525003601"},"rms_utils_authentication_py":{"index":{"relative_filename":"rms/utils/authentication.py","html_filename":"rms_utils_authentication_py.html","nums":[1,32,0,0,0,0,0]},"hash":"9816983ff8e57e8d1a9ed68b7c30ff50"},"rms_external_mock_orm_common___init___py":{"index":{"relative_filename":"rms/external_mock/orm_common/__init__.py","html_filename":"rms_external_mock_orm_common___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_model___init___py":{"index":{"relative_filename":"rms/model/__init__.py","html_filename":"rms_model___init___py.html","nums":[1,3,0,0,0,0,0]},"hash":"cf7982d8674fcb1858c46e0ed829f1e2"},"rms_storage_my_sql___init___py":{"index":{"relative_filename":"rms/storage/my_sql/__init__.py","html_filename":"rms_storage_my_sql___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_model_url_parm_py":{"index":{"relative_filename":"rms/model/url_parm.py","html_filename":"rms_model_url_parm_py.html","nums":[1,63,0,4,0,0,0]},"hash":"554a5d26967309c0321bb2d5ca4de2d0"},"rms_controllers_root_py":{"index":{"relative_filename":"rms/controllers/root.py","html_filename":"rms_controllers_root_py.html","nums":[1,12,0,1,0,0,0]},"hash":"22b13e705390f352b9e7a78c2f83d7b9"},"rms_external_mock_keystone_utils___init___py":{"index":{"relative_filename":"rms/external_mock/keystone_utils/__init__.py","html_filename":"rms_external_mock_keystone_utils___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_controllers_v2_orm_resources_groups_py":{"index":{"relative_filename":"rms/controllers/v2/orm/resources/groups.py","html_filename":"rms_controllers_v2_orm_resources_groups_py.html","nums":[1,124,0,22,0,0,0]},"hash":"38e755d11e73209da31ce4c4faff8d49"},"rms_controllers_v2_orm_resources_status_py":{"index":{"relative_filename":"rms/controllers/v2/orm/resources/status.py","html_filename":"rms_controllers_v2_orm_resources_status_py.html","nums":[1,47,0,3,0,0,0]},"hash":"afc1e6ecd339095ff57e6b9c7c9c819d"},"rms_services_error_base_py":{"index":{"relative_filename":"rms/services/error_base.py","html_filename":"rms_services_error_base_py.html","nums":[1,18,0,2,0,0,0]},"hash":"9cf5cf89d59dd8f73527b7bec0f6f11d"},"rms_external_mock_orm_common_policy_policy_py":{"index":{"relative_filename":"rms/external_mock/orm_common/policy/policy.py","html_filename":"rms_external_mock_orm_common_policy_policy_py.html","nums":[1,6,0,2,0,0,0]},"hash":"7ea56b6475a95231ec2271c5fb347853"},"rms_storage___init___py":{"index":{"relative_filename":"rms/storage/__init__.py","html_filename":"rms_storage___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_external_mock_orm_common_policy___init___py":{"index":{"relative_filename":"rms/external_mock/orm_common/policy/__init__.py","html_filename":"rms_external_mock_orm_common_policy___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_controllers_v2_orm___init___py":{"index":{"relative_filename":"rms/controllers/v2/orm/__init__.py","html_filename":"rms_controllers_v2_orm___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"f820fd7cab97fc8512bec0556f3f002c"},"rms_controllers_v2___init___py":{"index":{"relative_filename":"rms/controllers/v2/__init__.py","html_filename":"rms_controllers_v2___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"103b3a1826780f920626a4f622bcee7c"},"rms_controllers_v2_orm_resources_regions_py":{"index":{"relative_filename":"rms/controllers/v2/orm/resources/regions.py","html_filename":"rms_controllers_v2_orm_resources_regions_py.html","nums":[1,187,0,5,0,0,0]},"hash":"31c3b8e26317be7b0c19896d4f008617"},"rms_model_model_py":{"index":{"relative_filename":"rms/model/model.py","html_filename":"rms_model_model_py.html","nums":[1,100,0,7,0,0,0]},"hash":"29463d225fbe8d7a76bd2c96fc854ea9"},"rms_external_mock_orm_common_utils_utils_py":{"index":{"relative_filename":"rms/external_mock/orm_common/utils/utils.py","html_filename":"rms_external_mock_orm_common_utils_utils_py.html","nums":[1,6,0,1,0,0,0]},"hash":"3fd1f8e4472126ea5ccdbf31e97d61ea"},"rms_services___init___py":{"index":{"relative_filename":"rms/services/__init__.py","html_filename":"rms_services___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"8ac99c36cc7a0f004e5b32bd37a07666"},"rms_controllers_configuration_py":{"index":{"relative_filename":"rms/controllers/configuration.py","html_filename":"rms_controllers_configuration_py.html","nums":[1,17,0,0,0,0,0]},"hash":"b26d7e4d8662a3399ee6bfcca7910f6a"},"rms_storage_data_manager_factory_py":{"index":{"relative_filename":"rms/storage/data_manager_factory.py","html_filename":"rms_storage_data_manager_factory_py.html","nums":[1,12,0,0,0,0,0]},"hash":"187c41f6ce3b54925ae87043fbd31c9d"},"rms_storage_base_data_manager_py":{"index":{"relative_filename":"rms/storage/base_data_manager.py","html_filename":"rms_storage_base_data_manager_py.html","nums":[1,24,0,0,0,0,0]},"hash":"161f32081cdb26e50f07e76b8b1a9a5d"},"rms_controllers_v2_orm_resources_metadata_py":{"index":{"relative_filename":"rms/controllers/v2/orm/resources/metadata.py","html_filename":"rms_controllers_v2_orm_resources_metadata_py.html","nums":[1,85,0,19,0,0,0]},"hash":"7bb73ee1f834e6f8998371ce19f77ade"},"rms_external_mock___init___py":{"index":{"relative_filename":"rms/external_mock/__init__.py","html_filename":"rms_external_mock___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"19a064df3967067a2ec86c467e92d140"},"rms_storage_my_sql_data_manager_py":{"index":{"relative_filename":"rms/storage/my_sql/data_manager.py","html_filename":"rms_storage_my_sql_data_manager_py.html","nums":[1,270,0,31,0,0,0]},"hash":"5a1cbfe3ec7b9c95011d5586e27057cb"},"rms_external_mock_keystone_utils_tokens_py":{"index":{"relative_filename":"rms/external_mock/keystone_utils/tokens.py","html_filename":"rms_external_mock_keystone_utils_tokens_py.html","nums":[1,5,0,1,0,0,0]},"hash":"9e3b83a68d18e91870ada743cc6e8aaf"},"rms_controllers_v2_root_py":{"index":{"relative_filename":"rms/controllers/v2/root.py","html_filename":"rms_controllers_v2_root_py.html","nums":[1,3,0,0,0,0,0]},"hash":"a6ab4c4b9cc373374c0cdf71e05f92b2"},"rms_external_mock_orm_common_utils_api_error_utils_py":{"index":{"relative_filename":"rms/external_mock/orm_common/utils/api_error_utils.py","html_filename":"rms_external_mock_orm_common_utils_api_error_utils_py.html","nums":[1,2,0,1,0,0,0]},"hash":"5b097d36789f1b7dea3d91b3b8d3718a"},"rms_services_services_py":{"index":{"relative_filename":"rms/services/services.py","html_filename":"rms_services_services_py.html","nums":[1,170,0,55,0,0,0]},"hash":"ee882c9e5fa6c871e813a62a7126e7f8"},"rms_external_mock_audit_client_api_audit_py":{"index":{"relative_filename":"rms/external_mock/audit_client/api/audit.py","html_filename":"rms_external_mock_audit_client_api_audit_py.html","nums":[1,4,0,4,0,0,0]},"hash":"b0c363258cf77b3628c98037bd768ab4"},"rms_controllers___init___py":{"index":{"relative_filename":"rms/controllers/__init__.py","html_filename":"rms_controllers___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_controllers_logs_py":{"index":{"relative_filename":"rms/controllers/logs.py","html_filename":"rms_controllers_logs_py.html","nums":[1,36,0,2,0,0,0]},"hash":"8e5e06cf27f60958af7f39bc4c28a5b9"},"rms_external_mock_audit_client___init___py":{"index":{"relative_filename":"rms/external_mock/audit_client/__init__.py","html_filename":"rms_external_mock_audit_client___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"19a064df3967067a2ec86c467e92d140"},"rms_controllers_v2_orm_root_py":{"index":{"relative_filename":"rms/controllers/v2/orm/root.py","html_filename":"rms_controllers_v2_orm_root_py.html","nums":[1,5,0,0,0,0,0]},"hash":"7d9f45649dfaa9de7107f13e60452b2e"},"rms_external_mock_orm_common_utils___init___py":{"index":{"relative_filename":"rms/external_mock/orm_common/utils/__init__.py","html_filename":"rms_external_mock_orm_common_utils___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"},"rms_utils___init___py":{"index":{"relative_filename":"rms/utils/__init__.py","html_filename":"rms_utils___init___py.html","nums":[1,0,0,0,0,0,0]},"hash":"eef1bc6a4630e20d1fc10b7474fc01f8"}},"version":"4.3.4","settings":"38064b61f52503ec7d8e083087b27b2f","format":1} \ No newline at end of file diff --git a/orm/services/region_manager/htmlcov/style.css b/orm/services/region_manager/htmlcov/style.css deleted file mode 100644 index 86b82091..00000000 --- a/orm/services/region_manager/htmlcov/style.css +++ /dev/null @@ -1,375 +0,0 @@ -/* Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 */ -/* For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt */ - -/* CSS styles for coverage.py. */ - -/* Page-wide styles */ -html, body, h1, h2, h3, p, table, td, th { - margin: 0; - padding: 0; - border: 0; - outline: 0; - font-weight: inherit; - font-style: inherit; - font-size: 100%; - font-family: inherit; - vertical-align: baseline; - } - -/* Set baseline grid to 16 pt. */ -body { - font-family: georgia, serif; - font-size: 1em; - } - -html>body { - font-size: 16px; - } - -/* Set base font size to 12/16 */ -p { - font-size: .75em; /* 12/16 */ - line-height: 1.33333333em; /* 16/12 */ - } - -table { - border-collapse: collapse; - } -td { - vertical-align: top; -} -table tr.hidden { - display: none !important; - } - -p#no_rows { - display: none; - font-size: 1.2em; - } - -a.nav { - text-decoration: none; - color: inherit; - } -a.nav:hover { - text-decoration: underline; - color: inherit; - } - -/* Page structure */ -#header { - background: #f8f8f8; - width: 100%; - border-bottom: 1px solid #eee; - } - -#source { - padding: 1em; - font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; - } - -.indexfile #footer { - margin: 1em 3em; - } - -.pyfile #footer { - margin: 1em 1em; - } - -#footer .content { - padding: 0; - font-size: 85%; - font-family: verdana, sans-serif; - color: #666666; - font-style: italic; - } - -#index { - margin: 1em 0 0 3em; - } - -/* Header styles */ -#header .content { - padding: 1em 3em; - } - -h1 { - font-size: 1.25em; - display: inline-block; -} - -#filter_container { - display: inline-block; - float: right; - margin: 0 2em 0 0; -} -#filter_container input { - width: 10em; -} - -h2.stats { - margin-top: .5em; - font-size: 1em; -} -.stats span { - border: 1px solid; - padding: .1em .25em; - margin: 0 .1em; - cursor: pointer; - border-color: #999 #ccc #ccc #999; -} -.stats span.hide_run, .stats span.hide_exc, -.stats span.hide_mis, .stats span.hide_par, -.stats span.par.hide_run.hide_par { - border-color: #ccc #999 #999 #ccc; -} -.stats span.par.hide_run { - border-color: #999 #ccc #ccc #999; -} - -.stats span.run { - background: #ddffdd; -} -.stats span.exc { - background: #eeeeee; -} -.stats span.mis { - background: #ffdddd; -} -.stats span.hide_run { - background: #eeffee; -} -.stats span.hide_exc { - background: #f5f5f5; -} -.stats span.hide_mis { - background: #ffeeee; -} -.stats span.par { - background: #ffffaa; -} -.stats span.hide_par { - background: #ffffcc; -} - -/* Help panel */ -#keyboard_icon { - float: right; - margin: 5px; - cursor: pointer; -} - -.help_panel { - position: absolute; - background: #ffffcc; - padding: .5em; - border: 1px solid #883; - display: none; -} - -.indexfile .help_panel { - width: 20em; height: 4em; -} - -.pyfile .help_panel { - width: 16em; height: 8em; -} - -.help_panel .legend { - font-style: italic; - margin-bottom: 1em; -} - -#panel_icon { - float: right; - cursor: pointer; -} - -.keyhelp { - margin: .75em; -} - -.keyhelp .key { - border: 1px solid black; - border-color: #888 #333 #333 #888; - padding: .1em .35em; - font-family: monospace; - font-weight: bold; - background: #eee; -} - -/* Source file styles */ -.linenos p { - text-align: right; - margin: 0; - padding: 0 .5em; - color: #999999; - font-family: verdana, sans-serif; - font-size: .625em; /* 10/16 */ - line-height: 1.6em; /* 16/10 */ - } -.linenos p.highlight { - background: #ffdd00; - } -.linenos p a { - text-decoration: none; - color: #999999; - } -.linenos p a:hover { - text-decoration: underline; - color: #999999; - } - -td.text { - width: 100%; - } -.text p { - margin: 0; - padding: 0 0 0 .5em; - border-left: 2px solid #ffffff; - white-space: pre; - position: relative; - } - -.text p.mis { - background: #ffdddd; - border-left: 2px solid #ff0000; - } -.text p.run, .text p.run.hide_par { - background: #ddffdd; - border-left: 2px solid #00ff00; - } -.text p.exc { - background: #eeeeee; - border-left: 2px solid #808080; - } -.text p.par, .text p.par.hide_run { - background: #ffffaa; - border-left: 2px solid #eeee99; - } -.text p.hide_run, .text p.hide_exc, .text p.hide_mis, .text p.hide_par, -.text p.hide_run.hide_par { - background: inherit; - } - -.text span.annotate { - font-family: georgia; - color: #666; - float: right; - padding-right: .5em; - } -.text p.hide_par span.annotate { - display: none; - } -.text span.annotate.long { - display: none; - } -.text p:hover span.annotate.long { - display: block; - max-width: 50%; - white-space: normal; - float: right; - position: absolute; - top: 1.75em; - right: 1em; - width: 30em; - height: auto; - color: #333; - background: #ffffcc; - border: 1px solid #888; - padding: .25em .5em; - z-index: 999; - border-radius: .2em; - box-shadow: #cccccc .2em .2em .2em; - } - -/* Syntax coloring */ -.text .com { - color: green; - font-style: italic; - line-height: 1px; - } -.text .key { - font-weight: bold; - line-height: 1px; - } -.text .str { - color: #000080; - } - -/* index styles */ -#index td, #index th { - text-align: right; - width: 5em; - padding: .25em .5em; - border-bottom: 1px solid #eee; - } -#index th { - font-style: italic; - color: #333; - border-bottom: 1px solid #ccc; - cursor: pointer; - } -#index th:hover { - background: #eee; - border-bottom: 1px solid #999; - } -#index td.left, #index th.left { - padding-left: 0; - } -#index td.right, #index th.right { - padding-right: 0; - } -#index th.headerSortDown, #index th.headerSortUp { - border-bottom: 1px solid #000; - white-space: nowrap; - background: #eee; - } -#index th.headerSortDown:after { - content: " ↓"; -} -#index th.headerSortUp:after { - content: " ↑"; -} -#index td.name, #index th.name { - text-align: left; - width: auto; - } -#index td.name a { - text-decoration: none; - color: #000; - } -#index tr.total, -#index tr.total_dynamic { - } -#index tr.total td, -#index tr.total_dynamic td { - font-weight: bold; - border-top: 1px solid #ccc; - border-bottom: none; - } -#index tr.file:hover { - background: #eeeeee; - } -#index tr.file:hover td.name { - text-decoration: underline; - color: #000; - } - -/* scroll marker styles */ -#scroll_marker { - position: fixed; - right: 0; - top: 0; - width: 16px; - height: 100%; - background: white; - border-left: 1px solid #eee; - } - -#scroll_marker .marker { - background: #eedddd; - position: absolute; - min-height: 3px; - width: 100%; - } diff --git a/orm/services/region_manager/rms/external_mock/__init__.py b/orm/services/region_manager/rms/external_mock/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/region_manager/rms/external_mock/audit_client/__init__.py b/orm/services/region_manager/rms/external_mock/audit_client/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/region_manager/rms/external_mock/audit_client/api/__init__.py b/orm/services/region_manager/rms/external_mock/audit_client/api/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/region_manager/rms/external_mock/audit_client/api/audit.py b/orm/services/region_manager/rms/external_mock/audit_client/api/audit.py deleted file mode 100644 index ec483bdd..00000000 --- a/orm/services/region_manager/rms/external_mock/audit_client/api/audit.py +++ /dev/null @@ -1,6 +0,0 @@ -def audit(*args, **kwargs): - pass - - -def init(*args, **kwargs): - pass diff --git a/orm/services/region_manager/rms/external_mock/keystone_utils/__init__.py b/orm/services/region_manager/rms/external_mock/keystone_utils/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/region_manager/rms/external_mock/keystone_utils/tokens.py b/orm/services/region_manager/rms/external_mock/keystone_utils/tokens.py deleted file mode 100644 index 52ef992f..00000000 --- a/orm/services/region_manager/rms/external_mock/keystone_utils/tokens.py +++ /dev/null @@ -1,7 +0,0 @@ -def get_token_user(*a, **k): - pass - - -class TokenConf(object): - def __init__(self, *a, **kw): - pass diff --git a/orm/services/region_manager/rms/external_mock/orm_common/__init__.py b/orm/services/region_manager/rms/external_mock/orm_common/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/region_manager/rms/external_mock/orm_common/policy/__init__.py b/orm/services/region_manager/rms/external_mock/orm_common/policy/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/region_manager/rms/external_mock/orm_common/policy/policy.py b/orm/services/region_manager/rms/external_mock/orm_common/policy/policy.py deleted file mode 100644 index 2953f204..00000000 --- a/orm/services/region_manager/rms/external_mock/orm_common/policy/policy.py +++ /dev/null @@ -1,10 +0,0 @@ -def init(*a, **kw): - pass - - -def enforce(*a, **kw): - pass - - -def authorize(*a, **kw): - pass diff --git a/orm/services/region_manager/rms/external_mock/orm_common/utils/__init__.py b/orm/services/region_manager/rms/external_mock/orm_common/utils/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/region_manager/rms/external_mock/orm_common/utils/api_error_utils.py b/orm/services/region_manager/rms/external_mock/orm_common/utils/api_error_utils.py deleted file mode 100644 index 653221e2..00000000 --- a/orm/services/region_manager/rms/external_mock/orm_common/utils/api_error_utils.py +++ /dev/null @@ -1,2 +0,0 @@ -def get_error(*args, **kwargs): - pass diff --git a/orm/services/region_manager/rms/external_mock/orm_common/utils/utils.py b/orm/services/region_manager/rms/external_mock/orm_common/utils/utils.py deleted file mode 100755 index bf615fea..00000000 --- a/orm/services/region_manager/rms/external_mock/orm_common/utils/utils.py +++ /dev/null @@ -1,15 +0,0 @@ -"""Utils module mock.""" - - -def report_config(conf, dump=False): - """Mock report_config function.""" - pass - - -def set_utils_conf(conf): - """Mock set_utils_conf function.""" - pass - - -def audit_trail(*args, **kwargs): - pass diff --git a/orm/services/region_manager/rms_mock/MANIFEST.in b/orm/services/region_manager/rms_mock/MANIFEST.in deleted file mode 100644 index c922f11a..00000000 --- a/orm/services/region_manager/rms_mock/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -recursive-include public * diff --git a/orm/services/region_manager/rms_mock/__init__.py b/orm/services/region_manager/rms_mock/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/region_manager/rms_mock/config.py b/orm/services/region_manager/rms_mock/config.py deleted file mode 100644 index eef79b91..00000000 --- a/orm/services/region_manager/rms_mock/config.py +++ /dev/null @@ -1,56 +0,0 @@ -# Server Specific Configurations -server = { - 'port': '8082', - 'host': '0.0.0.0' -} - -# Pecan Application Configurations -app = { - 'root': 'rms_mock.controllers.root.RootController', - 'modules': ['rms_mock'], - 'static_root': '%(confdir)s/public', - 'template_path': '%(confdir)s/rms_mock/templates', - 'debug': True, - 'errors': { - 404: '/error/404', - '__force_dict__': True - } -} - -logging = { - 'root': {'level': 'INFO', 'handlers': ['console']}, - 'loggers': { - 'mock': {'level': 'DEBUG', 'handlers': ['console'], - 'propagate': False}, - 'pecan': {'level': 'DEBUG', 'handlers': ['console'], - 'propagate': False}, - 'py.warnings': {'handlers': ['console']}, - '__force_dict__': True - }, - 'handlers': { - 'console': { - 'level': 'DEBUG', - 'class': 'logging.StreamHandler', - 'formatter': 'color' - } - }, - 'formatters': { - 'simple': { - 'format': ('%(asctime)s %(levelname)-5.5s [%(name)s]' - '[%(threadName)s] %(message)s') - }, - 'color': { - '()': 'pecan.log.ColorFormatter', - 'format': ('%(asctime)s [%(padded_color_levelname)s] [%(name)s]' - '[%(threadName)s] %(message)s'), - '__force_dict__': True - } - } -} - -# Custom Configurations must be in Python dictionary format:: -# -# foo = {'bar':'baz'} -# -# All configurations are accessible at:: -# pecan.conf diff --git a/orm/services/region_manager/rms_mock/data/zones.json b/orm/services/region_manager/rms_mock/data/zones.json deleted file mode 100644 index fa83cdef..00000000 --- a/orm/services/region_manager/rms_mock/data/zones.json +++ /dev/null @@ -1,4002 +0,0 @@ -[ - { - "site": { - "location_type": "Kaka", - "id": 0 - }, - "zonePurpose": { - "name": "56d560c0fdf7f8f3d54e0975", - "id": 1809 - }, - "powerType": { - "name": "56d560c0beb6b59b6971e4af", - "id": 5591 - }, - "designType": { - "name": "56d560c0e888eae4b4addf00", - "id": 7554 - }, - "zoneType": { - "name": "56d560c0b8cc195e24fc71f1", - "id": 5290 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 65, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-09-21" - }, - "created": { - "date": "2015-07-17" - }, - "name": "56d560c0077bed9896419fed", - "id": 0 - }, - { - "site": { - "location_type": "Gerber", - "id": 1 - }, - "zonePurpose": { - "name": "56d560c00be07167daaca128", - "id": 9905 - }, - "powerType": { - "name": "56d560c0df982f8d8b9a31bc", - "id": 1502 - }, - "designType": { - "name": "56d560c0444b508f593e5212", - "id": 5758 - }, - "zoneType": { - "name": "56d560c0b34cab98f98d7810", - "id": 3283 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 87, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-07-13" - }, - "created": { - "date": "2014-12-31" - }, - "name": "56d560c0fb8c3a1e604ea38a", - "id": 1 - }, - { - "site": { - "location_type": "Darlington", - "id": 2 - }, - "zonePurpose": { - "name": "56d560c07c31e09908d572a2", - "id": 4989 - }, - "powerType": { - "name": "56d560c0bacb2d27d3478ecb", - "id": 7287 - }, - "designType": { - "name": "56d560c0671119915dd2bfa3", - "id": 8755 - }, - "zoneType": { - "name": "56d560c08b54a95277893bec", - "id": 44 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 31, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-07-28" - }, - "created": { - "date": "2015-01-02" - }, - "name": "56d560c0ad15ee6584ea7f6a", - "id": 2 - }, - { - "site": { - "location_type": "Grapeview", - "id": 3 - }, - "zonePurpose": { - "name": "56d560c0e9ee854d68341aeb", - "id": 1559 - }, - "powerType": { - "name": "56d560c07241c8733f4930cf", - "id": 2162 - }, - "designType": { - "name": "56d560c0f8faf5af9e3ebe31", - "id": 3085 - }, - "zoneType": { - "name": "56d560c077c836936e75abb2", - "id": 1721 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 52, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-07-27" - }, - "created": { - "date": "2015-06-01" - }, - "name": "56d560c0287fb8c701fc9e38", - "id": 3 - }, - { - "site": { - "location_type": "Harborton", - "id": 4 - }, - "zonePurpose": { - "name": "56d560c0208f030996c82344", - "id": 1738 - }, - "powerType": { - "name": "56d560c08c42f6f945f944f1", - "id": 9090 - }, - "designType": { - "name": "56d560c06b7def38de502709", - "id": 8537 - }, - "zoneType": { - "name": "56d560c079b0fc1cef6d2222", - "id": 5724 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 40, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-07-22" - }, - "created": { - "date": "2016-01-02" - }, - "name": "56d560c0b77f19e071949de8", - "id": 4 - }, - { - "site": { - "location_type": "Loma", - "id": 5 - }, - "zonePurpose": { - "name": "56d560c0ec3e2ac7b2c0f152", - "id": 8000 - }, - "powerType": { - "name": "56d560c0d0ec627f037015bb", - "id": 9791 - }, - "designType": { - "name": "56d560c0bd04e377a0dd0f2c", - "id": 2792 - }, - "zoneType": { - "name": "56d560c0f6d83b30489af6f5", - "id": 3254 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 69, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-09-10" - }, - "created": { - "date": "2015-06-28" - }, - "name": "56d560c0f1fa91683d500f95", - "id": 5 - }, - { - "site": { - "location_type": "Conestoga", - "id": 6 - }, - "zonePurpose": { - "name": "56d560c053d0ef55f8ea6d97", - "id": 9496 - }, - "powerType": { - "name": "56d560c079ffaf8bce92e04d", - "id": 3434 - }, - "designType": { - "name": "56d560c02416964249a44183", - "id": 3247 - }, - "zoneType": { - "name": "56d560c0186ca3357e09d971", - "id": 2673 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 64, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-11-06" - }, - "created": { - "date": "2015-04-07" - }, - "name": "56d560c0661fa2553b08bf58", - "id": 6 - }, - { - "site": { - "location_type": "Robbins", - "id": 7 - }, - "zonePurpose": { - "name": "56d560c02705578ca9d2a544", - "id": 3572 - }, - "powerType": { - "name": "56d560c08afb35dcb4059ea2", - "id": 4462 - }, - "designType": { - "name": "56d560c0d56b34acf3db716e", - "id": 8982 - }, - "zoneType": { - "name": "56d560c033901a4be0ac0f75", - "id": 3828 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 48, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-05-13" - }, - "created": { - "date": "2015-11-14" - }, - "name": "56d560c097454dbe336965d4", - "id": 7 - }, - { - "site": { - "location_type": "Levant", - "id": 8 - }, - "zonePurpose": { - "name": "56d560c036b795db4f296524", - "id": 8868 - }, - "powerType": { - "name": "56d560c0960ffb1caa91bc60", - "id": 6739 - }, - "designType": { - "name": "56d560c0e7171703cc080421", - "id": 6038 - }, - "zoneType": { - "name": "56d560c0daa037ee05426ba2", - "id": 5118 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 75, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-01-25" - }, - "created": { - "date": "2014-12-20" - }, - "name": "56d560c008fa52b023b29fc5", - "id": 8 - }, - { - "site": { - "location_type": "Ruckersville", - "id": 9 - }, - "zonePurpose": { - "name": "56d560c0b4c0c5f87861b820", - "id": 2198 - }, - "powerType": { - "name": "56d560c0dd9c2d8249119d7d", - "id": 6208 - }, - "designType": { - "name": "56d560c00ae96c94d4e5130c", - "id": 6494 - }, - "zoneType": { - "name": "56d560c04e9cd43ba9b82a99", - "id": 8232 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 60, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-05-20" - }, - "created": { - "date": "2014-09-12" - }, - "name": "56d560c0ef468199f4ce9fbe", - "id": 9 - }, - { - "site": { - "location_type": "Darbydale", - "id": 10 - }, - "zonePurpose": { - "name": "56d560c0568a1bc602c2a516", - "id": 4225 - }, - "powerType": { - "name": "56d560c016040e62ccfb0d91", - "id": 3783 - }, - "designType": { - "name": "56d560c0f3ba7341a17d8185", - "id": 2087 - }, - "zoneType": { - "name": "56d560c0d5b6fd0898c2e906", - "id": 836 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 12, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-12-22" - }, - "created": { - "date": "2014-10-21" - }, - "name": "56d560c03585ccd60db30317", - "id": 10 - }, - { - "site": { - "location_type": "Russellville", - "id": 11 - }, - "zonePurpose": { - "name": "56d560c07db2ad46c813de9a", - "id": 6894 - }, - "powerType": { - "name": "56d560c0a0caca1bcd68427e", - "id": 9151 - }, - "designType": { - "name": "56d560c00203072ed32a04de", - "id": 6937 - }, - "zoneType": { - "name": "56d560c0e70b8710fa947299", - "id": 2205 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 67, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-01-22" - }, - "created": { - "date": "2014-12-21" - }, - "name": "56d560c0e4749a49c3aa5c1a", - "id": 11 - }, - { - "site": { - "location_type": "Torboy", - "id": 12 - }, - "zonePurpose": { - "name": "56d560c0d2dfe463240d2aec", - "id": 6800 - }, - "powerType": { - "name": "56d560c0e9dfc4d729a79d88", - "id": 5345 - }, - "designType": { - "name": "56d560c0269658c50beef835", - "id": 2533 - }, - "zoneType": { - "name": "56d560c0cc3b33209a39b847", - "id": 6875 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 2, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-10-05" - }, - "created": { - "date": "2014-07-08" - }, - "name": "56d560c053960ab24ca0805e", - "id": 12 - }, - { - "site": { - "location_type": "Sunbury", - "id": 13 - }, - "zonePurpose": { - "name": "56d560c080bee9492ac82b1d", - "id": 4413 - }, - "powerType": { - "name": "56d560c02dc6868b70818fa2", - "id": 8623 - }, - "designType": { - "name": "56d560c07f9ccb7b84fad7bb", - "id": 2265 - }, - "zoneType": { - "name": "56d560c0ca5601d3f78203aa", - "id": 7699 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 71, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-08-15" - }, - "created": { - "date": "2014-10-25" - }, - "name": "56d560c03d488b2cc84a1dda", - "id": 13 - }, - { - "site": { - "location_type": "Lynn", - "id": 14 - }, - "zonePurpose": { - "name": "56d560c09a23c4ecd0ed752c", - "id": 9861 - }, - "powerType": { - "name": "56d560c00f300e4c7e8b1cd0", - "id": 8714 - }, - "designType": { - "name": "56d560c08aa0f77bd0795e90", - "id": 2862 - }, - "zoneType": { - "name": "56d560c0aad9980362e9a1b6", - "id": 6874 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 18, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-10-18" - }, - "created": { - "date": "2014-04-30" - }, - "name": "56d560c051688c89f3de807c", - "id": 14 - }, - { - "site": { - "location_type": "Nash", - "id": 15 - }, - "zonePurpose": { - "name": "56d560c0b7308257f2b028c0", - "id": 4799 - }, - "powerType": { - "name": "56d560c0d03dd4e556b6f928", - "id": 2694 - }, - "designType": { - "name": "56d560c05c8de483d88ba5a8", - "id": 73 - }, - "zoneType": { - "name": "56d560c07a4a13778f1e48ac", - "id": 8245 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 23, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-09-01" - }, - "created": { - "date": "2015-11-22" - }, - "name": "56d560c0a29e37498b71e70d", - "id": 15 - }, - { - "site": { - "location_type": "Cascades", - "id": 16 - }, - "zonePurpose": { - "name": "56d560c045a7ed95d8ad744b", - "id": 6161 - }, - "powerType": { - "name": "56d560c051cf90347cbad974", - "id": 6327 - }, - "designType": { - "name": "56d560c01f480e20a6cc9ad0", - "id": 6763 - }, - "zoneType": { - "name": "56d560c0b111b46a36a74504", - "id": 6658 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 99, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-05-05" - }, - "created": { - "date": "2016-02-09" - }, - "name": "56d560c057f556e9c3c1c6b6", - "id": 16 - }, - { - "site": { - "location_type": "Alamo", - "id": 17 - }, - "zonePurpose": { - "name": "56d560c0fe44e205be539cf3", - "id": 6946 - }, - "powerType": { - "name": "56d560c09cc6b3e45ff59c07", - "id": 4407 - }, - "designType": { - "name": "56d560c0a980159b631c9e5b", - "id": 3171 - }, - "zoneType": { - "name": "56d560c09d49a4761a48ffe3", - "id": 4357 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 99, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2016-02-01" - }, - "created": { - "date": "2014-07-31" - }, - "name": "56d560c00cf5a2760cf08e41", - "id": 17 - }, - { - "site": { - "location_type": "Frystown", - "id": 18 - }, - "zonePurpose": { - "name": "56d560c05952a93c02b6b576", - "id": 7733 - }, - "powerType": { - "name": "56d560c056fdce251c91a768", - "id": 7114 - }, - "designType": { - "name": "56d560c0ef82a3e2338ea7d0", - "id": 5849 - }, - "zoneType": { - "name": "56d560c0a65759eb60f29950", - "id": 8347 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 10, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-10-04" - }, - "created": { - "date": "2014-04-02" - }, - "name": "56d560c0241cde7ce6c58188", - "id": 18 - }, - { - "site": { - "location_type": "Brantleyville", - "id": 19 - }, - "zonePurpose": { - "name": "56d560c06a25d6dc604f01e0", - "id": 1082 - }, - "powerType": { - "name": "56d560c03d5d6ad44a79d1a1", - "id": 7015 - }, - "designType": { - "name": "56d560c0151053ff69026777", - "id": 3352 - }, - "zoneType": { - "name": "56d560c0fd123e68b408ed90", - "id": 6766 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 12, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-06-30" - }, - "created": { - "date": "2016-01-25" - }, - "name": "56d560c03c73665ebdc6056b", - "id": 19 - }, - { - "site": { - "location_type": "Cannondale", - "id": 20 - }, - "zonePurpose": { - "name": "56d560c09478dd6f647504dd", - "id": 1005 - }, - "powerType": { - "name": "56d560c0bc4043e8c6deb18a", - "id": 9489 - }, - "designType": { - "name": "56d560c04be3e637fa5c092f", - "id": 9217 - }, - "zoneType": { - "name": "56d560c0edcd5d451ffc6426", - "id": 4048 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 60, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-07-08" - }, - "created": { - "date": "2015-04-09" - }, - "name": "56d560c016415f96723501d1", - "id": 20 - }, - { - "site": { - "location_type": "Leyner", - "id": 21 - }, - "zonePurpose": { - "name": "56d560c04d8e23fd99da120b", - "id": 5456 - }, - "powerType": { - "name": "56d560c0df29852762a05de6", - "id": 7454 - }, - "designType": { - "name": "56d560c0758cd1219562ffb6", - "id": 4913 - }, - "zoneType": { - "name": "56d560c056dfdc9fc398dbed", - "id": 4009 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 59, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-07-02" - }, - "created": { - "date": "2014-10-01" - }, - "name": "56d560c0ce9b895539518fe3", - "id": 21 - }, - { - "site": { - "location_type": "Gorham", - "id": 22 - }, - "zonePurpose": { - "name": "56d560c0adebb96d11f6f791", - "id": 3097 - }, - "powerType": { - "name": "56d560c013eb6c1f0105810c", - "id": 8159 - }, - "designType": { - "name": "56d560c0c4863be25cc9dfa4", - "id": 1517 - }, - "zoneType": { - "name": "56d560c06b0ca411cb84a07e", - "id": 6974 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 92, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-10-08" - }, - "created": { - "date": "2015-07-08" - }, - "name": "56d560c0e24d04e0e61880dc", - "id": 22 - }, - { - "site": { - "location_type": "Fillmore", - "id": 23 - }, - "zonePurpose": { - "name": "56d560c066c130964a8f58d6", - "id": 5072 - }, - "powerType": { - "name": "56d560c0acf54c89ed29b3b2", - "id": 8943 - }, - "designType": { - "name": "56d560c0fb24b2f45d1dc3d9", - "id": 7884 - }, - "zoneType": { - "name": "56d560c054d47b34cb47f35d", - "id": 4668 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 5, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-07-15" - }, - "created": { - "date": "2014-10-26" - }, - "name": "56d560c0126cddd5f1a987bd", - "id": 23 - }, - { - "site": { - "location_type": "Greer", - "id": 24 - }, - "zonePurpose": { - "name": "56d560c05349527b410d1e7e", - "id": 3018 - }, - "powerType": { - "name": "56d560c0da936cb67de27921", - "id": 9559 - }, - "designType": { - "name": "56d560c0724f86e6a6a6afb2", - "id": 119 - }, - "zoneType": { - "name": "56d560c001633e4d0d567b48", - "id": 6613 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 18, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-10-30" - }, - "created": { - "date": "2014-04-26" - }, - "name": "56d560c0fc34077ac5f8babc", - "id": 24 - }, - { - "site": { - "location_type": "Bison", - "id": 25 - }, - "zonePurpose": { - "name": "56d560c0247024acf62455c3", - "id": 2622 - }, - "powerType": { - "name": "56d560c0ddb7f3280470d846", - "id": 7570 - }, - "designType": { - "name": "56d560c0c9ae1912a40456ce", - "id": 1433 - }, - "zoneType": { - "name": "56d560c0bce9c1f9c3b920f5", - "id": 2768 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 60, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2016-01-23" - }, - "created": { - "date": "2016-01-21" - }, - "name": "56d560c0c79b04a794c6c887", - "id": 25 - }, - { - "site": { - "location_type": "Smeltertown", - "id": 26 - }, - "zonePurpose": { - "name": "56d560c069b4a5fddb8d7d4c", - "id": 4235 - }, - "powerType": { - "name": "56d560c05a31f12df87e86b8", - "id": 422 - }, - "designType": { - "name": "56d560c022ef9593330519b0", - "id": 9307 - }, - "zoneType": { - "name": "56d560c0a8f766c6482cd548", - "id": 3376 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 33, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-03-01" - }, - "created": { - "date": "2015-12-03" - }, - "name": "56d560c033ae93c228322b30", - "id": 26 - }, - { - "site": { - "location_type": "Lodoga", - "id": 27 - }, - "zonePurpose": { - "name": "56d560c085d1df36b4cfc240", - "id": 3966 - }, - "powerType": { - "name": "56d560c0ae10ed5eaf5d4f1b", - "id": 6883 - }, - "designType": { - "name": "56d560c099ed12e73d38d06f", - "id": 5884 - }, - "zoneType": { - "name": "56d560c06cbb0fb0ed806eb4", - "id": 6026 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 98, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-04-29" - }, - "created": { - "date": "2015-04-16" - }, - "name": "56d560c029fddda29ae94099", - "id": 27 - }, - { - "site": { - "location_type": "Castleton", - "id": 28 - }, - "zonePurpose": { - "name": "56d560c005d5523efa88f11b", - "id": 9223 - }, - "powerType": { - "name": "56d560c066631aa8ec5c366e", - "id": 1442 - }, - "designType": { - "name": "56d560c00fc0fdad15c53ca2", - "id": 2050 - }, - "zoneType": { - "name": "56d560c024dd7d85839c6fba", - "id": 3735 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 39, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-02-19" - }, - "created": { - "date": "2015-11-16" - }, - "name": "56d560c0ce0e3a71cf4fd6bb", - "id": 28 - }, - { - "site": { - "location_type": "Tilleda", - "id": 29 - }, - "zonePurpose": { - "name": "56d560c020be752d13e4f0cd", - "id": 7834 - }, - "powerType": { - "name": "56d560c03cecf2671bb9ee2c", - "id": 3227 - }, - "designType": { - "name": "56d560c08837945128d96159", - "id": 1698 - }, - "zoneType": { - "name": "56d560c04fdf224ad8d0a998", - "id": 6490 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 79, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-03-02" - }, - "created": { - "date": "2015-04-14" - }, - "name": "56d560c0a78a2aea1e5df5b5", - "id": 29 - }, - { - "site": { - "location_type": "Valmy", - "id": 30 - }, - "zonePurpose": { - "name": "56d560c0b788c77b8c16e01c", - "id": 6296 - }, - "powerType": { - "name": "56d560c08ef889d6a7e215dd", - "id": 8792 - }, - "designType": { - "name": "56d560c041bb436f46172e7b", - "id": 9819 - }, - "zoneType": { - "name": "56d560c061fac9825e323af2", - "id": 465 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 53, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-03-09" - }, - "created": { - "date": "2014-09-16" - }, - "name": "56d560c03191b8f63969fd4e", - "id": 30 - }, - { - "site": { - "location_type": "Blue", - "id": 31 - }, - "zonePurpose": { - "name": "56d560c0b51a91dbdac3fc36", - "id": 1343 - }, - "powerType": { - "name": "56d560c046c5c6fa155f9ecf", - "id": 7517 - }, - "designType": { - "name": "56d560c06ef3ee967b7f5ccb", - "id": 8951 - }, - "zoneType": { - "name": "56d560c0286719c68089524b", - "id": 2042 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 87, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-11-16" - }, - "created": { - "date": "2014-02-26" - }, - "name": "56d560c03bb51163ed1e028e", - "id": 31 - }, - { - "site": { - "location_type": "Herlong", - "id": 32 - }, - "zonePurpose": { - "name": "56d560c0a69f976fe08f03af", - "id": 7471 - }, - "powerType": { - "name": "56d560c0aac0198e0745d8ba", - "id": 6107 - }, - "designType": { - "name": "56d560c0eed43fd9c0a94abb", - "id": 3396 - }, - "zoneType": { - "name": "56d560c01e08dd515acd4d45", - "id": 8826 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 34, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-10-16" - }, - "created": { - "date": "2014-05-11" - }, - "name": "56d560c049ca7f5030e09cb6", - "id": 32 - }, - { - "site": { - "location_type": "Rodanthe", - "id": 33 - }, - "zonePurpose": { - "name": "56d560c0c968144ed07e180a", - "id": 7716 - }, - "powerType": { - "name": "56d560c0e9c14ccda611a97b", - "id": 2584 - }, - "designType": { - "name": "56d560c090b97312fabcceba", - "id": 5558 - }, - "zoneType": { - "name": "56d560c01157ab8f0bb3e7cb", - "id": 5173 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 38, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-11-23" - }, - "created": { - "date": "2015-10-29" - }, - "name": "56d560c0326a70418fa07b91", - "id": 33 - }, - { - "site": { - "location_type": "Sanders", - "id": 34 - }, - "zonePurpose": { - "name": "56d560c01cea86b9060ac9bb", - "id": 3675 - }, - "powerType": { - "name": "56d560c082b8301ac84dc675", - "id": 5335 - }, - "designType": { - "name": "56d560c0d5f62bcd51abea28", - "id": 5121 - }, - "zoneType": { - "name": "56d560c066c5e191a879b52f", - "id": 2578 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 91, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-01-08" - }, - "created": { - "date": "2014-10-18" - }, - "name": "56d560c00f6e15f9503ea384", - "id": 34 - }, - { - "site": { - "location_type": "Calverton", - "id": 35 - }, - "zonePurpose": { - "name": "56d560c030cfa637f749326e", - "id": 5236 - }, - "powerType": { - "name": "56d560c05e23eb35e0b7432e", - "id": 5964 - }, - "designType": { - "name": "56d560c0df297a2eb168afcb", - "id": 5343 - }, - "zoneType": { - "name": "56d560c04cb3698141129144", - "id": 5191 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 27, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-12-15" - }, - "created": { - "date": "2014-01-09" - }, - "name": "56d560c0a2642bbad9f0180b", - "id": 35 - }, - { - "site": { - "location_type": "Rote", - "id": 36 - }, - "zonePurpose": { - "name": "56d560c08a8518cf01863a4d", - "id": 1290 - }, - "powerType": { - "name": "56d560c0832ecb1823e069a8", - "id": 1429 - }, - "designType": { - "name": "56d560c009191b5429961c39", - "id": 4446 - }, - "zoneType": { - "name": "56d560c05b4413606834951e", - "id": 3055 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 93, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-03-02" - }, - "created": { - "date": "2014-01-03" - }, - "name": "56d560c07ee2080ff4bcd900", - "id": 36 - }, - { - "site": { - "location_type": "Gloucester", - "id": 37 - }, - "zonePurpose": { - "name": "56d560c0100e69fbd25caecf", - "id": 934 - }, - "powerType": { - "name": "56d560c0b83644ed71029eb5", - "id": 7837 - }, - "designType": { - "name": "56d560c0b27c1d8d3ac70e4b", - "id": 1098 - }, - "zoneType": { - "name": "56d560c0620d33989ab375e2", - "id": 8544 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 22, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-07-09" - }, - "created": { - "date": "2015-12-17" - }, - "name": "56d560c071b95693ff3def45", - "id": 37 - }, - { - "site": { - "location_type": "Libertytown", - "id": 38 - }, - "zonePurpose": { - "name": "56d560c07d322c6dda1f0d61", - "id": 8516 - }, - "powerType": { - "name": "56d560c049c685a3f3a2bc3f", - "id": 7844 - }, - "designType": { - "name": "56d560c0f5fc4a8172d02db2", - "id": 2358 - }, - "zoneType": { - "name": "56d560c0bb27ffeb81c307b4", - "id": 1292 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 3, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-11-17" - }, - "created": { - "date": "2016-02-06" - }, - "name": "56d560c0397247302b0703bc", - "id": 38 - }, - { - "site": { - "location_type": "Madrid", - "id": 39 - }, - "zonePurpose": { - "name": "56d560c081d6850fca450f46", - "id": 9765 - }, - "powerType": { - "name": "56d560c082e495ba33e3ace3", - "id": 9109 - }, - "designType": { - "name": "56d560c00f831dfdd97f4aea", - "id": 1050 - }, - "zoneType": { - "name": "56d560c058b8cf043e0ddefc", - "id": 7071 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 3, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-05-07" - }, - "created": { - "date": "2016-01-16" - }, - "name": "56d560c065e33d4a7a97d6dc", - "id": 39 - }, - { - "site": { - "location_type": "Magnolia", - "id": 40 - }, - "zonePurpose": { - "name": "56d560c045ac9fed80740a73", - "id": 2020 - }, - "powerType": { - "name": "56d560c03c71f014cb6f41dd", - "id": 538 - }, - "designType": { - "name": "56d560c0dda73cacfaf7f70a", - "id": 3698 - }, - "zoneType": { - "name": "56d560c028d3df2a8a5a7097", - "id": 5185 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 42, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-05-30" - }, - "created": { - "date": "2014-10-07" - }, - "name": "56d560c079539139c836d585", - "id": 40 - }, - { - "site": { - "location_type": "Gilmore", - "id": 41 - }, - "zonePurpose": { - "name": "56d560c086d55b3215b897c1", - "id": 2761 - }, - "powerType": { - "name": "56d560c0af644b576afd4591", - "id": 9758 - }, - "designType": { - "name": "56d560c02e4e7a560f5b1c9e", - "id": 3327 - }, - "zoneType": { - "name": "56d560c01afef659bbd2a63e", - "id": 8009 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 15, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-05-05" - }, - "created": { - "date": "2015-06-09" - }, - "name": "56d560c052f661383788f819", - "id": 41 - }, - { - "site": { - "location_type": "Wheaton", - "id": 42 - }, - "zonePurpose": { - "name": "56d560c091897930e4a321ac", - "id": 7099 - }, - "powerType": { - "name": "56d560c0144e5a67a1c23005", - "id": 1417 - }, - "designType": { - "name": "56d560c0ec1399e14c3831c7", - "id": 7711 - }, - "zoneType": { - "name": "56d560c038f7cb1be99a077c", - "id": 8038 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 35, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-08-07" - }, - "created": { - "date": "2014-04-30" - }, - "name": "56d560c0107734f625b3c7e0", - "id": 42 - }, - { - "site": { - "location_type": "Delwood", - "id": 43 - }, - "zonePurpose": { - "name": "56d560c041eec1fca5437a00", - "id": 2300 - }, - "powerType": { - "name": "56d560c06285c6b65af88f7a", - "id": 6106 - }, - "designType": { - "name": "56d560c01ccd49801ba9cfbd", - "id": 7534 - }, - "zoneType": { - "name": "56d560c0626dafd003dc0ba1", - "id": 6481 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 41, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-08-12" - }, - "created": { - "date": "2015-12-28" - }, - "name": "56d560c00fd3ffc699a9a9f5", - "id": 43 - }, - { - "site": { - "location_type": "Chumuckla", - "id": 44 - }, - "zonePurpose": { - "name": "56d560c04b034f9b2f39a1a2", - "id": 7511 - }, - "powerType": { - "name": "56d560c00d6710729c93866d", - "id": 4002 - }, - "designType": { - "name": "56d560c00251b1d8f74040db", - "id": 1474 - }, - "zoneType": { - "name": "56d560c0d20f69bdb0f8e8ac", - "id": 5392 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 43, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-01-01" - }, - "created": { - "date": "2015-01-10" - }, - "name": "56d560c0f4a03df16f4d6081", - "id": 44 - }, - { - "site": { - "location_type": "Blanford", - "id": 45 - }, - "zonePurpose": { - "name": "56d560c07ebae1008545f665", - "id": 5638 - }, - "powerType": { - "name": "56d560c0f77e9bbc9460232e", - "id": 76 - }, - "designType": { - "name": "56d560c0497eb03d1071195c", - "id": 6700 - }, - "zoneType": { - "name": "56d560c066046abba79d8dcb", - "id": 2329 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 25, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-09-04" - }, - "created": { - "date": "2015-11-23" - }, - "name": "56d560c09b6527b949303ffb", - "id": 45 - }, - { - "site": { - "location_type": "Bascom", - "id": 46 - }, - "zonePurpose": { - "name": "56d560c0ee8d4ea5a1dd0243", - "id": 2815 - }, - "powerType": { - "name": "56d560c01adc0eeaceed92fe", - "id": 224 - }, - "designType": { - "name": "56d560c008e6c030928e09e4", - "id": 338 - }, - "zoneType": { - "name": "56d560c0aabadfa119131e0a", - "id": 6656 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 59, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-10-29" - }, - "created": { - "date": "2014-01-06" - }, - "name": "56d560c0289c2a2965c76497", - "id": 46 - }, - { - "site": { - "location_type": "Harold", - "id": 47 - }, - "zonePurpose": { - "name": "56d560c0731d5299d3122f2b", - "id": 4243 - }, - "powerType": { - "name": "56d560c00e9f70ce6b329a26", - "id": 2150 - }, - "designType": { - "name": "56d560c0a8f6e4445bdd6169", - "id": 7391 - }, - "zoneType": { - "name": "56d560c0bf5adf58ffffb14d", - "id": 2719 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 41, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-08-29" - }, - "created": { - "date": "2014-12-30" - }, - "name": "56d560c01f75f39e09e3c9f3", - "id": 47 - }, - { - "site": { - "location_type": "Roosevelt", - "id": 48 - }, - "zonePurpose": { - "name": "56d560c0988d063eb71729a7", - "id": 6667 - }, - "powerType": { - "name": "56d560c0ad31768ea1ddca09", - "id": 6991 - }, - "designType": { - "name": "56d560c0c28c4c6758652c3c", - "id": 5256 - }, - "zoneType": { - "name": "56d560c01bebe9061aa47d00", - "id": 6970 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 57, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2016-01-29" - }, - "created": { - "date": "2015-09-30" - }, - "name": "56d560c0d1b8adfa554b6423", - "id": 48 - }, - { - "site": { - "location_type": "Leland", - "id": 49 - }, - "zonePurpose": { - "name": "56d560c00423da2f23b6dcb1", - "id": 8098 - }, - "powerType": { - "name": "56d560c01792c147706146cd", - "id": 8653 - }, - "designType": { - "name": "56d560c0c789b9e3a0770593", - "id": 2149 - }, - "zoneType": { - "name": "56d560c0b5f828802b16e82a", - "id": 7818 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 98, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-07-06" - }, - "created": { - "date": "2014-12-30" - }, - "name": "56d560c01eef9e6dff0eeb5d", - "id": 49 - }, - { - "site": { - "location_type": "Jardine", - "id": 50 - }, - "zonePurpose": { - "name": "56d560c0cb9345d9d38fede8", - "id": 2308 - }, - "powerType": { - "name": "56d560c0e9fd1b050d95ae66", - "id": 3012 - }, - "designType": { - "name": "56d560c02d1e2244a85d7baf", - "id": 9549 - }, - "zoneType": { - "name": "56d560c09f247522857fc0f6", - "id": 6134 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 48, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-10-10" - }, - "created": { - "date": "2014-11-25" - }, - "name": "56d560c09f8a40e4324a4280", - "id": 50 - }, - { - "site": { - "location_type": "Trona", - "id": 51 - }, - "zonePurpose": { - "name": "56d560c0d7077ede587d4592", - "id": 3824 - }, - "powerType": { - "name": "56d560c058dd0e17896b96a9", - "id": 5409 - }, - "designType": { - "name": "56d560c0f36bfb970b33ffe6", - "id": 7274 - }, - "zoneType": { - "name": "56d560c0a4860ed240407db0", - "id": 4302 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 15, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-05-30" - }, - "created": { - "date": "2014-02-18" - }, - "name": "56d560c06d460d876cb74409", - "id": 51 - }, - { - "site": { - "location_type": "Whitestone", - "id": 52 - }, - "zonePurpose": { - "name": "56d560c0006314920e70e82c", - "id": 7292 - }, - "powerType": { - "name": "56d560c0ebee34abaaa4204d", - "id": 3853 - }, - "designType": { - "name": "56d560c038c35079789da1de", - "id": 5965 - }, - "zoneType": { - "name": "56d560c0013d9ded4cfbc59f", - "id": 8513 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 99, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-10-05" - }, - "created": { - "date": "2015-01-02" - }, - "name": "56d560c0f5386dfbbfd4039b", - "id": 52 - }, - { - "site": { - "location_type": "Lupton", - "id": 53 - }, - "zonePurpose": { - "name": "56d560c0410f97fbd39bb188", - "id": 6797 - }, - "powerType": { - "name": "56d560c06eafb4db025f1106", - "id": 2265 - }, - "designType": { - "name": "56d560c0a16a7371f3b818d5", - "id": 8569 - }, - "zoneType": { - "name": "56d560c08f19993f2e6e26a0", - "id": 1021 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 14, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-06-19" - }, - "created": { - "date": "2014-04-06" - }, - "name": "56d560c080ca44dd12438645", - "id": 53 - }, - { - "site": { - "location_type": "Rivera", - "id": 54 - }, - "zonePurpose": { - "name": "56d560c0832400a19d27c71a", - "id": 2428 - }, - "powerType": { - "name": "56d560c01caf295194dab3db", - "id": 3595 - }, - "designType": { - "name": "56d560c0d81865e32cfd5015", - "id": 1995 - }, - "zoneType": { - "name": "56d560c034c0c62dec180146", - "id": 1222 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 91, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-04-04" - }, - "created": { - "date": "2014-03-02" - }, - "name": "56d560c008b9be11f9ea2af3", - "id": 54 - }, - { - "site": { - "location_type": "Bayview", - "id": 55 - }, - "zonePurpose": { - "name": "56d560c0b8c00af24a57e1dc", - "id": 9190 - }, - "powerType": { - "name": "56d560c02d84a656157756c1", - "id": 2364 - }, - "designType": { - "name": "56d560c039f53fe3347386e2", - "id": 7347 - }, - "zoneType": { - "name": "56d560c00238f9a29b650121", - "id": 6711 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 67, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-03-30" - }, - "created": { - "date": "2016-02-02" - }, - "name": "56d560c08ae02ad02c962e6d", - "id": 55 - }, - { - "site": { - "location_type": "Craig", - "id": 56 - }, - "zonePurpose": { - "name": "56d560c0cdbd720e7d620f14", - "id": 5433 - }, - "powerType": { - "name": "56d560c0013a4ee2d8618fce", - "id": 1942 - }, - "designType": { - "name": "56d560c09e1a56046e1f8ba9", - "id": 6283 - }, - "zoneType": { - "name": "56d560c0e92d4b5c624e36d9", - "id": 1646 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 0, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-10-11" - }, - "created": { - "date": "2014-06-20" - }, - "name": "56d560c0d6ca45a9f0125296", - "id": 56 - }, - { - "site": { - "location_type": "Titanic", - "id": 57 - }, - "zonePurpose": { - "name": "56d560c0fbb05edc14762095", - "id": 5966 - }, - "powerType": { - "name": "56d560c0f60aa44c28712cbc", - "id": 456 - }, - "designType": { - "name": "56d560c0e160905a6e575615", - "id": 8400 - }, - "zoneType": { - "name": "56d560c08023b61f49493343", - "id": 6948 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 14, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-11-23" - }, - "created": { - "date": "2015-11-08" - }, - "name": "56d560c0761fab2939b9ed3d", - "id": 57 - }, - { - "site": { - "location_type": "Rockingham", - "id": 58 - }, - "zonePurpose": { - "name": "56d560c0f5b34a73b9cf891f", - "id": 8830 - }, - "powerType": { - "name": "56d560c012bec7571a69a7fc", - "id": 4413 - }, - "designType": { - "name": "56d560c091c8a6795879c234", - "id": 112 - }, - "zoneType": { - "name": "56d560c00f1fcc2699896dfd", - "id": 5779 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 93, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-01-24" - }, - "created": { - "date": "2015-03-25" - }, - "name": "56d560c05cbfa15ec7bfb3e4", - "id": 58 - }, - { - "site": { - "location_type": "Tuttle", - "id": 59 - }, - "zonePurpose": { - "name": "56d560c04169d60c304d1284", - "id": 6779 - }, - "powerType": { - "name": "56d560c05b5e6657f4622c48", - "id": 5927 - }, - "designType": { - "name": "56d560c031f9a0a8860e410c", - "id": 3470 - }, - "zoneType": { - "name": "56d560c0286d2374c3247255", - "id": 596 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 39, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-01-09" - }, - "created": { - "date": "2014-04-30" - }, - "name": "56d560c07121f35302543176", - "id": 59 - }, - { - "site": { - "location_type": "Katonah", - "id": 60 - }, - "zonePurpose": { - "name": "56d560c0d542bd664b5d93c3", - "id": 8153 - }, - "powerType": { - "name": "56d560c06e0536e61c9a0e98", - "id": 203 - }, - "designType": { - "name": "56d560c01c26486c1398d7cc", - "id": 7477 - }, - "zoneType": { - "name": "56d560c016519009f54f8df1", - "id": 9112 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 29, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-11-04" - }, - "created": { - "date": "2014-08-26" - }, - "name": "56d560c08e6f1b72a957cdf2", - "id": 60 - }, - { - "site": { - "location_type": "Unionville", - "id": 61 - }, - "zonePurpose": { - "name": "56d560c06cde4ee178611ed4", - "id": 6050 - }, - "powerType": { - "name": "56d560c054fd0bd4b212be14", - "id": 8759 - }, - "designType": { - "name": "56d560c0095871981b7901a8", - "id": 226 - }, - "zoneType": { - "name": "56d560c05dd527ac1fd78c0a", - "id": 8845 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 97, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-02-10" - }, - "created": { - "date": "2014-11-23" - }, - "name": "56d560c0ed72fec6e592add2", - "id": 61 - }, - { - "site": { - "location_type": "Coalmont", - "id": 62 - }, - "zonePurpose": { - "name": "56d560c090418fd4da3d2aab", - "id": 3669 - }, - "powerType": { - "name": "56d560c059f6dc824d76c767", - "id": 3525 - }, - "designType": { - "name": "56d560c0ffce94eea11ba508", - "id": 3046 - }, - "zoneType": { - "name": "56d560c093df5084d7f0ad5f", - "id": 834 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 51, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-06-04" - }, - "created": { - "date": "2015-06-21" - }, - "name": "56d560c092d30a559b40ba2d", - "id": 62 - }, - { - "site": { - "location_type": "Irwin", - "id": 63 - }, - "zonePurpose": { - "name": "56d560c087b64651dbcb1361", - "id": 3262 - }, - "powerType": { - "name": "56d560c000579241be30407c", - "id": 1335 - }, - "designType": { - "name": "56d560c062da2f0bbde27b37", - "id": 5320 - }, - "zoneType": { - "name": "56d560c0822dee52cba698ba", - "id": 417 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 61, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-11-02" - }, - "created": { - "date": "2014-02-02" - }, - "name": "56d560c03acc16df6b47dcc6", - "id": 63 - }, - { - "site": { - "location_type": "Crenshaw", - "id": 64 - }, - "zonePurpose": { - "name": "56d560c0bf1e2852cd4925c1", - "id": 5006 - }, - "powerType": { - "name": "56d560c0a93b6643c073b480", - "id": 6467 - }, - "designType": { - "name": "56d560c04787261cb236edd2", - "id": 3597 - }, - "zoneType": { - "name": "56d560c0c4c83a2bbb12763b", - "id": 3791 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 93, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-05-05" - }, - "created": { - "date": "2015-12-19" - }, - "name": "56d560c0c5ecc5e808265326", - "id": 64 - }, - { - "site": { - "location_type": "Belva", - "id": 65 - }, - "zonePurpose": { - "name": "56d560c0e9196a00a007e857", - "id": 4471 - }, - "powerType": { - "name": "56d560c09c9727544cfe1ee1", - "id": 4969 - }, - "designType": { - "name": "56d560c0127968d2b6a5a977", - "id": 6874 - }, - "zoneType": { - "name": "56d560c027fe345cf5530f2d", - "id": 1997 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 21, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-06-06" - }, - "created": { - "date": "2015-07-14" - }, - "name": "56d560c05b9c5abca8adebd6", - "id": 65 - }, - { - "site": { - "location_type": "Rockbridge", - "id": 66 - }, - "zonePurpose": { - "name": "56d560c157dad375db38b27e", - "id": 9853 - }, - "powerType": { - "name": "56d560c1e3ffb1af13368243", - "id": 9357 - }, - "designType": { - "name": "56d560c19a814a81cf725bae", - "id": 5757 - }, - "zoneType": { - "name": "56d560c1b56f90ed745f3c22", - "id": 8718 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 59, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-12-18" - }, - "created": { - "date": "2015-08-08" - }, - "name": "56d560c1c982f7aa14aaa418", - "id": 66 - }, - { - "site": { - "location_type": "Oley", - "id": 67 - }, - "zonePurpose": { - "name": "56d560c135814cd334320d3b", - "id": 207 - }, - "powerType": { - "name": "56d560c1398ccee865c3baaa", - "id": 9699 - }, - "designType": { - "name": "56d560c1e88dba86fec92df9", - "id": 5170 - }, - "zoneType": { - "name": "56d560c1c356cadfad0425c2", - "id": 7402 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 43, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-05-07" - }, - "created": { - "date": "2014-11-27" - }, - "name": "56d560c1f1ac9edd50fae484", - "id": 67 - }, - { - "site": { - "location_type": "Leeper", - "id": 68 - }, - "zonePurpose": { - "name": "56d560c166cd1db8dbacf7f0", - "id": 2697 - }, - "powerType": { - "name": "56d560c1aa5754dede90ff32", - "id": 7930 - }, - "designType": { - "name": "56d560c171b5a8f8c67fef7c", - "id": 2335 - }, - "zoneType": { - "name": "56d560c184e8a7b907e7673f", - "id": 3897 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 100, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-07-24" - }, - "created": { - "date": "2015-08-23" - }, - "name": "56d560c18b9b3aa0288cb26f", - "id": 68 - }, - { - "site": { - "location_type": "Detroit", - "id": 69 - }, - "zonePurpose": { - "name": "56d560c1994ce1159c0625b3", - "id": 2652 - }, - "powerType": { - "name": "56d560c17edf282edb081071", - "id": 2448 - }, - "designType": { - "name": "56d560c1b44f04bb41dd6dd2", - "id": 5040 - }, - "zoneType": { - "name": "56d560c1c61abf60958d1db0", - "id": 3496 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 44, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-07-04" - }, - "created": { - "date": "2015-10-19" - }, - "name": "56d560c138231bc7f6844803", - "id": 69 - }, - { - "site": { - "location_type": "Leroy", - "id": 70 - }, - "zonePurpose": { - "name": "56d560c172ced1c936869d12", - "id": 7284 - }, - "powerType": { - "name": "56d560c1650048a5d48e8dd7", - "id": 1132 - }, - "designType": { - "name": "56d560c19699f4ef4c6a4cfb", - "id": 1519 - }, - "zoneType": { - "name": "56d560c1e8d5b714d5893558", - "id": 4905 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 83, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-05-08" - }, - "created": { - "date": "2015-02-21" - }, - "name": "56d560c17cbc1d569ecdd225", - "id": 70 - }, - { - "site": { - "location_type": "Dupuyer", - "id": 71 - }, - "zonePurpose": { - "name": "56d560c13eb8af5955ed91a8", - "id": 4368 - }, - "powerType": { - "name": "56d560c128e5d7459fa1367e", - "id": 7564 - }, - "designType": { - "name": "56d560c1e4ba9e890872dc62", - "id": 3930 - }, - "zoneType": { - "name": "56d560c133179db7652a5e34", - "id": 6196 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 91, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-07-30" - }, - "created": { - "date": "2015-06-10" - }, - "name": "56d560c165534d12641f1d15", - "id": 71 - }, - { - "site": { - "location_type": "Caspar", - "id": 72 - }, - "zonePurpose": { - "name": "56d560c17fdf00d790acb5af", - "id": 8494 - }, - "powerType": { - "name": "56d560c12be5b3910451809b", - "id": 5521 - }, - "designType": { - "name": "56d560c1563801541feae38a", - "id": 6 - }, - "zoneType": { - "name": "56d560c10d702c675c6b1fe9", - "id": 9217 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 66, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-12-10" - }, - "created": { - "date": "2014-03-28" - }, - "name": "56d560c1cc08dc1c0e26b4b6", - "id": 72 - }, - { - "site": { - "location_type": "Drytown", - "id": 73 - }, - "zonePurpose": { - "name": "56d560c1dae28a1b5ae267ec", - "id": 2477 - }, - "powerType": { - "name": "56d560c1dfc10bf928b9c9f3", - "id": 3228 - }, - "designType": { - "name": "56d560c1287c90f1ccd20fb0", - "id": 9864 - }, - "zoneType": { - "name": "56d560c1a6eae1d900584625", - "id": 1583 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 81, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-05-29" - }, - "created": { - "date": "2015-04-09" - }, - "name": "56d560c1492afbc7c1427d77", - "id": 73 - }, - { - "site": { - "location_type": "Durham", - "id": 74 - }, - "zonePurpose": { - "name": "56d560c1ef65302934f5e6dc", - "id": 3898 - }, - "powerType": { - "name": "56d560c12b636879fc9ac848", - "id": 3383 - }, - "designType": { - "name": "56d560c1db8604849fee5fd4", - "id": 8929 - }, - "zoneType": { - "name": "56d560c13cdc8e1a01de7d8d", - "id": 877 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 65, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-12-15" - }, - "created": { - "date": "2015-07-10" - }, - "name": "56d560c1fa90866d656a6004", - "id": 74 - }, - { - "site": { - "location_type": "Jenkinsville", - "id": 75 - }, - "zonePurpose": { - "name": "56d560c1603c6b2be9de5e4d", - "id": 4698 - }, - "powerType": { - "name": "56d560c1fa18a8c0d656a422", - "id": 9998 - }, - "designType": { - "name": "56d560c12d9f261309cddf96", - "id": 8088 - }, - "zoneType": { - "name": "56d560c137336e7289f9fd36", - "id": 6565 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 48, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-09-18" - }, - "created": { - "date": "2015-12-12" - }, - "name": "56d560c1c3a8051dea22d46d", - "id": 75 - }, - { - "site": { - "location_type": "Gasquet", - "id": 76 - }, - "zonePurpose": { - "name": "56d560c13c9816037480ffe4", - "id": 7599 - }, - "powerType": { - "name": "56d560c1a6cad875a215ad89", - "id": 5056 - }, - "designType": { - "name": "56d560c1d6abc9b84a8cb846", - "id": 319 - }, - "zoneType": { - "name": "56d560c1e6d4b25b58eab937", - "id": 3990 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 66, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-12-20" - }, - "created": { - "date": "2015-08-01" - }, - "name": "56d560c1e4d63f2f6af4200f", - "id": 76 - }, - { - "site": { - "location_type": "Dowling", - "id": 77 - }, - "zonePurpose": { - "name": "56d560c1d0a538762b59e02f", - "id": 1615 - }, - "powerType": { - "name": "56d560c16ea1f0b739a39d2c", - "id": 4555 - }, - "designType": { - "name": "56d560c1f794ff62afd4274b", - "id": 9755 - }, - "zoneType": { - "name": "56d560c19345cad1efcafa14", - "id": 4699 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 59, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-04-30" - }, - "created": { - "date": "2014-07-23" - }, - "name": "56d560c1f6a875453d430369", - "id": 77 - }, - { - "site": { - "location_type": "Balm", - "id": 78 - }, - "zonePurpose": { - "name": "56d560c10227da3e57ebce4a", - "id": 6345 - }, - "powerType": { - "name": "56d560c10a3341aaf5466396", - "id": 6294 - }, - "designType": { - "name": "56d560c1e4e14c514a6abe2b", - "id": 212 - }, - "zoneType": { - "name": "56d560c15249489062d07d7a", - "id": 2414 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 19, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-06-05" - }, - "created": { - "date": "2015-11-30" - }, - "name": "56d560c1a58b9572c1ce12f1", - "id": 78 - }, - { - "site": { - "location_type": "Macdona", - "id": 79 - }, - "zonePurpose": { - "name": "56d560c17e4def1d50cc9d9e", - "id": 1376 - }, - "powerType": { - "name": "56d560c14a89ad37ec57d535", - "id": 8573 - }, - "designType": { - "name": "56d560c1d55c3d19bb9166db", - "id": 3172 - }, - "zoneType": { - "name": "56d560c16739ffe0dfee5149", - "id": 408 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 46, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-11-28" - }, - "created": { - "date": "2014-12-05" - }, - "name": "56d560c19de149e3bd30c972", - "id": 79 - }, - { - "site": { - "location_type": "Wattsville", - "id": 80 - }, - "zonePurpose": { - "name": "56d560c119fc710821e3f495", - "id": 2092 - }, - "powerType": { - "name": "56d560c189b822790b799165", - "id": 7339 - }, - "designType": { - "name": "56d560c164b56c4099dbff29", - "id": 4075 - }, - "zoneType": { - "name": "56d560c13bde6d70c6da0d1d", - "id": 1304 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 19, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-10-26" - }, - "created": { - "date": "2014-12-03" - }, - "name": "56d560c1b86d7ce12797f618", - "id": 80 - }, - { - "site": { - "location_type": "Buxton", - "id": 81 - }, - "zonePurpose": { - "name": "56d560c1f69903bc85c090e8", - "id": 7934 - }, - "powerType": { - "name": "56d560c1cae0dd4d94754853", - "id": 2180 - }, - "designType": { - "name": "56d560c11ba0e8fa84f55d1a", - "id": 8607 - }, - "zoneType": { - "name": "56d560c14ae48add0172593b", - "id": 1304 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 94, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-09-07" - }, - "created": { - "date": "2015-11-21" - }, - "name": "56d560c18e1c0dd8719b9401", - "id": 81 - }, - { - "site": { - "location_type": "Conway", - "id": 82 - }, - "zonePurpose": { - "name": "56d560c1d840cf24e9296df0", - "id": 6151 - }, - "powerType": { - "name": "56d560c188074d3dec302d02", - "id": 482 - }, - "designType": { - "name": "56d560c17b60a2e9c54b8608", - "id": 5809 - }, - "zoneType": { - "name": "56d560c12365e48fcf1694d6", - "id": 4354 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 98, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-11-05" - }, - "created": { - "date": "2014-12-07" - }, - "name": "56d560c1dd5675ae340efb8b", - "id": 82 - }, - { - "site": { - "location_type": "Jackpot", - "id": 83 - }, - "zonePurpose": { - "name": "56d560c11f00e6c29f78b357", - "id": 1744 - }, - "powerType": { - "name": "56d560c18df238018caa26ca", - "id": 5287 - }, - "designType": { - "name": "56d560c1b35bc61d3201bb7c", - "id": 8121 - }, - "zoneType": { - "name": "56d560c1edf03c238d559997", - "id": 1720 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 59, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-06-29" - }, - "created": { - "date": "2015-05-19" - }, - "name": "56d560c1d4b55352966eed84", - "id": 83 - }, - { - "site": { - "location_type": "Flintville", - "id": 84 - }, - "zonePurpose": { - "name": "56d560c1d428f161c6454acd", - "id": 2440 - }, - "powerType": { - "name": "56d560c1cd181d518199ce04", - "id": 8665 - }, - "designType": { - "name": "56d560c12bfc2ac757eb098b", - "id": 9819 - }, - "zoneType": { - "name": "56d560c12bcb1d075747ddc0", - "id": 2338 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 41, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-07-27" - }, - "created": { - "date": "2015-01-08" - }, - "name": "56d560c12fe463b676b7e647", - "id": 84 - }, - { - "site": { - "location_type": "Deercroft", - "id": 85 - }, - "zonePurpose": { - "name": "56d560c1fa9c119a979058ff", - "id": 8 - }, - "powerType": { - "name": "56d560c1ba9d11096c5769e6", - "id": 1345 - }, - "designType": { - "name": "56d560c1ab418371a415b8ba", - "id": 4950 - }, - "zoneType": { - "name": "56d560c1d5bed9c9f15e9efe", - "id": 9636 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 23, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-11-15" - }, - "created": { - "date": "2014-04-08" - }, - "name": "56d560c127f1c4d3708558f9", - "id": 85 - }, - { - "site": { - "location_type": "Cawood", - "id": 86 - }, - "zonePurpose": { - "name": "56d560c159b143aab9ef1e99", - "id": 4495 - }, - "powerType": { - "name": "56d560c1e7537e1bbf7d5648", - "id": 2554 - }, - "designType": { - "name": "56d560c1197293b7d414d3bb", - "id": 939 - }, - "zoneType": { - "name": "56d560c194d5d0d6e8dcf3ee", - "id": 974 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 52, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-09-15" - }, - "created": { - "date": "2015-08-11" - }, - "name": "56d560c12fb4759369c8f96d", - "id": 86 - }, - { - "site": { - "location_type": "Inkerman", - "id": 87 - }, - "zonePurpose": { - "name": "56d560c112d9498c1d3fcaa8", - "id": 1548 - }, - "powerType": { - "name": "56d560c1e0104f5e9d4f8d8a", - "id": 3361 - }, - "designType": { - "name": "56d560c133df234e47d6dca1", - "id": 8099 - }, - "zoneType": { - "name": "56d560c11c718ac4304c0502", - "id": 7261 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 92, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-09-05" - }, - "created": { - "date": "2015-03-18" - }, - "name": "56d560c1f71f5112ae54405d", - "id": 87 - }, - { - "site": { - "location_type": "Blodgett", - "id": 88 - }, - "zonePurpose": { - "name": "56d560c1150f38e8dc7a4334", - "id": 3995 - }, - "powerType": { - "name": "56d560c1d491b5fdda008ea3", - "id": 4677 - }, - "designType": { - "name": "56d560c179a359491ca8dd08", - "id": 9489 - }, - "zoneType": { - "name": "56d560c17c50b926dec1b1f5", - "id": 7173 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 4, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-04-25" - }, - "created": { - "date": "2014-06-07" - }, - "name": "56d560c1f39bec5d9efdbe06", - "id": 88 - }, - { - "site": { - "location_type": "Fidelis", - "id": 89 - }, - "zonePurpose": { - "name": "56d560c17535831df443ec51", - "id": 5998 - }, - "powerType": { - "name": "56d560c16f0040a27ea2506c", - "id": 2008 - }, - "designType": { - "name": "56d560c1ed6495cbebbe7930", - "id": 3526 - }, - "zoneType": { - "name": "56d560c1ead71c6d1e5b2174", - "id": 9417 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 15, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-01-31" - }, - "created": { - "date": "2016-01-14" - }, - "name": "56d560c1b9e56f19abd6d0bd", - "id": 89 - }, - { - "site": { - "location_type": "Hobucken", - "id": 90 - }, - "zonePurpose": { - "name": "56d560c15f5447d4be24a4a2", - "id": 1225 - }, - "powerType": { - "name": "56d560c16fd746187141fa5a", - "id": 7639 - }, - "designType": { - "name": "56d560c16162bc7f1465c827", - "id": 8999 - }, - "zoneType": { - "name": "56d560c1a75b14bd612a54c0", - "id": 446 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 30, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-03-13" - }, - "created": { - "date": "2015-09-15" - }, - "name": "56d560c111d62a18cd25e389", - "id": 90 - }, - { - "site": { - "location_type": "Coinjock", - "id": 91 - }, - "zonePurpose": { - "name": "56d560c137d70331834fa47c", - "id": 3158 - }, - "powerType": { - "name": "56d560c1eb63a51e75f1ef33", - "id": 8092 - }, - "designType": { - "name": "56d560c18f68172f95bb0412", - "id": 7822 - }, - "zoneType": { - "name": "56d560c1ec7e2d44ff7c8e48", - "id": 8128 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 57, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-09-03" - }, - "created": { - "date": "2014-01-01" - }, - "name": "56d560c13685873e32faf2fe", - "id": 91 - }, - { - "site": { - "location_type": "Ballico", - "id": 92 - }, - "zonePurpose": { - "name": "56d560c14d131b8fd1afd72c", - "id": 157 - }, - "powerType": { - "name": "56d560c1d8d3a94f20d11c97", - "id": 533 - }, - "designType": { - "name": "56d560c194c02371bb234868", - "id": 8345 - }, - "zoneType": { - "name": "56d560c1dc9ebbde0c28355a", - "id": 1564 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 23, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-06-30" - }, - "created": { - "date": "2014-09-07" - }, - "name": "56d560c107c932a3e08e44d9", - "id": 92 - }, - { - "site": { - "location_type": "Columbus", - "id": 93 - }, - "zonePurpose": { - "name": "56d560c11871178266078ed7", - "id": 8963 - }, - "powerType": { - "name": "56d560c11d43eb1b8d44e390", - "id": 1006 - }, - "designType": { - "name": "56d560c144ef61f5dc7c709f", - "id": 4945 - }, - "zoneType": { - "name": "56d560c1d2f6ce761b4328c5", - "id": 9895 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 99, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2015-03-05" - }, - "created": { - "date": "2015-07-19" - }, - "name": "56d560c1c37f519b199b12eb", - "id": 93 - }, - { - "site": { - "location_type": "Kirk", - "id": 94 - }, - "zonePurpose": { - "name": "56d560c1c71242e1f36e3b59", - "id": 6990 - }, - "powerType": { - "name": "56d560c14c3c992705e5fe68", - "id": 3348 - }, - "designType": { - "name": "56d560c175fcda9b3798923d", - "id": 3914 - }, - "zoneType": { - "name": "56d560c1c7be25f9c7150eed", - "id": 7459 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 79, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-08-15" - }, - "created": { - "date": "2015-09-26" - }, - "name": "56d560c13978259efa633fa5", - "id": 94 - }, - { - "site": { - "location_type": "Logan", - "id": 95 - }, - "zonePurpose": { - "name": "56d560c1254dae383a8dd86e", - "id": 3477 - }, - "powerType": { - "name": "56d560c12604efdfa865d9b1", - "id": 560 - }, - "designType": { - "name": "56d560c14c3615bcc6554586", - "id": 2663 - }, - "zoneType": { - "name": "56d560c11154f37c39cca7d4", - "id": 472 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 98, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-06-22" - }, - "created": { - "date": "2014-07-05" - }, - "name": "56d560c123c59b5e54271039", - "id": 95 - }, - { - "site": { - "location_type": "Vaughn", - "id": 96 - }, - "zonePurpose": { - "name": "56d560c16e6e5741fed83023", - "id": 1079 - }, - "powerType": { - "name": "56d560c1553a5d9fc6f9a1c3", - "id": 6041 - }, - "designType": { - "name": "56d560c1ade2d650edac5b3a", - "id": 9487 - }, - "zoneType": { - "name": "56d560c18607f77902613a1e", - "id": 9476 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 15, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-08-01" - }, - "created": { - "date": "2014-08-03" - }, - "name": "56d560c128bc0e550ee7cd9d", - "id": 96 - }, - { - "site": { - "location_type": "Hasty", - "id": 97 - }, - "zonePurpose": { - "name": "56d560c17ca2c51bca21b5ed", - "id": 7746 - }, - "powerType": { - "name": "56d560c1de7e5f37d960863f", - "id": 7781 - }, - "designType": { - "name": "56d560c1b35c5951047223bc", - "id": 2835 - }, - "zoneType": { - "name": "56d560c1110f2de2aec1cdc7", - "id": 1459 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 85, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-09-27" - }, - "created": { - "date": "2014-06-16" - }, - "name": "56d560c1428d7cc61a8ad82b", - "id": 97 - }, - { - "site": { - "location_type": "Worton", - "id": 98 - }, - "zonePurpose": { - "name": "56d560c15aa7e8436d56c023", - "id": 7942 - }, - "powerType": { - "name": "56d560c113f9f7cef8466bdb", - "id": 2035 - }, - "designType": { - "name": "56d560c19f900b07adaf74a5", - "id": 6988 - }, - "zoneType": { - "name": "56d560c1d3ba5cff37e5f0ff", - "id": 2242 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 65, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-09-29" - }, - "created": { - "date": "2014-02-10" - }, - "name": "56d560c113ca121ec83c9c94", - "id": 98 - }, - { - "site": { - "location_type": "Adelino", - "id": 99 - }, - "zonePurpose": { - "name": "56d560c1fd3213b0e9f937c4", - "id": 7382 - }, - "powerType": { - "name": "56d560c1496181a2fb68ee85", - "id": 6767 - }, - "designType": { - "name": "56d560c138bf22f6e8a98efa", - "id": 87 - }, - "zoneType": { - "name": "56d560c16ceffaa72387ccaa", - "id": 6987 - }, - "zoneState": "string", - "useableRackUnits": 0, - "openStackVersion": "string", - "numberOfComputeRack": 0, - "distributedControlPlane": "string", - "avialableKwPerRack": 23, - "secondaryDcp": "string", - "primaryDcp": "string", - "lastUpdateBy": "string", - "locked_by": "string", - "last_updated": { - "date": "2014-11-22" - }, - "created": { - "date": "2016-01-22" - }, - "name": "56d560c1edd271f6d12b707c", - "id": 99 - } -] \ No newline at end of file diff --git a/orm/services/region_manager/rms_mock/public/css/style.css b/orm/services/region_manager/rms_mock/public/css/style.css deleted file mode 100644 index 55c9db54..00000000 --- a/orm/services/region_manager/rms_mock/public/css/style.css +++ /dev/null @@ -1,43 +0,0 @@ -body { - background: #311F00; - color: white; - font-family: 'Helvetica Neue', 'Helvetica', 'Verdana', sans-serif; - padding: 1em 2em; -} - -a { - color: #FAFF78; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -div#content { - width: 800px; - margin: 0 auto; -} - -form { - margin: 0; - padding: 0; - border: 0; -} - -fieldset { - border: 0; -} - -input.error { - background: #FAFF78; -} - -header { - text-align: center; -} - -h1, h2, h3, h4, h5, h6 { - font-family: 'Futura-CondensedExtraBold', 'Futura', 'Helvetica', sans-serif; - text-transform: uppercase; -} diff --git a/orm/services/region_manager/rms_mock/public/images/logo.png b/orm/services/region_manager/rms_mock/public/images/logo.png deleted file mode 100644 index a8f403e4..00000000 Binary files a/orm/services/region_manager/rms_mock/public/images/logo.png and /dev/null differ diff --git a/orm/services/region_manager/rms_mock/rms_mock/__init__.py b/orm/services/region_manager/rms_mock/rms_mock/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/region_manager/rms_mock/rms_mock/app.py b/orm/services/region_manager/rms_mock/rms_mock/app.py deleted file mode 100644 index ded90984..00000000 --- a/orm/services/region_manager/rms_mock/rms_mock/app.py +++ /dev/null @@ -1,24 +0,0 @@ -from pecan.commands import CommandRunner -from pecan import make_app -from rms import model -from rms_mock import model - - -def setup_app(config): - - model.init_model() - app_conf = dict(config.app) - - return make_app( - app_conf.pop('root'), - logging=getattr(config, 'logging', {}), - **app_conf - ) - - -def main(): - runner = CommandRunner() - runner.run(['serve', '../config.py']) - -if __name__ == "__main__": - main() diff --git a/orm/services/region_manager/rms_mock/rms_mock/controllers/__init__.py b/orm/services/region_manager/rms_mock/rms_mock/controllers/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/region_manager/rms_mock/rms_mock/controllers/lcp_controller.py b/orm/services/region_manager/rms_mock/rms_mock/controllers/lcp_controller.py deleted file mode 100644 index a2ef0834..00000000 --- a/orm/services/region_manager/rms_mock/rms_mock/controllers/lcp_controller.py +++ /dev/null @@ -1,21 +0,0 @@ -import logging - -import pecan -from pecan import rest - -LOG = logging.getLogger(__name__) - - -class LcpController(rest.RestController): - """this class is for getting the lcp list from AIC Formation.""" - - @pecan.expose() - def get(self): - """when a get is received this function returns a list of lcp""" - LOG.info('int get function') - - file = open('data/zones.json', 'r') - zones = file.read() - - # return the lcp's as dictionary so they can be converted to Json - return zones diff --git a/orm/services/region_manager/rms_mock/rms_mock/controllers/root.py b/orm/services/region_manager/rms_mock/rms_mock/controllers/root.py deleted file mode 100644 index 6f87c573..00000000 --- a/orm/services/region_manager/rms_mock/rms_mock/controllers/root.py +++ /dev/null @@ -1,17 +0,0 @@ -from lcp_controller import LcpController -from pecan import expose -from webob.exc import status_map - - -class RootController(object): - """in charge of RestAPI in the root directory""" - lcp = LcpController() - - @expose('error.html') - def error(self, status): - try: - status = int(status) - except ValueError: # pragma: no cover - status = 500 - message = getattr(status_map.get(status), 'explanation', '') - return dict(status=status, message=message) diff --git a/orm/services/region_manager/rms_mock/rms_mock/model/__init__.py b/orm/services/region_manager/rms_mock/rms_mock/model/__init__.py deleted file mode 100644 index 2eef4a20..00000000 --- a/orm/services/region_manager/rms_mock/rms_mock/model/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -from pecan import conf # noqa - - -def init_model(): - """This is a stub method which is called at application startup time. - - If you need to bind to a parsed database configuration, set up tables or - ORM classes, or perform any database initialization, this is the - recommended place to do it. - - For more information working with databases, and some common recipes, - see http://pecan.readthedocs.org/en/latest/databases.html - """ - pass diff --git a/orm/services/region_manager/rms_mock/rms_mock/templates/error.html b/orm/services/region_manager/rms_mock/rms_mock/templates/error.html deleted file mode 100644 index 323bc562..00000000 --- a/orm/services/region_manager/rms_mock/rms_mock/templates/error.html +++ /dev/null @@ -1,12 +0,0 @@ -<%inherit file="../../../lcp_core/templates/layout.html" /> - -## provide definitions for blocks we want to redefine -<%def name="title()"> - Server Error ${status} - - -## now define the body of the template -
-

Server Error ${status}

-
-

${message}

diff --git a/orm/services/region_manager/rms_mock/rms_mock/templates/index.html b/orm/services/region_manager/rms_mock/rms_mock/templates/index.html deleted file mode 100644 index c5624a2e..00000000 --- a/orm/services/region_manager/rms_mock/rms_mock/templates/index.html +++ /dev/null @@ -1,34 +0,0 @@ -<%inherit file="../../../mock/templates/layout.html" /> - -## provide definitions for blocks we want to redefine -<%def name="title()"> - Welcome to Pecan! - - -## now define the body of the template -
-

-
- -
- -

This is a sample Pecan project.

- -

- Instructions for getting started can be found online at pecanpy.org -

- -

- ...or you can search the documentation here: -

- -
-
- - -
- Enter search terms or a module, class or function name. -
- -
diff --git a/orm/services/region_manager/rms_mock/rms_mock/templates/layout.html b/orm/services/region_manager/rms_mock/rms_mock/templates/layout.html deleted file mode 100644 index 40908591..00000000 --- a/orm/services/region_manager/rms_mock/rms_mock/templates/layout.html +++ /dev/null @@ -1,22 +0,0 @@ - - - ${self.title()} - ${self.style()} - ${self.javascript()} - - - ${self.body()} - - - -<%def name="title()"> - Default Title - - -<%def name="style()"> - - - -<%def name="javascript()"> - - diff --git a/orm/services/region_manager/rms_mock/setup.cfg b/orm/services/region_manager/rms_mock/setup.cfg deleted file mode 100644 index 00ca2206..00000000 --- a/orm/services/region_manager/rms_mock/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[nosetests] -match=^test -where=test -nocapture=1 -cover-package=test -cover-erase=1 diff --git a/orm/services/region_manager/rms_mock/setup.py b/orm/services/region_manager/rms_mock/setup.py deleted file mode 100644 index 0d17d5b6..00000000 --- a/orm/services/region_manager/rms_mock/setup.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -try: - from setuptools import setup, find_packages -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, find_packages - -setup( - name='mock', - version='0.1', - description='', - author='', - author_email='', - install_requires=[ - "pecan", - ], - test_suite='mock', - zip_safe=False, - include_package_data=True, - packages=find_packages(exclude=['ez_setup']) -) diff --git a/orm/services/resource_distributor/ordmockserver/MANIFEST.in b/orm/services/resource_distributor/ordmockserver/MANIFEST.in deleted file mode 100644 index c922f11a..00000000 --- a/orm/services/resource_distributor/ordmockserver/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -recursive-include public * diff --git a/orm/services/resource_distributor/ordmockserver/config.py b/orm/services/resource_distributor/ordmockserver/config.py deleted file mode 100755 index c054949a..00000000 --- a/orm/services/resource_distributor/ordmockserver/config.py +++ /dev/null @@ -1,114 +0,0 @@ -# Server Specific Configurations -server = { - 'port': '1337', - 'host': '0.0.0.0' -} - -UUID_URL = 'http://127.0.0.1:8090/v1/uuids' -RDS_STATUS_URL = 'http://127.0.0.1:8777/v1/rds/status' -SECONDS_BEFORE_STATUS_UPDATE = 5 - -status_data = { - 'ord_notifier_id': '1', - 'region': 'mtn6', - 'status': 'Success', - 'error_code': '', - 'error_msg': '' -} - -image_extra_metadata = { - 'checksum': 'd4ea426817a742328da91438e3a3208b', - # Size should be int and virtual_size should be real None once our - # database supports these values - 'size': '1337', - 'virtual_size': 'None' -} - -# Pecan Application Configurations -app = { - 'root': 'ordmockserver.controllers.root.RootController', - 'modules': ['ordmockserver'], - 'static_root': '%(confdir)s/public', - 'template_path': '%(confdir)s/restapi/templates', - 'debug': True, - 'errors': { - 404: '/error/404', - '__force_dict__': True - } -} - -verify = False - -logging = { - 'root': {'level': 'INFO', 'handlers': ['console']}, - 'loggers': { - 'restapi': {'level': 'DEBUG', 'handlers': ['console', 'logfile'], 'propagate': False}, - 'pecan': {'level': 'DEBUG', 'handlers': ['console'], 'propagate': False}, - 'py.warnings': {'handlers': ['console']}, - '__force_dict__': True - }, - 'handlers': { - 'console': { - 'level': 'DEBUG', - 'class': 'logging.StreamHandler', - 'formatter': 'color' - }, - 'logfile': { - 'class': 'logging.FileHandler', - 'filename': '/home/pecanlogs.log', - 'level': 'DEBUG', - 'formatter': 'simple' - } - }, - 'formatters': { - 'simple': { - 'format': ('%(asctime)s %(levelname)-5.5s [%(name)s]' - '[%(threadName)s] %(message)s') - }, - 'color': { - '()': 'pecan.log.ColorFormatter', - 'format': ('%(asctime)s [%(padded_color_levelname)s] [%(name)s]' - '[%(threadName)s] %(message)s'), - '__force_dict__': True - } - } -} - - -""" -# orign logging -logging = { - 'root': {'level': 'INFO', 'handlers': ['console']}, - 'loggers': { - 'restapi': {'level': 'DEBUG', 'handlers': ['console'], 'propagate': False}, - 'pecan': {'level': 'DEBUG', 'handlers': ['console'], 'propagate': False}, - 'py.warnings': {'handlers': ['console']}, - '__force_dict__': True - }, - 'handlers': { - 'console': { - 'level': 'DEBUG', - 'class': 'logging.StreamHandler', - 'formatter': 'color' - } - }, - 'formatters': { - 'simple': { - 'format': ('%(asctime)s %(levelname)-5.5s [%(name)s]' - '[%(threadName)s] %(message)s') - }, - 'color': { - '()': 'pecan.log.ColorFormatter', - 'format': ('%(asctime)s [%(padded_color_levelname)s] [%(name)s]' - '[%(threadName)s] %(message)s'), - '__force_dict__': True - } - } -} -""" -# Custom Configurations must be in Python dictionary format:: -# -# foo = {'bar':'baz'} -# -# All configurations are accessible at:: -# pecan.conf diff --git a/orm/services/resource_distributor/ordmockserver/ordmockserver/__init__.py b/orm/services/resource_distributor/ordmockserver/ordmockserver/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/resource_distributor/ordmockserver/ordmockserver/app.py b/orm/services/resource_distributor/ordmockserver/ordmockserver/app.py deleted file mode 100644 index 0a9930d4..00000000 --- a/orm/services/resource_distributor/ordmockserver/ordmockserver/app.py +++ /dev/null @@ -1,14 +0,0 @@ -from ordmockserver import model -from pecan import make_app - - -def setup_app(config): - - model.init_model() - app_conf = dict(config.app) - - return make_app( - app_conf.pop('root'), - logging=getattr(config, 'logging', {}), - **app_conf - ) diff --git a/orm/services/resource_distributor/ordmockserver/ordmockserver/controllers/OrdNotifier/__init__.py b/orm/services/resource_distributor/ordmockserver/ordmockserver/controllers/OrdNotifier/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/orm/services/resource_distributor/ordmockserver/ordmockserver/controllers/OrdNotifier/models/__init__.py b/orm/services/resource_distributor/ordmockserver/ordmockserver/controllers/OrdNotifier/models/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/orm/services/resource_distributor/ordmockserver/ordmockserver/controllers/OrdNotifier/root.py b/orm/services/resource_distributor/ordmockserver/ordmockserver/controllers/OrdNotifier/root.py deleted file mode 100755 index 707a9216..00000000 --- a/orm/services/resource_distributor/ordmockserver/ordmockserver/controllers/OrdNotifier/root.py +++ /dev/null @@ -1,91 +0,0 @@ -import json -import logging.handlers -import threading -import time - -import requests - -from pecan import conf -import pecan.rest -import wsme -from wsme import types as wtypes -from wsmeext.pecan import wsexpose - -my_logger = logging.getLogger(__name__) - - -class Result(wtypes.DynamicBase): - haha = wsme.wsattr(wtypes.text, mandatory=True) - - def __init__(self, haha): - self.haha = haha - - -class OrdNotifierWrapper(wtypes.DynamicBase): - ord_notifier = wsme.wsattr( - {str: str, str: str, str: str, str: str, str: str}, mandatory=False, - name='ord-notifier') - - def __init__(self, ord_notifier=None): - self.ord_notifier = ord_notifier - - -def send_status_update(ord_notifier_wrapper): - # Wait before sending the status update, to make sure RDS updates the - # status to Submitted - time.sleep(conf.SECONDS_BEFORE_STATUS_UPDATE) - - json_to_send = {"rds-listener": {}} - for key in ('ord-notifier-id', 'region', 'status', 'error-code', - 'error-msg',): - # Take the keys from the configuration - json_to_send['rds-listener'][key] = conf.status_data[ - key.replace('-', '_')] - - for key in ('request-id', 'resource-id', 'resource-type', - 'resource-template-version', 'resource-template-type', - 'region',): - # Take the keys from the input json - json_to_send['rds-listener'][key] = ord_notifier_wrapper.ord_notifier[ - key] - - json_to_send['rds-listener']['resource-operation'] = \ - ord_notifier_wrapper.ord_notifier['operation'] - - if ord_notifier_wrapper.ord_notifier['resource-type'] == 'image': - json_to_send['rds-listener'][ - 'resource_extra_metadata'] = dict(conf.image_extra_metadata) - - result = requests.post(conf.RDS_STATUS_URL, - headers={'Content-Type': 'application/json'}, - data=json.dumps(json_to_send), - verify=conf.verify) - my_logger.debug( - 'Status update status code: {}, content: {}'.format(result.status_code, - result.content)) - return result - - -class OrdNotifier(pecan.rest.RestController): - def _send_status_update(self, ord_notifier_wrapper): - thread = threading.Thread(target=send_status_update, - args=(ord_notifier_wrapper,)) - thread.start() - - @wsexpose(Result, body=OrdNotifierWrapper, status_code=200, - rest_content_types='json') - def post(self, ord_notifier_wrapper): - try: - my_logger.debug('Entered post, ord_notifier: {}'.format( - ord_notifier_wrapper.ord_notifier)) - mandatory_keys = ['resource-type'] - if not all( - [key in ord_notifier_wrapper.ord_notifier for key in - mandatory_keys]): - raise ValueError('A mandatory key is missing') - - self._send_status_update(ord_notifier_wrapper) - except Exception as exc: - my_logger.error(str(exc)) - - return Result('Success') diff --git a/orm/services/resource_distributor/ordmockserver/ordmockserver/controllers/__init__.py b/orm/services/resource_distributor/ordmockserver/ordmockserver/controllers/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/resource_distributor/ordmockserver/ordmockserver/controllers/root.py b/orm/services/resource_distributor/ordmockserver/ordmockserver/controllers/root.py deleted file mode 100755 index 0c3da319..00000000 --- a/orm/services/resource_distributor/ordmockserver/ordmockserver/controllers/root.py +++ /dev/null @@ -1,46 +0,0 @@ -from OrdNotifier import root -from pecan import * -from pecan import expose -from webob.exc import status_map - - -class CatalogController(object): - @expose() - def index(self): - return "Welcome to the catalog." - - -class ORD(object): - @expose() - def index(self): - return dict() - ord_notifier = root.OrdNotifier() - - -class RootOne(object): - @expose() - def index(self): - return dict() - ord = ORD() - - -class RootController(object): - - @expose(generic=True, template='index.html') - def index(self): - return dict() - - @index.when(method='GET') - def index_get(self): - return 'hi' - - def error(self, status): - try: - status = int(status) - except ValueError: # pragma: no cover - status = 500 - message = getattr(status_map.get(status), 'explanation', '') - return dict(status=status, message=message) - - cat = CatalogController() - v1 = RootOne() diff --git a/orm/services/resource_distributor/ordmockserver/ordmockserver/model/__init__.py b/orm/services/resource_distributor/ordmockserver/ordmockserver/model/__init__.py deleted file mode 100644 index 2eef4a20..00000000 --- a/orm/services/resource_distributor/ordmockserver/ordmockserver/model/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -from pecan import conf # noqa - - -def init_model(): - """This is a stub method which is called at application startup time. - - If you need to bind to a parsed database configuration, set up tables or - ORM classes, or perform any database initialization, this is the - recommended place to do it. - - For more information working with databases, and some common recipes, - see http://pecan.readthedocs.org/en/latest/databases.html - """ - pass diff --git a/orm/services/resource_distributor/ordmockserver/ordmockserver/templates/error.html b/orm/services/resource_distributor/ordmockserver/ordmockserver/templates/error.html deleted file mode 100644 index f2d97961..00000000 --- a/orm/services/resource_distributor/ordmockserver/ordmockserver/templates/error.html +++ /dev/null @@ -1,12 +0,0 @@ -<%inherit file="layout.html" /> - -## provide definitions for blocks we want to redefine -<%def name="title()"> - Server Error ${status} - - -## now define the body of the template -
-

Server Error ${status}

-
-

${message}

diff --git a/orm/services/resource_distributor/ordmockserver/ordmockserver/templates/index.html b/orm/services/resource_distributor/ordmockserver/ordmockserver/templates/index.html deleted file mode 100644 index f17c3862..00000000 --- a/orm/services/resource_distributor/ordmockserver/ordmockserver/templates/index.html +++ /dev/null @@ -1,34 +0,0 @@ -<%inherit file="layout.html" /> - -## provide definitions for blocks we want to redefine -<%def name="title()"> - Welcome to Pecan! - - -## now define the body of the template -
-

-
- -
- -

This is a sample Pecan project.

- -

- Instructions for getting started can be found online at pecanpy.org -

- -

- ...or you can search the documentation here: -

- -
-
- - -
- Enter search terms or a module, class or function name. -
- -
diff --git a/orm/services/resource_distributor/ordmockserver/ordmockserver/templates/layout.html b/orm/services/resource_distributor/ordmockserver/ordmockserver/templates/layout.html deleted file mode 100644 index 40908591..00000000 --- a/orm/services/resource_distributor/ordmockserver/ordmockserver/templates/layout.html +++ /dev/null @@ -1,22 +0,0 @@ - - - ${self.title()} - ${self.style()} - ${self.javascript()} - - - ${self.body()} - - - -<%def name="title()"> - Default Title - - -<%def name="style()"> - - - -<%def name="javascript()"> - - diff --git a/orm/services/resource_distributor/ordmockserver/public/css/style.css b/orm/services/resource_distributor/ordmockserver/public/css/style.css deleted file mode 100644 index 55c9db54..00000000 --- a/orm/services/resource_distributor/ordmockserver/public/css/style.css +++ /dev/null @@ -1,43 +0,0 @@ -body { - background: #311F00; - color: white; - font-family: 'Helvetica Neue', 'Helvetica', 'Verdana', sans-serif; - padding: 1em 2em; -} - -a { - color: #FAFF78; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -div#content { - width: 800px; - margin: 0 auto; -} - -form { - margin: 0; - padding: 0; - border: 0; -} - -fieldset { - border: 0; -} - -input.error { - background: #FAFF78; -} - -header { - text-align: center; -} - -h1, h2, h3, h4, h5, h6 { - font-family: 'Futura-CondensedExtraBold', 'Futura', 'Helvetica', sans-serif; - text-transform: uppercase; -} diff --git a/orm/services/resource_distributor/ordmockserver/public/images/logo.png b/orm/services/resource_distributor/ordmockserver/public/images/logo.png deleted file mode 100644 index a8f403e4..00000000 Binary files a/orm/services/resource_distributor/ordmockserver/public/images/logo.png and /dev/null differ diff --git a/orm/services/resource_distributor/ordmockserver/setup.cfg b/orm/services/resource_distributor/ordmockserver/setup.cfg deleted file mode 100644 index 4c9b8495..00000000 --- a/orm/services/resource_distributor/ordmockserver/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[nosetests] -match=^test -where=ordmockserver -nocapture=1 -cover-package=ordmockserver -cover-erase=1 diff --git a/orm/services/resource_distributor/ordmockserver/setup.py b/orm/services/resource_distributor/ordmockserver/setup.py deleted file mode 100644 index c4d11ee5..00000000 --- a/orm/services/resource_distributor/ordmockserver/setup.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -try: - from setuptools import setup, find_packages -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, find_packages - -setup( - name='ordmockserver', - version='0.1', - description='', - author='', - author_email='', - install_requires=[ - "pecan", - ], - test_suite='ordmockserver', - zip_safe=False, - include_package_data=True, - packages=find_packages(exclude=['ez_setup']) -) diff --git a/orm/services/resource_distributor/rds/utils/module_mocks/README.txt b/orm/services/resource_distributor/rds/utils/module_mocks/README.txt deleted file mode 100644 index 87ddd695..00000000 --- a/orm/services/resource_distributor/rds/utils/module_mocks/README.txt +++ /dev/null @@ -1,3 +0,0 @@ -This directory contains mock modules for modules that are outside of this repository. -The relative path to this directory should be included in PYTHONPATH whenever running tests (in tox.ini, for example). - diff --git a/orm/services/resource_distributor/rds/utils/module_mocks/__init__.py b/orm/services/resource_distributor/rds/utils/module_mocks/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/resource_distributor/rds/utils/module_mocks/audit_client/__init__.py b/orm/services/resource_distributor/rds/utils/module_mocks/audit_client/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/resource_distributor/rds/utils/module_mocks/audit_client/api/__init__.py b/orm/services/resource_distributor/rds/utils/module_mocks/audit_client/api/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/resource_distributor/rds/utils/module_mocks/audit_client/api/audit.py b/orm/services/resource_distributor/rds/utils/module_mocks/audit_client/api/audit.py deleted file mode 100644 index ec483bdd..00000000 --- a/orm/services/resource_distributor/rds/utils/module_mocks/audit_client/api/audit.py +++ /dev/null @@ -1,6 +0,0 @@ -def audit(*args, **kwargs): - pass - - -def init(*args, **kwargs): - pass diff --git a/orm/services/resource_distributor/rds/utils/module_mocks/keystone_utils/__init__.py b/orm/services/resource_distributor/rds/utils/module_mocks/keystone_utils/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/resource_distributor/rds/utils/module_mocks/keystone_utils/tokens.py b/orm/services/resource_distributor/rds/utils/module_mocks/keystone_utils/tokens.py deleted file mode 100755 index 99708117..00000000 --- a/orm/services/resource_distributor/rds/utils/module_mocks/keystone_utils/tokens.py +++ /dev/null @@ -1,6 +0,0 @@ -def is_token_valid(token_to_validate, lcp_id, conf, token_role): - pass - - -def TokenConf(mech_id, mech_password, rms_url, tenant_name, keystone_version): - pass diff --git a/orm/services/resource_distributor/rds/utils/module_mocks/orm_common/__init__.py b/orm/services/resource_distributor/rds/utils/module_mocks/orm_common/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/resource_distributor/rds/utils/module_mocks/orm_common/utils/__init__.py b/orm/services/resource_distributor/rds/utils/module_mocks/orm_common/utils/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/orm/services/resource_distributor/rds/utils/module_mocks/orm_common/utils/utils.py b/orm/services/resource_distributor/rds/utils/module_mocks/orm_common/utils/utils.py deleted file mode 100755 index ba516a7a..00000000 --- a/orm/services/resource_distributor/rds/utils/module_mocks/orm_common/utils/utils.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Utils module mock.""" - - -def report_config(conf, dump=False): - """Mock report_config function.""" - - pass - - -def set_utils_conf(conf): - """Mock set_utils_conf function.""" - - pass