Пример #1
0
    def _set_num_copies(self):
        from repository.models import git_annex_where_is

        data = git_annex_where_is(self)
        try:
            whereis = json.loads(data)
            self.num_copies = len(whereis[u'whereis'])
        except ValueError:
            self.num_copies = 1
Пример #2
0
 def _set_num_copies(self):
     from repository.models import git_annex_where_is
     
     data = git_annex_where_is(self)
     try:
         whereis = json.loads(data)
         self.num_copies = len(whereis[u'whereis'])
     except ValueError:
         self.num_copies = 1
Пример #3
0
    def where_is(self):
        from repository.models import git_annex_where_is

        data = git_annex_where_is(self)
        whereis = json.loads(data)

        index = 0
        for item in whereis["whereis"]:
            # strip [ or ]  (prevent errors of getting mucuas address like [dpadua])
            mucua_name = re.sub("[\[\]]", "", item["description"]).split(" ")[0]
            whereis["whereis"][index]["description"] = mucua_name
            index += 1

        return whereis
Пример #4
0
    def where_is(self):
        from repository.models import git_annex_where_is

        data = git_annex_where_is(self)
        whereis = json.loads(data)

        index = 0
        for item in whereis['whereis']:
            # strip [ or ]  (prevent errors of getting mucuas address like [dpadua])
            mucua_name = re.sub("[\[\]]", "",
                                item['description']).split(' ')[0]
            whereis['whereis'][index]['description'] = mucua_name
            index += 1

        return whereis
Пример #5
0
 def where_is(self):
     from repository.models import git_annex_where_is
     
     data = git_annex_where_is(self)
     try:
         whereis = json.loads(data)
     except ValueError:
         logger.debug("Data error " + data)
         whereis = { 'whereis': [] }
     
     index = 0
     for item in whereis['whereis']:
         # strip [ or ]  (prevent errors of getting mucuas address like [dpadua])
         mucua_name = re.sub("[\[\]]", "", item['description']).split(' ')[0]
         whereis['whereis'][index]['description'] = mucua_name
         index += 1
     
     return whereis
Пример #6
0
 def where_is(self):
     from repository.models import git_annex_where_is
     return git_annex_where_is(self)
Пример #7
0
 def _set_num_copies(self):
     from repository.models import git_annex_where_is
     import json
     data = git_annex_where_is(self)
     whereis = json.loads(data)
     self.num_copies = len(whereis[u'whereis'])
Пример #8
0
 def where_is(self):
     from repository.models import git_annex_where_is
     return git_annex_where_is(self)
Пример #9
0
 def _set_num_copies(self):        
     from repository.models import git_annex_where_is
     import json
     data = git_annex_where_is(self)
     whereis = json.loads(data)
     self.num_copies = len(whereis[u'whereis'])