csv, xml, etc import in a restful way - import

We are in the proces of adding our data import functionality to our RESTful interface.
We are trying to come up with a RESTful way to handle this proces.
From a user perspective we have the following proces:
(1) The user uploads a file (2) the user selects some configuration options that control how the data is entered into the system and the system presents a preview of the result (the user can change the settings untill satisfied) (3) once the user confirms everything is correct the import is executed. This results in new elements being created in the /participants resource.
Currently we upload the data to a /imports resource on step 1. Everytime the user changes the import configuration we save the new configuration to the resource and get back a new preview. We have a differenco of opinion about what the "go ahead and process the input" action should look like and whether it should be posted to the /import or /participants resource.
We are not completely happy with the amount of actions we need to get this going but we cant change the user scenario for functional reasons.
What would be the most restful way of dealing with the "go ahead and process the import" stage (it feels SOAP'y) or how can we change this if necessary?

You uploaded an "import" so you should "process" that import.
Perhaps something like:
POST /import/<id>/process
To this, you would return a status code of 202 Accepted since you'll be actually creating something else

Related

An assertion on the test case file - Webdriverio

I need some help, I'm starting with this automation stuff, I like it but I'm still learning, recently I create a test case that basically is, going to a certain page and click on a button to upgrade the account on an specific sale, so I did that but when I got my PR reviewed and devops ask me if I can add an assertion.
So, this code is on the spec file not on the page objects file, so the devops mean I have to create the code on the page object file and then call it on the spec file???? any tip would be great and thanks!
You can do it either way. You can write the assertion in the spec file, or write the assertion in the page objects file and call it from the specs file. If the latter is your framework's code convention, you may want to do it that way for consistency, but either way should work.

Setting a value in Frappe application isn't reflected in ERPNext GUI

I have added a 'number_of_members' value to the Customer DocType via customization.
In my application I have tried several ways to update the value. However the value never updates in the webpage. I feel like I'm missing some sort of save or update or commit step.
For example I have tried:
frappe.client.set_value('Customer', '00042', 'number_of_members', 8887)
frappe.set_value('Customer', '00042', 'number_of_members', 8887)
frappe.db.set_value('Customer', '00042', 'number_of_members', 8887)
and also
customer = frappe.get_doc('Customer', '00042')
customer.number_of_members = 8887
customer.save()
In each case I can do something like frappe.get_value, or frappe.get_doc and it shows the value is set to 8887. However it never updates in the web side. This is what makes me think I'm updating some sort of cache or database transaction and I need some way to save it, but have not had any luck.
I am mostly testing this via bench console if that has any bearing on it, but I've tried a couple of the methods in my application code as well.
Relevant documentation:
Frappe Developer API - Document
Frappe Developer API - Database
Turns out the answer is to call frappe.db.commit() after making changes. If someone can point this out in the documentation so I can better understand how I'm missing stuff, I would appreciate it.
I also noticed if you try to Save something in the UI before you send frappe.db.commit() the UI will hang.

Does CQ5 store modification list(history) of crx?

Sometime someone want to change inside something crx directly on environment.
Often it is a cause of unworking state of environment. And often enough hard to find the cause of the problem. And I think it is will be helpful if cq5 crx will have audit log. something like this.
12.12.12 21:03 /etc/blueprints/geometrixx was removed [rollout]
...
maybe CQ5 has something like this already?
Assuming these changes to the repositories are made using crxde lite[/crx/de/index.jsp] or content explorer [/crx/explorer/browser/index.jsp] , there is an indirect way to find out who did it.
The data can be fetched by looking into two different logs request.log and audit.log [these files can be found at \crx-quickstart\logs folder ]
The modifications to nodes are POST requests. These are logged in request.log , the path of the request will only show the interface used or to root node. If you search the time stamp of the POST in audit.log you can find which user did a GET request.
This is not direct way, nor will it tell more of the changes except for which user read the node at the time of the POST .

Stopping Ember.js Controller

My question is very basic on one hand but on the other hand the general situation is more complex, plus I cannot really get any working sample.
I'm developing/maintaing a web-application which is currently in transition from GWT code base into Ember.js.
Most of the newer code already relies on Ember.js and I think it's really awesome.
The problem is we cannot use Ember Router as all the request are being handled by the GWT.
In order to enabled the application run in this unusual configuration we have special JavaScript files that create our Ember main objects (Controllers & Models) for us.
As you can imagine navigation between tabs is cumbersome and is handled by GWT who creates Ember objects when needed. We are in transit toward a brave new world Ember Router and all.
But in the meantime, this is the problem I'm facing right now.
The user clicks a link which opens a page that contains some Ember based table.
The data is retrieved form the server using some Ajax code. Upon success it spawns a forEach loop which tries to pushObject all the received date into our Ember based components.
My problem happens when the user quickly switches between tabs. In this case the first list of object has not finished rendering yet and suddenly there's a new set of objects to handle. This causes Ember to throw errors like:
"Uncaught Error: Cannot perform operations on a Metamorph that is not in the DOM. "
and
"Uncaught NotFoundError: An attempt was made to reference a Node in a context where it does not exist."
Is it possible to prevent the loop from trying to render?
I've tried checking if the controller in question is already inDOM and it is, is there a way to notify Ember this object is no longer valid?
Sorry for a lengthy question and lack of running sample.
I'd probably modify the switch tab code to only execute afterRender has completed, that way you aren't mucking with ember objects while they are being used.
Ember.run.scheduleOnce('afterRender', this, function(){
// call GWT switch tab routine
});
Thank you Daniel and Márcio Rodrigues Correa Júnior. eventually what I did is to add a patch that would check the current context of the application (in my case the currently selected tab). If upon receiving the AJAX response the application is in the correct context (meaning the user haven't change the tab) go on. Otherwise just ignore the response and do not try to render it.
Now it seems to be working

doctrine2: explicitly fetching without cache

I use doctrine2.2.2 with Zend Framework1 and am currently working on an editing tool.
A user clicks a link to move someting "up" in the list, my action does its work, changes are made to teh database, i redirect but then the result, newly fetched from the database is still the old version.
I would figure it has to do with cache since i am not temporarily storing the object in the session or anything.
So the Question is: Is there a way to fetch something and tell Doctrine, not to use the cache for this specific request? Or is there a possibility to delete certain cache entries?
Yep, take a look at http://readthedocs.org/docs/doctrine-orm/en/latest/reference/caching.html?highlight=cache#result-cache .
There is a query api to enable, disable, ... result cache for example, individuallty on each query; or globally.