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

Add longer text strings to mailbox demo to test string truncation #8893

Merged
merged 3 commits into from
Aug 8, 2017

Conversation

PhracturedBlue
Copy link
Contributor

Description:

This is just a minor change to add longer text messages to the mailbox demo to make it easier to test string truncation in the frontend.
I would like the frontend to show only the 1st 2 lines of a message, and need longer messages to demonstrate that. This code has no other effect, and if the current frontend code is sufficient, maybe no need to pull this change.

The related frontend request is here:
home-assistant/frontend#319

Checklist:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass

@@ -0,0 +1,7 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta, odio vitae volutpat sollicitudin, neque odio lacinia lorem, non auctor metus lorem id arcu. Integer mollis luctus velit id pharetra. In id sagittis metus. Mauris ultricies, lorem et pulvinar ornare, metus augue iaculis enim, ullamcorper dictum ipsum urna sit amet augue. Nunc dapibus libero quis dui semper scelerisque. Nam dapibus feugiat est ac dapibus. Suspendisse sit amet odio ac turpis commodo volutpat ut ut massa. Etiam quam mauris, tincidunt at orci ut, eleifend aliquam sem.
Copy link
Member

Choose a reason for hiding this comment

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

Let's not include this file but instead just generate some text on the fly. It's ok to be garbage. Otherwise we're going to ship 2.2kB to every user forever just for a demo.

Copy link
Member

Choose a reason for hiding this comment

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

text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " * 10

for idx in range(0, 10):
msgtime = int(dt.as_timestamp(
dt.utcnow()) - 3600 * 24 * (10 - idx))
msgtxt = "This is recorded message # %d" % (idx)
msgtxt = ("Message %d. %s" %
Copy link
Member

Choose a reason for hiding this comment

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

Please use the string format function instead '%' -> "Bla {} is {}".format(1, 2)

@pvizeli pvizeli merged commit 19ee3c4 into home-assistant:dev Aug 8, 2017
@fabaff fabaff mentioned this pull request Aug 12, 2017
dethpickle pushed a commit to dethpickle/home-assistant that referenced this pull request Aug 18, 2017
…me-assistant#8893)

* Add longer text strings to mailbox demo to test string truncation in frontend

* Remove lorem ipsum txt file

* Use format instead of %
@home-assistant home-assistant locked and limited conversation to collaborators Dec 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants