Exemplo n.º 1
0
def take_data(conn):
    conn.send(b'Enter login: '******'Enter password safe: ')
    data = conn.recv(1024).decode("utf-8")
    password = data
    result = take_datadb(login.split()[0], password)
    id = result[0][0]
    for i in result:
        for j in i:
            conn.send(str(j).encode("utf-8"))
            conn.send(b" ")
    if result != []:
        conn.send(b'\nDelete this safe y/n ?\n')
        data = conn.recv(1024)
        if data.decode("utf-8") == 'y\n':
            delete(id)
            conn.send(b'Your safe has been successfully deleted\n')
    else:
        conn.send(b'Incorrect id or password\n')
    conn.send(b'\nBack to menu y/n ?\n')
    data = conn.recv(1024)
    if data.decode("utf-8") == 'y\n':
        welcome(conn, 1)
Exemplo n.º 2
0
 def test_name(self):
     o = database.get("homescreen.name")
     database.delete("homescreen.name")
     self.assertEqual(homescreen.name("default"), "default")
     database.set("homescreen.name", "foo")
     self.assertEqual(homescreen.name("default"), "foo")
     database.set("homescreen.name", o)
Exemplo n.º 3
0
 async def cleanup(self, ctx):
     res = select(self.conn, 'Settings', ['guild_id', 'last_command'])
     current_time = datetime.datetime.now().timestamp()
     cutoff = 3600 * 24 * 90
     cutoff_time = current_time - cutoff
     active = 0
     inactive = 0
     deleted = 0
     for row in res:
         guild_id = row[0]
         last_command = row[1]
         guild = self.bot.get_guild(guild_id)
         if guild:
             if last_command and last_command > cutoff_time:
                 active += 1
             else:
                 inactive += 1
                 logger.info("Leaving guild {0}...".format(guild.name))
                 await guild.leave()
                 ## Don't immediately delete settings in case they rejoin.
         else:
             logger.info("We are no longer in {0}".format(guild_id))
             delete(self.conn, 'Settings', ['guild_id'], [guild_id])
             deleted += 1
     self.conn.commit()
     logger.info("Active guild count: {0}".format(active))
     logger.info("Inactive guild count: {0}".format(inactive))
     logger.info("Deleted guild count: {0}".format(deleted))
     await ctx.send("Active guild count: {0}".format(active))
     await ctx.send("Inactive guild count: {0}".format(inactive))
     await ctx.send("Deleted guild count: {0}".format(deleted))
Exemplo n.º 4
0
def deleteInfo():
    if 'g-recaptcha-response' in request.args:
        g_recaptcha_response = request.args['g-recaptcha-response']
        if recaptcha.verify(g_recaptcha_response):
            u_mail = request.args['mail']
            u_password = request.args['password']
            if database.is_exist(u_mail):
                d_status, d_password = database.query_password(u_mail)
                if d_status:
                    if database.check_password(
                            u_password,
                            base64.b64decode(d_password).decode()):
                        id_status, u_id = database.find_ID(u_mail)
                        if id_status:
                            database.delete(u_id)
                            status, msg = database.reformat_id()
                            if status:
                                return {'status': True, 'data': '重新排序成功'}
                            else:
                                return {'status': True, 'data': msg}
                            return {'status': True, 'data': '删除成功'}
                        else:
                            return {'status': False, 'data': '服务器错误'}
                    else:
                        return {'status': False, 'data': '密码错误'}
                else:
                    return {'status': False, 'data': '服务器错误'}
            else:
                {'status': False, 'data': '邮箱不存在'}
        else:
            return errors.recaptcha_verify_failed
    else:
        return errors.recaptcha_not_found
