Revision 29148653 snf-pithos-backend/pithos/backends/lib/sqlalchemy/public.py
b/snf-pithos-backend/pithos/backends/lib/sqlalchemy/public.py | ||
---|---|---|
45 | 45 |
|
46 | 46 |
logger = logging.getLogger(__name__) |
47 | 47 |
|
48 |
|
|
48 | 49 |
def create_tables(engine): |
49 | 50 |
metadata = MetaData() |
50 | 51 |
columns = [] |
... | ... | |
80 | 81 |
candidate = get_random_word(length=l, alphabet=public_url_alphabet) |
81 | 82 |
if self.public_path(candidate) is None: |
82 | 83 |
return candidate |
83 |
l +=1 |
|
84 |
l += 1
|
|
84 | 85 |
|
85 | 86 |
def public_set(self, path, public_security, public_url_alphabet): |
86 | 87 |
s = select([self.public.c.public_id]) |
... | ... | |
117 | 118 |
def public_get(self, path): |
118 | 119 |
s = select([self.public.c.url]) |
119 | 120 |
s = s.where(and_(self.public.c.path == path, |
120 |
self.public.c.active == True))
|
|
121 |
self.public.c.active)) |
|
121 | 122 |
r = self.conn.execute(s) |
122 | 123 |
row = r.fetchone() |
123 | 124 |
r.close() |
... | ... | |
129 | 130 |
s = select([self.public.c.path, self.public.c.url]) |
130 | 131 |
s = s.where(self.public.c.path.like( |
131 | 132 |
self.escape_like(prefix) + '%', escape=ESCAPE_CHAR)) |
132 |
s = s.where(self.public.c.active == True)
|
|
133 |
s = s.where(self.public.c.active) |
|
133 | 134 |
r = self.conn.execute(s) |
134 | 135 |
rows = r.fetchall() |
135 | 136 |
r.close() |
... | ... | |
138 | 139 |
def public_path(self, public): |
139 | 140 |
s = select([self.public.c.path]) |
140 | 141 |
s = s.where(and_(self.public.c.url == public, |
141 |
self.public.c.active == True))
|
|
142 |
self.public.c.active)) |
|
142 | 143 |
r = self.conn.execute(s) |
143 | 144 |
row = r.fetchone() |
144 | 145 |
r.close() |
Also available in: Unified diff