I am getting the following error during test condition. I did not understand where i am doing mistake.
client = MongoClient(settings.MONGO_HOST, settings.MONGO_PORT)
raise TypeError("port must be an instance of int")
TypeError: port must be an instance of int
Your settings.MONGO_PORT value is most likely a string, while it should be an integer.
You can either change it at the source, or cast it here at the call site:
client = MongoClient(settings.MONGO_HOST, int(settings.MONGO_PORT))
Related
I have to create a consumer proxy in SAP, the proxy generation is OK (or no errors were reported), but when i tried yo consume the proxy (SE80), i have the next error:
SOAP:1.027 SRT: Serialization / Deserialization failed
System expected a value for the type g.
If i continue, i have the response, but when i tried to call the customer service in a report, i have the error and i can't continue.
In a report, when i tried yo consume the proxy using this code, i have the same error, and i don't have response:
CREATE OBJECT proxy
EXPORTING
logical_port_name = 'LOGICAL_01'.
CALL METHOD proxy->proccess_check_status_invoice
EXPORTING
process_check_status_invoice = input
IMPORTING
process_check_status_invoice_r = output.
Whow can i solve this error?
Thanks,
Please use srt_util and verify the execution error with a trace of that proxy. The error log will specify which field and values are not allowed during the transformation.
SOAP:1.027 SRT: Serialization / Deserialization failed errors are due to incompatible data types, in my experience, most of the times are dates since ABAP datum and the standard differ and must be transformed.
Type g is usually the constant for the TYPEKIND of STRING. My guess is you are binding values that are CHARs instead of the STRING datatype.
I'm trying to bind to a LDAP server using the ldap library in Python. However, every time I try to use sasl_interactive_bind_s() in Python, I get the following error:
AttributeError: sasl_interactive_bind_s
I don't know why this is happening, and the error message isn't very helpful either. Here is the code I'm using. (dc.hostname is just the server name)
conn = ldap.initialize("ldap://" + dc.hostname + ":3268")
conn.set_option(ldap.OPT_NETWORK_TIMEOUT, 5)
conn.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
conn.set_option(ldap.OPT_REFERRALS, ldap.OPT_OFF)
conn.set_option(ldap.OPT_RESTART, ldap.OPT_ON)
sasl_cb_value_dict = {}
sasl_cb_value_dict[ldap.sasl.CB_AUTHNAME] = bind_dn
sasl_cb_value_dict[ldap.sasl.CB_PASS] = admin_pw
auth_tokens = ldap.sasl.sasl(sasl_cb_value_dict,"DIGEST-MD5")
conn.sasl_interactive_bind_s("", auth_tokens)
In order to try and circumvent this, I also tried to bind using the C function ldap_sasl_bind_s() and this helped bind successfully. But, now I don't know how to pass this connection object back to Python, so that I can query the LDAP server. (Note: I used the ldap_search_ext_s() function in C, but that never really returned anything, because it took too long to query)
Any help/advice would be greatly appreciated. Thanks in advance!
I'm trying to use the instructions find here:
http://emberjs.com/guides/models/persisting-records/
My server receives the json well and creates a record which it then returns properly, but my onSuccess function doesn't get anything usable as a response. It gets this strange object which if I try to pass onto the next route like the instructions say, it errors out saying this:
Uncaught Error: Assertion Failed: The value that #each loops over must be an Array. You passed '' (wrapped in (generated articles.view controller))
Here is my code:
https://github.com/mgenev/Full-Stack-JS-Boilerplate/blob/master/public/ember/controllers/articles_controller.js
I appreciate any help.
It looks like your transitionToArticle function requires an argument but you're not passing in anything when you're calling it:
article.save().then(transitionToArticle).catch(failure);
So I have a remote ColdFusion Function like:
remote string function name (required numeric varname){
This is accessed via AJAX call. Google has taken it upon itself to pass in junk/blank values to the URL to this remote function. How can I gracefully handle those for Bots/Users to manage to get in a junk value. I've tried putting try/catch around/inside the function and doesn't work. I've also tried setting a default value but I still get an error. I'd like to be able to return an error message.
Thoughts?
Right now:
domain.com/path/to/page.cfc?method=function&varname=
Is throwing an error
domain.com/path/to/page.cfc?method=function&varname=5
Is working as expected.
Update:
I am leaving this here for posterity, as it explains the cause of the error and chain of events with validation. However, Adam's response is the correct solution IMO.
remote string function name (required numeric varname){
I've tried putting try/catch around/inside the function and doesn't work.
Because the argument value is validated before CF executes anything inside the function. So it never even gets to the try/catch.
If you want to allow non-numeric values, you must set the argument type to string and perform validation inside the function. ie
// use whatever check is appropriate here
if ( IsNumeric(arguments.varname) ) {
// good value. do something
}
else {
// bad value. do something else
}
I've also tried setting a default value but I still get an error
domain.com/path/to/page.cfc?method=function&varname=
Update
The reason it does not work is because the varname parameter does exists. Its value is an empty string. As long as some value is passed (even an empty string) the default is ignored.
I disagree that the accepted solution is the best approach here.
Firstly, if your method is expecting a numeric and it's being passed a string, then an error is precisely the correct reaction here. You shouldn't feel the need to mitigate for requests that pass invalid values. Consider it like someone making a request to http://some.domain/path/to/file/wrongOne.html (they should have requested http://some.domain/path/to/file/rightOne.html)... it's completely OK for things to return a 404 "error" there, isn't it? An error response is exactly right in that situation.
Similarly, you have dictated that for your remote call URL, that argument is supposed to be numeric. So if it's not numeric... that is an error condition. So your server returning a 500-type error is actually the correct thing to do.
This is an example of the "garbage in, garbage out" rule.
If you are looking for an elegant solution, I'd say you already have the most elegant solution. Don't mess around writing special code to deal with incorrectly made requests. That is not an elegant approach.
You are better off letting the thing error, because then the mechanism requesting the URL will stop doing it. Messing around so that you are returning a 200 OK for a request that wasn't "OK" is the wrong thing to do.
Errors - when they are the correct result - are fine. There's nothing wrong with them.
I've a C++ function which saves a document to MongoDB using C++ driver. It takes connection reference as argument:
http://pastebin.com/jwRDhNWQ
When I restart MongoDB, I can see that new connection is being made.
However, conn.isFailed() remains true.
This maybe happening due to the fact that when I reconnect, I am using conn and not &conn
When I do use &conn as in &conn.connect("localhost");, I get error message-
error: lvalue required as unary ‘&’ operand
How do I fix this? i.e. modify the underlying connection so that conn.isFailed() becomes false when a new connection has been established?
You should enable _autoReconnect in the mongo::DBClientConnection::DBClientConnection constructor.
http://api.mongodb.org/cplusplus/current/classmongo_1_1_d_b_client_connection.html#a6a1a348024dd302572504b7bfb6e74a2
The variable _failed returned by the method isfailed() is not set until _check Connection is called. _checkConnection is not called until something is sent to the database, so as an alternative, you could call the ping command before calling _isFailed. However, the recommended fix is to enable _autoReconnect.