Exemplo n.º 5
0
    def set_factor_address(self):
        factor_id = self.ids.factor_id_selector.text
        address = self.ids.address_selector.text
        customer = self.ids.customer_selector.text
        if customer != "unregistered user":
            if address == "Restaurant":
                postgres_delete_query = """DELETE FROM factor_address
                                           WHERE factor_id = %s"""
                values = (factor_id, )
                delete(postgres_delete_query, values, "factor_address")
                self.address = address

                postgres_delete_query = """DELETE FROM delivery
                                            WHERE  factor_id= %s"""
                values = (factor_id, )
                delete(postgres_delete_query, values, "delivery")
                self.ids.biker_selector.disabled = True
                self.ids.set_biker.disabled = True
            else:
                postgres_insert_query = """INSERT INTO factor_address(factor_id, address_phone) 
                                            VALUES (%s, %s) ON CONFLICT (factor_id) 
                                            DO UPDATE 
                                            SET address_phone = %s 
                                            WHERE factor_address.factor_id = %s"""
                values = (factor_id, address, address, factor_id)
                insert(postgres_insert_query, values, "factor_customer")
                self.ids.biker_selector.disabled = False
                self.ids.set_biker.disabled = False
            self.address = address
        else:
            self.address = "Restaurant"
Exemplo n.º 6
0
def retrieve(uid):
    entry = database.read(uid)
    if _is_expired(entry):
        database.delete(uid)
        raise database.NonExistentUID(uid)
    else:
        return entry['text']
Exemplo n.º 7
0
 def delete(self):
     national_code = self.ids.customer_selector.text
     postgres_delete_query = """DELETE FROM customer
                           WHERE national_code = %s"""
     values = (national_code, )
     delete(postgres_delete_query, values, "customer")
     self.update_customer_selector()
Exemplo n.º 8
0
def reindex_image_files():
    """
    Function reindex all Image files in DB
    Function check if path exist, if not - delete all images from this path
    Function check if image exist in this folder,
        if not - make not exist images ID's list and delete them from DB
    """
    image_files = group_image_files()
    # get path and file name
    for path, files in image_files.items():
        try:
            # check if path exist
            if os.path.exists(path):
                # get path files
                path_files = os.listdir(path)
                # filter files
                # if files not exist in FS but exist in DB - they deleted by user
                # and we need clean DB
                deletable_files = (image[1] for image in files if image[0] not in path_files)
                # looping in cycle and delete already deleted files(in FS) from DB
                for deleted_file in deletable_files:
                    # delete file selected by ID
                    Image[deleted_file].delete()

            else:
                # delete path if not exist
                delete(image for image in Image if image.image_path == path)
        except Exception:
            logger.error(traceback.format_exc())
            continue
Exemplo n.º 9
0
 def delete(self):
     national_code = self.ids.biker_selector.text
     postgres_delete_query = """DELETE FROM bike
                                WHERE national_code = %s"""
     values = (national_code, )
     delete(postgres_delete_query, values, "bike")
     self.update_biker_selector()
Exemplo n.º 10
0
 async def sign_up_cancel(self, i):
     await i.response.defer()
     raid_id = i.message.id
     timestamp = int(time.time())
     assigned_slot = select_one(self.conn, 'Assignment', ['slot_id'],
                                ['player_id', 'raid_id'],
                                [i.user.id, raid_id])
     if assigned_slot is not None:
         class_name = select_one(self.conn, 'Assignment', ['class_name'],
                                 ['player_id', 'raid_id'],
                                 [i.user.id, raid_id])
         error_msg = _(
             "Dearest raid leader, {0} has cancelled their availability. "
             "Please note they were assigned to {1} in the raid.").format(
                 i.user.mention, class_name)
         await i.channel.send(error_msg)
         class_names = ','.join(
             self.raid_cog.slots_class_names[assigned_slot])
         assign_columns = ['player_id', 'byname', 'class_name']
         assign_values = [None, _("<Open>"), class_names]
         upsert(self.conn, 'Assignment', assign_columns, assign_values,
                ['raid_id', 'slot_id'], [raid_id, assigned_slot])
     r = select_one(self.conn, 'Players', ['byname'],
                    ['player_id', 'raid_id'], [i.user.id, raid_id])
     if r:
         delete(self.conn, 'Players', ['player_id', 'raid_id'],
                [i.user.id, raid_id])
     else:
         byname = self.process_name(i.guild.id, i.user)
         upsert(self.conn, 'Players',
                ['byname', 'timestamp', 'unavailable'],
                [byname, timestamp, True], ['player_id', 'raid_id'],
                [i.user.id, raid_id])
     self.conn.commit()
     await self.raid_cog.update_raid_post(raid_id, i.channel)
