| 107 | | try: |
|---|
| 108 | | sql = """ |
|---|
| 109 | | UPDATE azcalendar_event set |
|---|
| 110 | | author = \"%s\", |
|---|
| 111 | | time_insert =%s, |
|---|
| 112 | | time_update =%s, |
|---|
| 113 | | time_begin =%s, |
|---|
| 114 | | time_end =%s, |
|---|
| 115 | | type= %s, |
|---|
| 116 | | priority = %s, |
|---|
| 117 | | title = \"%s\" where id = %s |
|---|
| 118 | | """ % ( self._author_,self._time_insert_, self._time_update_ , |
|---|
| 119 | | self._time_begin_, self._time_end_ , self._type_ ,self._priority_, self._title_, self._id_ ) |
|---|
| 120 | | req.hdf['sql'] = sql |
|---|
| 121 | | cursor.execute(sql) |
|---|
| 122 | | db.commit() |
|---|
| 123 | | return 'redirect.cs', None |
|---|
| 124 | | except: |
|---|
| 125 | | req.hdf['azcalendar.reason'] = "Database failure." |
|---|
| 126 | | return 'azerror.cs', None |
|---|
| | 110 | sql = """ |
|---|
| | 111 | UPDATE azcalendar_event |
|---|
| | 112 | SET |
|---|
| | 113 | author = %s, |
|---|
| | 114 | time_insert = %s, |
|---|
| | 115 | time_update = %s, |
|---|
| | 116 | time_begin = %s, |
|---|
| | 117 | time_end = %s, |
|---|
| | 118 | type = %s, |
|---|
| | 119 | priority = %s, |
|---|
| | 120 | title = %s |
|---|
| | 121 | WHERE |
|---|
| | 122 | id = %s |
|---|
| | 123 | """ |
|---|
| | 124 | cursor.execute(sql, |
|---|
| | 125 | (self._author_, |
|---|
| | 126 | self._time_insert_, self._time_update_, self._time_begin_, self._time_end_, |
|---|
| | 127 | self._type_, self._priority_, self._title_, self._id_)) |
|---|
| | 128 | db.commit() |
|---|
| | 129 | return 'redirect.cs', None |
|---|
| 135 | | try: |
|---|
| 136 | | sql = """ |
|---|
| 137 | | INSERT INTO azcalendar_event |
|---|
| 138 | | (author, |
|---|
| 139 | | time_insert, time_update, time_begin, time_end, |
|---|
| 140 | | type, priority, title) |
|---|
| 141 | | VALUES |
|---|
| 142 | | (\"%s\", |
|---|
| 143 | | %s, %s, %s, %s, |
|---|
| 144 | | %s, %s, "%s" ) |
|---|
| 145 | | """ % (self._author_, self._time_insert_, self._time_update_, |
|---|
| 146 | | self._time_begin_, self._time_end_ , self._type_, self._priority_, self._title_) |
|---|
| 147 | | cursor.execute(sql) |
|---|
| 148 | | db.commit() |
|---|
| 149 | | return 'redirect.cs', None |
|---|
| 150 | | except: |
|---|
| 151 | | req.hdf['azcalendar.reason'] = "Database failure." |
|---|
| 152 | | return 'azerror.cs', None |
|---|
| | 138 | sql = """ |
|---|
| | 139 | INSERT INTO azcalendar_event ( |
|---|
| | 140 | author, |
|---|
| | 141 | time_insert, time_update, time_begin, time_end, |
|---|
| | 142 | type, priority, title) |
|---|
| | 143 | VALUES ( |
|---|
| | 144 | %s, |
|---|
| | 145 | %s, %s, %s, %s, |
|---|
| | 146 | %s, %s, %s) |
|---|
| | 147 | """ |
|---|
| | 148 | cursor.execute(sql, |
|---|
| | 149 | (self._author_, |
|---|
| | 150 | self._time_insert_, self._time_update_, self._time_begin_, self._time_end_, |
|---|
| | 151 | self._type_, self._priority_, self._title_)) |
|---|
| | 152 | db.commit() |
|---|
| | 153 | return 'redirect.cs', None |
|---|
| 161 | | try: |
|---|
| 162 | | sql = "DELETE FROM azcalendar_event WHERE id = \"%s\"" % self._id_ |
|---|
| 163 | | cursor.execute(sql) |
|---|
| 164 | | db.commit() |
|---|
| 165 | | return 'redirect.cs', None |
|---|
| 166 | | except: |
|---|
| 167 | | req.hdf['azcalendar.reason'] = "Database failure." |
|---|
| 168 | | return 'azerror.cs', None |
|---|
| | 162 | sql = """ |
|---|
| | 163 | DELETE FROM azcalendar_event WHERE id = %s |
|---|
| | 164 | """ |
|---|
| | 165 | cursor.execute(sql, (self._id_,)) |
|---|
| | 166 | db.commit() |
|---|
| | 167 | return 'redirect.cs', None |
|---|