Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Cherokee: commits
[6825] wizards2: WIP: Implements internal Virtual Server wizards support.
 

Index | Next | Previous | View Flat


cherokee at cherokee-project

Aug 24, 2011, 8:49 AM


Views: 152
Permalink
[6825] wizards2: WIP: Implements internal Virtual Server wizards support.

Revision: 6825
http://svn.cherokee-project.com/changeset/6825
Author: alo
Date: 2011-08-24 17:49:25 +0200 (Wed, 24 Aug 2011)
Log Message:
-----------
WIP: Implements internal Virtual Server wizards support.

Modified Paths:
--------------
wizards2/Wizard2.py
wizards2/Wizard2_GUI.py
wizards2/wizards/drupal.py
wizards2/wizards/wordpress.py

Modified: wizards2/Wizard2.py
===================================================================
--- wizards2/Wizard2.py 2011-08-24 15:46:11 UTC (rev 6824)
+++ wizards2/Wizard2.py 2011-08-24 15:49:25 UTC (rev 6825)
@@ -33,13 +33,13 @@
"""
self.params
-----------
- type : 'directory' or 'vserver'
- vserver_num: 10, 20, ..
- directory: /webdir
- vserver_nick: example.com
- app_fetch: /tmp/bat.tgz, http://_/foo.tgz
- app_dir: /var/www_apps/worpress
- targz_path: /tmp/foobar.tgz
+ type : 'directory' or 'vserver'
+ vserver_num: 10, 20, ..
+ web_directory: /webdir
+ vserver_nick: example.com
+ app_fetch: /tmp/bat.tgz, http://_/foo.tgz
+ app_dir: /var/www_apps/worpress
+ targz_path: /tmp/foobar.tgz
"""

type = property (lambda s: s.params.get('type'), lambda s,v: s.params.update({'type': v}))
@@ -101,17 +101,17 @@
# Directory
if self.type == 'directory':
vserver_num = self.params.get('vserver_num')
- directory = self.params.get('directory')
+ directory = self.params.get('web_directory')

if not vserver_num:
errors += ["Property 'vserver_num' missing"]
elif not vserver_num.isdigit():
- errors += [."Invalid value of the 'directory' property: it must be a number"]
+ errors += [."Invalid value of the 'vserver_num' property: it must be a number"]

if not directory:
- errors += ["Property 'directory' missing"]
+ errors += ["Property 'web_directory' missing"]
elif directory[0] != '/':
- errors += [."Invalid value of the 'directory' property: it must be a directory path"]
+ errors += [."Invalid value of the 'web_directory' property: it must be a directory path"]

# Virtual Server
elif self.type == 'vserver':

Modified: wizards2/Wizard2_GUI.py
===================================================================
--- wizards2/Wizard2_GUI.py 2011-08-24 15:46:11 UTC (rev 6824)
+++ wizards2/Wizard2_GUI.py 2011-08-24 15:49:25 UTC (rev 6825)
@@ -23,6 +23,7 @@
#

import os
+import re
import time
import CTK
import validations
@@ -35,7 +36,8 @@
CFG_PREFIX = "tmp!wizard"

VALIDATION = [.
- ('%s!vserver_nick'%(CFG_PREFIX), validations.is_not_empty),
+ ('%s!vserver_nick' %(CFG_PREFIX), validations.is_not_empty),
+ ('%s!web_directory'%(CFG_PREFIX), validations.is_dir_formatted),
]

#
@@ -110,6 +112,11 @@
# Set installation type
CTK.cfg['%s!type'%(CFG_PREFIX)] = install_type

+ # Figure out virtual server ID if it's a 'directory' install
+ if install_type == "directory":
+ tmp = re.findall (r'/wizard/vserver/(\d+)/', CTK.request.url)
+ CTK.cfg['%s!vserver_num'%(CFG_PREFIX)] = tmp[0]
+
def __build_GUI__ (self):
icon = CTK.Box ({'class': 'icon'})
icon += Categories.Icon (self.wizard_info)
@@ -166,6 +173,37 @@


