def decoder_destroy(request): d = Decoder() ids = request.POST.getlist('id') d.destroy(ids) v = Venue() v.remove_decoder_by_ids(ids) return HttpResponse('ok')
def venue_save(request): v = Venue() inf = request.POST if inf.has_key('id'): return HttpResponse(v.update(inf)) else: return HttpResponse(v.create(inf))
def decoder_save(request): d = Decoder() inf = request.POST if inf.has_key('id'): v = Venue() v.update_decoder(inf['id'],inf) return HttpResponse(d.update(inf)) else: return HttpResponse(d.create(inf))
def load_raw_from_file(self, input_file): self.venues = {} with open(input_file, 'r') as fin: for line in fin: try: venue = Venue() venue.load_raw(line) self.venues[venue.vid] = venue except: # print line continue
def inf(self): v = Venue() for venue in self.root.findall('Venues/Venue'): name = etree.SubElement(venue, 'name') name.text = v.find(venue.get('id')).find('name').text all = etree.SubElement(self.root, 'AllVenues') for venue in v.root.findall('Venue'): _v = etree.SubElement(all, 'Venue') _v.set('id', venue.get('id')) name = etree.SubElement(_v, 'name') name.text = venue.find('name').text return self.root
def getVenues(self): venues = [] self.__cursor.execute('SELECT * FROM Venue;') data = self.__cursor.fetchall() for row in data: venues.append(Venue(row[1], row[2])) return venues
def __init__(self): self.venues.append(Venue(0, "Union Concourse", 300)) self.venues.append(Venue(1, "Union Ballroom", 1500, False, 2)) self.venues.append(Venue(2, "Wisconsin Room", 1500, False, 3)) self.venues.append(Venue(3, "Alumni Fireside Lounge", 200)) self.venues.append( Venue(4, "Art Gallery", 300, limited_availability=True)) self.venues.append( Venue(5, "Union Cinema", 300, limited_availability=True)) self.venues.append(Venue(6, "Ernest Spaights Plaza", 300)) self.venues.append(Venue(7, "Pangaea Mall", 300)) self.venues.append(Venue(8, "Other Outdoor", 2000, in_door=False)) meeting_rooms = [ 145, 179, 181, 183, 191, 198, 220, 240, 250, 260, 280, 340, 342, 343, 344, 346, 347 ] for i, m in enumerate(meeting_rooms): self.venues.append(Venue(i + 9, m, 6))
def __init__(self, event_data): self.listing_count = event_data['stats']['listing_count'] self.average_price = event_data['stats']['average_price'] self.lowest_price_good_deals = event_data['stats'][ 'lowest_price_good_deals'] self.lowest_price = event_data['stats']['lowest_price'] self.highest_price = event_data['stats']['highest_price'] self.title = event_data['title'] self.url = event_data['url'] self.datetime_local = event_data['datetime_local'] self.announce_date = event_data['announce_date'] self.visible_until_utc = event_data['visible_until_utc'] self.time_tbd = event_data['time_tbd'] self.date_tbd = event_data['date_tbd'] self.performers = [ Performer(performer) for performer in event_data['performers'] ] self.venue = Venue(event_data['venue']) self.short_title = event_data['short_title'] self.score = event_data['score'] self.taxonomies = event_data['taxonomies'] self.type = event_data['type']
def make_shows(self, html): """Venue-specific parsing for Show (namedtuple) creation.""" today = datetime.date.today() summaries = self.get_summaries(html) for s in summaries: artists = self.get_artist_billing(s) venue_name, venue_id = self.get_venue_info(s) show_iso = self.get_show_date(s, today) price = self.get_show_price(s) show_url = self.get_show_url(s) show_tup = Venue.show_fac(artists=artists, venue_name=venue_name,\ venue_id=venue_id, show_date=show_iso, price=price,\ show_url=show_url, schedule_url=self.url, date_added=today) self.shows.append(show_tup) print("Found {} shows".format(len(self.shows)))
def add_venue_if_new(self, new_venue_name, new_city): a_venue = Venue(new_venue_name, new_city) self.all_my_venues.append(a_venue) return a_venue
my_hs_garage_band = Band(name="My Band From High School") phish.shows.extend([phish_12_31_95, phish_11_28_03]) dead.shows.extend([dead_5_8_77, dead_venetta, dead_1_7_79]) person1.shows.extend([dead_5_8_77, phish_12_31_95, phish_11_28_03]) person2.shows.extend([dead_venetta, dead_5_8_77]) person3.shows.append(dead_venetta) # Cities uniondale = City(name="Uniondale, NY") veneta = City(name="Veneta, OR") nyc = City(name="New York, NY") ithaca = City(name="Ithaca, NY") # Venues nassau_coliseum = Venue(name='Nassau Veterans Memorial Coliseum', capacity=17686) springfield_creamery = Venue(name='Springfield Creamery', capacity=30000) msg = Venue(name="Madison Square Garden", capacity=20789) barton_hall = Venue(name="Barton Hall", capacity=5000) brooklyn_bowl = Venue(name="Brooklyn Bowl", capacity=600) nassau_coliseum.city = uniondale springfield_creamery.city = veneta msg.city = nyc barton_hall.city = ithaca brooklyn_bowl.city = nyc phish_11_28_03.venue = nassau_coliseum phish_12_31_95.venue = msg dead_5_8_77.venue = barton_hall dead_venetta.venue = springfield_creamery
def add_decoder(request): v = Venue() inf = request.POST v.add_decoder(inf) return HttpResponse('ok')
def remove_decoder(request): v = Venue() id = request.POST['id'] device_id = request.POST['device_id'] v.remove_decoder(id,device_id) return HttpResponse('ok')
def add_device(request): v = Venue() id = request.POST['id'] return HttpResponse(v.add_device(id))
def venue_list(request): v = Venue() return HttpResponse(etree.tostring(v.list(), encoding='UTF-8', xml_declaration=True, pretty_print=True),mimetype='text/xml')
def remove_venue(request): v = Venue() id = request.POST['id'] v.destroy(id) return HttpResponse('ok')
def setUp(self): self.venue_00 = Venue(0, "Test", 100) self.venue_01 = Venue(1, "Test", 100)