|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
functions with functions
I am new at this....
I have this plagarised/hacked script for the grinder: from net.grinder.script import Test from net.grinder.plugin.http import HTTPRequest from HTTPClient import NVPair log = grinder.logger.output def foo(): import random number = random.randrange(1, 2000, 1) return number # We declare a default URL for the HTTPRequest. request = HTTPRequest(url = "http://host") def page1(): request.GET('/app') request.GET('/app/j_security_check?j_password=test&j_username=test') request.GET('/app/adduser.do?UserName=JSmith_foo()&userPassword=JSmith') page1Test = Test(1, "First page").wrap(page1) class TestRunner: def __call__(self): page1Test() how do I get the output of the function foo() to form part of the definition of the function page1() ??? |
|
#2
|
|||
|
|||
|
you should place your code within [ CODE ] and [/ CODE ] tags (without the spaces) because it's good practice; if you had more complicated code it'd be a lot harder to tell where a function definition ends, the way you have it posted (tabs and spaces are stripped)
plagarism isn't a good thing... and it's got nothing to do with hacking if you call foo() from page1()... that should give you the return value, you might want to store that into a variable and call it a day. |
|
#3
|
||||
|
||||
|
I agree with CV, plagarism definalty into somthing.. you should be admitting to
.Quote:
page1Test isnt a valid function, loose the parentasis at the end or this jut isn't gonna work ![]() Have fun, Mark. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > functions with functions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|