Change find_available_file_name into private method
This commit is contained in:
parent
a7f078eb54
commit
71be1a56b8
@ -347,7 +347,7 @@ class Collection(BaseCollection):
|
|||||||
path, self.storage_encoding, mode).open() as fd:
|
path, self.storage_encoding, mode).open() as fd:
|
||||||
yield fd
|
yield fd
|
||||||
|
|
||||||
def find_available_file_name(self):
|
def _find_available_file_name(self):
|
||||||
# Prevent infinite loop
|
# Prevent infinite loop
|
||||||
for _ in range(10000):
|
for _ in range(10000):
|
||||||
file_name = hex(getrandbits(32))[2:]
|
file_name = hex(getrandbits(32))[2:]
|
||||||
@ -430,13 +430,13 @@ class Collection(BaseCollection):
|
|||||||
for item in items:
|
for item in items:
|
||||||
new_collection.add(item)
|
new_collection.add(item)
|
||||||
self.upload(
|
self.upload(
|
||||||
self.find_available_file_name(), new_collection)
|
self._find_available_file_name(), new_collection)
|
||||||
|
|
||||||
elif tag == "VCARD":
|
elif tag == "VCARD":
|
||||||
self.set_meta("tag", "VADDRESSBOOK")
|
self.set_meta("tag", "VADDRESSBOOK")
|
||||||
if collection:
|
if collection:
|
||||||
for card in collection:
|
for card in collection:
|
||||||
self.upload(self.find_available_file_name(), card)
|
self.upload(self._find_available_file_name(), card)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user