Merge branch 'master' into packaging
authorKostas Papadimitriou <kpap@grnet.gr>
Mon, 23 Jan 2012 13:34:30 +0000 (15:34 +0200)
committerKostas Papadimitriou <kpap@grnet.gr>
Mon, 23 Jan 2012 13:34:30 +0000 (15:34 +0200)
Conflicts:
pithos/settings.py
snf-pithos-app/pithos/middleware/log.py
snf-pithos-app/pithos/urls.py
snf-pithos-backend/pithos/backends/__init__.py
snf-pithos-tools/setup.py

54 files changed:
LICENSE
docs/source/devguide.rst
other/migrate-data
other/migrate-db
other/migrate-users
other/migrate.py
pithos/api/login.py [new file with mode: 0644]
snf-pithos-app/pithos/api/faults.py
snf-pithos-app/pithos/api/functions.py
snf-pithos-app/pithos/api/public.py
snf-pithos-app/pithos/api/templatetags/get_type.py
snf-pithos-app/pithos/api/urls.py
snf-pithos-app/pithos/api/util.py
snf-pithos-app/pithos/middleware/log.py
snf-pithos-app/pithos/middleware/secure.py
snf-pithos-app/pithos/middleware/user.py
snf-pithos-app/pithos/ui/views.py
snf-pithos-app/pithos/urls.py
snf-pithos-backend/pithos/backends/__init__.py
snf-pithos-backend/pithos/backends/base.py
snf-pithos-backend/pithos/backends/lib/hashfiler/__init__.py
snf-pithos-backend/pithos/backends/lib/hashfiler/blocker.py
snf-pithos-backend/pithos/backends/lib/hashfiler/context_file.py
snf-pithos-backend/pithos/backends/lib/hashfiler/mapper.py
snf-pithos-backend/pithos/backends/lib/hashfiler/store.py
snf-pithos-backend/pithos/backends/lib/sqlalchemy/__init__.py
snf-pithos-backend/pithos/backends/lib/sqlalchemy/dbworker.py
snf-pithos-backend/pithos/backends/lib/sqlalchemy/dbwrapper.py
snf-pithos-backend/pithos/backends/lib/sqlalchemy/groups.py
snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py
snf-pithos-backend/pithos/backends/lib/sqlalchemy/permissions.py
snf-pithos-backend/pithos/backends/lib/sqlalchemy/public.py
snf-pithos-backend/pithos/backends/lib/sqlalchemy/xfeatures.py
snf-pithos-backend/pithos/backends/lib/sqlite/__init__.py
snf-pithos-backend/pithos/backends/lib/sqlite/dbworker.py
snf-pithos-backend/pithos/backends/lib/sqlite/dbwrapper.py
snf-pithos-backend/pithos/backends/lib/sqlite/groups.py
snf-pithos-backend/pithos/backends/lib/sqlite/node.py
snf-pithos-backend/pithos/backends/lib/sqlite/permissions.py
snf-pithos-backend/pithos/backends/lib/sqlite/public.py
snf-pithos-backend/pithos/backends/lib/sqlite/xfeatures.py
snf-pithos-backend/pithos/backends/modular.py
snf-pithos-lib/pithos/lib/client.py
snf-pithos-lib/pithos/lib/filter.py
snf-pithos-lib/pithos/lib/hashmap.py
snf-pithos-lib/pithos/lib/transfer.py
snf-pithos-lib/pithos/lib/util.py
snf-pithos-tools/pithos/__init__.py
snf-pithos-tools/pithos/tools/dispatcher.py
snf-pithos-tools/pithos/tools/fs.py
snf-pithos-tools/pithos/tools/sh.py
snf-pithos-tools/pithos/tools/sync.py
snf-pithos-tools/pithos/tools/test.py
snf-pithos-tools/setup.py

diff --git a/LICENSE b/LICENSE
index 6f7fb94..aa12569 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright 2011 GRNET S.A. All rights reserved.
+Copyright 2011-2012 GRNET S.A. All rights reserved.
 
 Redistribution and use in source and binary forms, with or
 without modification, are permitted provided that the following
index b3614fe..b172413 100644 (file)
@@ -19,19 +19,22 @@ The present document is meant to be read alongside the OOS API documentation. Th
 
 Whatever marked as to be determined (**TBD**), should not be considered by implementors.
 