#
+# Enter Web Directory
+#
+
+NOTE_WEBDIR = N_("Web directory where the application will be accessible. For example: /blog")
+
+class Stage_Enter_Web_Directory (Phase_PrevNext):
+ class Apply:
+ def __call__ (self):
+ return CTK.cfg_apply_post()
+
+ def __init__ (self):
+ Phase_PrevNext.__init__ (self, _("Name of the Web Directory"))
+
+ def __build_GUI__ (self):
+ table = CTK.PropsTable()
+ table.Add (_('Web Directory'), CTK.TextCfg('%s!web_directory'%(CFG_PREFIX), False, {'class':'noauto'}), _(NOTE_WEBDIR))
+
+ submit = CTK.Submitter (URL_STAGE_ENTER_WEBDIR_APPLY)
+ submit.bind ('submit_success', CTK.DruidContent__JS_to_goto_next (table.id))
+ submit += table
+
+ self += submit
+
+URL_STAGE_ENTER_WEBDIR = "/wizard2/stages/enter_webdir"
+URL_STAGE_ENTER_WEBDIR_APPLY = "/wizard2/stages/enter_webdir/apply"
+
+CTK.publish ('^%s'%(URL_STAGE_ENTER_WEBDIR), Stage_Enter_Web_Directory)
+CTK.publish ('^%s'%(URL_STAGE_ENTER_WEBDIR_APPLY), Stage_Enter_Web_Directory.Apply, validation=VALIDATION, method="POST")
+
+
+#
# Virtual Server Logging
#

@@ -626,7 +664,7 @@
#

def Register_Standard_VServer_GUI (wizard_info, Install_Class, default_download_func):
- wizard_url_name = wizard_info['name'].lower().replace(' ', '_')
+ wizard_url_name = wizard_info['id']
url_srv = '/wizard/vserver/%s' %(wizard_url_name)

CTK.publish ('^%s$' %(url_srv), lambda: Phase_Welcome (wizard_info, 'vserver').Render().toStr())
@@ -639,8 +677,17 @@
CTK.publish ('^%s/8$'%(url_srv), Stage_Finished)

def Register_Standard_Directory_GUI (wizard_info, Install_Class, default_download_func):
- None
+ wizard_url_name = wizard_info['id']
+ url_srv = '/wizard/vserver/\d+/%s' %(wizard_url_name)

+ CTK.publish ('^%s$' %(url_srv), lambda: Phase_Welcome (wizard_info, 'directory').Render().toStr())
+ CTK.publish ('^%s/2$'%(url_srv), lambda: Stage_Install_Type (default_download_func).Render().toStr())
+ CTK.publish ('^%s/3$'%(url_srv), Stage_Enter_Web_Directory)
+ CTK.publish ('^%s/4$'%(url_srv), Stage_Install_Directory)
+ CTK.publish ('^%s/5$'%(url_srv), Stage_Download)
+ CTK.publish ('^%s/6$'%(url_srv), lambda: Stage_Do_Install (Install_Class, CTK.request.url[:-1]+'7').Render().toStr())
+ CTK.publish ('^%s/7$'%(url_srv), Stage_Finished)
+
def Register_Standard_GUI (*args, **kw):
Register_Standard_VServer_GUI (*args, **kw)
Register_Standard_Directory_GUI (*args, **kw)

Modified: wizards2/wizards/drupal.py
===================================================================
--- wizards2/wizards/drupal.py 2011-08-24 15:46:11 UTC (rev 6824)
+++ wizards2/wizards/drupal.py 2011-08-24 15:49:25 UTC (rev 6825)
@@ -80,26 +80,26 @@

