Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 8th, 2003, 08:03 AM
steve_yeoman steve_yeoman is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 4 steve_yeoman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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()

???

Reply With Quote
  #2  
Old October 8th, 2003, 08:39 AM
cvchen cvchen is offline
Hi, I'm Calvin
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: LosAngeles, SanDiego, Houston
Posts: 50 cvchen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 7 sec
Reputation Power: 10
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.

Reply With Quote
  #3  
Old October 8th, 2003, 06:50 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
I agree with CV, plagarism definalty into somthing.. you should be admitting to .

Quote:
class TestRunner:
def __call__(self):
page1Test()


page1Test isnt a valid function, loose the parentasis at the end or this jut isn't gonna work

Have fun,
Mark.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > functions with functions

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap