Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a51b52a
Adding in content from previous week
Jan 28, 2019
7b507c8
checking in stubs for list_lab
Jan 28, 2019
19382dd
done with series one
Jan 28, 2019
31d088e
Done with list_lab.py
Jan 29, 2019
17ac6a0
done with string formatting lab
Jan 29, 2019
1b73c2b
Mostly done with labs. On to mailroom assignment
Jan 29, 2019
e0329e5
working on mailroom
Jan 29, 2019
0f8e5e3
checking in mailroom code
Jan 30, 2019
3c527e7
final push for mailroom.py
Jan 30, 2019
aec8cbc
Restructuring for requested format and stubbing out session04 assignm…
Jan 31, 2019
d5915a9
cleaning up dir
Jan 31, 2019
6caeefd
Merge branch 'master' of https://github.com/rootrUW/Python210-W19
Feb 4, 2019
0ce7f2b
done with dictionaries
Feb 4, 2019
7ea5d2b
done with dictionaries 2
Feb 4, 2019
6ba47cb
done with sets
Feb 4, 2019
2b70fb6
done with sets 2
Feb 4, 2019
002a250
Done with katafourteen.py exercise
Feb 5, 2019
0ef7735
Updated code to use a dict to switch between the user’s selections
Feb 5, 2019
1a5d10b
Added new send letters to all donors features and got the function to…
Feb 5, 2019
b8f6df5
Updated create a report feature to work (mostly) correctly
Feb 6, 2019
14e559c
first commit for week 5
Feb 7, 2019
c6dbf10
Added headers to all files for week 5
Feb 7, 2019
02f2d77
Merge branch 'master' of https://github.com/rootrUW/Python210-W19
Feb 7, 2019
8d07098
Completed except_exercise.py
Feb 12, 2019
a3bf30e
Added code from mailroompart2.py
Feb 12, 2019
be16b40
Added try / catch (try / except) blocks for user input
Feb 12, 2019
4a57b68
Adding in mailroompart4
Feb 14, 2019
57f874d
Adding in unit tests
Feb 20, 2019
739884b
Realized I didn't need a separate file for unit tests lol
Feb 20, 2019
c7799bc
Added add_donation to support better unit tests
Feb 20, 2019
32cad91
Verified unit tests work as expected
Feb 20, 2019
233a774
Adding in method stubs for lesson 07
Feb 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions students/robert_kesterson/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions students/robert_kesterson/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions students/robert_kesterson/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions students/robert_kesterson/.idea/robert_kesterson.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions students/robert_kesterson/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

342 changes: 342 additions & 0 deletions students/robert_kesterson/.idea/workspace.xml

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions students/robert_kesterson/lesson07/html_render.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3

"""
A class-based system for rendering html.
"""


# This is the framework for the base class
class Element(object):

def __init__(self, content=None):
pass

def append(self, new_content):
pass

def render(self, out_file):
out_file.write("just something as a place holder...")
231 changes: 231 additions & 0 deletions students/robert_kesterson/lesson07/run_html_render.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
#!/usr/bin/env python3

"""
a simple script can run and test your html rendering classes.

Uncomment the steps as you add to your rendering.

"""

from io import StringIO

# importing the html_rendering code with a short name for easy typing.
import html_render as hr


# writing the file out:
def render_page(page, filename, indent=None):
"""
render the tree of elements

This uses StringIO to render to memory, then dump to console and
write to file -- very handy!
"""

f = StringIO()
if indent is None:
page.render(f)
else:
page.render(f, indent)

print(f.getvalue())
with open(filename, 'w') as outfile:
outfile.write(f.getvalue())


# Step 1
#########

page = hr.Element()

page.append("Here is a paragraph of text -- there could be more of them, "
"but this is enough to show that we can do some text")

page.append("And here is another piece of text -- you should be able to add any number")

render_page(page, "test_html_output1.html")

# The rest of the steps have been commented out.
# Uncomment them as you move along with the assignment.

# ## Step 2
# ##########

# page = hr.Html()

# body = hr.Body()

# body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
# "but this is enough to show that we can do some text"))

