@@ -592,15 +592,10 @@ def _validate_limitations(self, images_to_copy_count):
592592 project_id = self ._project .uuid ,
593593 folder_id = self ._to_folder .uuid ,
594594 )
595- errors = []
596595 if not response .ok :
597596 raise AppValidationException (response .error )
598597 if images_to_copy_count > response .data .folder_limit .remaining_image_count :
599- errors .append (constances .UPLOAD_FOLDER_LIMIT_ERROR_MESSAGE )
600- elif images_to_copy_count > response .data .project_limit .remaining_image_count :
601- errors .append (constances .UPLOAD_PROJECT_LIMIT_ERROR_MESSAGE )
602- if errors :
603- raise AppValidationException (errors )
598+ AppValidationException (constances .COPY_ITEMS_LIMIT_ERROR_MESSAGE )
604599
605600 def validate_project_type (self ):
606601 if self ._project .project_type in constances .LIMITED_FUNCTIONS :
@@ -740,7 +735,7 @@ def validate_limitations(self):
740735 if not response .ok :
741736 raise AppValidationException (response .error )
742737 if to_upload_count > response .data .folder_limit .remaining_image_count :
743- raise AppValidationException (constances .UPLOAD_FOLDER_LIMIT_ERROR_MESSAGE )
738+ raise AppValidationException (constances .MOVE_ITEMS_LIMIT_ERROR_MESSAGE )
744739
745740 def execute (self ):
746741 if self .is_valid ():
@@ -1137,18 +1132,15 @@ def validate_limitations(self):
11371132 project_id = self ._project .uuid ,
11381133 folder_id = self ._folder .uuid ,
11391134 )
1140- errors = []
11411135 if response .data .folder_limit .remaining_image_count < 1 :
1142- errors . append (constances .UPLOAD_FOLDER_LIMIT_ERROR_MESSAGE )
1136+ raise AppValidationException (constances .UPLOAD_FOLDER_LIMIT_ERROR_MESSAGE )
11431137 elif response .data .project_limit .remaining_image_count < 1 :
1144- errors . append (constances .UPLOAD_PROJECT_LIMIT_ERROR_MESSAGE )
1138+ raise AppValidationException (constances .UPLOAD_PROJECT_LIMIT_ERROR_MESSAGE )
11451139 elif (
11461140 response .data .super_user_limit
11471141 and response .data .super_user_limit .remaining_image_count < 1
11481142 ):
1149- errors .append (constances .UPLOAD_USER_LIMIT_ERROR_MESSAGE )
1150- if errors :
1151- raise AppValidationException ("\n " .join (errors ))
1143+ raise AppValidationException (constances .UPLOAD_USER_LIMIT_ERROR_MESSAGE )
11521144
11531145 @property
11541146 def auth_data (self ):
@@ -1278,18 +1270,15 @@ def validate_limitations(self):
12781270 if not response .ok :
12791271 raise AppValidationException (response .error )
12801272 to_upload_count = len (self .images_to_upload )
1281- errors = []
12821273 if to_upload_count > response .data .folder_limit .remaining_image_count :
1283- errors . append (constances .UPLOAD_FOLDER_LIMIT_ERROR_MESSAGE )
1274+ raise AppValidationException (constances .UPLOAD_FOLDER_LIMIT_ERROR_MESSAGE )
12841275 elif to_upload_count > response .data .project_limit .remaining_image_count :
1285- errors . append (constances .UPLOAD_PROJECT_LIMIT_ERROR_MESSAGE )
1276+ raise AppValidationException (constances .UPLOAD_PROJECT_LIMIT_ERROR_MESSAGE )
12861277 elif (
12871278 response .data .super_user_limit
12881279 and to_upload_count > response .data .super_user_limit .remaining_image_count
12891280 ):
1290- errors .append (constances .UPLOAD_USER_LIMIT_ERROR_MESSAGE )
1291- if errors :
1292- raise AppValidationException ("\n " .join (errors ))
1281+ raise AppValidationException (constances .UPLOAD_USER_LIMIT_ERROR_MESSAGE )
12931282
12941283 def validate_annotation_status (self ):
12951284 if (
@@ -1598,18 +1587,15 @@ def validate_limitations(self):
15981587 if not response .ok :
15991588 raise AppValidationException (response .error )
16001589 to_upload_count = len (self ._image_urls )
1601- errors = []
16021590 if to_upload_count > response .data .folder_limit .remaining_image_count :
1603- errors . append (constances .UPLOAD_FOLDER_LIMIT_ERROR_MESSAGE )
1591+ raise AppValidationException (constances .UPLOAD_FOLDER_LIMIT_ERROR_MESSAGE )
16041592 elif to_upload_count > response .data .project_limit .remaining_image_count :
1605- errors . append (constances .UPLOAD_PROJECT_LIMIT_ERROR_MESSAGE )
1593+ raise AppValidationException (constances .UPLOAD_PROJECT_LIMIT_ERROR_MESSAGE )
16061594 elif (
16071595 response .data .super_user_limit
16081596 and to_upload_count > response .data .super_user_limit .remaining_image_count
16091597 ):
1610- errors .append (constances .UPLOAD_USER_LIMIT_ERROR_MESSAGE )
1611- if errors :
1612- raise AppValidationException ("\n " .join (errors ))
1598+ raise AppValidationException (constances .UPLOAD_USER_LIMIT_ERROR_MESSAGE )
16131599
16141600 def validate_image_names (self ):
16151601 if self ._image_names and len (self ._image_names ) != len (self ._image_urls ):
@@ -1893,18 +1879,15 @@ def validate_limitations(self):
18931879 )
18941880 if not response .ok :
18951881 raise AppValidationException (response .error )
1896- errors = []
18971882 if attachments_count > response .data .folder_limit .remaining_image_count :
1898- errors . append (constances .ATTACH_FOLDER_LIMIT_ERROR_MESSAGE )
1883+ raise AppValidationException (constances .ATTACH_FOLDER_LIMIT_ERROR_MESSAGE )
18991884 elif attachments_count > response .data .project_limit .remaining_image_count :
1900- errors . append (constances .ATTACH_PROJECT_LIMIT_ERROR_MESSAGE )
1885+ raise AppValidationException (constances .ATTACH_PROJECT_LIMIT_ERROR_MESSAGE )
19011886 elif (
19021887 response .data .super_user_limit
19031888 and attachments_count > response .data .super_user_limit .remaining_image_count
19041889 ):
1905- errors .append (constances .ATTACH_USER_LIMIT_ERROR_MESSAGE )
1906- if errors :
1907- raise AppValidationException ("\n " .join (errors ))
1890+ raise AppValidationException (constances .ATTACH_USER_LIMIT_ERROR_MESSAGE )
19081891
19091892 @property
19101893 def annotation_status_code (self ):
@@ -1999,16 +1982,21 @@ def validate_limitations(self):
19991982 )
20001983 if not response .ok :
20011984 raise AppValidationException (response .error )
2002- errors = []
20031985 if response .data .folder_limit .remaining_image_count < 1 :
2004- errors .append (constances .ATTACH_FOLDER_LIMIT_ERROR_MESSAGE )
1986+ if self ._move :
1987+ raise AppValidationException (constances .MOVE_ITEMS_LIMIT_ERROR_MESSAGE )
1988+ raise AppValidationException (constances .COPY_ITEMS_LIMIT_ERROR_MESSAGE )
20051989 elif (
20061990 self ._to_project .uuid != self ._from_project .uuid
20071991 and response .data .project_limit .remaining_image_count < 1
20081992 ):
2009- errors .append (constances .ATTACH_PROJECT_LIMIT_ERROR_MESSAGE )
2010- if errors :
2011- raise AppValidationException ("\n " .join (errors ))
1993+ if self ._move :
1994+ raise AppValidationException (
1995+ constances .MOVE_ITEM_PROJECT_LIMIT_ERROR_MESSAGE
1996+ )
1997+ raise AppValidationException (
1998+ constances .COPY_ITEM_PROJECT_LIMIT_ERROR_MESSAGE
1999+ )
20122000
20132001 def execute (self ) -> Response :
20142002 if self .is_valid ():
0 commit comments