##// END OF EJS Templates
Prefix gist storage with rc, and store some metadata info into...
marcink -
r3841:979edf6a beta
parent child Browse files
Show More
@@ -22,7 +22,7
22 22 #
23 23 # You should have received a copy of the GNU General Public License
24 24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25
25 from __future__ import with_statement
26 26 import os
27 27 import time
28 28 import logging
@@ -32,6 +32,7 import shutil
32 32 from pylons.i18n.translation import _
33 33 from rhodecode.lib.utils2 import safe_unicode, unique_id, safe_int, \
34 34 time_to_datetime, safe_str, AttributeDict
35 from rhodecode.lib.compat import json
35 36 from rhodecode.lib import helpers as h
36 37 from rhodecode.model import BaseModel
37 38 from rhodecode.model.db import Gist
@@ -41,7 +42,8 from rhodecode.lib.vcs import get_repo
41 42
42 43 log = logging.getLogger(__name__)
43 44
44 GIST_STORE_LOC = '.gist_store'
45 GIST_STORE_LOC = '.rc_gist_store'
46 GIST_METADATA_FILE = '.rc_gist_metadata'
45 47
46 48
47 49 class GistModel(BaseModel):
@@ -143,7 +145,17 class GistModel(BaseModel):
143 145 nodes=processed_mapping,
144 146 trigger_push_hook=False
145 147 )
146
148 # store metadata inside the gist, this can be later used for imports
149 # or gist identification
150 metadata = {
151 'gist_db_id': gist.gist_id,
152 'gist_access_id': gist.gist_access_id,
153 'gist_owner_id': owner.user_id,
154 'gist_type': gist.gist_type,
155 'gist_exipres': gist.gist_expires
156 }
157 with open(os.path.join(repo.path, '.hg', GIST_METADATA_FILE), 'wb') as f:
158 f.write(json.dumps(metadata))
147 159 return gist
148 160
149 161 def delete(self, gist, fs_remove=True):
General Comments 0
You need to be logged in to leave comments. Login now