-
Notifications
You must be signed in to change notification settings - Fork 2
Add locale change stuff and tests from unicore-cms #21
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a1bed67
cleaning things up a bit, now with 2 new errors, mount your refactorc…
smn 5d05bb6
Merge branch 'feature/issue-21-add-locale-change' of github.com:unive…
smn 152c195
fixing 404 error
smn d0b88a7
Created filter to render language names correctly
nathanbegbie a4501f4
Corrected util test
nathanbegbie 7aadbe6
Fixed displayed languages
nathanbegbie 6e3d155
Changed stored language info as just a list of locales, not a dict of…
nathanbegbie 3eedefe
Adhered to Simon's slight preference
nathanbegbie 847129d
Added docstrings to util functions
nathanbegbie bd6a6b8
Removed trailing whitespace
nathanbegbie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,9 +42,34 @@ def wrapper(self, *args, **kwargs): | |
|
|
||
|
|
||
| def config_list(data): | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Someone should shout at me for not having added docstrings.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. <3 nice. |
||
| """ | ||
| A function that takes a string of values separated by newline characters | ||
| and returns a list of those values | ||
|
|
||
| :param func context_func: | ||
| A function which takes one argument, a string of values separated by | ||
| newline characters | ||
|
|
||
| :returns: | ||
| A list containing the values separated by newline characters, | ||
| stripped of whitespace between the value and newline character | ||
|
|
||
| """ | ||
| return filter(None, (x.strip() for x in data.splitlines())) | ||
|
|
||
|
|
||
| def config_dict(data): | ||
| """ | ||
| A function that takes a string of pair values, indicated by '=', separated | ||
| by newline characters and returns a dict of those value pairs | ||
|
|
||
| :param func context_func: | ||
| A function which takes one argument, a string of value pairs with | ||
| '= between them' separated by newline characters | ||
|
|
||
| :returns: | ||
| A dict containing the value pairs separated by newline characters | ||
|
|
||
| """ | ||
| lines = config_list(data) | ||
| return dict(re.split('\s*=\s*', value) for value in lines) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want to skip
lang_codehere if it's the same aslanguagebecause otherwise we'd potentially get it twice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's taken care of here https://github.com/universalcore/springboard/blob/feature/issue-21-add-locale-change/springboard/views.py#L55 in order to avoid duplication, but I'll put a check in the template, just to be sure