Revision c9b996b7 snf-pithos-backend/pithos/backends/lib/hashfiler/fileblocker.py

b/snf-pithos-backend/pithos/backends/lib/hashfiler/fileblocker.py
1 1
# Copyright 2011-2012 GRNET S.A. All rights reserved.
2
# 
2
#
3 3
# Redistribution and use in source and binary forms, with or
4 4
# without modification, are permitted provided that the following
5 5
# conditions are met:
6
# 
6
#
7 7
#   1. Redistributions of source code must retain the above
8 8
#      copyright notice, this list of conditions and the following
9 9
#      disclaimer.
10
# 
10
#
11 11
#   2. Redistributions in binary form must reproduce the above
12 12
#      copyright notice, this list of conditions and the following
13 13
#      disclaimer in the documentation and/or other materials
14 14
#      provided with the distribution.
15
# 
15
#
16 16
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 17
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 18
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
......
25 25
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 26
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 27
# POSSIBILITY OF SUCH DAMAGE.
28
# 
28
#
29 29
# The views and conclusions contained in the software and
30 30
# documentation are those of the authors and should not be
31 31
# interpreted as representing official policies, either expressed
......
56 56
            if not exists(blockpath):
57 57
                makedirs(blockpath)
58 58
            else:
59
                raise ValueError("Variable blockpath '%s' is not a directory" % (blockpath,))
59
                m = "Variable blockpath '%s' is not a directory" % (blockpath,)
60
                raise ValueError(m)
60 61

  
61 62
        hashtype = params['hashtype']
62 63
        try:
......
125 126
                if not rbl:
126 127
                    break
127 128
                for block in rbl.sync_read_chunks(blocksize, 1, 0):
128
                    break # there should be just one block there
129
                    break  # there should be just one block there
129 130
            if not block:
130 131
                break
131 132
            append(self._pad(block))
......
164 165
        block = self.block_retr((blkhash,))
165 166
        if not block:
166 167
            return None, None
167
        
168

  
168 169
        block = block[0]
169 170
        newblock = block[:offset] + data
170 171
        if len(newblock) > blocksize:
......
207 208
            sextend(sl)
208 209
            lastsize = len(block)
209 210

  
210
        size = (len(hashlist) -1) * blocksize + lastsize if hashlist else 0
211
        size = (len(hashlist) - 1) * blocksize + lastsize if hashlist else 0
211 212
        return size, hashlist, storedlist
212

  

Also available in: Unified diff