Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. cls.__instance = super(MysqlPython, cls).__new__(cls,*args,**kwargs)
  2. TypeError: object() takes no parameters
  3.  
  4. from classes.mysql_python import MysqlPython
  5. connect_mysql = MysqlPython('127.0.0.1', 'root', '', 'bio')
  6. exit()
  7.  
  8. import MySQLdb, sys
  9. from collections import OrderedDict
  10.  
  11. class MysqlPython(object):
  12. """
  13. Python Class for connecting with MySQL server and accelerate development project using MySQL
  14. Extremely easy to learn and use, friendly construction."""
  15.  
  16. __instance = None
  17. __host = None
  18. __user = None
  19. __password = None
  20. __database = None
  21. __session = None
  22. __connection = None
  23.  
  24. def __new__(cls, *args, **kwargs):
  25. if not cls.__instance or not cls.__database:
  26. cls.__instance = super(MysqlPython, cls).__new__(cls,*args,**kwargs)
  27. return cls.__instance
  28. ## End def __new__
  29.  
  30. def __init__(self, host='localhost', user='root', password='', database=''):
  31. self.__host = host
  32. self.__user = user
  33. self.__password = password
  34. self.__database = database
  35. ## End def __init__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement