소스 검색

LodelContext is used in the lodelsite starting process

Roland Haroutiounian 8 년 전
부모
커밋
360a60fee7
2개의 변경된 파일20개의 추가작업 그리고 1개의 파일을 삭제
  1. 10
    1
      lodel/context.py
  2. 10
    0
      progs/slim/slim.py

+ 10
- 1
lodel/context.py 파일 보기

@@ -271,4 +271,13 @@ initialize it anymore")
271 271
             warnings.warn("A module exposure leads in globals overwriting for \
272 272
 key '%s'" % alias)
273 273
         globs[alias] = obj
274
-        
274
+
275
+    ## @brief initializes a context from the path
276
+    # @param path str
277
+    @classmethod
278
+    def from_path(cls, path):
279
+        sitename = path.split('/')[-1]
280
+        if cls._type == cls.MULTISITE:
281
+            cls._contexts[sitename] = cls.new(sitename)
282
+        else:
283
+            cls._current = cls.new(sitename)

+ 10
- 0
progs/slim/slim.py 파일 보기

@@ -253,6 +253,15 @@ def get_pid(name):
253 253
 ##@brief Start an instance
254 254
 #@param names list : instance name list
255 255
 def start_instances(names, foreground):
256
+    from lodel.context import LodelContext
257
+    for name in names:
258
+        if name in LodelContext._contexts:
259
+            logging.warning("The instance %s is already activated" % name)
260
+            continue
261
+        LodelContext.from_path(name)
262
+        logging.info("Instance '%s' started.")
263
+
264
+    '''
256 265
     pids = get_pids()
257 266
     store_datas = get_store_datas()
258 267
     
@@ -274,6 +283,7 @@ def start_instances(names, foreground):
274 283
             pids[name] = curexec.pid
275 284
             logging.info("Instance '%s' started. PID %d" % (name, curexec.pid))
276 285
     save_pids(pids)
286
+    '''
277 287
 
278 288
 ##@brief Stop an instance given its name
279 289
 #@param names list : names list

Loading…
취소
저장