+More info about Pithos can be found here: https://code.grnet.gr/projects/pithos
+
 Document Revisions
 ^^^^^^^^^^^^^^^^^^
 
 =========================  ================================
 Revision                   Description
 =========================  ================================
-0.8 (Dec 22, 2011)         Update allowed versioning values.
+0.8 (Jan 19, 2012)         Update allowed versioning values.
 \                          Change policy/meta formatting in JSON/XML replies.
 \                          Document that all non-ASCII characters in headers should be URL-encoded.
 \                          Support metadata-based queries when listing objects at the container level.
 \                          Note Content-Type issue when using the internal django web server.
 \                          Add object UUID field.
 \                          Always reply with the MD5 in the ETag.
+\                          Note that ``/login`` will only work if an external authentication system is defined.
 0.7 (Nov 21, 2011)         Suggest upload/download methods using hashmaps.
 \                          Propose syncing algorithm.
 \                          Support cross-account object copy and move.
@@ -77,13 +80,11 @@ Revision                   Description
 Pithos Users and Authentication
 -------------------------------
 
-Pithos keeps separate databases for users and objects.
-
-Each user is uniquely identified by the ``Uniq`` field. This should be used as the user's account in the API. The API uses the ``Token`` field to authenticate a user, thus allowing cross-account requests. All API requests require a token.
+In Pithos, each user is uniquely identified by a token. All API requests require a token and each token is internally resolved to an account string. The API uses the account string to identify the user's own files, thus whether a request is local or cross-account.
 
-User entries can be modified/added via the management interface available at ``https://hostname/admin``.
+Pithos does not keep a user database. For development and testing purposes, user identifiers and their corresponding tokens can be defined in the settings file. However, Pithos is designed with an external authentication service in mind. This service must handle the details of validating user credentials and communicate with Pithos via a middleware software component that, given a token, fills in the internal request account variable.
 