# body.append(hr.P("And here is another piece of text -- you should be able to add any number"))

# page.append(body)

# render_page(page, "test_html_output2.html")

# # Step 3
# ##########

# page = hr.Html()

# head = hr.Head()
# head.append(hr.Title("PythonClass = Revision 1087:"))

# page.append(head)

# body = hr.Body()

# body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
# "but this is enough to show that we can do some text"))
# body.append(hr.P("And here is another piece of text -- you should be able to add any number"))

# page.append(body)

# render_page(page, "test_html_output3.html")

# # Step 4
# ##########

# page = hr.Html()

# head = hr.Head()
# head.append(hr.Title("PythonClass = Revision 1087:"))

# page.append(head)

# body = hr.Body()

# body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
# "but this is enough to show that we can do some text",
# style="text-align: center; font-style: oblique;"))

# page.append(body)

# render_page(page, "test_html_output4.html")

# # Step 5
# #########

# page = hr.Html()

# head = hr.Head()
# head.append(hr.Title("PythonClass = Revision 1087:"))

# page.append(head)

# body = hr.Body()

# body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
# "but this is enough to show that we can do some text",
# style="text-align: center; font-style: oblique;"))

# body.append(hr.Hr())

# page.append(body)

# render_page(page, "test_html_output5.html")

# # Step 6
# #########

# page = hr.Html()

# head = hr.Head()
# head.append(hr.Title("PythonClass = Revision 1087:"))

# page.append(head)

# body = hr.Body()

# body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
# "but this is enough to show that we can do some text",
# style="text-align: center; font-style: oblique;"))

# body.append(hr.Hr())

# body.append("And this is a ")
# body.append( hr.A("http://google.com", "link") )
# body.append("to google")

# page.append(body)

# render_page(page, "test_html_output6.html")

# # Step 7
# #########

# page = hr.Html()

# head = hr.Head()
# head.append(hr.Title("PythonClass = Revision 1087:"))

# page.append(head)

# body = hr.Body()

# body.append( hr.H(2, "PythonClass - Class 6 example") )

# body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
# "but this is enough to show that we can do some text",
# style="text-align: center; font-style: oblique;"))

# body.append(hr.Hr())

# list = hr.Ul(id="TheList", style="line-height:200%")

# list.append( hr.Li("The first item in a list") )
# list.append( hr.Li("This is the second item", style="color: red") )

# item = hr.Li()
# item.append("And this is a ")
# item.append( hr.A("http://google.com", "link") )
# item.append("to google")

# list.append(item)

# body.append(list)

# page.append(body)

# render_page(page, "test_html_output7.html")

# # Step 8 and 9
# ##############

# page = hr.Html()


# head = hr.Head()
# head.append( hr.Meta(charset="UTF-8") )
# head.append(hr.Title("PythonClass = Revision 1087:"))

# page.append(head)

# body = hr.Body()

# body.append( hr.H(2, "PythonClass - Example") )

# body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
# "but this is enough to show that we can do some text",
# style="text-align: center; font-style: oblique;"))

# body.append(hr.Hr())

# list = hr.Ul(id="TheList", style="line-height:200%")

# list.append( hr.Li("The first item in a list") )
# list.append( hr.Li("This is the second item", style="color: red") )

# item = hr.Li()
# item.append("And this is a ")
# item.append( hr.A("http://google.com", "link") )
# item.append("to google")

# list.append(item)

# body.append(list)

# page.append(body)

# render_page(page, "test_html_output8.html")
27 changes: 27 additions & 0 deletions students/robert_kesterson/lesson07/sample_html.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Python Class Sample page</title>
</head>
<body>
<h2>Python Class - Html rendering example</h2>
<p style="text-align: center; font-style: oblique;">
Here is a paragraph of text -- there could be more of them, but this is enough to show that we can do some text
</p>
<hr />
<ul id="TheList" style="line-height:200%">
<li>
The first item in a list
</li>
<li style="color: red">
This is the second item
</li>
<li>
And this is a
<a href="http://google.com">link</a>
to google
</li>
</ul>
</body>
</html>
Loading