Compare commits
2 Commits
5478518d51
...
e71fd48975
Author | SHA1 | Date | |
---|---|---|---|
e71fd48975 | |||
c0e43dd48e |
@ -9,14 +9,13 @@ from .config import Config
|
||||
|
||||
|
||||
def format_event(event_details, truncate: bool):
|
||||
try:
|
||||
url = (
|
||||
"https://claremontmakerspace.org/events/#!event/register/"
|
||||
+ event_details["url"]
|
||||
)
|
||||
if "lgo" in event_details:
|
||||
img = (
|
||||
f"""<img class="alignleft" width="400" src="{event_details['lgo']['l']}">"""
|
||||
)
|
||||
img = f"""<img class="alignleft" width="400" src="{event_details['lgo']['l']}">"""
|
||||
else:
|
||||
img = ""
|
||||
# print(json.dumps(event_details))
|
||||
@ -33,6 +32,11 @@ def format_event(event_details, truncate: bool):
|
||||
|
||||
<a href="{url}">Register for this class now!</a>"""
|
||||
return out
|
||||
except KeyError as e:
|
||||
print(
|
||||
f"Event '{event_details.get('ttl')}' missing required property: '{e.args[0]}'"
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def format_section(title: str, blurb: str, events, truncate: bool):
|
||||
@ -62,6 +66,7 @@ def generate_post():
|
||||
full_events = []
|
||||
upcoming_events = []
|
||||
for event in events["evt"]:
|
||||
try:
|
||||
# ignore hidden events
|
||||
if event["cal"] == 0:
|
||||
continue
|
||||
@ -78,8 +83,14 @@ def generate_post():
|
||||
full_events.append(event_details)
|
||||
else:
|
||||
upcoming_events.append(event_details)
|
||||
except KeyError as e:
|
||||
print(
|
||||
f"Event '{event.get('ttl')}' missing required property: '{e.args[0]}'"
|
||||
)
|
||||
raise
|
||||
|
||||
header = """<p><img class="aligncenter size-medium wp-image-2319" src="https://claremontmakerspace.org/wp-content/uploads/2019/03/CMS-Logo-b-y-g-300x168.png" alt="" width="300" height="168" /></a></p>
|
||||
# header
|
||||
yield """<p><img class="aligncenter size-medium wp-image-2319" src="https://claremontmakerspace.org/wp-content/uploads/2019/03/CMS-Logo-b-y-g-300x168.png" alt="" width="300" height="168" /></a></p>
|
||||
<p>Greetings Upper Valley Makers:</p>
|
||||
<p>We have an exciting list of upcoming classes at the Claremont MakerSpace that we think might interest you.</p>
|
||||
<strong>For most classes and events, CMS MEMBERSHIP IS NOT REQUIRED.</strong> That said, members receive a discount on registration and there are some classes/events that are for members only (this will be clearly noted in the event description).
|
||||
@ -93,15 +104,6 @@ def generate_post():
|
||||
<hr />
|
||||
"""
|
||||
|
||||
footer = """<div style="clear: both;">
|
||||
<hr />
|
||||
|
||||
<div>Happy Makin’!</div>
|
||||
<div>We are grateful for all of the public support that our 501(c)(3), non-profit organization receives. If you’d like to make a donation,please visit the <a href="https://claremontmakerspace.org/support/"><strong>Support Us page</strong></a> of our website.</div>
|
||||
</div>
|
||||
"""
|
||||
|
||||
yield header
|
||||
yield format_section(
|
||||
"Upcoming Events",
|
||||
"Events that are currently open for registration.",
|
||||
@ -123,7 +125,14 @@ def generate_post():
|
||||
truncate=True,
|
||||
)
|
||||
|
||||
yield (footer)
|
||||
# footer
|
||||
yield """<div style="clear: both;">
|
||||
<hr />
|
||||
|
||||
<div>Happy Makin’!</div>
|
||||
<div>We are grateful for all of the public support that our 501(c)(3), non-profit organization receives. If you’d like to make a donation,please visit the <a href="https://claremontmakerspace.org/support/"><strong>Support Us page</strong></a> of our website.</div>
|
||||
</div>
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
|
Reference in New Issue
Block a user