Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / management / commands / resource-export-astakos.py @ 398a9604

History | View | Annotate | Download (2 kB)

1 e4a6c11d Giorgos Korfiatis
# Copyright 2013 GRNET S.A. All rights reserved.
2 e4a6c11d Giorgos Korfiatis
#
3 e4a6c11d Giorgos Korfiatis
# Redistribution and use in source and binary forms, with or
4 e4a6c11d Giorgos Korfiatis
# without modification, are permitted provided that the following
5 e4a6c11d Giorgos Korfiatis
# conditions are met:
6 e4a6c11d Giorgos Korfiatis
#
7 e4a6c11d Giorgos Korfiatis
#   1. Redistributions of source code must retain the above
8 e4a6c11d Giorgos Korfiatis
#      copyright notice, this list of conditions and the following
9 e4a6c11d Giorgos Korfiatis
#      disclaimer.
10 e4a6c11d Giorgos Korfiatis
#
11 e4a6c11d Giorgos Korfiatis
#   2. Redistributions in binary form must reproduce the above
12 e4a6c11d Giorgos Korfiatis
#      copyright notice, this list of conditions and the following
13 e4a6c11d Giorgos Korfiatis
#      disclaimer in the documentation and/or other materials
14 e4a6c11d Giorgos Korfiatis
#      provided with the distribution.
15 e4a6c11d Giorgos Korfiatis
#
16 e4a6c11d Giorgos Korfiatis
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 e4a6c11d Giorgos Korfiatis
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 e4a6c11d Giorgos Korfiatis
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 e4a6c11d Giorgos Korfiatis
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 e4a6c11d Giorgos Korfiatis
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 e4a6c11d Giorgos Korfiatis
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 e4a6c11d Giorgos Korfiatis
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 e4a6c11d Giorgos Korfiatis
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 e4a6c11d Giorgos Korfiatis
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 e4a6c11d Giorgos Korfiatis
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 e4a6c11d Giorgos Korfiatis
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 e4a6c11d Giorgos Korfiatis
# POSSIBILITY OF SUCH DAMAGE.
28 e4a6c11d Giorgos Korfiatis
#
29 e4a6c11d Giorgos Korfiatis
# The views and conclusions contained in the software and
30 e4a6c11d Giorgos Korfiatis
# documentation are those of the authors and should not be
31 e4a6c11d Giorgos Korfiatis
# interpreted as representing official policies, either expressed
32 e4a6c11d Giorgos Korfiatis
# or implied, of GRNET S.A.
33 e4a6c11d Giorgos Korfiatis
34 e4a6c11d Giorgos Korfiatis
from django.utils import simplejson as json
35 e4a6c11d Giorgos Korfiatis
from django.core.management.base import BaseCommand
36 e4a6c11d Giorgos Korfiatis
37 e4a6c11d Giorgos Korfiatis
from astakos.im.astakos_resources import service, resources
38 e4a6c11d Giorgos Korfiatis
39 e4a6c11d Giorgos Korfiatis
40 e4a6c11d Giorgos Korfiatis
class Command(BaseCommand):
41 e4a6c11d Giorgos Korfiatis
    help = "Export astakos resources in json format"
42 e4a6c11d Giorgos Korfiatis
43 e4a6c11d Giorgos Korfiatis
    def handle(self, *args, **options):
44 e4a6c11d Giorgos Korfiatis
        data = {'service': service,
45 e4a6c11d Giorgos Korfiatis
                'resources': resources,
46 e4a6c11d Giorgos Korfiatis
                }
47 0b48a1b4 Giorgos Korfiatis
        output = json.dumps(data, indent=4)
48 e4a6c11d Giorgos Korfiatis
        self.stdout.write(output + '\n')