|
POST
|
Turn the dictionary into a string, then try to load that with the strict param: my_dict = '{"key1" : "test is a string with\\nsome escaped characters\\nsuch newlines"}'
my_jsonloads = json.loads(my_dict, strict=False)
my_json = json.dumps(my_jsonloads)
print(my_json)
... View more
12-21-2016
06:59 AM
|
0
|
1
|
1794
|
|
POST
|
Not sure if this is correct for the .dumps() but try setting strict param: my_json = json.dumps(my_dict, strict=False)
... View more
12-21-2016
06:24 AM
|
0
|
3
|
1794
|
|
POST
|
my_dict = {"key1" : "test is a string with\\nsome escaped characters\\nsuch newlines"}
... View more
12-21-2016
05:57 AM
|
0
|
7
|
3126
|
|
POST
|
Is there a way to add the headers in there? The headers as in the first row of your csv file? Just make sure your list is correctly populated from the csv. mylist = [[0, "Header1", "Header2", "Header3", "Header4", "Header5"],[1, "blah", "blah2", "blah3", "blah4", "blah5"], [2, "blah33", "blah44", "blah55", "blah66", "blah77"], [3, "blah111", "blah222", "blah333", "blah444", "blah555"]] Or do you mean attach the csv file to the message?
... View more
12-20-2016
05:44 AM
|
0
|
1
|
2559
|
|
POST
|
My mistake, yes I was testing with "mylist" not "mylist2". The result I get when print hmtl: <html>
<head></head>
<body>
<p><br>
Python Script Errors & Logging Reports<br> <br> <br>
| Log Items | <br>
<a href=>[1, 'blah', 'blah2', 'blah3', 'blah4', 'blah5']</a>
<a href=>[2, 'blah33', 'blah44', 'blah55', 'blah66', 'blah77']</a>
<a href=>[3, 'blah111', 'blah222', 'blah333', 'blah444', 'blah555']</a><br> <br>
</p>
</body>
</html>
... View more
12-19-2016
12:01 PM
|
0
|
3
|
2559
|
|
POST
|
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
mylist2 = [[1, "blah", "blah2", "blah3", "blah4", "blah5"], [2, "blah33", "blah44", "blah55", "blah66", "blah77"], [3, "blah111", "blah222", "blah333", "blah444", "blah555"]]
mylistitem = (["""<a href=>""" + str(i) + """</a>""" for i in mylist])
merged = [item for sublist in zip(mylistitem) for item in sublist]
htmlline = '\n'.join(merged)
me = "[email protected]"
you = "[email protected]"
# Create message container - the correct MIME type is multipart/alternative.
msg = MIMEMultipart('alternative')
msg['Subject'] = "Some Subject Line"
msg['From'] = me
msg['To'] = you
html = """\
<html>
<head></head>
<body>
<p><br>
Python Script Errors & Logging Reports<br> <br> <br>
| Errors Items | <br>
| Log Items | <br>
""" + htmlline + """<br> <br>
</p>
</body>
</html>
"""
part2 = MIMEText(html, 'html')
msg.attach(part2)
s = smtplib.SMTP('mail.mydomain.com', 25)
s.sendmail(me, you, msg.as_string())
print "msg sent"
s.quit()
... View more
12-19-2016
11:13 AM
|
0
|
7
|
8228
|
|
POST
|
It's really hard to tell but I'd suspect that there is some mismatch in the number of items within the arrays in the lists. I'd strip the down to make sure there are the same number of columns in each array.
... View more
12-19-2016
09:53 AM
|
0
|
9
|
8228
|
|
POST
|
Format the list items into a merged html line then populate a complete html into a message body. mylist = [[1, "blah", "blah2", "blah3", "blah4", "blah5"], [2, "blah33", "blah44", "blah55", "blah66", "blah77"], [3, "blah111", "blah222", "blah333", "blah444", "blah555"]]
mylistitem = (["""<a href=>""" + str(i) + """</a>""" for i in mylist])
merged = [item for sublist in zip(mylistitem) for item in sublist]
htmlline = '\n'.join(merged)
#print htmlline
html = """\
<html>
<head></head>
<body>
<p><br>
Python Script Errors & Logging Reports<br> <br> <br>
| Log Items | <br>
""" + htmlline + """<br> <br>
</p>
</body>
</html>
"""
print html
... View more
12-19-2016
07:31 AM
|
0
|
11
|
8228
|
|
POST
|
Why not create Web Layers from the services, configure the popups and other properties on them (appropriate tags and make them easily identifiable) and then just implement the Add Data widget? I would pursue putting all of the web layers into a specific group in your Org's AGOL that is tagged just for this application and perhaps customize the AddData widget to only point to that group. Let user's decide which data to pull into the app but limit the choices to what's in the group. (wish I had more time to explore these kinds of customizations for myself).
... View more
12-14-2016
06:07 AM
|
2
|
0
|
2614
|
|
POST
|
In a feeble attempt to implement the desired behavior of updating/inserting into related tables, I took a look a the regular "Edit Widget" (since this does exactly that). I added the "RelatedRecordsEditor.js" from the Edit Widget and then tried to implement the corresponding code from its "Widget.js" directly into a copied version of the Batch Attribute Edit widget. When launching the widget I get the error: "Create Widget error: widgets/BatchAttributeEditor2/Widget" and it fails to load. Again, I simply copied the original, renamed the folder and added the RelatedRecordsEditor.js file: I did update the manifest.json file's "name" attribute to: "name": "BatchAttributeEditor2" Finally, I attempted to implement the corresponding JavaScript out of the Edit widget's Widget.js file and into the BatchAttributeEditor2's Widget.js file: Adding to the onOpen(): //prepare tableInfosParam data for relatedRecordsEditor this._getTableInfosParam().then(lang.hitch(this, function(tableInfosParam) { this.tableInfosParam = tableInfosParam; this.tableInfosParamClone = this._cloneLayerOrTableInfosParam(this.tableInfosParam); this._tableInfoParamDef.resolve(); Adding to the define(): './RelatedRecordsEditor' And the following methods towards the end of the Widget.js file: /****************************************** * Methods for prepare edit related records ******************************************/ _createRelatedRecordsEditor: function(feature) { if(!feature) { return; } // prepare loading shelter var loadingDomNode = html.create('div', {style:"position: relative"}); html.place(loadingDomNode, this.editor.attributeInspector.domNode, "after"); var loading = new LoadingShelter({ }).placeAt(loadingDomNode); // get tableInfosParam this._tableInfoParamDef.then(lang.hitch(this, function() { try { if(this._relatedRecordsEditor) { this._relatedRecordsEditor.destroy(); this._relatedRecordsEditor = null; } // create relatedRecordsEditor this._relatedRecordsEditor = new RelatedRecordsEditor({ originalFeature: feature, editorATI: this.editor.attributeInspector, tableInfosParam: this.layerInfosParamClone.concat(this.tableInfosParamClone), nls: lang.mixin(lang.clone(this.nls), window.jimuNls.common) }); loading.destroy(); } catch(err) { console.warn(err.message); loading.destroy(); this._enableToAnswerEventForEditorATI(); } })); }, _disableToAnswerEventForEditorATI: function() { // disable to answer onSelctionChange for editor ATI. if(!this._mapInfoStorage.editorATIonLayerSelectionChange) { this._mapInfoStorage.editorATIonLayerSelectionChange = this.editor.attributeInspector.onLayerSelectionChange; this.editor.attributeInspector.onLayerSelectionChange = lang.hitch(this, function(){}); } }, _enableToAnswerEventForEditorATI: function() { // enable to answer onSelctionChange for editor ATI. if(this._mapInfoStorage.editorATIonLayerSelectionChange) { this.editor.attributeInspector.onLayerSelectionChange = lang.hitch(this.editor.attributeInspector, this._mapInfoStorage.editorATIonLayerSelectionChange); this._mapInfoStorage.editorATIonLayerSelectionChange = null; } }, _getTableInfosParam: function() { var tableInfos; var defs = []; var resultTableInfosParam = []; if(!this._configEditor.tableInfos) { // configured in setting page and no layers checked. tableInfos = []; } else if(this._configEditor.tableInfos.length > 0) { // configured and has been checked. tableInfos = this._converConfiguredLayerInfos(this._configEditor.tableInfos); } else { // has not been configured. tableInfos = this._getDefaultTableInfos(); } array.forEach(tableInfos, function(tableInfo) { var jimuTableInfo = this._jimuLayerInfos.getTableInfoById(tableInfo.featureLayer.id); if(jimuTableInfo) { tableInfo.jimuTableInfo = jimuTableInfo; defs.push(jimuTableInfo.getLayerObject()); } }, this); return all(defs).then(lang.hitch(this, function() { array.forEach(tableInfos, function(tableInfo) { if(!tableInfo.jimuTableInfo) { return; } var tableObject = tableInfo.jimuTableInfo.layerObject; var capabilities = tableInfo.jimuTableInfo.getCapabilitiesOfWebMap(); var isEditableInWebMap; if(capabilities && capabilities.toLowerCase().indexOf('editing') === -1) { isEditableInWebMap = false; } else { isEditableInWebMap = true; } if(tableObject && tableObject.visible &&//??************ tableObject.isEditable && tableObject.isEditable() && isEditableInWebMap) {//todo ...... tableInfo.featureLayer = tableInfo.jimuTableInfo.layerObject; delete tableInfo.jimuTableInfo; resultTableInfosParam.push(tableInfo); } }, this); return resultTableInfosParam; })); }, /************************* * Methods for change UI ************************/ _updateDeleteBtnInToolbar: function() { if(this._canDeleteSelectionFeatures()) { this._enableDeleBtnInToolbar(); } else { this._disableDeleteBtnInToolbar(); } }, _disableDeleteBtnInToolbar: function() { if(this._configEditor.toolbarVisible) { query("[class~=deleteFeatureIcon]", this.editor.domNode).style("display", "none"); } }, _enableDeleBtnInToolbar: function() { if(this._configEditor.toolbarVisible) { query("[class~=deleteFeatureIcon]", this.editor.domNode).style("display", "inline-block"); } }, /************************* * Response events ************************/ _update: function() { if(this.editor){ this.editor.templatePicker.update(true); } }, resize: function() { this._update(); }, onClose: function() { if (this.editor) { this.editor.destroy(); } this.editor = null; // close method will call onDeActive automaticlly // so do not need to call onDeActive(); this._worksAfterClose(); }, onNormalize: function(){ setTimeout(lang.hitch(this, this._update), 100); }, onMinimize: function(){ }, onMaximize: function(){ setTimeout(lang.hitch(this, this._update), 100); }, reClickMap: function(clickEvt) { this._createOverDef.then(lang.hitch(this, function() { this.map.onClick(clickEvt); })); }, _onGraphicMoveStart: function(evt) { this._recordsSelectedFeatureInfoWhenMoveStart(evt); }, _onGraphicMoveStop: function(evt) { this._recordsSelectedFeatureInfoWhenMoveStop(evt); this._autoApplyEditWhenGeometryIsModified(evt); }, _onGraphicChangeStop: function(evt) { this._autoApplyEditWhenGeometryIsModified(evt); }, _beforeMapClick: function() { if(!this._configEditor.autoApplyEditWhenGeometryIsMoved) { this._checkStickyMoveTolerance(); } }, _onEditorPopupShow: function() { // disable event for editorATI var currentFeature = this.editor.attributeInspector._currentFeature; //var currentLayer = currentFeature.getLayer(); this._disableToAnswerEventForEditorATI(); this._createRelatedRecordsEditor(currentFeature); }, _onEditorPopupHide: function() { // enable event for editorATI this._enableToAnswerEventForEditorATI(); }, _onNextOfEditorATI: function(evt) { this._createRelatedRecordsEditor(evt.feature); }, _onLayerSelectionChange: function() { if(this._configEditor.toolbarVisible) { this._updateDeleteBtnInToolbar(); } }
... View more
11-15-2016
08:21 AM
|
0
|
0
|
890
|
|
POST
|
Has anyone had success modifying the Batch Attribute Editor Widget to update GDB tables that participate in a relationship class (1-to-many)? The Edit Widget does this flawlessly.
... View more
11-15-2016
06:10 AM
|
0
|
1
|
1372
|
|
POST
|
I think this may be a publishing issue. I re-published the same Feature Class again as a new hosted Feature Layer and configured the widget on it and it appears to function as expected.
... View more
11-09-2016
01:54 PM
|
0
|
0
|
917
|
|
POST
|
Possible bug: The batch attribute editor allows you to specific multiple date-type fields in the configuration, however when attempting to perform a batch attribute update only 1 of the date-type fields shows a calendar control drop-down and you cannot manually type in the date information. Can anyone confirm this? Workaround? Thanks!
... View more
11-09-2016
01:09 PM
|
0
|
1
|
1224
|
|
POST
|
I should have specified 21 times with different parameters each time You want the impossible unless you can explain the specifics of each parameter. I suspect your DistrictConfig contains everything but we are not going to be able to help without knowing what's in it. distfc = DistrictConfig.distfc I'm not exactly sure what this even is because you are importing it from another python class.
... View more
10-24-2016
10:54 AM
|
0
|
0
|
5032
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-17-2020 10:47 AM | |
| 1 | 10-25-2022 11:46 AM | |
| 1 | 08-08-2022 01:40 PM | |
| 1 | 02-15-2019 08:21 AM | |
| 2 | 08-14-2023 07:14 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-22-2025
02:28 PM
|