Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comma escape #1755

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 8 additions & 1 deletion app/main/views/send.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pipes import quote
import time
import uuid
from string import ascii_uppercase
Expand Down Expand Up @@ -93,6 +94,7 @@ def get_example_csv_rows(template, use_example_as_example=True, submitted_fields
)
@user_has_permissions("send_messages", restrict_admin_usage=True)
def send_messages(service_id, template_id):
print(hilite("top of send_messages"))
notification_count = service_api_client.get_notification_count(service_id)
remaining_messages = current_service.message_limit - notification_count

Expand Down Expand Up @@ -485,6 +487,7 @@ def send_one_off_step(service_id, template_id, step_index):


def _check_messages(service_id, template_id, upload_id, preview_row, **kwargs):
print(hilite("top of _check_messages"))
try:
# The happy path is that the job doesn’t already exist, so the
# API will return a 404 and the client will raise HTTPError.
Expand Down Expand Up @@ -620,6 +623,7 @@ def _check_messages(service_id, template_id, upload_id, preview_row, **kwargs):
@user_has_permissions("send_messages", restrict_admin_usage=True)
def check_messages(service_id, template_id, upload_id, row_index=2):
data = _check_messages(service_id, template_id, upload_id, row_index)
print(hilite(f"data after checking messages: \n {data}"))
data["allowed_file_extensions"] = Spreadsheet.ALLOWED_FILE_EXTENSIONS

if (
Expand Down Expand Up @@ -956,7 +960,10 @@ def send_notification(service_id, template_id):
values = []
for k, v in session["placeholders"].items():
keys.append(k)
values.append(v)
print(hilite(f"value: {v} type: {type(v)}"))
value_quotes = '"' + v + '"'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    value_quotes = f'"{v}"'

Would be more efficient/cleaner.

print(hilite(f"value with quotes: {value_quotes}"))
values.append(value_quotes)

data = ",".join(keys)
vals = ",".join(values)
Expand Down
4 changes: 4 additions & 0 deletions poetry.lock

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

Loading