setting confluence page title with atlassian-python-api - atlassian-python-api

Is there a way of editing the title of a Confluence page using the atlassian-python-api?
I tried using
confluence.set_page_property(page_id, {'title': new_page_title})
but I get an error <Response [500]>
In detail:
pytest_test.py::test_remove_all_qqq_from_titles FAILED [100%]
venv\conversion_scripts\pytest_test.py:103 (test_remove_all_qqq_from_titles)
def test_remove_all_qqq_from_titles():
> toto = cu.remove_all_qqq_from_titles('TS')
pytest_test.py:105:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
convert_utils.py:286: in remove_all_qqq_from_titles
cc.set_page_property(page_id, {'title': new_page_title})
..\lib\site-packages\atlassian\confluence.py:1768: in set_page_property
response = self.post(path=url, data=json_data)
..\lib\site-packages\atlassian\rest_client.py:309: in post
response = self.request(
..\lib\site-packages\atlassian\rest_client.py:242: in request
self.raise_for_status(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <atlassian.confluence.Confluence object at 0x000001DAEAC19550>
response = <Response [500]>
def raise_for_status(self, response):
"""
Checks the response for an error status and raises an exception with the error message provided by the server
:param response:
:return:
"""
if 400 <= response.status_code < 600:
try:
j = response.json()
error_msg = j["message"]
except Exception:
response.raise_for_status()
else:
> raise HTTPError(error_msg, response=response)
E requests.exceptions.HTTPError
..\lib\site-packages\atlassian\confluence.py:2774: HTTPError

Related

How can I determine why my JSON object fails?

In the following code, I am trying to get the data using ajax but it fails and alerts the error message in the ajax call.
I need the data in the object to populate a form. It just alerts "Ooop there is something wrong" in the error of the ajax call.
Please find below my ajax call. As I said previously it alert the error message and since it is not successful, nothing to show in the developer tool on my browser for console.log()
dim rstRev, strRevSQL
dim intReviewStatus
dim intReviewID
intReviewID = sqlsafe2(request("review_id"),2)
Set rstRev = Server.CreateObject("ADODB.Recordset")
strRevSQL = "exec ppsp_reviewDetails '" & intReviewID & "'"
rstRev.open strRevSQL, db,adOpenForwardOnly,adLockReadOnly
if not rstRev.EOF then
intValueScore = cint(rstRev("value_score"))
intQualityScore = cint(rstRev("quality_score"))
intReview_ID = intReviewID
reviewID = rstRev("review_id")
reviewDate = rstRev("review_date")
reviewEmail =rstRev("email")
pf_id = rstRev("pf_id")
product = rstRev("product_name")
reviewTitle =rstRev("review_title")
linkText = rstRev("link_text")
TT = cint(rstRev("t_and_t"))
reviewStatus = cint(rstRev("active"))
reviewText = rstRev("review_text")
ppResponse = rstRev("pp_response")
strJSON = "{" & _
"""success"": true," & _
"""intValueScore"":""" & intValueScore & """," & _
"""intQualityScore"":""" & intQualityScore & """," & _
"""intReview_ID"":""" & intReview_ID & """," & _
"""reviewID"":""" & reviewID & """," & _
"""reviewDate"":""" & reviewDate & """," & _
"""reviewEmail"":""" & reviewEmail & """," & _
"""pf_id"":""" & pf_id & """," & _
"""product"":""" & product & """," & _
"""reviewTitle"":""" & reviewTitle & """," & _
"""linkText"":""" & linkText & """," & _
"""TT "":""" & TT & """," & _
"""reviewStatus"":""" & reviewStatus & """," & _
"""reviewText"":""" & reviewText & """," & _
"""ppResponse"":""" & ppResponse & """" & _
"}"
%>
<%
end if
rstRev.Close
set rstRev = nothing
Response.Write(strJSON)
%>```
```$('tbody tr td a').click(function(e){
e.preventDefault()
var x =$(this).prop("href")
var y = x.indexOf("=")+1
revID = x.substring(y)
//alert (x)
$.ajax({
type:"POST",
dataType:"json",
async: true,
url:"/web_utils/ppgf_utils/ajax/xt-review_details05122019.asp",
data:{
review_id:revID
},
success:function(data){
window.scrollTo(0, 0)
if(data.success ==true){
console.log(data.success)
}
},
error:function(){
alert("Ooop Something is wrong")
}
});```

Run-time Error '3061' Too few parameters. Expected 8

I'm trying to create a vba code to append some data to a Table named T_Tickets
Below the code I'm using.
Function addticketScheduleChange()
Dim route As String
route = InputBox("Please enter the URL for the ticket:", "Schedule Review")
Set db = CurrentDb
Dim frm As Form
Set frm = Form_Frm_View_Team
sSQL = "Insert INTO T_Tickets ([CSA Login],[Team Manager],[Schedule Description],[WF Shift Pattern],[Mytime Schedule Description],[Shift Pattern Description],[Mytime Description Code],[Type of Ticket],[Resolved?],[Date Submited],[Ticket Link])" _
& "Select " _
& "frm.[CSA Login]" & ", " _
& "frm.[Team Manager]" & ", " _
& "frm.[Schedule Description]" & ", " _
& "frm.[CSSM SPD]" & ", " _
& "frm.[Mytime Descrription]" & ", " _
& "frm.[Shift Pattern Descr]" & ", " _
& "frm.[MytimeDescriptionCode]" & ", " _
& "'Schedule Change'" & ", " _
& False & ", " _
& "Now()" & ", " _
& "route"
db.Execute sSQL
MsgBox ("Record saved.")
End Function
Any help is appreciated.
Try this:
sSQL = "Insert INTO T_Tickets ([CSA Login],[Team Manager],[Schedule Description],[WF Shift Pattern],[Mytime Schedule Description],[Shift Pattern Description],[Mytime Description Code],[Type of Ticket],[Resolved?],[Date Submited],[Ticket Link]) " _
& "Values (" _
& "'" & frm.[CSA Login] & "'," _
& "'" & frm.[Team Manager] & "'," _
& "'" & frm.[Schedule Description] & "'," _
& "'" & frm.[CSSM SPD] & "'," _
& "'" & frm.[Mytime Descrription] & "'," _
& "'" & frm.[Shift Pattern Descr] & "'," _
& "'" & frm.[MytimeDescriptionCode] & "'," _
& "'Schedule Change'," _
& " False, " _
& " Now(), " _
& "'" & route & "')"

Format Now() to yyyymmdd for date serialization when exporting a PDF

How do I simply format the now() function to a string to name a file that needs a date in it so I don't over write files when I export them?
My reason for asking is I need to export a report to a PDF and I need the name of the PDF in the file location to be:
DoCmd.OutputTo acOutputReport, _
"Issue_invsnapshotR", acFormatPDF, _
"\\SPFS1\Stone\Quality\Support Docs\Issues\" & _
[issue_id] & _
"\inv_snapshot_for_issue_" & _
Me.issue_id & _
"_on_" & _
???yyyymmdd function??? & _ <-----unknown function here
".pdf", _
False, _
"", , acExportQualityPrint
The unknown function is this:
Format(now(), "yyyymmdd")
The finished code looks like this:
DoCmd.OutputTo acOutputReport, _
"Issue_invsnapshotR", acFormatPDF, _
"\\SPFS1\Stone\Quality\Support Docs\Issues\" & _
[issue_id] & _
"\inv_snapshot_for_issue_" & _
Me.issue_id & _
"_on_" & _
Format(Now(), "yyyymmdd") & _
".pdf", _
False, _
"", , acExportQualityPrint
this function will return a string of (today being 3/8/17) 20170308. which can be used to serialize files and folders.

Learning to use AXE library for ASP

I'm attempting to use the AXE library to parse some JSON data. In trying to make sure that everything is running correctly I have created a test page. I am getting an error:
Error Type:
Microsoft JScript compilation (0x800A03EA)
Syntax error
json2.asp Line 1
I'm using the code that is in the json2.asp file to test this out:
<script language="javascript" runat="server" src="json2.asp"></script>
<%
dim TestData : set TestData = JSON.parse(join(array( _
"{", _
" ""firstname"": ""Fabio"",", _
" ""lastname"": ""Nagao"",", _
" ""alive"": true,", _
" ""age"": 27,", _
" ""nickname"": ""nagaozen"",", _
" ""fruits"": [", _
" ""banana"",", _
" ""orange"",", _
" ""apple"",", _
" ""papaya"",", _
" ""pineapple""", _
" ],", _
" ""complex"": {", _
" ""real"": 1,", _
" ""imaginary"": 2", _
" }", _
"}" _
)))
Response.write(TestData.firstname & vbNewline) ' prints Fabio
Response.write(TestData.alive & vbNewline) ' prints True
Response.write(TestData.age & vbNewline) ' prints 27
Response.write(TestData.fruits.get(0) & vbNewline) ' prints banana
Response.write(TestData.fruits.get(1) & vbNewline) ' prints orange
Response.write(TestData.complex.real & vbNewline) ' prints 1
Response.write(TestData.complex.imaginary & vbNewline) ' prints 2
' You can also enumerate object properties ...
dim key : for each key in TestData.keys()
Response.write( key & vbNewline )
next
set TestData = nothing
Where am I going wrong?