Exemplo n.º 11
0
def cleanOldUsers():
  dt = datetime.date.today().toordinal() - objects.DAYS_KEEP_OLD_USERS
  old = database.select('persons', where=
    [('start_date', '<', dt), 'and', ('end_date', '<', dt)])
  for pid in [tp['pid'] for tp in old]:
    log(2, 'Removing user %d from database' % (pid,))
    database.delete('persons', { 'pid': pid })
  database.close()
def delete_menu_item(object_kind, menu_item_id):
    if request.method == 'DELETE':
        response = database.delete(api_db_mapping.mapping[object_kind]['object_type'], id=menu_item_id)
    else:
        post_data = request.get_json()
        if post_data['action'] == 'delete':
            response = database.delete(api_db_mapping.mapping[object_kind]['object_type'], post_data['store'])

    return jsonify(response)
Exemplo n.º 13
0
def delete(message_id):
    if request.method == "POST":
        password = request.form.get("password")
        if password == token:
            database.delete(message_id)
            flash("Silme İşlemi Başarılı")
            return redirect(url_for('home'))

    return render_template("wipe.html")
Exemplo n.º 14
0
 def del_model(self):
     model = self.current_model()
     if model is not None:
         self.modellogSignal.emit(
             "Model {} has been deleted successfully".format(model.name))
         database.delete(database, self.current_model())
     self.update_model_list()
     self.model_mog_list.clear()
     database.modified = True
Exemplo n.º 15
0
def delete(call):
    db.delete(id=aut.check_user(u.multithreading[str(call.message.chat.id)].current_object.summary()), title=aut.check_doc(u.multithreading[str(call.message.chat.id)].current_object.summary()))
    bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id,
                          text="{} is deleted from {}".format(
                              u.multithreading[str(call.message.chat.id)].current_object.get_title() if isinstance(u.multithreading[str(call.message.chat.id)].current_object, Book) or isinstance(
                                  u.multithreading[str(call.message.chat.id)].current_object, Article) or isinstance(u.multithreading[str(call.message.chat.id)].current_object,
                                                                           AV_Materials) else u.multithreading[str(call.message.chat.id)].current_object.get_id(),
                              u.multithreading[str(call.message.chat.id)].field))
    bot.edit_message_reply_markup(chat_id=call.message.chat.id, message_id=call.message.message_id,
                                  reply_markup=bot_features.get_inline_markup(u.keyboard_button_back))
Exemplo n.º 16
0
def delete_checkout():
    ''' EditCheckout
    ---
    delete:
        description: Deletes the checkout
        tags:
            - Payment
        parameters:
            - in: path
              name: checkout_token
              schema:
                type: string
              required: true
              description: Checkout's ID value given when it is created.
        responses:
            200:
                description: A JSON containing the result of the proccess.
                content:
                    application/json:
                      schema:
                        properties:
                          SUCCESS:
                            type: boolean
            400:
                description: A JSON containing a ERROR that identifies the problem
                content:
                    application/json:
                      schema:
                        properties:
                          ERROR:
                            type: string
    '''
    # request.args looks ugly and takes too much space...
    args = request.args
    keys = args.keys()
    required_keys = ['checkout_token']

    # Checking for required arguments
    if not args or not check_keys(required_keys, keys):
        return jsonify({'ERROR': error_message('invalid_request')}), 400

    # Checking if checkout exists
    if not db.exists('CHECKOUT', 'id', args['checkout_token']):
        return jsonify({'ERROR': error_message('invalid_checkout')}), 400

    # Delete from database
    try:
        db.delete('CHECKOUT', 'id', args['checkout_token'])
    except Exception as e:
        print(e)
        return jsonify({'ERROR': error_message('db_error')}), 500

    # Everything went well
    return jsonify({'SUCCESS': True}), 200
Exemplo n.º 17
0
    def remove_document(self, title):
        if self.get_priv() == 3:
            db.delete(title)

            id_str = str(self.get_id())
            date = get_date()
            title_str = str(title)
            db.insert_log(date + " | Librarian(" + id_str +
                          ") removed Document with title: " + title_str)
        else:
            return
Exemplo n.º 18
0
def stop_alarm(args):
    db_list = database.read("alarm")
    found = False

    alarm = []
    for row in db_list:
        if row[2] == '1':
            database.delete("alarm", row[0])
            found = True

    if not found:
        error('I\'m sorry, there are no alarms to stop')
Exemplo n.º 19
0
    def remove(self, id):
        if self.get_priv() == 3:

            db.delete(id=id)

            id_str = str(self.get_id())
            date = get_date()
            us_id_str = str(id)
            db.insert_log(date + " | Librarian(" + id_str +
                          ") removed user with id: " + us_id_str)
        else:
            return
Exemplo n.º 20
0
 def delete(self):
     try:
         if (self.entry_order_id.get() == ""):
             tk.messagebox.showerror('Error','Select an entry')
         else:
             confirmation = tk.messagebox.askquestion('Delete Data','Are you sure you want to delete this entry')
             if confirmation == 'yes':
                 data = (self.entry_order_id.get())
                 database.delete("Orders", "order_id = ?", (data,))
                 self.load_data()
                 self.reset()
     except sqlite3.IntegrityError:
         tk.messagebox.showerror('Error','Deletion Failed')
def delete_menu_item(object_kind, menu_item_id):
    if request.method == 'DELETE':
        response = database.delete(
            api_db_mapping.mapping[object_kind]['object_type'],
            id=menu_item_id)
    else:
        post_data = request.get_json()
        if post_data['action'] == 'delete':
            response = database.delete(
                api_db_mapping.mapping[object_kind]['object_type'],
                post_data['store'])

    return jsonify(response)
Exemplo n.º 22
0
    def del_bhole(self):
        """
        Deletes a borehole instance from boreholes
        """
        item = self.current_borehole()
        if item:
            self.bhlogSignal.emit("{} has been deleted".format(item.name))
            database.delete(database, item)

            self.update_List_Widget()
            self.update_List_Edits()

            database.modified = True
Exemplo n.º 23
0
def delete(call):
    if users[call.message.chat.id].object.summary()["type"] in [
            "Book", "Article", "AV"
    ]:
        id_of_user = get_property(users[call.message.chat.id].object, 2)
        db.delete(id=id_of_user)
    else:
        title_of_doc = get_property(users[call.message.chat.id].object, 0)
        db.delete(id=title_of_doc)
    bot.edit_message_text(chat_id=call.message.chat.id,
                          message_id=call.message.message_id,
                          text="{} is deleted".format(u.current.name),
                          reply_markup=bot_features.get_inline_markup(
                              u.keyboard_button_back))
Exemplo n.º 24
0
 def delete(self):
     try:
         if (self.entry_delivery_id.get() == ""):
             tk.messagebox.showerror('Error', 'Select an entry')
         else:
             confirmation = tk.messagebox.askquestion(
                 'Delete Data',
                 'Are you sure you want to delete this entry')
             if confirmation == 'yes':
                 data = (self.entry_delivery_id.get(), self.entry_fee.get())
                 database.delete("delivery ",
                                 "delivery_id = ? and delivery_fee = ?",
                                 data)
                 self.load_data()
     except sqlite3.IntegrityError:
         tk.messagebox.showerror('Error', 'Deletion Failed')
Exemplo n.º 25
0
 async def timezone(self, ctx, timezone):
     """Sets the user's default timezone to be used for raid commands."""
     conn = self.bot.conn
     if timezone in [_("delete"), _("reset"), _("default")]:
         res = delete(conn, 'Timezone', ['player_id'], [ctx.author.id])
         if res:
             conn.commit()
             await ctx.send(
                 _("Deleted timezone information for {0}.").format(
                     ctx.author.mention))
         else:
             await ctx.send(_("An error occurred."))
         return
     try:
         tz = pytz.timezone(timezone)
     except pytz.UnknownTimeZoneError as e:
         await ctx.send(str(e) + _(" is not a valid timezone!"))
     else:
         tz = str(tz)
         res = upsert(conn, 'Timezone', ['timezone'], [tz], ['player_id'],
                      [ctx.author.id])
         if res:
             conn.commit()
             await ctx.send(
                 _("Set default timezone for {0} to {1}.").format(
                     ctx.author.mention, tz))
         else:
             await ctx.send(_("An error occurred."))
     return
Exemplo n.º 26
0
def delete_wallet():
    sql = """SELECT my_list.name, value, volume, my_list.id, virtual_id FROM virtual_wallet
            LEFT JOIN my_list ON my_list.id = virtual_wallet.company_id"""
    results = database.select(sql)
    print()
    i = 1
    if results:
        for result in results:
            print("{i} - {n} : {p}€ {v}".format(i=i, n=result[0], p=result[1], v=result[2]))
            i += 1
        print("0 - Retour\n")
        action = input("Quelle action voulez-vous supprimer ?")
        action = int(action)
        if action == 0:
            wallet.virtual()
        if 0 < action <= len(results):
            action = results[action - 1]
            sql = "DELETE FROM virtual_wallet WHERE virtual_id={i}"\
                .format(i=action[4])
            request = database.delete(sql)
            if request == "delete":
                print("----- {n} ({vo}) -----\nValeur: {va}€ supprimé".format(n=action[0], vo=action[2], va=action[1]))
        else:
            print("Merci de rentrer une valeur valable")
            time.sleep(2)
            delete_wallet()
    else:
        print("Pas d'actions")
    time.sleep(2)
    wallet.submenu_virtual()
Exemplo n.º 27
0
    def uncheck(self):
        """
        This method allows to delete the last completion of a task.

        Returns
        -------
        bool
            Could the record for the completion be deleted successfully?

        """
        if self.is_completed_today == 1:
            confirm_removal = input("Do you really want to remove today's"
                                    " habit completion? [y/n]")
            if confirm_removal == "y":
                query = """
                    DELETE FROM streak
                    WHERE streak_id=
                        (SELECT max(streak_id)
                         FROM streak
                         WHERE habit_id=?)
                    """
                where = (self.habit.habit_id, )

                if db.delete(query, where) != 0:
                    print("Today's completion has been deleted!")
                    return True
                else:
                    return False
            else:
                print("Action cancelled!")
                return False
        else:
            print("The habit has not yet been checked off today..."
                  " If not now, when?!")
Exemplo n.º 28
0
    def eliminar(self):
        row = self.tableWidget.currentRow()
        if row >= 0:
            msg = QMessageBox()
            msg.setIcon(QMessageBox.Question)
            msg.setText("Desea eliminar este registro")
            msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No
                                   | QMessageBox.Cancel)
            reply = msg.exec_()

            if reply == QMessageBox.Yes:
                pais = (self.tableWidget.item(row, 0).text())
                sexo = (self.tableWidget.item(row, 2).text())
                edad = (self.tableWidget.item(row, 3).text())
                gene = (self.tableWidget.item(row, 8).text())
                num = db.delete(pais, sexo, edad, gene)

                if num > 0:
                    mensaje = QMessageBox()
                    mensaje.setText("Registro eliminado")
                    mensaje.exec_()
                    self.obtener()

        else:
            mensaje = QMessageBox()
            mensaje.setText("Selecciona una fila de la tabla")
            mensaje.exec_()
