mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
dev: fix imports
This commit is contained in:
parent
6cc29dca52
commit
6a6d0d881c
@ -78,7 +78,7 @@ class IssueSerializer(BaseSerializer):
|
||||
parsed_str = html.tostring(parsed, encoding="unicode")
|
||||
data["description_html"] = parsed_str
|
||||
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise serializers.ValidationError("Invalid HTML passed")
|
||||
|
||||
# Validate assignees are from project
|
||||
@ -349,7 +349,7 @@ class IssueCommentSerializer(BaseSerializer):
|
||||
parsed_str = html.tostring(parsed, encoding="unicode")
|
||||
data["comment_html"] = parsed_str
|
||||
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise serializers.ValidationError("Invalid HTML passed")
|
||||
return data
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
# Python imports
|
||||
from datetime import timedelta
|
||||
|
||||
# Django imports
|
||||
from django.utils import timezone
|
||||
from django.db.models import Q
|
||||
|
||||
# Third party imports
|
||||
from celery import shared_task
|
||||
|
||||
# Django imports
|
||||
from django.db.models import Q
|
||||
from django.utils import timezone
|
||||
|
||||
# Module imports
|
||||
from plane.db.models import FileAsset
|
||||
|
||||
@ -29,25 +29,8 @@ def delete_file_asset():
|
||||
|
||||
|
||||
@shared_task
|
||||
def file_asset_size(slug, email, members, issue_count, cycle_count, module_count):
|
||||
def file_asset_size():
|
||||
asset_size = []
|
||||
# s3_client = boto3.client('s3')
|
||||
assets_to_update = []
|
||||
|
||||
# for asset in FileAsset.objects.filter(size__isnull=True):
|
||||
# try:
|
||||
# key = f"{workspace_id}/{asset_key}"
|
||||
# response = s3_client.head_object(Bucket=settings.AWS_STORAGE_BUCKET_NAME, Key=key)
|
||||
# size = response['ContentLength']
|
||||
# asset.size = size
|
||||
# assets_to_update.append(asset)
|
||||
# except Exception as e:
|
||||
# # Handle exceptions such as S3 object not found
|
||||
# print(f"Error updating asset size for {asset.asset.key}: {e}")
|
||||
|
||||
# # Bulk update only objects that need updating
|
||||
# FileAsset.objects.bulk_update(assets_to_update, ["size"], batch_size=50)
|
||||
|
||||
for asset in FileAsset.objects.filter(size__isnull=True):
|
||||
asset.size = asset.asset.size
|
||||
asset_size.append(asset)
|
||||
|
@ -1,23 +1,21 @@
|
||||
# Python imports
|
||||
import getpass
|
||||
|
||||
# Django imports
|
||||
from django.core.management import BaseCommand
|
||||
|
||||
# Module imports
|
||||
from plane.db.models import User
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Check the file asset size of the file"
|
||||
|
||||
|
||||
def handle(self, *args, **options):
|
||||
|
||||
from plane.bgtasks.file_asset_task import file_asset_size
|
||||
|
||||
# Start the queueing
|
||||
file_asset_size.delay()
|
||||
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(f"File asset size pushed to queue")
|
||||
self.style.SUCCESS("File asset size pushed to queue")
|
||||
)
|
||||
|
@ -1,5 +1,9 @@
|
||||
# Python imports
|
||||
import uuid
|
||||
|
||||
# Django imports
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
from django.db import models
|
||||
from django.db.models.signals import post_save
|
||||
@ -94,8 +98,8 @@ class IssueManager(models.Manager):
|
||||
|
||||
def get_upload_path(instance, filename):
|
||||
if instance.workspace_id is not None:
|
||||
return f"{instance.workspace.id}/{uuid4().hex}"
|
||||
return f"user-{uuid4().hex}"
|
||||
return f"{instance.workspace.id}/{uuid.uuid4().hex}"
|
||||
return f"user-{uuid.uuid4().hex}"
|
||||
|
||||
|
||||
def file_size(value):
|
||||
|
Loading…
Reference in New Issue
Block a user