Skip to content

Commit

Permalink
Removing html elements from events description.
Browse files Browse the repository at this point in the history
  • Loading branch information
edenxcodes authored and oliviasculley committed Sep 28, 2023
1 parent be2156b commit 209cd7b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,39 @@
from dateutil import parser


# import regular expression module
import re



class Event:
"""Event records all the data from an event, and has methods to generate the
message from an event
"""

# pylint: disable=too-many-instance-attributes
# Events have lots of data that we need to save together



def __init__(
self, title, group_name, description, location, time, url, status, uuid
):
# pylint: disable=too-many-arguments
self.title = title
self.group_name = group_name
self.description = description
self.description = self.remove_html(description)
self.location = location
self.time = time
self.url = url
self.status = status
self.uuid = uuid

def remove_html(self, string):
regex = re.compile(r'<[^>]+>')
return regex.sub('', string)


# creates a struct of event information used to compose different formats of the event message
@classmethod
def from_event_json(cls, event_json):
Expand Down

0 comments on commit 209cd7b

Please sign in to comment.