Exemplo n.º 29
0
Arquivo: main.py Projeto: achuj/Crecs
def view_user():

    if "delete" in request.args:
        id = request.args['id']
        res = db.delete("delete from user where login _id='%s'" % (id))
        res1 = db.delete("delete from login where login_id='%s'" % (id))
        print(res)
        if (res > 0):
            res1 = db.select("select * from user")
            return render_template('admin/view_user.html', data=res1)

    if "login_id" in session['login_data']:
        res = db.select("select * from user")
        return render_template("admin/view_user.html", data=res)
    else:
        return redirect(url_for('public/login'))
Exemplo n.º 30
0
def deletedatabase(name, token):
    if apptoken.verify(token):
        if db.delete(name):
            return Response("Database deleted")
        else:
            return Response("Error deleting database", status=400)
    else:
        return Response("Invalid authorization", status=401)
Exemplo n.º 31
0
def cancel_alarm(args):
    db_list = database.read("alarm")
    print("cancelling alarm at", args)
    uid = ''
    parsed_datetime = get_datetime_from_time(args)

    for row in db_list:
        if row[1] == str(parsed_datetime.timestamp()) or row[1] == str(
            (parsed_datetime - datetime.timedelta(days=1)).timestamp()):
            uid = row[0]
            break

    if uid == '':
        error('I\'m sorry, there is no alarm set for ' + " ".join(args))
        return

    database.delete("alarm", uid)
Exemplo n.º 32
0
 def delete(self, email):
   if not self.isLegalUser(email):
     self.error(404)
   else:
     if self.request.url.endswith('apply'):
       data = mafDelete(email)
     else:
       data = delete(email)
     self.checkData(data)
Exemplo n.º 33
0
 def set_factor_customer(self):
     factor_id = self.ids.factor_id_selector.text
     customer = self.ids.customer_selector.text
     if customer == "unregistered user":
         postgres_insert_query = """DELETE FROM factor_customer
                                    WHERE factor_customer.factor_id = %s"""
         values = (factor_id)
         delete(postgres_insert_query, values, "factor_customer")
     else:
         postgres_insert_query = """INSERT INTO factor_customer(factor_id, customer_national_code) VALUES (%s, %s)
                                    ON CONFLICT (factor_id)
                                    DO UPDATE 
                                    SET customer_national_code = %s
                                    WHERE factor_customer.factor_id = %s"""
         values = (factor_id, customer, customer, factor_id)
         insert(postgres_insert_query, values, "factor_customer")
     self.address_lister()
     self.ids.customer_selector.disabled = True
