How to specify what django view to display when a process ends? - django-viewflow

If I've understood the viewflow code correctly, when a flow reaches its end node, the function get_next_task_url from viewflow.flow.views.utils redirects to the process detail page or the process index page.
It would be great if the End node allowed us to specify what view to redirect to at the end of the process. For example, it would be great in a flow object to be able to write something like:
end = flow.End(redirect='app:view',args=...,kwargs=...)
And then get_next_task_url could redirect as specified.
Perhaps it would be possible to subclass the existing End node to achieve this - any pointers how to achieve this would be most welcome.

Mm, yep, there is no such functionality on the end node, since it could be triggered not only by a person task. To override redirect path, just do it in your task view, like you will do with pure Django.

Related

waiting for the website to change something

I am a student and in the school website, what I want to do is that I want to busy wait on the certain URL and check if the class i want to register for is open or not. I was wondering if there was a way to constantly check on the website(busy waiting or otherwise) to see if the class is open or not. There is a table Rem where it shows the number of places remaining in the User Interface.
Also what language would you use to solve this problem?
Yes you can. but for that you will probably need to create a script that fetches the value of data from that table.
So something like web scraping should work.
I would definately use php for this stuff.
Google web scraping and you can code the script.
I am not sure if this is the exact thing that will help you, but what you need to do is something similar - See Here

How to handle urls in load runner?

I have created/recorded a script in Vugen, however the the URL of the site has been changed recently. Is there any way just by replacing the url with a parameter works?
I have tried by replacing url with parameters, the new URL is
http://xsx.xxx.xsx.xxx/test99
Yhe parameters I have tried are below:
NewUrl: http://xsx.xxx.xsx.xxx/
Newhos: test99
I have replaced all in the script and when I run it I get the following error:
Error -27651: Attempted read from an unconnected socket (empty response, no HTTP headers received). URL="http://xsx.xxx.xsx.xxx/scripts/uiServer.dll"
What is the solution for this? Should i record again with the new URL ?
Thanks.
Hope I've understood what you're asking for, so here goes. If it's only the URL that has changed and not the content of the site which you might require later on in your script that this is fairly simple to do.
As you have created the new parameters ensure that they are getting the data from the same DAT file. I.e. newurl.dat which contains the following:
newurl,newhost
http://xsx.xxx.xsx.xxx/,test99
and assign the parameters to the correct column and have the newhost set to sameline as newurl. This way it’s easier to maintain I believe.
Now that the parameters have been created and properly assigned in your script you’ll need to change the url your trying to change from:
http://xsx.xxx.xsx.xxx/oldtest to {newurl}{newhost}
this needs to be done for all instances where the change has occurred.
Hope this helps with your problem you’re having.
Are you certain that the build level has not also changed at the same time as the host? If so then your new instance may be out of synch with the request model of the scripts built using an earlier build. Developers have a habit of including items below the scenes that do affect the site visually but change the structure of the requests. The error you are receiving is common when you attempt to continue a conversation on a dead connection resulting from a missed dynamic session component which may have been added in the last build.
When in doubt quickly record the second site and take a look at the differences in the requests, even to the point of using WinDiff (included in LoadRunner) for this purpose.

IW31 searching for a user exit or enh. point to get gsber

I am working with transaction IW31, the task is to rewrite the field of gsber with another value during the save process (when I clicked the save button this function should be activated at this time).
I had seen all the relevant user exit and enhancement point corresponding to transaction iw31 but no success. I couldn't find any point where I can get the whole CAUFVD structure (it contains the field gsber).
I would need a user point where I can import this structure, not only export.
Could anybody help me solving this task? Or do I need to create an implicit point because the lack of User-Exit?
Thank you in advance,
Gabor
Which SAP Release do you use?
Have you checked the Include LCOIHF2V? There you will find the Enhancement Point FCODE_BU2_01 in which you have full access to structure CAUFVD.
ENHANCEMENT-POINT FCODE_BU2_01 SPOTS ES_SAPLCOIH STATIC.
In addition you have of course always the possibility to add an implicit enhancement (as you suggested) at the end of this form routine.
Hope this helps!

Testing mobile and desktop versions of the same site with Cucumber

I have a site that completely differs on the front-end between the mobile and desktop versions.
You cannot scope steps when defining them on Cucumber, so I am stuck with two solutions (as I see):
Write every step that conflicts with the other version, explicitly saying which version I am
Set up a "background" which tells me what is my context, and change all the step definitions to check for this context
None of this seem optimal to me.
Is there a better/cleaner way to do this?
You can use tags and hooks for this, tag each scenario/feature with the version of the site it tests:
#mobile
Scenario: Logging in on mobile
Given I visit the login page
#desktop
Scenario: Logging in on desktop
Given I visit the login page
Use some hooks to set a variable indicating the version of the site being tested:
Before '#mobile' do
#version = :mobile
end
Before '#desktop' do
#version = :desktop
end
Then in your steps:
Given /^I visit the login page$/ do
if #version == :desktop
# Desktop specific code
elsif
# Mobile specific code
else
raise "Don't know what to do!"
end
end
I ended up using a solution similar to Jon M.
For the concurring steps I made a "meta" step, that passes on to the correct context. Here is an example:
When /^I log in$/ do
step %Q{I log in on #{#context}}
end
Then in another file (separated by context) I have:
When /^I log in on mobile$/ do
# do stuff
end
To setup the context, I created a support module. Basically, it keeps the current context and also has a default one, that you can change with a step:
Given /^I am on the "(.*?)" version$/ do |version|
#context = version
end
It's not exactly how I setup the context part, but you get the picture.
The advantage in this, is that I can have infinite contexts and this "meta" steps will pick them up. I also don't have bloated steps. Each step stays simple and only deals with it's own context logic.
The downside is that for each non-default context I have, I need a Background stating that I am on a different context.
I won't accept a right answer here, since there is no such thing. You can deal with it with different approaches and until now, there isn't even a best practice about this :)

Javascript override Request.Form("foo") for security (XSS)

I've got some source code that has some cross site scripting vulnerabilities in it. There is no input validation that happens when the browser sends data over to the server which is executing server-side Javascript and classic ASP (IIS 7.0).
My question is, is there a way to override the Request.Form("foo") object/method so that I can call a sanitization function too and get rid of prohibited JS/HTML? I don't want to do a find and replace on every single file everywhere Request.Form is called. I was hoping for something more elegant.
Any suggestions are appreciated.
I don't think you can change Request.Form members.
What you can do, as a partial solution, is to create a code that will run first on every page (for example, using an include directive) which loops over Request.Form, Request.QueryString etc., and if it finds suspected code, it terminates the code execution (Response.End). This solution is partial because it doesn't really sanitize input, it just drops execution when it finds suspected text.
Another option: Create an array, parallel to Request.Form. Populate this array with the same members as in Request.Form, but this time sanitized. Then, quickly do a Find-and-Replace over your whole code base, and change Request.Form to your custom array variable.
There is a way to replace the whole Request object with another COM object but its an insane solution and it would still require that all ASP files that use Form contain a common top include file. Its not possible to replace the Request object or one of its members globally at the application level.
The correct solution to the problem, your statement "don't want to do a find and replace on every single file everywhere" notwithstanding, is to perform such global replace.
Despite the number of .asp files that exist the cost is no more than knocking up a simple program to open each ASP file in a folder tree, adding an include line and replacing Request.Form.

Resources