Skip to content

Commit

Permalink
further refoctor default render emailMarketingManager
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Mar 5, 2021
1 parent 5b698c1 commit 5d41b30
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions emailMarketing/emailMarketingManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import json
from random import randint
import time

from plogical.httpProc import httpProc
from .models import EmailMarketing, EmailLists, EmailsInList, EmailJobs
from websiteFunctions.models import Websites
Expand All @@ -14,7 +13,6 @@
from .models import SMTPHosts, EmailTemplate
from loginSystem.models import Administrator
from .emACL import emACL
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging

class EmailMarketingManager:

Expand Down Expand Up @@ -115,7 +113,7 @@ def createEmailList(self):
if emACL.checkIfEMEnabled(admin.userName) == 0:
return ACLManager.loadError()

proc = httpProc(self.request, 'emailMarketing/createEmailList.html', {'domain': self.domain}, 'admin')
proc = httpProc(self.request, 'emailMarketing/createEmailList.html', {'domain': self.domain})
return proc.render()
except KeyError as msg:
return redirect(loadLoginPage)
Expand Down Expand Up @@ -161,6 +159,7 @@ def manageLists(self):
userID = self.request.session['userID']
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)

if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
pass
else:
Expand All @@ -171,14 +170,15 @@ def manageLists(self):

listNames = emACL.getEmailsLists(self.domain)

proc = httpProc(self.request, 'emailMarketing/manageLists.html', {'listNames': listNames, 'domain': self.domain}, 'admin')
proc = httpProc(self.request, 'emailMarketing/manageLists.html', {'listNames': listNames, 'domain': self.domain})
return proc.render()

except KeyError as msg:
return redirect(loadLoginPage)

def configureVerify(self):
try:

userID = self.request.session['userID']
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
Expand All @@ -192,7 +192,7 @@ def configureVerify(self):
return ACLManager.loadError()

proc = httpProc(self.request, 'emailMarketing/configureVerify.html',
{'domain': self.domain}, 'admin')
{'domain': self.domain})
return proc.render()

except KeyError as msg:
Expand Down Expand Up @@ -490,7 +490,7 @@ def manageSMTP(self):
listNames.append(items.listName)

proc = httpProc(self.request, 'emailMarketing/manageSMTPHosts.html',
{'listNames': listNames, 'domain': self.domain}, 'admin')
{'listNames': listNames, 'domain': self.domain})
return proc.render()
except KeyError as msg:
return redirect(loadLoginPage)
Expand Down Expand Up @@ -659,7 +659,7 @@ def composeEmailMessage(self):
return ACLManager.loadErrorJson()

proc = httpProc(self.request, 'emailMarketing/composeMessages.html',
None, 'admin')
None)
return proc.render()
except KeyError as msg:
return redirect(loadLoginPage)
Expand Down Expand Up @@ -714,7 +714,7 @@ def sendEmails(self):
Data['listNames'] = listNames

proc = httpProc(self.request, 'emailMarketing/sendEmails.html',
Data, 'admin')
Data)
return proc.render()

except KeyError as msg:
Expand Down

0 comments on commit 5d41b30

Please sign in to comment.