Validation details not showing


new to frappe development to learn frappe development i am following a library management tutorial for this link

i reached the chapter controller of first lesson and i followed instructions for validating about the library transaction but i not getting any validation after i write below code in library file

from future import unicode_literals
import frappe
from frappe.model.document import Document

class LibraryMembership(Document):
# validating is book issued or member exist
# validatae is a frappe event handler it will automatically called
def validate(self):
#select transaction,transaction_date from library_transacton where
#transaction_date<= user selected date and name= user selected date
last_transaction = frappe.get_list(“Library Transaction”,fields=[“transaction_type”,“transaction_date”],
filters = {“article”:self.article,“transaction_date”:(“<=”, self.transaction_date),“name”:(“!=”,
#checking user selected mode of transaction and if it is issue below code will work
if self.transaction_type==“Issue”:
# this msg will generate pop on prensatation layer which say selected article has not been returned since the last issued date
msg = (“Article {0} {1} has not been recorded as returned since {2}”)
# check in last transaction is issue and if it is then it will throw message using frappe.throw
# this error message has name of article,date of last transaction
if last_transaction and last_transaction[0].transaction_type==“Issue”:
# if user selcted transaction is return
# checks for the last transaction table is empty or last transaction is return
# if yes throw an error cannot return non issued books
if not last_transaction or last_transaction[0].transaction_type!=“Issue”:
(“Cannot return not issued”))

i have added comments to explain what i understand about the code if it is wrong please help me to correct myself so that i can improve in frappe development thanks

On what transaction is it not validating?

The relevant tutorial page has a helpful debugging tip at the end:

To Debug, always keep your JS Console open. Lookout for both Javascript and server tracebacks.

Also check your terminal window for exceptions. Any 500 Internal Server Errors will get printed in your terminal where on which your server is running.

See if notice these and post anything unexpected.

oh sorry i wrote the above code in wrong .py file so sorry