Ticket #52 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Fix long strings to conform with the new guidelines

Reported by: ctrochalakis Owned by: Telimektar
Priority: major Milestone:
Component: Core Version: devel
Keywords: easy_task Cc:
Easy Task: Blocked By:
Blocking: Ready for Review:
Patch Review: Needs Patch:

Description

New style:

    def lorem_ipsum():
       description = _(
           "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas "
           "nisl leo, suscipit sed, elementum ac, condimentum eget, augue. "
           "Pellentesque consequat posuere metus. Curabitur scelerisque faucibus "
           "massa. Vestibulum ut nisl ut leo cursus commodo."
       )

Attachments

ticket52-1.bundle Download (0.8 MB) - added by Telimektar 2 years ago.
First attempt of patch for Ticket 52
ticket52-2.bundle Download (2.0 KB) - added by Telimektar 2 years ago.
Second attempt for fixing #52

Change History

  Changed 2 years ago by Telimektar

  • owner changed from Dimitris Glezos to Telimektar
  • status changed from new to assigned

  Changed 2 years ago by Telimektar

Do we apply this only to inline long strings ? Or do we extend this to text blocks (options descriptions, big print (except docstrings that follows their own PEP)) ?

  Changed 2 years ago by ctrochalakis

Yup, every string is included. This is done mainly because of the strings that break indenting levels.

  Changed 2 years ago by Telimektar

Ok, I think I have made the whole changes.
There were only a few strings that need changes. I hope my work will be the one awaited.
You can find the bundle attached.
I'm not familiar with Mercurial so I could have done a mistake, please let me know !

Changed 2 years ago by Telimektar

First attempt of patch for Ticket 52

follow-ups: ↓ 6 ↓ 9   Changed 2 years ago by glezos

The patch could have a couple of things fixed before it's ready for mainline:

  • Running python setup.py gets us a syntax error -- multi-line strings should be in ( parenthesis ), as described in the guideline.
  • The test suite should succeed (in our case, only return 2 errors)
  • The patch changes some things that it shouldn't (for example, it alters the file transifex/tests/test_model.py.

I have a few comments on the patch itself. To be more efficient, it would be better to have a discussion on the mailing list with the patch inline. To do so, please send the patch using hg email (as described in Development/Workflow.

Awaiting the updated version.

in reply to: ↑ 5 ; follow-up: ↓ 7   Changed 2 years ago by ctrochalakis

* Running python setup.py gets us a syntax error -- multi-line strings should be in ( parenthesis ), as described in the guideline.

python setup.py doesn't work because of an IndentationError?. You just need to get the strings 1 tab inside to match long_desc indent:

long_description = "Transifex is a highly scalable localization platform with a "
"focus on integrating well with the existing workflow of both translators "
"and developers. It aims in making it dead-simple for content providers to "
"receive quality translations from big translation communities, no matter "
"where the project is hosted."

So you don't have to use parenthesis or '\' chars python automatically concatenates adjacent strings.

About the patch, it seems that you have reverted some the recent commits we made in transifex mainline :) So after you fix the indenting error recompute the patch on top of the tip version of the repository and email it.

If you need any help, we ll probably be at #transifex :)

in reply to: ↑ 6   Changed 2 years ago by glezos

Replying to ctrochalakis:

python setup.py doesn't work because of an IndentationError?. You just need to get the strings 1 tab inside to match long_desc indent:

I prefer the use of parenthesis, which produces cleaner code, does not need deep indentation, keeps the guideline consistent and is closer to  PEP 8. Example:

long_description = ("Transifex is a highly scalable localization platform with a "
    "focus on integrating well with the existing workflow of both translators "
    "..."
)

Please use this syntax for any long string like the long_description one.

  Changed 2 years ago by glezos

One changeset which was reverted back was 378%3A6f693980b9d4.

in reply to: ↑ 5   Changed 2 years ago by Telimektar

Replying to glezos:

The patch could have a couple of things fixed before it's ready for mainline:

* Running python setup.py gets us a syntax error -- multi-line strings should be in ( parenthesis ), as described in the guideline.
* The test suite should succeed (in our case, only return 2 errors)
* The patch changes some things that it shouldn't (for example, it alters the file transifex/tests/test_model.py.

I have a few comments on the patch itself. To be more efficient, it would be better to have a discussion on the mailing list with the patch inline. To do so, please send the patch using hg email (as described in Development/Workflow.

Awaiting the updated version.

Hi and thanks all for your comments !

The patch altered recent revisions for id did not know about the pull command.
Now it's ok.

I'm going to put the patch bundle on the mailing-list. Please note that I cannot use hg email due to somes connection limitations (I can only use port 80 and 443).

Changed 2 years ago by Telimektar

Second attempt for fixing #52

  Changed 2 years ago by ctrochalakis

  • status changed from assigned to closed
  • resolution set to fixed

Pushed in r384

If you cant send the patch by email you can upload here (trac). Here is how you can create such a patch using mercurial:

hg pull tx-mainline
hg merge (if new heads were introduced)
hg ci -m 'merged with upstream'
hg diff -r<tx-tip>:tip >mypatch.diff #tx-tip is the tip revision of transifex in our servers
upload mypatch.diff here

You can avoid all the above if you use mercurial queues or transplant extention but those could be a bit dangerous.

Note: See TracTickets for help on using tickets.