mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-04 03:27:12 -05:00 
			
		
		
		
	fixup: remove helper fn 'make_dirs'
This commit is contained in:
		
							parent
							
								
									3e8038577d
								
							
						
					
					
						commit
						bccac5017c
					
				@ -48,7 +48,7 @@ class Consumer:
 | 
				
			|||||||
        self.consume = consume
 | 
					        self.consume = consume
 | 
				
			||||||
        self.scratch = scratch
 | 
					        self.scratch = scratch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        make_dirs(self.scratch)
 | 
					        os.makedirs(self.scratch, exists_ok=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if not self.consume:
 | 
					        if not self.consume:
 | 
				
			||||||
            raise ConsumerError(
 | 
					            raise ConsumerError(
 | 
				
			||||||
@ -247,11 +247,3 @@ class Consumer:
 | 
				
			|||||||
        with open(doc, "rb") as f:
 | 
					        with open(doc, "rb") as f:
 | 
				
			||||||
            checksum = hashlib.md5(f.read()).hexdigest()
 | 
					            checksum = hashlib.md5(f.read()).hexdigest()
 | 
				
			||||||
        return Document.objects.filter(checksum=checksum).exists()
 | 
					        return Document.objects.filter(checksum=checksum).exists()
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def make_dirs(*dirs):
 | 
					 | 
				
			||||||
    for dir in dirs:
 | 
					 | 
				
			||||||
        try:
 | 
					 | 
				
			||||||
            os.makedirs(dir)
 | 
					 | 
				
			||||||
        except FileExistsError:
 | 
					 | 
				
			||||||
            pass
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ import time
 | 
				
			|||||||
from django.conf import settings
 | 
					from django.conf import settings
 | 
				
			||||||
from django.core.management.base import BaseCommand, CommandError
 | 
					from django.core.management.base import BaseCommand, CommandError
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from ...consumer import Consumer, ConsumerError, make_dirs
 | 
					from ...consumer import Consumer, ConsumerError
 | 
				
			||||||
from ...mail import MailFetcher, MailFetcherError
 | 
					from ...mail import MailFetcher, MailFetcherError
 | 
				
			||||||
 | 
					
 | 
				
			||||||
try:
 | 
					try:
 | 
				
			||||||
@ -80,7 +80,8 @@ class Command(BaseCommand):
 | 
				
			|||||||
        except (ConsumerError, MailFetcherError) as e:
 | 
					        except (ConsumerError, MailFetcherError) as e:
 | 
				
			||||||
            raise CommandError(e)
 | 
					            raise CommandError(e)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        make_dirs(self.ORIGINAL_DOCS, self.THUMB_DOCS)
 | 
					        for d in (self.ORIGINAL_DOCS, self.THUMB_DOCS):
 | 
				
			||||||
 | 
					            os.makedirs(d, exists_ok=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        logging.getLogger(__name__).info(
 | 
					        logging.getLogger(__name__).info(
 | 
				
			||||||
            "Starting document consumer at {}{}".format(
 | 
					            "Starting document consumer at {}{}".format(
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user