Python Forum
Flask - adding new page affects all other pages
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flask - adding new page affects all other pages
#4
(Mar-28-2020, 01:39 PM)CMR Wrote: Voicevlan is part of the add interface section and is not entered in the Add VLAN section
I am bit confused, because you pass result['vlanname'], i.e. it looks like you omit result['datavlan']

At the moment result['vlanname'] is the value you pass for datavlan parameter

(Mar-28-2020, 01:39 PM)CMR Wrote: but the addVLAN section is looking for it
I am bid confused
It looks like you have some misunderstanding about the functions/class methods.
your class.__init__() takes only positional arguments, i.e. no default values, so all arguments are required. You cannot just skip
You can change it to take some default values, e.g. (just an example, it's up to you to decide which params and what default values)
def __init__(self,device_type,ip,username,password,port,interface,datavlan=None,voicevlan=None):
in this case you can skip datavlan and/or voicevlan.

Look also at this one:
https://python-forum.io/Thread-init-ques...#pid108442
here is the method signature:
def __init__(self,device_type,ip,username,password,port,interface,datavlan,voicevlan):
and here is how you call it:
addvlan = router('cisco_ios', result['hostname'], result['username'], result['password'], result['port'], result['number'], result['vlanname'])
so you have 9 params and when match with the arguments you pass
  • self - instance it self. it is passed automatically
  • device_type = 'cisco_ios'
  • ip = result['hostname']
  • username = result['username']
  • password = result['password']
  • port = result['port']
  • interface = result['number']
  • datavlan = result['vlanname']
  • voicevlan - NO VALUE THUS THE ERROR
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE: Flask - adding new page affects all other pages - by buran - Mar-28-2020, 01:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Flask and SQLAlchemy question: Database is being created but tables aren't adding pythonpaul32 3 4,888 Feb-07-2023, 10:48 AM
Last Post: pythonpaul32
  Flask run function in background and auto refresh page raossabe 2 7,756 Aug-20-2022, 10:00 PM
Last Post: snippsat
  Reload flask current page GrahamL 2 5,192 Jan-08-2021, 08:31 AM
Last Post: GrahamL
  API auto-refresh on HTML page using Flask toc 2 11,920 Dec-23-2020, 02:00 PM
Last Post: toc
  [Flask]After login page is not redirecting me to dashboard shockwave 0 2,735 May-07-2020, 05:22 PM
Last Post: shockwave
  use Xpath in Python :: libxml2 for a page-to-page skip-setting apollo 2 3,670 Mar-19-2020, 06:13 PM
Last Post: apollo
  Flask - Opening second page via href is failing - This site can’t be reached rafiPython1 2 5,523 Apr-11-2018, 08:41 AM
Last Post: rafiPython1

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020