telerik grid detailtview Razor vb.net Syntax

I need some help with the syntax
I have the Razor code below. But I do not get the detail view ok. When I use the code below the detail grid will be rendered and after that the normal customer grid. The object is a customer and a detail view are some settings for this customer? Can someone help me with the syntax?
Thanks!
#(Html.Telerik.Grid(Model) _
.Name("CustomerGrid") _
.DataBinding(Function(dataBinding) dataBinding.Server() _
.Update("SaveCustomer", "Admin")) _
.DataKeys(Function(keys) keys.Add(Function(o) o.CustomerID)) _
.DetailView(Function(dt) dt.Template(Sub(tt)
Html.Telerik.Grid(tt.MessageSettings) _
.Name("MessageSetting" & tt.CustomerID) _
.Columns(Function(dc) {
dc.Bound(Function(dd) dd.CustomerMessageSettingsID), _
dc.Bound(Function(dd) dd.Free)
}).Render
End Sub)) _
.Columns(Function(c) { _
c.Bound(Function(o) o.CompanyName).Width(200), _
c.Bound(Function(o) o.Credits), _
c.Bound(Function(o) o.Address), _
c.Bound(Function(o) o.City), _
c.Command(Function(d) { _
d.Edit.ButtonType(GridButtonType.Image) _
}) _
}) _
.Filterable _
.Groupable _
.Editable(Function(e) e.Mode(GridEditMode.InLine)) _
.Pageable() _
.Sortable() _
)
I recommend you to use LoadContentFrom()
.DetailView(details => details.ClientTemplate(
Html.Telerik().TabStrip()
.Items(items =>
{
items.Add().Text("MyView").LoadContentFrom("PartialActionResult", "Controller", New With { _
.param1 = "<#= ID#>" _
})
}) // End of item Tabs
.ToHtmlString()
) // End of Detail View Client Template
) // End of Detail View