33 """ File object class """
35 def __init__(self, filepath="", postfield="", boundary_size=30):
38 @param path str -The filepath
39 @param postField str - The post field name.
40 @param boundary_size int - Size of random boundary string for the
41 filename to add on the post field.
45 if filepath
is not "":
46 self.
__path = path.expanduser(path.normpath(filepath))
50 if postfield
is not "":
58 """! Equality method """
59 return self.
serialize() == other.serialize()
66 @return string - The file path.
75 @param path (String) - The file path.
77 absPath = path.expanduser(path.normpath(filepath))
83 """! Post field name getter
85 @return string - The post field name.
92 """! Post field name setter
94 @param fieldname (String) - The post field name.
105 if not path.isfile(self.
__path):
106 raise Exception(
'File not found: {0}'.format(self.
__path))
108 name, ext = path.splitext(path.basename(self.
__path))
109 filename =
'.'.join((
''.join((name,
'-', randStr)), ext))
def __eq__
Equality method.
def postfield
Post field name getter.