-
Notifications
You must be signed in to change notification settings - Fork 60
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
Differentiate Exceptions from License Submission #471
Changes from all commits
17bbfec
68ec7f1
eb04be8
2f0f1ba
6a0795f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,3 +132,4 @@ data/certbot/ | |
|
||
container_logs | ||
|
||
node_modules/ |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -28,6 +28,32 @@ | |||||||||
("Unknown", "Don't know") | ||||||||||
) | ||||||||||
|
||||||||||
YES_NO_CHOICES = ( | ||||||||||
(True, 'Yes'), | ||||||||||
(False, 'No'), | ||||||||||
) | ||||||||||
|
||||||||||
class TooltipTextInput(forms.TextInput): | ||||||||||
def __init__(self, tooltip='', attrs=None): | ||||||||||
super().__init__(attrs) | ||||||||||
self.tooltip = tooltip | ||||||||||
|
||||||||||
def get_context(self, name, value, attrs): | ||||||||||
context = super().get_context(name, value, attrs) | ||||||||||
context['widget']['attrs']['data-toggle'] = 'tooltip' | ||||||||||
context['widget']['attrs']['title'] = self.tooltip | ||||||||||
return context | ||||||||||
|
||||||||||
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. W293: blank line contains whitespace ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||
class CustomSelectWidget(forms.Select): | ||||||||||
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. E302: expected 2 blank lines, found 1 ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||
def __init__(self, *args, **kwargs): | ||||||||||
self.tooltip = kwargs.pop('tooltip', '') # Get the tooltip text from widget attributes | ||||||||||
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. E501: line too long (95 > 79 characters) ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||
super().__init__(*args, **kwargs) | ||||||||||
|
||||||||||
def get_context(self, name, value, attrs): | ||||||||||
context = super().get_context(name, value, attrs) | ||||||||||
context['widget'].update({'attrs': {'title': self.tooltip}}) # Add the title attribute to the widget | ||||||||||
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. E501: line too long (109 > 79 characters) ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||
return context | ||||||||||
|
||||||||||
class UserRegisterForm(forms.ModelForm): | ||||||||||
|
||||||||||
password = forms.CharField(widget=forms.PasswordInput()) | ||||||||||
|
@@ -75,12 +101,19 @@ def __init__(self, *args, **kwargs): | |||||||||
super(LicenseRequestForm, self).__init__(*args,**kwargs) | ||||||||||
self.fields["userEmail"] = forms.EmailField(label='Email', initial=self.email, max_length=35, required=False) | ||||||||||
|
||||||||||
licenseAuthorName = forms.CharField(label="License Author name", max_length=100, required=False) | ||||||||||
fullname = forms.CharField(label="Fullname", max_length=70) | ||||||||||
shortIdentifier = forms.CharField(label='Short identifier', max_length=25) | ||||||||||
sourceUrl = forms.CharField(label='Source / URL', required=False) | ||||||||||
osiApproved = forms.CharField(label="OSI Status", widget=forms.Select(choices=OSI_CHOICES)) | ||||||||||
exampleUrl = forms.CharField(label='Example Projects / URL', required=True) | ||||||||||
licenseAuthorName = forms.CharField(label="License Author name", max_length=100, required=False, widget=TooltipTextInput(tooltip='License Author name text goes here')) | ||||||||||
fullname = forms.CharField(label="Fullname", max_length=70, widget=TooltipTextInput(tooltip='Tooltip text goes here')) | ||||||||||
shortIdentifier = forms.CharField(label='Short identifier', max_length=25, widget=TooltipTextInput(tooltip='Tooltip text goes here')) | ||||||||||
sourceUrl = forms.CharField(label='Source / URL', required=False, widget=TooltipTextInput(tooltip='Tooltip text goes here')) | ||||||||||
osiApproved = forms.ChoiceField( | ||||||||||
choices=OSI_CHOICES, | ||||||||||
widget=CustomSelectWidget(tooltip='This is a tooltip') | ||||||||||
) | ||||||||||
isException = forms.ChoiceField( | ||||||||||
choices=YES_NO_CHOICES, | ||||||||||
widget=CustomSelectWidget(tooltip='Yes No tooltip') | ||||||||||
) | ||||||||||
exampleUrl = forms.CharField(label='Example Projects / URL', required=True, widget=TooltipTextInput(tooltip='Tooltip text goes here')) | ||||||||||
comments = forms.CharField(label='Comments', required=True, widget=forms.Textarea(attrs={'rows': 4, 'cols': 40})) | ||||||||||
licenseHeader = forms.CharField(label='Standard License Header', widget=forms.Textarea(attrs={'rows': 3, 'cols': 40}), required=False) | ||||||||||
text = forms.CharField(label='Text', widget=forms.Textarea(attrs={'rows': 4, 'cols': 40})) | ||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -131,7 +131,7 @@ def getTextElement(points): | |||||||||||||||||||||||||||||||
return elements[0] | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
def generateLicenseXml(licenseOsi, licenseIdentifier, licenseName, listVersionAdded, licenseSourceUrls, licenseHeader, licenseNotes, licenseText): | ||||||||||||||||||||||||||||||||
def generateLicenseXml(licenseOsi, licenseIdentifier, licenseName, listVersionAdded, licenseSourceUrls, licenseHeader, licenseNotes, licenseText, isException=False): | ||||||||||||||||||||||||||||||||
""" Generate a spdx license xml | ||||||||||||||||||||||||||||||||
returns the license xml as a string | ||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||
|
@@ -140,7 +140,10 @@ def generateLicenseXml(licenseOsi, licenseIdentifier, licenseName, listVersionAd | |||||||||||||||||||||||||||||||
licenseOsi = "true" | ||||||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||||||
licenseOsi = "false" | ||||||||||||||||||||||||||||||||
license = ET.SubElement(root, "license", isOsiApproved=licenseOsi, licenseId=licenseIdentifier, listVersionAdded=listVersionAdded, name=licenseName) | ||||||||||||||||||||||||||||||||
if isException: | ||||||||||||||||||||||||||||||||
license = ET.SubElement(root, "exception", isOsiApproved=licenseOsi, licenseId=licenseIdentifier, listVersionAdded=listVersionAdded, name=licenseName) | ||||||||||||||||||||||||||||||||
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. E501: line too long (158 > 79 characters) ❗❗ 17 similar findings have been found in this PR 🔎 Expand here to view all instances of this finding
Showing 10 of 17 findings. Visit the Lift Web Console to see all. ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. 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. @sonatype-lift ignoreall 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. The ignoreall command is active on this PR, all the existing Lift issues are ignored. |
||||||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||||||
license = ET.SubElement(root, "license", isOsiApproved=licenseOsi, licenseId=licenseIdentifier, listVersionAdded=listVersionAdded, name=licenseName) | ||||||||||||||||||||||||||||||||
crossRefs = ET.SubElement(license, "crossRefs") | ||||||||||||||||||||||||||||||||
for sourceUrl in licenseSourceUrls: | ||||||||||||||||||||||||||||||||
ET.SubElement(crossRefs, "crossRef").text = sourceUrl | ||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,33 @@ | ||||||||||||||||||
# Generated by Django 3.2.18 on 2023-05-29 14:33 | ||||||||||||||||||
|
||||||||||||||||||
from django.db import migrations, models | ||||||||||||||||||
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. E0401: Unable to import 'django.db' ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. 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. reportMissingImports: Import "django.db" could not be resolved ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||||||||||
|
||||||||||||||||||
|
||||||||||||||||||
class Migration(migrations.Migration): | ||||||||||||||||||
|
||||||||||||||||||
dependencies = [ | ||||||||||||||||||
('app', '0001_initial'), | ||||||||||||||||||
] | ||||||||||||||||||
|
||||||||||||||||||
operations = [ | ||||||||||||||||||
migrations.AddField( | ||||||||||||||||||
model_name='licensenamespace', | ||||||||||||||||||
name='isException', | ||||||||||||||||||
field=models.BooleanField(default=True), | ||||||||||||||||||
), | ||||||||||||||||||
migrations.AddField( | ||||||||||||||||||
model_name='licensenamespace', | ||||||||||||||||||
name='text', | ||||||||||||||||||
field=models.TextField(default=''), | ||||||||||||||||||
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. You will need to commit only changed migrations if this is fixed in the other PR |
||||||||||||||||||
), | ||||||||||||||||||
migrations.AddField( | ||||||||||||||||||
model_name='licenserequest', | ||||||||||||||||||
name='isException', | ||||||||||||||||||
field=models.BooleanField(default=True), | ||||||||||||||||||
), | ||||||||||||||||||
migrations.AddField( | ||||||||||||||||||
model_name='licenserequest', | ||||||||||||||||||
name='text', | ||||||||||||||||||
field=models.TextField(default=''), | ||||||||||||||||||
), | ||||||||||||||||||
] |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -69,7 +69,7 @@ def checkPermission(user): | |||||||||||||||||||||||||||
logger.error("Permission denied while accessing the github api.") | ||||||||||||||||||||||||||||
return False | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
def makePullRequest(username, token, branchName, updateUpstream, fileName, commitMessage, prTitle, prBody, xmlText, is_ns): | ||||||||||||||||||||||||||||
def makePullRequest(username, token, branchName, updateUpstream, fileName, commitMessage, prTitle, prBody, xmlText, plainText, isException, is_ns): | ||||||||||||||||||||||||||||
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. E302: expected 2 blank lines, found 1 ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
if not xmlText: | ||||||||||||||||||||||||||||
logger.error("Error occurred while getting xml text. The xml text is empty") | ||||||||||||||||||||||||||||
|
@@ -171,26 +171,54 @@ def makePullRequest(username, token, branchName, updateUpstream, fileName, commi | |||||||||||||||||||||||||||
""" Creating Commit """ | ||||||||||||||||||||||||||||
if fileName[-4:] == ".xml": | ||||||||||||||||||||||||||||
fileName = fileName[:-4] | ||||||||||||||||||||||||||||
fileName += ".xml" | ||||||||||||||||||||||||||||
commit_url = "{0}repos/{1}/{2}/contents/src/{3}".format(url, username, settings.NAMESPACE_REPO_NAME if is_ns else settings.LICENSE_REPO_NAME, fileName) | ||||||||||||||||||||||||||||
if isException: | ||||||||||||||||||||||||||||
textFileName = fileName + "-exception.txt" | ||||||||||||||||||||||||||||
fileName += "-exception.xml" | ||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||
textFileName = fileName + ".txt" | ||||||||||||||||||||||||||||
fileName += ".xml" | ||||||||||||||||||||||||||||
if isException: | ||||||||||||||||||||||||||||
commit_url = "{0}repos/{1}/{2}/contents/src/exceptions/{3}".format(url, username, settings.NAMESPACE_REPO_NAME if is_ns else settings.LICENSE_REPO_NAME, fileName) | ||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||
commit_url = "{0}repos/{1}/{2}/contents/src/{3}".format(url, username, settings.NAMESPACE_REPO_NAME if is_ns else settings.LICENSE_REPO_NAME, fileName) | ||||||||||||||||||||||||||||
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. W291: trailing whitespace ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||||||||||||||||||||
text_commit_url = "{0}repos/{1}/{2}/contents/test/simpleTestForGenerator/{3}".format(url, username, settings.NAMESPACE_REPO_NAME if is_ns else settings.LICENSE_REPO_NAME, textFileName) | ||||||||||||||||||||||||||||
xmlText = xmlText.encode('utf-8') if isinstance(xmlText, str) else xmlText | ||||||||||||||||||||||||||||
fileContent = base64.b64encode(xmlText).decode() | ||||||||||||||||||||||||||||
plainText = plainText.encode('utf-8') if isinstance(plainText, str) else plainText | ||||||||||||||||||||||||||||
textFileContent = base64.b64encode(plainText).decode() | ||||||||||||||||||||||||||||
body = { | ||||||||||||||||||||||||||||
"path":"src/"+fileName, | ||||||||||||||||||||||||||||
"message":commitMessage, | ||||||||||||||||||||||||||||
"content":fileContent, | ||||||||||||||||||||||||||||
"branch":branchName, | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
text_file_body = { | ||||||||||||||||||||||||||||
"path":"src/"+ textFileName, | ||||||||||||||||||||||||||||
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. E231: missing whitespace after ':' ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. 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. E225: missing whitespace around operator ❗❗ 4 similar findings have been found in this PR 🔎 Expand here to view all instances of this finding
Visit the Lift Web Console to find more details in your report. ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||||||||||||||||||||
"message":commitMessage, | ||||||||||||||||||||||||||||
"content":textFileContent, | ||||||||||||||||||||||||||||
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. E231: missing whitespace after ':' ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||||||||||||||||||||
"branch":branchName, | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
""" Check if file already exists """ | ||||||||||||||||||||||||||||
file_url = "{0}/contents/src/{1}".format(TYPE_TO_URL_NAMESPACE[NORMAL] if is_ns else TYPE_TO_URL_LICENSE[NORMAL], fileName) | ||||||||||||||||||||||||||||
if isException: | ||||||||||||||||||||||||||||
file_url = "{0}/contents/src/exceptions/{1}".format(TYPE_TO_URL_NAMESPACE[NORMAL] if is_ns else TYPE_TO_URL_LICENSE[NORMAL], fileName) | ||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||
file_url = "{0}/contents/src/{1}".format(TYPE_TO_URL_NAMESPACE[NORMAL] if is_ns else TYPE_TO_URL_LICENSE[NORMAL], fileName) | ||||||||||||||||||||||||||||
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. W291: trailing whitespace ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||||||||||||||||||||
response = requests.get(file_url, headers=headers) | ||||||||||||||||||||||||||||
text_file_url = "{0}/contents/test/simpleTestForGenerator/{1}".format(TYPE_TO_URL_NAMESPACE[NORMAL] if is_ns else TYPE_TO_URL_LICENSE[NORMAL], textFileName) | ||||||||||||||||||||||||||||
text_response = requests.get(text_file_url, headers=headers) | ||||||||||||||||||||||||||||
if response.status_code == 200: | ||||||||||||||||||||||||||||
""" Creating Commit by updating the file """ | ||||||||||||||||||||||||||||
data = json.loads(response.text) | ||||||||||||||||||||||||||||
file_sha = data["sha"] | ||||||||||||||||||||||||||||
body["sha"] = file_sha | ||||||||||||||||||||||||||||
if text_response.status_code == 200: | ||||||||||||||||||||||||||||
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. Some changes looks similar to #470 . Please look into working with multiple branches on git. Create PRs with the correct upstream branch (branch before this one) 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. I have made a new PR #492 for this, like further moving forward I have to redo #470 because of the migrations issues which it has having, so I have incorporated all the changes which you had suggested in #470 in #492, so now there is an extra utils function as well. Let me know if anything else needs to be done in that |
||||||||||||||||||||||||||||
""" Creating Commit by updating the file """ | ||||||||||||||||||||||||||||
data = json.loads(text_response.text) | ||||||||||||||||||||||||||||
file_sha = data["sha"] | ||||||||||||||||||||||||||||
text_file_body["sha"] = file_sha | ||||||||||||||||||||||||||||
response = requests.put(commit_url, headers=headers, data=json.dumps(body)) | ||||||||||||||||||||||||||||
if not (response.status_code==201 or response.status_code==200): | ||||||||||||||||||||||||||||
text_response = requests.put(text_commit_url, headers=headers, data=json.dumps(text_file_body)) | ||||||||||||||||||||||||||||
if not (response.status_code==201 or response.status_code==200 or text_response.status_code==201 or text_response.status_code==200): | ||||||||||||||||||||||||||||
logger.error("[Pull Request] Error occured while making commit, for {0} user. {1}".format(username, response.text)) | ||||||||||||||||||||||||||||
return { | ||||||||||||||||||||||||||||
"type":"error", | ||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -108,6 +108,11 @@ def submitNewLicense(request): | |||||||||||||||
licenseName = form.cleaned_data['fullname'] | ||||||||||||||||
licenseIdentifier = form.cleaned_data['shortIdentifier'] | ||||||||||||||||
licenseOsi = form.cleaned_data['osiApproved'] | ||||||||||||||||
isException = form.cleaned_data['isException'] | ||||||||||||||||
if isException == "False": | ||||||||||||||||
isException = False | ||||||||||||||||
else: | ||||||||||||||||
isException = True | ||||||||||||||||
licenseSourceUrls = request.POST.getlist('sourceUrl') | ||||||||||||||||
licenseExamples = request.POST.getlist('exampleUrl') | ||||||||||||||||
licenseHeader = form.cleaned_data['licenseHeader'] | ||||||||||||||||
|
@@ -154,10 +159,10 @@ def submitNewLicense(request): | |||||||||||||||
# Check if the license text doesn't matches with the rejected as well as not yet approved licenses | ||||||||||||||||
if not matches: | ||||||||||||||||
xml = generateLicenseXml(licenseOsi, licenseIdentifier, licenseName, | ||||||||||||||||
listVersionAdded, licenseSourceUrls, licenseHeader, licenseNotes, licenseText) | ||||||||||||||||
listVersionAdded, licenseSourceUrls, licenseHeader, licenseNotes, licenseText, isException) | ||||||||||||||||
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. E128: continuation line under-indented for visual indent ❗❗ 2 similar findings have been found in this PR 🔎 Expand here to view all instances of this finding
Visit the Lift Web Console to find more details in your report. ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||||||||
now = datetime.datetime.now() | ||||||||||||||||
licenseRequest = LicenseRequest(licenseAuthorName=licenseAuthorName, fullname=licenseName, shortIdentifier=licenseIdentifier, | ||||||||||||||||
submissionDatetime=now, notes=licenseNotes, xml=xml) | ||||||||||||||||
submissionDatetime=now, notes=licenseNotes, xml=xml, text=licenseText, isException=isException) | ||||||||||||||||
licenseRequest.save() | ||||||||||||||||
licenseId = licenseRequest.id | ||||||||||||||||
serverUrl = request.build_absolute_uri('/') | ||||||||||||||||
|
@@ -852,7 +857,7 @@ def license_xml_edit(request, page_id): | |||||||||||||||
return HttpResponseRedirect('/app/xml_upload') | ||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
def get_context_dict_for_license_xml(request, license_obj): | ||||||||||||||||
def get_context_dict_for_license_xml(request, license_obj, license_id): | ||||||||||||||||
context_dict = {} | ||||||||||||||||
if request.user.is_authenticated: | ||||||||||||||||
user = request.user | ||||||||||||||||
|
@@ -863,6 +868,7 @@ def get_context_dict_for_license_xml(request, license_obj): | |||||||||||||||
context_dict["github_login"] = github_login | ||||||||||||||||
context_dict["xml_text"] = license_obj.xml | ||||||||||||||||
context_dict["license_name"] = license_obj.fullname | ||||||||||||||||
context_dict["license_id"] = license_id | ||||||||||||||||
return context_dict | ||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
|
@@ -873,7 +879,7 @@ def edit_license_xml(request, license_id=None): | |||||||||||||||
if not LicenseRequest.objects.filter(id=license_id).exists(): | ||||||||||||||||
return render(request, "404.html", {}, status=404) | ||||||||||||||||
license_obj = LicenseRequest.objects.get(id=license_id) | ||||||||||||||||
context_dict = get_context_dict_for_license_xml(request, license_obj) | ||||||||||||||||
context_dict = get_context_dict_for_license_xml(request, license_obj, license_id) | ||||||||||||||||
return render(request, "app/editor.html", context_dict, status=200) | ||||||||||||||||
else: | ||||||||||||||||
return HttpResponseRedirect('/app/license_requests') | ||||||||||||||||
|
@@ -886,7 +892,7 @@ def edit_license_namespace_xml(request, license_id=None): | |||||||||||||||
if not LicenseNamespace.objects.filter(id=license_id).exists(): | ||||||||||||||||
return render(request, "404.html", {}, status=404) | ||||||||||||||||
license_obj = LicenseNamespace.objects.get(id=license_id) | ||||||||||||||||
context_dict = get_context_dict_for_license_xml(request, license_obj) | ||||||||||||||||
context_dict = get_context_dict_for_license_xml(request, license_obj, license_id) | ||||||||||||||||
return render(request, "app/ns_editor.html", context_dict, status=200) | ||||||||||||||||
else: | ||||||||||||||||
return HttpResponseRedirect('/app/license_namespace_requests') | ||||||||||||||||
|
@@ -977,7 +983,7 @@ def promoteNamespaceRequests(request, license_id=None): | |||||||||||||||
listVersionAdded, licenseSourceUrls, licenseHeader, licenseNotes, licenseText) | ||||||||||||||||
now = datetime.datetime.now() | ||||||||||||||||
licenseRequest = LicenseRequest(licenseAuthorName=licenseAuthorName, fullname=licenseName, shortIdentifier=licenseIdentifier, | ||||||||||||||||
submissionDatetime=now, userEmail=userEmail, notes=licenseNotes, xml=xml) | ||||||||||||||||
submissionDatetime=now, userEmail=userEmail, notes=licenseNotes, xml=xml, text=licenseText) | ||||||||||||||||
licenseRequest.save() | ||||||||||||||||
licenseId = licenseRequest.id | ||||||||||||||||
serverUrl = request.build_absolute_uri('/') | ||||||||||||||||
|
@@ -1200,6 +1206,8 @@ def handle_pull_request(request, is_ns): | |||||||||||||||
github_login = user.social_auth.get(provider="github") | ||||||||||||||||
token = github_login.extra_data["access_token"] | ||||||||||||||||
username = github_login.extra_data["login"] | ||||||||||||||||
license_id = request.POST.get('hidden_field') | ||||||||||||||||
license_obj = LicenseRequest.objects.get(id=license_id) | ||||||||||||||||
response = utils.makePullRequest( | ||||||||||||||||
username, | ||||||||||||||||
token, | ||||||||||||||||
|
@@ -1210,6 +1218,8 @@ def handle_pull_request(request, is_ns): | |||||||||||||||
request.POST["prTitle"], | ||||||||||||||||
request.POST["prBody"], | ||||||||||||||||
request.POST["xmlText"], | ||||||||||||||||
license_obj.text, | ||||||||||||||||
license_obj.isException, | ||||||||||||||||
is_ns, | ||||||||||||||||
) | ||||||||||||||||
if response["type"] == "success": | ||||||||||||||||
|
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.
E302: expected 2 blank lines, found 1
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
@sonatype-lift ignore
@sonatype-lift ignoreall
@sonatype-lift exclude <file|issue|path|tool>
file|issue|path|tool
from Lift findings by updating your config.toml fileNote: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.