Exemplo n.º 34
0
def clear_all(cid = None, table = None, wildcard = False):
  """
   Expire data from the cache. If called without arguments, expirable
   entries will be cleared from the cache_page and cache_block tables.
  
   @param cid
     If set, the cache ID to delete. Otherwise, all cache entries that can
     expire are deleted.
  
   @param table
     If set, the table table to delete from. Mandatory
     argument if cid is set.
  
   @param wildcard
     If set to TRUE, the cid is treated as a substring
     to match rather than a complete ID. The match is a right hand
     match. If '*' is given as cid, the table table will be emptied.
  """
  if (cid == None and table == None):
    # Clear the block cache first, so stale data will
    # not end up in the page cache.
    clear_all(None, 'cache_block');
    clear_all(None, 'cache_page');
    return;
  if (cid == None):
    if (variable_get('cache_lifetime', 0)):
      # We store the time in the current user's user.cache variable which
      # will be saved into the sessions table by sess_write(). We then
      # simulate that the cache was flushed for this user by not returning
      # cached data that was cached before the timestamp.
      lib_appglobals.user.cache = REQUEST_TIME;
      cache_flush = variable_get('cache_flush', 0);
      if (cache_flush == 0):
        # This is the first request to clear the cache, start a timer.
        variable_set('cache_flush', REQUEST_TIME);
      elif (REQUEST_TIME > (cache_flush + variable_get('cache_lifetime', 0))):
        # Clear the cache for everyone, cache_flush_delay seconds have
        # passed since the first request to clear the cache.
        db_query(\
          "DELETE FROM {" + table + "} WHERE expire != %d AND expire < %d", \
          CACHE_PERMANENT, REQUEST_TIME);
        variable_set('cache_flush', 0);
    else:
      # No minimum cache lifetime, php.flush all temporary cache entries now.
      db_query(\
        "DELETE FROM {" + table + "} WHERE expire != %d AND expire < %d", \
        CACHE_PERMANENT, REQUEST_TIME);
  else:
    if (wildcard):
      if (cid == '*'):
        lib_database.delete(table).execute()
      else:
        lib_database.delete(table).condition('cid', cid +'%', 'LIKE').execute()
    else:
      lib_database.delete(table).condition('cid', cid).execute()
    def do_POST(self):
        try:
            parsed_url = urlparse(self.path)

            self.path = parsed_url.path

            # initialize mime type to be application/json
            mime_type = mime_types.get('json')

            # initialize response to client
            response = ''

            # api request
            if is_api(self.path):

                api_regex_match = get_api_match(self.path)
                # extract api call from request
                api_call = api_regex_match.group(3)
                api_params = parse_qs(parsed_url.query)
                # load post data and convert to dict
                post_data = from_json(self.rfile.read(int(self.headers.getheader('Content-Length'))))

                if post_data['action'] == 'update':
                    response = to_json(database.update(api_db_mapping.mapping[api_call]['object_type'], from_json(post_data['store'])))
                elif post_data['action'] == 'delete':
                    response = to_json(database.delete(api_db_mapping.mapping[api_call]['object_type'], from_json(post_data['store'])))

            self.send_response(200)
            self.send_header('Content-type', mime_type)
            self.end_headers()

            self.wfile.write(response)

            print response

            return

        except IOError:
            self.send_error(404, 'File not found: %s' % self.path)
Exemplo n.º 36
0
if len(sites) == 0:
	print 'Ce site n\'a pas l\'air d\'exister, navré.'
	sys.exit()

site_id = list(sites)[0].id

typed = ''

while typed != 'oui, vraiment!' and typed != 'non':
	typed = text('Voulez vous VRAIMENT supprimer %s ? Ceci est irréversible.\nTapez "oui, vraiment!" si c\'est le cas, ou "non" dans le cas contraire :' % domain)

if typed == 'non':
	sys.exit()

path = '/home/%s/%s' % (user, domain)
log_path = '/home/%s/logs/%s' % (user, domain)

delete_files = choices('Supprimer aussi les fichiers dans %s ?' % path, dict(o=True,n=False), default='n')
delete_logs = choices('Supprimer également les logs dans %s ?' % log_path, dict(o=True,n=False), default='n')

db.delete('websites', where='id = $site_id', vars=locals())

os.system('/beadmin/restart-lighttpd.sh')

if delete_files:
	os.system('rm -Rf %s' % path)
if delete_logs:
	os.system('rm -Rf %s' % log_path)

print '%s a été supprimé !' % domain
Exemplo n.º 37
0
def deleteAlarm():
	id = request.form['id']
	db.delete(id)
	return redirect("/")
Exemplo n.º 38
0
        number = input("number: ")
        database.insert('directory.txt', name, number)
    if type=="f":
        name = input("name: ")
        found = str(database.select_one('directory.txt', name))
        if found == "None":
            print("Name not in directory")
        else:
            print(found)
    if type=="d":
        name = input("name: ")
        found = str(database.select_one('directory.txt', name))
        if found == "None":
            print("Name not in directory")
        else:
            database.delete('directory.txt', name)
    if type=="u":
        name = input("name: ")
        found = str(database.select_one('directory.txt', name))
        if found == "None":
            print("Name not in directory")
        else:
            number = input("new number: ")
            database.update('directory.txt', name, number)
    if type=="q":
        break
    
            
    
        
Exemplo n.º 39
0
 def delete(self, email):
   self.isLegalUser(email)
   if self.request.url.endswith(email):
     self.checkData(delete(email))
   else:
     self.abort(404)