how to change zopehome variable - zope

from App.config import getConfiguration
When I print getConfiguration it shows
/home/zeo_zope/zope-2.13.19/lib/python2.6
I do not understand how it sets the variable to the above value.
How can I change this to /home/zeo_zope ?

Related

Vue2 Variable unexpected behaviour

I'm having some issues with Vue2 variables.
My aim is to create a backup of a variable pulled down from an Axios call, this will then be used to reset the main variable back to the original values. The main variable is called loaded_data, and the copy is called original_data.
My issue is that when I copy the variable over, it's passing it by reference, not value. So when I update my loaded_data variable, the original_data
How the variables are defined:
data() {
return {
loaded_data: false,
original_data: false,
};
},
How the variables are set:
this.loaded_data = axios_response.response.data;
this.original_data = axios_response.response.data;
Reset data function.
reset_data() {
console.log('ORIGINAL', this.original_data);
console.log('LOADED', this.loaded_data);
this.loaded_data = this.original_data;
},
So when I update my loaded_data variable. eg:
loaded_data.value = 'this is an update to the data';
It's also updating the original_data variable. Console log looks like this if I run the reset_data() function.
ORIGINAL {__ob__: Observer}
value: "this is an update to the data"
LOADED {__ob__: Observer}
value: "this is an update to the data"
What it should look like:
ORIGINAL {__ob__: Observer}
value: ""
LOADED {__ob__: Observer}
value: "this is an update to the data"
It doesn't really make sense because loaded_data and original_data aren't linked beside the reset_data function and setting it with axios_response.
Any help or ideas would be greatly helpful.
JavaScript copies the same object into both variables. You would need a second copy of your object as original_data. One way to get that is to use
this.original_data = JSON.parse(JSON.stringify(axios_response.response.data));
after you got the data.

Use dropdown input as placeholder in another field

Based on this threat I've managed (with special thanks to Tami) to create a dropdown menu with variable year numbers in it.
Now I would like to use that chosen value of that dropdown menu as a (part of the) placeholder for another input field.
I tried this with no luck:
[number* ba-maanden min:1 max:12 placeholder "cf7_get_input="recent-years""]
Does anyone has an idea how to get this done?
Thanks,
Vasco
This is not tested, but should work. You can either add this to your form itself by making it all inline and surrounded with <script> and </script> or add this to your theme's js file.
jQuery(function($) {
$('select[name="ba-maanden"]').on('change', function(){
// Assign variable $placeholder to the chosen value
let $placeholder = $(this).val();
// replace 'your-field-name' with the cf7 field name
$('input[name="your-field-name"]').attr('placeholder', $placeholder);
});
});

bind dynamically to this vuejs

Hey guys I have the following function its working ok but I think it could be better.
methods: {
onFileChange(e, filedName) {
console.log(e.target.files);
console.log(filedName);
const file = e.target.files[0];
const fileToCheck=document.getElementById(filedName);
console.log(fileToCheck);
if(filedName=='thumbnail1'){
if(fileToCheck.value!=''){
this.thumbnail1 = fileToCheck;
this.thumbnail1Url= URL.createObjectURL(file);
} else {
this.thumbnail1=null;
this.thumbnail1Url=null;
}
}
if(filedName=='thumbnail2'){
if(fileToCheck.value!=''){
console.log(fileToCheck);
this.thumbnail2=fileToCheck;
this.thumbnail2Url = URL.createObjectURL(file);
} else {this.thumbnail2=fileToCheck; this.thumbnail2Url=null;}
}
},
Instead of checking the value for
if(fieldName == "something"){
this.something = URL.createObjectURL(file)
}
I would simply pass in a string of the fieldName and bind to it dynamically by just typing this.fieldName (filedName could equal thumbnail1 or thumbnail2 or chicken for all I care I just want to be able to pass in the name of the data atrribute and bind to it that way) but when ever I do this it doesn't work. Any help here would be great.
It's not completely clear to me what you want to accomplish, but I think you're asking about creating a dynamic data property for a view component. If that's the case, there are a couple of things to consider.
First, the example you cite, this.fieldName is not correct JavaScript syntax if fieldName is a string that contains a property name. The correct version is this[fieldName].
Note, though, that you can't simply define a new data property for a Vue component by setting it to a value. That's a limitation of JavaScript that's described in the Vue documentation. If data[fieldName] is an existing property that's defined in the component's data object, then you'll be okay. Even if you don't know the value of the property, you can initialize it, for example, with a value of null and then update the value in your method. Otherwise, you'll need to add the property to an existing non-root-level property as the documentation explains.

How to receive variables in a js file when I create it with Element script from another JS file?

I have "file1.js" with the following code where I create a element script to call another js file named test.js
var property = 'email';
var NewScript=document.createElement('script');
NewScript.src="/js/test.js?property="+property;
document.body.appendChild(NewScript);
The code work fine because call (or insert) the file "test.js" my problem is that I also want to send a variable to "test.js" to use it there, I dont know how to send/receive this variable in that way, any help ?
This is what I should have in "test.js"
alert(property);
but how do I receive this variable?
No you can't pass a querystring parameter to a javascript file like that. What I've seen done is to set the variable in script before you create your new javascript file reference. Which is kind of what you are doing above, but you need to declare your property variable outside whatever function you have this code in. So for example if you have this code in a jQuery document ready function it would look something like this:
var property = 'email';
$(document).ready(function () {
var NewScript = document.createElement('script');
NewScript.src = "/js/test.js";
document.body.appendChild(NewScript);
});
This will allow your property variable to stay in scope for your external file. HTML JavaScript Include File Variable Scope

Access ExtJS grid's column model from other file

I have an ExtJS grid that has a button set up in it. The button triggers a function that's defined into other JS file that's included in the grid page. The function triggers ok but in that function I want to get the columns count like this:
grid.getColumnModel().getColumnCount()
The problem is that I get an error like: grid.getColumnModel is not a function.
In PHP I would make a "global $ext" and then access that function. How can I do this in Ext ? How can I access the grid from other file ? What needs to be defined ?
Thank you.
How did you define the grid object? Did you do it like this:
var grid = new Ext.grid.GridPanel(...);
If so, the grid object is not in global scope. Remove the "var" and see if it helps.
This looks like a scope issue. See variable scope in JavaScript.
Basically, you can do:
my_global_grid = ... // accessible in the current ~global~ context (document, window)
var my_local_grid = ... // accessible only in the function
window.my_window_global_grid = ... // accessible in the same window
You might also pass the grid object into your function as an argument:
function myFunction(arg1,arg2,grid){
...
var count = grid.getColumnModel().getColumnCount();
...
}