Exemplo n.º 1
0
 def plant_settings_list(self):
     try:
         plant_settings = PlantSettings_Session.query(PlantSetting).all()
     except DBAPIError:
         return Response('database error.',
                         content_type='text/plain',
                         status_int=500)
     return {'plant_settings': plant_settings}
Exemplo n.º 2
0
 def plant_settings_view(self):
     try:
         plant_setting = PlantSettings_Session.query(PlantSetting).filter(
             PlantSetting._id == self.request.matchdict['_id']).first()
         return {'plant_setting': plant_setting}
     except DBAPIError:
         return Response('database error.',
                         content_type='text/plain',
                         status_int=500)
Exemplo n.º 3
0
class StageConfigurationSchema(MappingSchema):
    parameter = SchemaNode(
        typ=Int(),
        title='Parameter',
        widget=SelectWidget(values=[(_id, name)
                                    for _id, name in DBSession.query(
                                        Parameter._id, Parameter.name)]))
    time = SchemaNode(typ=Time(), title='Time', default=time(0, 0))
    setpoint = SchemaNode(typ=Float(), title='Setpoint')
    upper_limit = SchemaNode(typ=Float(), title='Upper limit')
    lower_limit = SchemaNode(typ=Float(), title='Lower limit')
Exemplo n.º 4
0
 def stage_new(self):
     response_dict = dict()
     addForm = Form(StageSchema(), formid='addForm', buttons=('Save',), use_ajax=True)
     form = addForm.render()
     if 'Save' in self.request.POST:
         controls = self.request.POST.items()
         try:
             plant_setting = PlantSettings_Session.query(PlantSetting).filter(PlantSetting._id==self.request.matchdict['_id']).first()
         except DBAPIError:
             return Response('database error.', content_type='text/plain', status_int=500)
         try:
             values = addForm.validate(controls)
             new_stage = Stage(plant_setting, values['Number'], values['Duration'], values['Name'], values['Description'])
             PlantSettings_Session.add(new_stage)
             return HTTPFound(location=self.request.route_url('plant_settings_view', _id=plant_setting._id))
         except ValidationFailure as e:
             form = e.render()
     return {'addForm': form}
 def plant_settings_view(self):
     try:
         plant_setting = PlantSettings_Session.query(PlantSetting).filter(PlantSetting._id==self.request.matchdict['_id']).first()
         return {'plant_setting': plant_setting}
     except DBAPIError:
         return Response('database error.', content_type='text/plain', status_int=500)
 def plant_settings_list(self):
     try:
         plant_settings = PlantSettings_Session.query(PlantSetting).all()
     except DBAPIError:
         return Response('database error.', content_type='text/plain', status_int=500)
     return {'plant_settings': plant_settings}
Exemplo n.º 7
0
 def stage_view(self):
     try:
         stage = PlantSettings_Session.query(Stage).filter(Stage._id==self.request.matchdict['_id']).first()
         return {'stage': stage}
     except DBAPIError:
         return Response('database error.', content_type='text/plain', status_int=500)