-Pithos is also compatible with Shibboleth (http://shibboleth.internet2.edu/). The connection between Shibboleth and Pithos is done by ``https://hostname/login``. An application that wishes to connect to Pithos, but does not have a token, should redirect the user to the login URI.
+Client software using Pithos, if not already knowing a user's identifier and token, should forward to the ``/login`` URI. The Pithos server, depending on its configuration will redirect to the appropriate login page.
 
 The login URI accepts the following parameters:
 
@@ -94,9 +95,9 @@ next                    The URI to redirect to when the process is finished
 renew                   Force token renewal (no value parameter)
 ======================  =========================
 
-The login process starts by redirecting the user to an external URI (controlled by Shibboleth), where the actual authentication credentials are entered. Then, the user is redirected back to the login URI from Shibboleth, with various identification information in the request headers.
+When done with logging in, the service's login URI should redirect to the URI provided with ``next``, adding ``user`` and ``token`` parameters, which contain the account and token fields respectively.
 
-If the user does not exist in the database, Pithos adds the user and creates a random token. If the user exists, the token has not expired and ``renew`` is not set, the existing token is reused. Finally, the login URI redirects to the URI provided with ``next``, adding the ``user`` and ``token`` parameters, which contain the ``Uniq`` and ``Token`` fields respectively. 
+A user management service that implements a login URI according to these conventions is Astakos (https://code.grnet.gr/projects/astakos), by GRNET.
 
 The Pithos API
 --------------
index b4a9e71..91db5dd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 68c7be1..2a59b96 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index cdf1053..4a0b237 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index de2146d..b2b7fbb 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
@@ -83,4 +83,4 @@ class Cache():
         r.close()
         if not l:
             return l
-        return l[0]
\ No newline at end of file
+        return l[0]
diff --git a/pithos/api/login.py b/pithos/api/login.py
new file mode 100644 (file)
index 0000000..9f6dba0
--- /dev/null
@@ -0,0 +1,60 @@
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or
+# without modification, are permitted provided that the following
+# conditions are met:
+# 
+#   1. Redistributions of source code must retain the above
+#      copyright notice, this list of conditions and the following
+#      disclaimer.
+# 
+#   2. Redistributions in binary form must reproduce the above
+#      copyright notice, this list of conditions and the following
+#      disclaimer in the documentation and/or other materials
+#      provided with the distribution.
+# 
+# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# 
+# The views and conclusions contained in the software and
+# documentation are those of the authors and should not be
+# interpreted as representing official policies, either expressed
+# or implied, of GRNET S.A.
+
+import logging
+
+from django.http import HttpResponseNotFound, HttpResponseRedirect
+from django.utils.http import urlencode
+from django.conf import settings
+
+
+logger = logging.getLogger(__name__)
+
+
+def redirect_to_login_service(request):
+    users = settings.AUTHENTICATION_USERS
+    host = settings.AUTHENTICATION_HOST
+    if users is not None or host is None:
+       return HttpResponseNotFound()
+    
+    if request.is_secure():
+       proto = 'https://'
+    else:
+       proto = 'http://'
+       next = request.GET.get('next', '')
+       params = {'next': next}
+       renew = 'renew' in request.GET
+       if renew:
+               params['renew'] = True
+    uri = proto + host + '/login?' + urlencode(params)
+    return HttpResponseRedirect(uri)
\ No newline at end of file
index f9dd1d1..7db0084 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index e15843e..14eef95 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index a932a02..b264285 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index cb98d4c..1b544b0 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index a612ff3..aa9af55 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 709de17..53b5ebf 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 31581d8..1db8682 100644 (file)
@@ -1,5 +1,5 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
-#
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
+# 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
 # conditions are met:
index b109fac..0220d20 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 99d03a4..d334648 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index f822f1b..6b176df 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index cd7c58f..b6ef990 100644 (file)
@@ -1,5 +1,5 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
-#
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
+# 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
 # conditions are met:
@@ -35,8 +35,9 @@ from django.conf.urls.defaults import include, patterns
 
 
 urlpatterns = patterns('',
-    (r'v1(?:$|/)', include('pithos.api.urls')),
-    (r'v1\.0(?:$|/)', include('pithos.api.urls')),
-    (r'public/(?P<v_public>.+?)/?$', 'pithos.api.public.public_demux'),
-    (r'ui', include('pithos.ui.urls'))
+    (r'^v1(?:$|/)', include('pithos.api.urls')),
+    (r'^v1\.0(?:$|/)', include('pithos.api.urls')),
+    (r'^public/(?P<v_public>.+?)/?$', 'pithos.api.public.public_demux'),
+    (r'^login/?$', 'pithos.api.login.redirect_to_login_service'),
+    (r'^ui', include('pithos.ui.urls'))
 )
index 4b3c6dc..5a12c15 100644 (file)
@@ -1,5 +1,5 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
-#
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
+# 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
 # conditions are met:
@@ -47,4 +47,3 @@ def connect_backend(**kwargs):
         warnings.filters = original_filters
 
     return backend
-
index 5e7f611..daf789d 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 9b6fae9..4798ad6 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 49aa20c..2c5fc5e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 0a16b2a..67894f2 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index cfa53d2..a366156 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index b2dd1a2..fdd1204 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 7464f6d..49ada08 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 2537e57..147f3ff 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 0c98bae..9f3a37d 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index cff3bb6..7caa30e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 094e8d4..a47ec5f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 0497353..2f54aaa 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 9ebdae3..d7ae0f2 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
@@ -32,8 +32,8 @@
 # or implied, of GRNET S.A.
 
 from dbworker import DBWorker
-from sqlalchemy import Table, Column, String, Integer, MetaData
-from sqlalchemy.sql import select
+from sqlalchemy import Table, Column, String, Integer, Boolean, MetaData
+from sqlalchemy.sql import and_, select
 from sqlalchemy.schema import Index
 
 
@@ -45,30 +45,39 @@ class Public(DBWorker):
         metadata = MetaData()
         columns=[]
         columns.append(Column('public_id', Integer, primary_key=True))
-        columns.append(Column('path', String(2048)))
+        columns.append(Column('path', String(2048), nullable=False))
+        columns.append(Column('active', Boolean, nullable=False, default=True))
         self.public = Table('public', metadata, *columns, mysql_engine='InnoDB', sqlite_autoincrement=True)
         # place an index on path
         Index('idx_public_path', self.public.c.path, unique=True)
         metadata.create_all(self.engine)
     
     def public_set(self, path):
-        s = self.public.select()
+        s = select([self.public.c.public_id])
         s = s.where(self.public.c.path == path)
         r = self.conn.execute(s)
-        public = r.fetchall()
+        row = r.fetchone()
         r.close()
-        if len(public) == 0:
+        if row:
+            s = self.public.update().where(self.public.c.public_id == row[0])
+            s = s.values(active=True)
+        else:
             s = self.public.insert()
-            r = self.conn.execute(s, path = path)
-            r.close()
+            s = s.values(path=path, active=True)
+        r = self.conn.execute(s)
+        r.close()
     
     def public_unset(self, path):
-        s = self.public.delete().where(self.public.c.path == path)
+        s = self.public.update()
+        s = s.where(self.public.c.path == path)
+        s = s.values(active=False)
         r = self.conn.execute(s)
         r.close()
     
     def public_get(self, path):
-        s = select([self.public.c.public_id], self.public.c.path == path)
+        s = select([self.public.c.public_id])
+        s = s.where(and_(self.public.c.path == path,
+                                        self.public.c.active == True))
         r = self.conn.execute(s)
         row = r.fetchone()
         r.close()
@@ -77,7 +86,9 @@ class Public(DBWorker):
         return None
     
     def public_path(self, public):
-        s = select([self.public.c.path], self.public.c.public_id == public)
+        s = select([self.public.c.path])
+        s = s.where(and_(self.public.c.public_id == public,
+                                        self.public.c.active == True))
         r = self.conn.execute(s)
         row = r.fetchone()
         r.close()
index 48514fb..8fca110 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 7464f6d..49ada08 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 3c7efb2..5f1047f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 388f31a..96fa5e6 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 8ae9746..cd248dd 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index e0e2502..752c3c0 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 966612d..d5b3434 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 23f00c1..eec19b5 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
@@ -43,20 +43,23 @@ class Public(DBWorker):
         
         execute(""" create table if not exists public
                           ( public_id integer primary key autoincrement,
-                            path      text ) """)
+                            path      text not null,
+                            active    boolean not null default 1 ) """)
         execute(""" create unique index if not exists idx_public_path
                     on public(path) """)
     
     def public_set(self, path):
         q = "insert or ignore into public (path) values (?)"
         self.execute(q, (path,))
+        q = "update public set active = 1 where path = ?"
+        self.execute(q, (path,))
     
     def public_unset(self, path):
-        q = "delete from public where path = ?"
+        q = "update public set active = 0 where path = ?"
         self.execute(q, (path,))
     
     def public_get(self, path):
-        q = "select public_id from public where path = ?"
+        q = "select public_id from public where path = ? and active = 1"
         self.execute(q, (path,))
         row = self.fetchone()
         if row:
@@ -64,7 +67,7 @@ class Public(DBWorker):
         return None
     
     def public_path(self, public):
-        q = "select path from public where public_id = ?"
+        q = "select path from public where public_id = ? and active = 1"
         self.execute(q, (public,))
         row = self.fetchone()
         if row:
index 0f013da..9f4f885 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index e2c5d3a..950c6db 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
@@ -645,6 +645,7 @@ class ModularBackend(BaseBackend):
     @backend_method
     def get_uuid(self, user, uuid):
         """Return the (account, container, name) for the UUID given."""
+        
         logger.debug("get_uuid: %s", uuid)
         info = self.node.latest_uuid(uuid)
         if info is None:
@@ -657,6 +658,7 @@ class ModularBackend(BaseBackend):
     @backend_method
     def get_public(self, user, public):
         """Return the (account, container, name) for the public id given."""
+        
         logger.debug("get_public: %s", public)
         if public is None or public < ULTIMATE_ANSWER:
             raise NameError
index 45a18d8..16cfabc 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 6303c75..afaa6ed 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 02a0e6a..e65d036 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index a854d4e..2feecb1 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 905b9d0..df650de 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index c78fbe6..d3e1674 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 8625390..2138ac6 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 391a1ef..96a6411 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 767b26f..dda8e8c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 91a93bf..d92c9cb 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 35c3fdd..35d5e9c 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 #coding=utf8
 
-# Copyright 2011 GRNET S.A. All rights reserved.
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index c1149db..123ff4f 100644 (file)
@@ -1,4 +1,6 @@
-# Copyright 2011 GRNET S.A. All rights reserved.
+#!/usr/bin/env python
+
+# Copyright 2011-2012 GRNET S.A. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
@@ -203,4 +205,3 @@ setup(
          ],
       },
 )
-