Compare commits

..

1 Commits

Author SHA1 Message Date
Patrick Melanson 73bbf6bb33 Use currently-logged-in user to authenticate for mass email sending.
Basically, this commit removes email sending code that asked the
user for a CSC username and email to authenticate to an SMTP server
to send a mass email. Now, we just use the system utility 'sendmail'
to do it, which means you don't have to enter in your email creds
to send a mass email once you're already logged in.

Magic!
2017-08-28 16:51:14 -04:00
5 changed files with 26 additions and 63 deletions

1
TODO
View File

@ -6,7 +6,6 @@ Support for multiple copies
- (better support, that is)
Search function in db_layer
- eventually something which takes things like "title:foo author:bar some other keywords"
Don't let patrons with overdue books checkout more books
_Code Quality Improvements_

23
debian/changelog vendored
View File

@ -1,28 +1,9 @@
library (1.1-0~bionic0) bionic; urgency=medium
library (1.0-4stretch0) UNRELEASED; urgency=medium
* Package for bionic
-- Charlie Wang <s455wang@csclub.uwaterloo.ca> Sun, 17 Feb 2019 21:45:27 -0500
library (1.1-0~xenial0) xenial; urgency=medium
* Package for xenial
-- Zachary Seguin <ztseguin@csclub.uwaterloo.ca> Sun, 15 Apr 2018 16:16:07 -0400
library (1.1-0~buster0) buster; urgency=medium
* Package for buster
-- Zachary Seguin <ztseguin@csclub.uwaterloo.ca> Sun, 15 Apr 2018 16:14:05 -0400
library (1.1-0~stretch0) stretch; urgency=medium
[ Patrick James Melanson ]
* New menu option to send out mass email for overdue books
* Community effort by Connor Murphy, Charlie Wang, Patrick Melanson
-- Zachary Seguin <ztseguin@csclub.uwaterloo.ca> Sun, 15 Apr 2018 16:12:58 -0400
-- Patrick James Melanson <pj2melan@csclub.uwaterloo.ca> Sat, 29 Jul 2017 15:12:12 -0400
library (1.0-3stretch0) stretch; urgency=medium

View File

@ -10,9 +10,7 @@ import library.interface.sendemails as sendemails
from library import book_data
class SmallScreenException(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
stdscr=0
hb=0
@ -38,16 +36,11 @@ def menutest(s, l):
try:
menu(w, l)
except SystemExit: pass
except SmallScreenException:
text = """That's a small screen!
This librarian program won't work with a small screen.
Make your terminal window bigger and try again."""
form.error_form(text, stdscr, hb)
raise
except:
text = """An unexpected error occured.
Email the librarian (librarian@csclub.uwaterloo.ca)
with python's output after this program quits.
You can contact the librarian (librarian@csclub.uwaterloo.ca),
but given the history of the library system, it seems unlikely
that somebody will be around to care.
The program will now quit."""
form.error_form(text, stdscr, hb)
raise
@ -108,10 +101,7 @@ def addForm():
(my,mx)=stdscr.getmaxyx()
bf = form.BookForm(w,hb,width=mx-20)
(r,c)=w.getmaxyx()
try:
w.mvwin((my-r)//2,(mx-c)//2)
except curses.error as exc:
raise SmallScreenException("Terminal screen too small. Try again with a bigger terminal.") from exc
w.mvwin((my-r)//2,(mx-c)//2)
bf.lookup_isbn=book_data.openLibrary_isbn
bf.lookup_lccn=book_data.openLibrary_lccn
bf.caption='Add a Book'
@ -126,10 +116,7 @@ def browseMenu():
b = browser.bookBrowser(w,hb)
(r,c) = w.getmaxyx()
(my,mx)=stdscr.getmaxyx()
try:
w.mvwin((my-r)//2 -2, (mx-c)//2)
except curses.error as exc:
raise SmallScreenException("Terminal screen too small. Try again with a bigger terminal.") from exc
w.mvwin((my-r)//2 -2, (mx-c)//2)
b.refreshBooks()
b.eventLoop()
b.clear()
@ -139,10 +126,7 @@ def trashMenu():
b = browser.trashBrowser(w,hb)
(r,c) = w.getmaxyx()
(my,mx)=stdscr.getmaxyx()
try:
w.mvwin((my-r)//2 -2, (mx-c)//2)
except curses.error as exc:
raise SmallScreenException("Terminal screen too small. Try again with a bigger terminal.") from exc
w.mvwin((my-r)//2 -2, (mx-c)//2)
b.refreshBooks()
b.eventLoop()
b.clear()
@ -152,10 +136,7 @@ def uncategorizedMenu():
b = browser.bookBrowser(w,hb)
(r,c) = w.getmaxyx()
(my,mx)=stdscr.getmaxyx()
try:
w.mvwin((my-r)//2 -2, (mx-c)//2)
except curses.error as exc:
raise SmallScreenException("Terminal screen too small. Try again with a bigger terminal.") from exc
w.mvwin((my-r)//2 -2, (mx-c)//2)
b.refreshBooksUncategorized()
b.eventLoop()
b.clear()
@ -165,10 +146,7 @@ def checkedout_menu():
b = browser.bookBrowser(w,hb)
(r,c) = w.getmaxyx()
(my,mx)=stdscr.getmaxyx()
try:
w.mvwin((my-r)//2 -2, (mx-c)//2)
except curses.error as exc:
raise SmallScreenException("Terminal screen too small. Try again with a bigger terminal.") from exc
w.mvwin((my-r)//2 -2, (mx-c)//2)
b.refreshBooksCheckedout()
b.columnDefs = [("id",0,3),
("uwid",0,8),
@ -183,10 +161,7 @@ def onshelf_menu():
b = browser.bookBrowser(w,hb)
(r,c) = w.getmaxyx()
(my,mx)=stdscr.getmaxyx()
try:
w.mvwin((my-r)//2 -2, (mx-c)//2)
except curses.error as exc:
raise SmallScreenException("Terminal screen too small. Try again with a bigger terminal.") from exc
w.mvwin((my-r)//2 -2, (mx-c)//2)
b.refreshBooksOnshelf()
b.eventLoop()
b.clear()
@ -206,10 +181,7 @@ def catMenu():
w=curses.newwin(3,5)
cat = browser.categoryBrowser(w,hb)
(r,c) = w.getmaxyx()
try:
w.mvwin((my-r)//2 -2, (mx-c)//2)
except curses.error as exc:
raise SmallScreenException("Terminal screen too small. Try again with a bigger terminal.") from exc
w.mvwin((my-r)//2 -2, (mx-c)//2)
cat.refreshCategories()
cat.sortByColumn('category')
cat.eventLoop()

View File

@ -23,8 +23,6 @@ Our records indicate that you have had the book {} signed out for {} days.
If you would like to keep this book checked out, tell us when in the next month you will return this book.
If you think you have received this message in error, reply back to this email please!
Otherwise, please return the book to the CS Club office (MC 3036) at your earliest convenience.
Thank you for using the CS Club library!

View File

@ -283,6 +283,19 @@ class FormWindow:
if self.bt==-1:
self.entries[self.hl].handle_input(ch)
class LoginForm(FormWindow):
caption = "Enter your csclub login to access the mail server"
blabel = "Login"
labels = ["ID", "Password"]
def _make_entries(self):
self.entries = []
self.entries.append(TextEntry(self.w))
self.entries.append(PasswordEntry(self.w))
def _return_values(self):
return [self.entries[0].value, self.entries[1].value]
class BookForm(FormWindow):
caption = "Add a Book"
blabel = "Add"