def test_create_contact(self): a = contact(1,'Ashish','*****@*****.**','9787619875','Thano, dehradun') b = contact(2,'Anurag','*****@*****.**','9787629875','Thano, dehradun') c = contact(3,'Kuldeep','*****@*****.**','9787639875','Thano, dehradun') d = contact(4,'Rachit','*****@*****.**','9787649875','Thano, dehradun') e = contact(5,'Omkar','*****@*****.**','9787659875','Thano, dehradun') f = contact(6,'Krishna','*****@*****.**','9787669875','Thano, dehradun') g = contact(7,'Pandey','*****@*****.**','9787679875','Thano, dehradun') h = contact(8,'Vaibhav','*****@*****.**','9787689875','Thano, dehradun') i = contact(9,'Anil','*****@*****.**','9787699875','Thano, dehradun') cm = contacts_manager([a,b,c,d,e,f,g,h,i]) self.assertEqual(len(cm.view_contacts()),9)
def contactWeb(): if 'id' in login_session and login_session.get('type') == "0": contactsDetails = contact.query.filter_by().all() return render_template('contactAdmin.html', contactsDetails=contactsDetails) else: if request.method == 'POST': if 'id' in login_session: firstName = login_session["fn"] email = login_session["email"] firstName = request.form["firstName"] email = request.form["email"] subject = request.form["subject"] message = request.form["message"] newContact = contact(fname=firstName, email=email, subject=subject, message=message) db.session.add(newContact) db.session.commit() return redirect(url_for('contactWeb')) else: return render_template('contact.html') """ returns contact page """
def test_add_empty_contacts(self): success = True wd = self.wd self.open_home_page(wd) self.Login(wd, username="******", password="******") self.new_contact_page(wd) self.add_contact(wd, contact(firstname="", midname="", lastname="", nik="", title="", company="", address="", home="", mobile="", work="", fax="", email="")) self.logout(wd)
def test_add_contacts(self): success = True wd = self.wd self.open_home_page(wd) self.Login(wd, username="******", password="******") self.new_contact_page(wd) self.add_contact(wd, contact(firstname="sqw", midname="ws", lastname="gbrt", nik="vrvrbvr", title="brr", company="ggr", address="ggrrg", home="erft3", mobile="3g3erfd", work="juyhg", fax="grf", email="fre34")) self.logout(wd)
def contact(num): flds = [ 'name', 'address', 'city', 'zipcode', 'telephone1', 'telephone2', 'ci_webpage_1', 'website_url' ] types = ['PLB', 'ELT', 'EPIRB'] return render_template("contact.html", contact=contacts.contact(num, flds, types), types=types, flds=flds, showmenu=MENU)
def Contact(): """ returns index page """ if request.method == 'POST': name = request.form["name"] phone = request.form["number"] email = request.form["email"] message = request.form["message"] contactx = contact(name=name, phone=phone, email=email, message=message) db.session.add(contactx) db.session.commit() return render_template('contact.html') else: return render_template('contact.html')
def decoded(hexcode): flds = [('Organization', 'name'), ('Address', 'address'), ('City', 'city'), ('Zip code', 'zipcode'), ('Phone', 'telephone1'), ('Alternate Phone:', 'telephone2'), ('Email:', 'email'), ('Contact Website', 'ci_webpage_1'), ('Other information', 'website_url')] contacttypes = ['PLB', 'ELT', 'EPIRB'] tflds2 = [('Model', 'name'), ('', { 'manufacturer_id': ['name', 'short_name'] }), ('Manufacturer', 'manufacturer_id'), ('ID', 'id'), ('Sub TAC', 'database_id'), ('Other name', 'model_add_names'), ('Battery', 'battery'), ('Protocols Tested', 'protocols_tested')] tflds = [('Model', 'name')] # send POST request to jotforms for logging #ipaddress=str(request.remote_addr) #ipaddress = str(request.environ.get('HTTP_X_REAL_IP', request.remote_addr)) ipaddress = str( request.environ.get('HTTP_X_FORWARDED_FOR', request.remote_addr)) #if ipaddress in ['199.199.172.43','199.162.159.113']: # return 'Automated script detected - blocked' geocoord = (0, 0) locationcheck = False try: beacon = decodehex2.Beacon(hexcode) error = '' if len(beacon.errors) > 0: error = ', '.join(beacon.errors) if beacon.type == 'uin': if beacon.gentype == 'first': tmp = 'encodelongfirst.html' # redirect with the hexcode, beacon type - different inputs depending on type of first gen change 3 elif beacon.gentype == 'second': tmp = 'encodelongsecond.html' print('sgb uin') elif beacon.gentype == 'secondtruncated': tmp = 'output.html' else: tmp = 'output.html' if beacon.has_loc() and is_number(beacon.location[0]) and is_number( beacon.location[1]): geocoord = (float(beacon.location[0]), float(beacon.location[1])) locationcheck = True mid = str(beacon.get_mid()) #print([c[0] for c in contacttypes]) #print(contacts.contact(mid,[f[1] for f in flds],[c[0] for c in contacttypes])) taclist = typeapproval.tac(beacon.gettac(), [f[1] for f in tflds]) taclist = [] tacdic = {} if len(taclist) > 0: for l in taclist: k = l['id'] tacdic[k] = l hexsave = Hexdecodes(hex=hexcode, ipaddress=ipaddress) db.session.add(hexsave) db.session.commit() return render_template(tmp, hexcode=hexcode.upper(), decoded=beacon.tablebin, errors=beacon.errors, warnings=beacon.warnings, locationcheck=locationcheck, geocoord=geocoord, genmsg=beacon.genmsg, uin=beacon.hexuin(), contact=contacts.contact( mid, [f[1] for f in flds], contacttypes), types=contacttypes, flds=flds, tac=beacon.gettac(), tacdetail=tacdic, tacflds=tflds, showmenu=MENU, gmap_key=gmap_key) except (decodehex2.Gen2.Gen2Error or decodehex2.HexError) as err: # decodehex2.HexError or print(err.value, err.message) return render_template('badhex.html', errortype=err.value, errormsg=err.message)
def __init__(self): """ Attributes ---------- Trm : float solar cell temperature tau_th : float carrier thermalization time tau_pp : float optical phonon decay time NM : float number of phonon modes Tph : float optical phonon temperature EP : bool if true, solve electron phonon balance equations d : float thickness of the cell if bulk structure is assumed Ephn : float dominant phonon energy (only used in polar optical (POP) scattering) hw0 : float dominant longitudinal optical (LO) phonon energy absb : class absorber class object defined in a separate file lcnt : class left electrical contact defined in a separte file rcnt : class right electrical contacts defined in a separete file lesc : class left energy selective contact defined in a separate file resc :class right energy selective contact defined in a separate file Jext : function current through energy selective contact Uext : function energy through energy selective contact Uth : function carrier energy thermalization rate _c1 : float constant variables _cJ : float constant variables _cS : float constant variables Methods ------- display_attributes(self): print attributes JextTherm(muc, mue) current flux extraction via thermionic emission UextTherm(muc, mue) energy flux extraction via thermionic emission JextESC(self, muc, mue) extracted current through tunneling assume carrier selective contact electron current flows from absb to right contact (absb->resc->rcnt) UextESC(self, muc, mue) extracted energy flux JextRN(self, muc, mue) unused UextRN(self, muc, mue) unused Uthstandard(self, muc): standard thermalization consider dimension try 3D parameter is tau_th thermalization time """ # Current and energy flux # Choose either via thermionic emission or tunneling # via tunneling self.Jext = self.JextESC self.Uext = self.UextESC # via thermionic emission self.Jext = self.JextTherm self.Uext = self.UextTherm # thermalization loss in bulk self.Uth = self.Uthstandard self.Trm = 300.0 self.tau_th = 1.0*nu.ps self.tau_pp = 8.0*nu.ps self.NM = 1.0e17 # good guess number self.Tph = 300.0 self.EP = False self.d = 100*nu.nm self.Ephn = 28.8*nu.meV self.hw0 = self.Ephn # For future purpose, materials in each components are defined # in separate files in bulk and contacts self.absb = bulk.bulk() # electrical contact self.lcnt = contacts.contact() self.rcnt = contacts.contact() # energy selective contacts left and right self.lesc = contacts.energy_selective_contact() self.resc = contacts.energy_selective_contact() # default set extraction energy at 5% above energy band gap self.resc.E = self.absb.Eg*1.05 # These are constants self._c1 = 2*np.pi/(sc.h**3*sc.c**2) # Jrec self._cJ = sc.e*self.absb.m_e/(2*np.pi**2*sc.hbar**3) # Je self._cS = self.absb.m_e/(2*np.pi**2*sc.hbar**3) # Se return