Skip to content

Commit

Permalink
Added function to remove whitespace
Browse files Browse the repository at this point in the history
There was a problem with formatting when posting to space if there was a trailing or leading space in Subject. Added function to remove the spaces.
  • Loading branch information
naitmare01 authored Sep 11, 2018
1 parent 782657f commit c1047e1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion services/webexTeams.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
from flata import Query, where
from . import log

#Remove whitespace from trailing and leading
def remove_whitespace(text):
cleanedtext = text.rstrip().lstrip()

return cleanedtext

#Send data to Cisco Teams space.
def send_it(token, room_id, message):
Expand Down Expand Up @@ -42,6 +47,9 @@ def buildJson(jsonObject):
lastUpdated = n["Updated"]
tags = ""
incidentId = n["Id"]

#Clean whitespace from subject to avoid formating error when posting to space.
subject = remove_whitespace(subject)

if n["NewsType"]:
type = type = n["NewsType"]["Name"]
Expand Down Expand Up @@ -102,4 +110,4 @@ def postToSpace(objectset, database, logdb, botToken, roomId):
database.update(n, where('IncidentId') == incidentIddb)
send_it(botToken, roomId, n)

logdb.insert(log.log("New update on object with incidentID of: " + incidentIddb))
logdb.insert(log.log("New update on object with incidentID of: " + incidentIddb))

0 comments on commit c1047e1

Please sign in to comment.