Exemple #1
0
 def __init__(self):
     PostgresSearchTable.__init__(self,
                                  db=db,
                                  search_table="users",
                                  label_col="email",
                                  include_nones=True)
     # FIXME
     self._rw_userdb = db.can_read_write_userdb()
Exemple #2
0
def update(self, query, changes, resort=False, restat=False, commit=True):
    return PostgresSearchTable.update(self,
                                      query=query,
                                      changes=changes,
                                      resort=resort,
                                      restat=restat,
                                      commit=commit)
Exemple #3
0
def insert_many(self,
                data,
                resort=False,
                reindex=False,
                restat=False,
                commit=True):
    return PostgresSearchTable.insert_many(self,
                                           data=data,
                                           resort=resort,
                                           reindex=reindex,
                                           restat=restat,
                                           commit=commit)
Exemple #4
0
def sanitized_table(name):
    cur = db._execute(
        SQL("SELECT name, label_col, sort, count_cutoff, id_ordered, out_of_order, "
            "has_extras, stats_valid, total, include_nones FROM meta_tables WHERE name=%s"
            ), [name])

    def update(self, query, changes, resort=False, restat=False, commit=True):
        raise APIError({"code": "update_prohibited"})

    def insert_many(self,
                    data,
                    resort=False,
                    reindex=False,
                    restat=False,
                    commit=True):
        raise APIError({"code": "insert_prohibited"})

    # We remove the raw argument from search and lucky keywords since these allow the execution of arbitrary SQL
    def search(self, *args, **kwds):
        kwds.pop("raw", None)
        return PostgresSearchTable.search(self, *args, **kwds)

    def lucky(self, *args, **kwds):
        kwds.pop("raw", None)
        return PostgresSearchTable.lucky(self, *args, **kwds)

    from seminars import count
    table = PostgresSearchTable(db, *cur.fetchone())
    table.update = update.__get__(table)
    table.count = count.__get__(table)
    table.search = search.__get__(table)
    table.lucky = lucky.__get__(table)
    table.insert_many = insert_many.__get__(table)
    table.search_cols = [
        col for col in table.search_cols if col in whitelisted_cols
    ]
    table.col_type = {
        col: typ
        for (col, typ) in table.col_type.items() if col in whitelisted_cols
    }
    return table
Exemple #5
0
 def __init__(self, *args, **kwds):
     PostgresSearchTable.__init__(self, *args, **kwds)
     self._verifier = None  # set when importing lmfdb.verify
Exemple #6
0
 def lucky(self, *args, **kwds):
     kwds.pop("raw", None)
     return PostgresSearchTable.lucky(self, *args, **kwds)
Exemple #7
0
 def search(self, *args, **kwds):
     kwds.pop("raw", None)
     return PostgresSearchTable.search(self, *args, **kwds)
Exemple #8
0
def count(self, query, groupby=None, record=False):
    return PostgresSearchTable.count(self,
                                     query=query,
                                     groupby=groupby,
                                     record=record)