CONFIG_DIR = """
%(pre_rule_plus4)s!match = request
-%(pre_rule_plus4)s!match!request = ^%(target_directory)s/([0-9]+)$
+%(pre_rule_plus4)s!match!request = ^%(web_directory)s/([0-9]+)$
%(pre_rule_plus4)s!handler = redir
-%(pre_rule_plus4)s!handler!rewrite!1!regex = ^%(target_directory)s/([0-9]+)$
+%(pre_rule_plus4)s!handler!rewrite!1!regex = ^%(web_directory)s/([0-9]+)$
%(pre_rule_plus4)s!handler!rewrite!1!show = 0
-%(pre_rule_plus4)s!handler!rewrite!1!substring = %(target_directory)s/index.php?q=/node/$1
+%(pre_rule_plus4)s!handler!rewrite!1!substring = %(web_directory)s/index.php?q=/node/$1

%(pre_rule_plus3)s!match = request
-%(pre_rule_plus3)s!match!request = %(target_directory)s/$
+%(pre_rule_plus3)s!match!request = %(web_directory)s/$
%(pre_rule_plus3)s!handler = redir
%(pre_rule_plus3)s!handler!rewrite!1!show = 0
-%(pre_rule_plus3)s!handler!rewrite!1!substring = %(target_directory)s/index.php
+%(pre_rule_plus3)s!handler!rewrite!1!substring = %(web_directory)s/index.php

%(pre_rule_plus2)s!match = directory
-%(pre_rule_plus2)s!match!directory = %(target_directory)s
+%(pre_rule_plus2)s!match!directory = %(web_directory)s
%(pre_rule_plus2)s!match!final = 0
%(pre_rule_plus2)s!document_root = %(app_dir)s

%(pre_rule_plus1)s!match = and
%(pre_rule_plus1)s!match!left = directory
-%(pre_rule_plus1)s!match!left!directory = %(target_directory)s
+%(pre_rule_plus1)s!match!left!directory = %(web_directory)s
%(pre_rule_plus1)s!match!right = request
%(pre_rule_plus1)s!match!right!request = \.(engine|inc|info|install|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$
%(pre_rule_plus1)s!handler = custom_error
@@ -109,7 +109,7 @@

%(pre_rule_minus1)s!match = and
%(pre_rule_minus1)s!match!left = directory
-%(pre_rule_minus1)s!match!left!directory = %(target_directory)s
+%(pre_rule_minus1)s!match!left!directory = %(web_directory)s
%(pre_rule_minus1)s!match!right = exists
%(pre_rule_minus1)s!match!right!iocache = 1
%(pre_rule_minus1)s!match!right!match_any = 1
@@ -118,14 +118,14 @@
%(pre_rule_minus1)s!handler = file

%(pre_rule_minus2)s!match = directory
-%(pre_rule_minus2)s!match!directory = %(target_directory)s
+%(pre_rule_minus2)s!match!directory = %(web_directory)s
%(pre_rule_minus2)s!handler = redir
%(pre_rule_minus2)s!handler!rewrite!1!show = 0
%(pre_rule_minus2)s!handler!rewrite!1!regex = ^/(.*)\?(.*)$
-%(pre_rule_minus2)s!handler!rewrite!1!substring = %(target_directory)s/index.php?q=$1&$2
+%(pre_rule_minus2)s!handler!rewrite!1!substring = %(web_directory)s/index.php?q=$1&$2
%(pre_rule_minus2)s!handler!rewrite!2!show = 0
%(pre_rule_minus2)s!handler!rewrite!2!regex = ^/(.*)$
-%(pre_rule_minus2)s!handler!rewrite!2!substring = %(target_directory)s/index.php?q=$1
+%(pre_rule_minus2)s!handler!rewrite!2!substring = %(web_directory)s/index.php?q=$1
"""

#

Modified: wizards2/wizards/wordpress.py
===================================================================
--- wizards2/wizards/wordpress.py 2011-08-24 15:46:11 UTC (rev 6824)
+++ wizards2/wizards/wordpress.py 2011-08-24 15:49:25 UTC (rev 6825)
@@ -66,22 +66,22 @@

CONFIG_DIR = """
%(pre_rule_plus1)s!match = directory
-%(pre_rule_plus1)s!match!directory = %(directory)s
+%(pre_rule_plus1)s!match!directory = %(web_directory)s
%(pre_rule_plus1)s!match!final = 0
%(pre_rule_plus1)s!document_root = %(app_dir)s

# The PHP rule comes here

%(pre_rule_minus1)s!match = fullpath
-%(pre_rule_minus1)s!match!fullpath!1 = %(directory)s/wp-admin
+%(pre_rule_minus1)s!match!fullpath!1 = %(web_directory)s/wp-admin
%(pre_rule_minus1)s!handler = redir
%(pre_rule_minus1)s!handler!rewrite!10!show = 0
-%(pre_rule_minus1)s!handler!rewrite!10!substring = %(directory)s/wp-admin/
+%(pre_rule_minus1)s!handler!rewrite!10!substring = %(web_directory)s/wp-admin/

%(pre_rule_minus3)s!match = and
%(pre_rule_minus3)s!match!final = 1
%(pre_rule_minus3)s!match!left = directory
-%(pre_rule_minus3)s!match!left!directory = %(directory)s
+%(pre_rule_minus3)s!match!left!directory = %(web_directory)s
%(pre_rule_minus3)s!match!right = exists
%(pre_rule_minus3)s!match!right!iocache = 1
%(pre_rule_minus3)s!match!right!match_any = 1
@@ -93,10 +93,10 @@
%(pre_rule_minus3)s!handler!iocache = 1

%(pre_rule_minus4)s!match = request
-%(pre_rule_minus4)s!match!request = %(directory)s/?(.*)
+%(pre_rule_minus4)s!match!request = %(web_directory)s/?(.*)
%(pre_rule_minus4)s!handler = redir
%(pre_rule_minus4)s!handler!rewrite!1!show = 0
-%(pre_rule_minus4)s!handler!rewrite!1!substring = %(directory)s/index.php?/$1
+%(pre_rule_minus4)s!handler!rewrite!1!substring = %(web_directory)s/index.php?/$1
"""

#

Subject User Time
[6825] wizards2: WIP: Implements internal Virtual Server wizards support. cherokee at cherokee-project Aug 24, 2011, 8:49 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.