This repository has been archived by the owner on Dec 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Sourcery refactored master branch #6
Open
sourcery-ai
wants to merge
1
commit into
master
Choose a base branch
from
sourcery/master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 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 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 |
---|---|---|
|
@@ -16,18 +16,19 @@ | |
ELRTE_DEFAULT_OPTIONS = { | ||
'doctype': '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', | ||
'cssClass': 'el-rte', | ||
'cssfiles': ['%selrte-inner.css' % elrte.settings.CSS_BASE_URL], | ||
'cssfiles': [f'{elrte.settings.CSS_BASE_URL}elrte-inner.css'], | ||
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. Lines
This removes the following comments ( why? ):
|
||
'absoluteURLs': True, | ||
'allowSource': True, | ||
'lang': 'en', | ||
'styleWithCss': False, | ||
'height': None, | ||
'fmAllow': True, | ||
'toolbar': 'normal', | ||
# 'fmOpen': FileManagerOpener(), | ||
} | ||
|
||
ELRTE_LANG_INCLUSION = 'i18n/elrte.%s.js' % getattr(ELRTE_DEFAULT_OPTIONS, 'lang', 'en') | ||
ELRTE_LANG_INCLUSION = ( | ||
f"i18n/elrte.{getattr(ELRTE_DEFAULT_OPTIONS, 'lang', 'en')}.js" | ||
) | ||
|
||
|
||
class FileManagerOpener(object): | ||
|
@@ -68,7 +69,7 @@ def render(self, name, value, attrs=None): | |
final_attrs = self.build_attrs(attrs) | ||
final_attrs['name'] = name | ||
config = self.get_config(name) | ||
html = [u'<textarea%s>%s</textarea>' % (flatatt(final_attrs), escape(value))] | ||
html = [f'<textarea{flatatt(final_attrs)}>{escape(value)}</textarea>'] | ||
Comment on lines
-71
to
+72
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. Function
|
||
html.append(u'<input type="hidden" name="%(name)s_img" id="%(name)s_img">' % {'name': name}) | ||
html.append(config) | ||
return mark_safe(u'\n'.join(html)) | ||
|
@@ -91,25 +92,16 @@ class AdminElrteTextareaWidget(ElrteTextareaWidget, admin_widgets.AdminTextareaW | |
|
||
def get_language_config(content_language=None): | ||
language = get_language()[:2] | ||
if content_language: | ||
content_language = content_language[:2] | ||
else: | ||
content_language = language | ||
|
||
config = {} | ||
config['language'] = language | ||
|
||
content_language = content_language[:2] if content_language else language | ||
config = {'language': language} | ||
lang_names = SortedDict() | ||
for lang, name in settings.LANGUAGES: | ||
if lang[:2] not in lang_names: lang_names[lang[:2]] = [] | ||
lang_names[lang[:2]].append(_(name)) | ||
sp_langs = [] | ||
for lang, names in lang_names.items(): | ||
if lang == content_language: | ||
default = '+' | ||
else: | ||
default = '' | ||
sp_langs.append(u'%s%s=%s' % (default, ' / '.join(names), lang)) | ||
default = '+' if lang == content_language else '' | ||
sp_langs.append(f"{default}{' / '.join(names)}={lang}") | ||
Comment on lines
-94
to
+104
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. Function
|
||
|
||
config['spellchecker_languages'] = ','.join(sp_langs) | ||
|
||
|
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.
Lines
25-51
refactored with the following changes:replace-interpolation-with-fstring
)