MCPcopy Create free account
hub / github.com/ActiveState/code / bookEntry

Function bookEntry

recipes/Python/123894_Text_Based_Guest_Book/recipe-123894.py:26–44  ·  view source on GitHub ↗
( entry )

Source from the content-addressed store, hash-verified

24# entry == the form dictionary
25# book == the guestbook file
26def bookEntry( entry ):
27 book = open( book_file_name, 'a')
28 book.write( '<TR><TD COLSPAN="2"><B>%s</B>' % entry['name'].value )
29 book.write( ''&#x27;
30 <HR WIDTH="100%"><BR>
31 </TD></TR>
32 <TR><TD VALIGN="TOP" ALIGN="RIGHT">
33 ''&#x27; )
34 if entry.has_key('email'):
35 email = entry['email'].value
36 book.write( '<A HREF="mailto:%s">\n %s\n</A>' % (email,email) )
37 book.write( '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n<BR>\n' )
38 if entry.has_key('website'):
39 website = entry['website'].value
40 book.write( '<A HREF="http://%s">\n %s\n</A>' % (website,website) )
41 book.write( '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n' )
42 book.write( '</TD><TD VALIGN="TOP">\n%s\n</TD></TR>\n' %entry['message'].value )
43 book.write( '<TR><TD><BR></TD></TR>\n\n\n' )
44 book.close() # This line was changed from the April 30 version
45
46
47###################

Callers 1

recipe-123894.pyFile · 0.85

Calls 4

openFunction · 0.50
writeMethod · 0.45
has_keyMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected