Skip to content

Commit

Permalink
Merge pull request #1106 from xzzy/master2
Browse files Browse the repository at this point in the history
Package patching
  • Loading branch information
xzzy authored Dec 4, 2024
2 parents 3e8c480 + 07e92f1 commit eebbcbf
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
38 changes: 38 additions & 0 deletions ledger/accounts/management/commands/clean_privatedocuments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from django.core.management.base import BaseCommand, CommandError
from ledger.address.models import UserAddress
from ledger.accounts.models import PrivateDocument,EmailUser
from django.db.models import Q

class Command(BaseCommand):
help = 'Cleans up private documents table.'

def add_arguments(self, parser):
pass

def handle(self, *args, **options):
try:
query_string = Q(extension='') | Q(extension=None)
pd = PrivateDocument.objects.filter(query_string)
print ("Total Results: "+str(pd.count()))
for p in pd:


ext = ''
if p.upload.path[-4] == '.':
ext = p.upload.path[-4:]
if p.upload.path[-5] == '.':
ext = p.upload.path[-5:]


if len(ext) > 0:
print (p.id)
print (p.upload.path)
p.extension = ext
p.name = 'file'+ext
eu = EmailUser.objects.filter(identification2=p.id)
print (eu)
if eu.count() > 0:
p.file_group=1
p.save()
except Exception as e:
raise CommandError(e)
3 changes: 3 additions & 0 deletions python-cron
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@

# App Monitor Client
10 9 * * * python3 /app/manage_ledgergw.py appmonitor_check >> /app/logs/appmonitor_client.log 2>&1

# Fix private documents information
10 * * * * python /app/manage_ledgergw.py clean_privatedocuments >> /app/logs/clean_privatedocuments.log
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ git+https://github.com/scottp-dpaw/social-core.git@email_fix#egg=social-auth-cor
webtemplate-dbca==0.6.0
coverage==4.3.1
coveralls==1.1
reportlab==3.5.26
reportlab==4.2.5
#django_bootstrap3==7.1.0
django_bootstrap3==12.0.3
django-braces>=1.8.1
Expand All @@ -34,7 +34,6 @@ django-ical==1.4
django-taggit==0.21.3
geojson==1.3.3
unicodecsv==0.14.1
PyPDF2==1.26.0
django-extra-fields==0.9
django-crispy-forms==1.9.0
django-reset-migrations==0.3.1
Expand Down

0 comments on commit eebbcbf

Please sign in to comment.