uzuuzu-core 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.redcar/tags +145 -0
- data/Gemfile +10 -6
- data/Gemfile.lock +14 -10
- data/VERSION +1 -1
- data/lib/uzuuzu-core.rb +5 -1
- data/lib/uzuuzu/controller/admin.rb +11 -0
- data/lib/uzuuzu/controller/contents.rb +11 -0
- data/lib/uzuuzu/controller/crud.rb +235 -0
- data/lib/uzuuzu/controller/css.rb +11 -0
- data/lib/uzuuzu/controller/error.rb +11 -0
- data/lib/uzuuzu/controller/index.rb +25 -0
- data/lib/uzuuzu/controller/initialize.rb +52 -0
- data/lib/uzuuzu/controller/javascript.rb +11 -0
- data/lib/uzuuzu/controller/oauth.rb +10 -0
- data/lib/uzuuzu/controller/openid.rb +40 -0
- data/lib/uzuuzu/controller/page.rb +14 -0
- data/lib/uzuuzu/controller/plugin.rb +11 -0
- data/lib/uzuuzu/controller/user.rb +22 -0
- data/lib/uzuuzu/controller/view/admin/index.xhtml +0 -0
- data/lib/uzuuzu/controller/view/crud/destroy.rhtml +28 -0
- data/lib/uzuuzu/controller/view/crud/edit.rhtml +52 -0
- data/lib/uzuuzu/controller/view/crud/index.rhtml +45 -0
- data/lib/uzuuzu/controller/view/crud/new.rhtml +48 -0
- data/lib/uzuuzu/controller/view/crud/show.rhtml +47 -0
- data/lib/uzuuzu/controller/view/error/404.tenjin +0 -0
- data/lib/uzuuzu/controller/view/initialize/step1.xhtml +30 -0
- data/lib/uzuuzu/controller/view/initialize/step2.xhtml +1 -0
- data/lib/uzuuzu/controller/view/initialize/step3.xhtml +0 -0
- data/lib/uzuuzu/controller/view/openid/index.xhtml +14 -0
- data/lib/uzuuzu/controller/view/page.xhtml +17 -0
- data/lib/uzuuzu/controller/view/user/entry.xhtml +13 -0
- data/lib/uzuuzu/fixture/layout.yaml +110 -0
- data/lib/uzuuzu/helper/controller.rb +135 -0
- data/lib/uzuuzu/helper/fixture.rb +9 -0
- data/lib/uzuuzu/helper/localize.rb +15 -0
- data/lib/uzuuzu/helper/renderer.rb +158 -0
- data/lib/uzuuzu/helper/route.rb +62 -0
- data/lib/uzuuzu/helper/uzuuzu_page.rb +61 -0
- data/lib/uzuuzu/helper/xhtml.rb +44 -0
- data/lib/uzuuzu/model/.DS_Store +0 -0
- data/lib/uzuuzu/model/remote_user.rb +70 -0
- data/lib/uzuuzu/uzuuzu-core.rb +10 -1
- data/lib/uzuuzu/wrapper/application.rb +282 -0
- data/lib/uzuuzu/wrapper/controller.rb +28 -80
- data/lib/uzuuzu/wrapper/datastore.rb +17 -0
- data/lib/uzuuzu/wrapper/environments.rb +129 -0
- data/lib/uzuuzu/wrapper/helper.rb +13 -0
- data/lib/uzuuzu/wrapper/lang/en.yaml +19 -0
- data/lib/uzuuzu/wrapper/lang/ja.yaml +19 -0
- data/lib/uzuuzu/wrapper/logger.rb +95 -21
- data/lib/uzuuzu/wrapper/object.rb +9 -0
- data/lib/uzuuzu/wrapper/request.rb +26 -0
- data/lib/uzuuzu/wrapper/response.rb +16 -0
- data/lib/uzuuzu/wrapper/uzuuzu.rb +26 -146
- data/uzuuzu-core.gemspec +71 -14
- metadata +104 -15
@@ -0,0 +1,62 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module UzuUzu
|
4
|
+
module Helper
|
5
|
+
module Route
|
6
|
+
module RouteClass
|
7
|
+
def url_for(*args)
|
8
|
+
app = UzuUzu.current
|
9
|
+
route_string = UzuUzu::Request.current.env['SCRIPT_NAME']
|
10
|
+
app.controllers.each do |controller|
|
11
|
+
re = Regexp.compile("^#{controller.name}::")
|
12
|
+
if re =~ self.name
|
13
|
+
path = self.name.gsub(re, '').gsub(/Controller$/, '').to_const_path
|
14
|
+
route_string << "/#{path}" unless path == 'index'
|
15
|
+
break
|
16
|
+
end
|
17
|
+
end
|
18
|
+
if args[-1].kind_of?(Hash)
|
19
|
+
query = query_string(args.pop)
|
20
|
+
end
|
21
|
+
args.each do |arg|
|
22
|
+
route_string << "/#{arg}"
|
23
|
+
end
|
24
|
+
|
25
|
+
route_string << '/' if args.blank?
|
26
|
+
route_string << query unless query.blank?
|
27
|
+
route_string
|
28
|
+
end
|
29
|
+
alias :r :url_for
|
30
|
+
#
|
31
|
+
#
|
32
|
+
#
|
33
|
+
def query_string(query_options={})
|
34
|
+
query_string = []
|
35
|
+
query_options do |key, value|
|
36
|
+
query_string << "#{key}=#{value}"
|
37
|
+
end
|
38
|
+
return "" if query_string.blank?
|
39
|
+
"?#{query_string.join('&')}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.included(clazz)
|
44
|
+
clazz.extend RouteClass
|
45
|
+
end
|
46
|
+
|
47
|
+
def url_for(*args)
|
48
|
+
route_string = @_route.clone
|
49
|
+
if args[-1].kind_of?(Hash)
|
50
|
+
query = query_string(args.pop)
|
51
|
+
end
|
52
|
+
args.each do |arg|
|
53
|
+
route_string << "/#{arg}"
|
54
|
+
end
|
55
|
+
route_string << '/' if args.blank?
|
56
|
+
route_string << query unless query.blank?
|
57
|
+
route_string
|
58
|
+
end
|
59
|
+
alias :r :url_for
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module UzuUzu
|
4
|
+
module Helper
|
5
|
+
#
|
6
|
+
#
|
7
|
+
#
|
8
|
+
module UzuUzuPage
|
9
|
+
#
|
10
|
+
#
|
11
|
+
#
|
12
|
+
def render_uzuuzu(resource, contents=nil)
|
13
|
+
@uzuuzu_resource = resource
|
14
|
+
@uzuuzu_header = render_contents(resource.header.contents)
|
15
|
+
@uzuuzu_footer = render_contents(resource.footer.contents)
|
16
|
+
@uzuuzu_left = render_contents(resource.left.contents)
|
17
|
+
@uzuuzu_right = render_contents(resource.right.contents)
|
18
|
+
@uzuuzu_contents = contents
|
19
|
+
@uzuuzu_contents ||= yield if block_given?
|
20
|
+
@uzuuzu_contents ||= render_contents(resource.page_body.contents) if resource.respond_to?(:page_body)
|
21
|
+
@uzuuzu_contents ||= ""
|
22
|
+
@uzuuzu_body = render_string(resource.layout.body, resource.layout.format)
|
23
|
+
if request.xhr?
|
24
|
+
return_string = @uzuuzu_body
|
25
|
+
else
|
26
|
+
return_string = render_file('./view/page.rhtml')
|
27
|
+
end
|
28
|
+
@uzuuzu_resource = @uzuuzu_header = @uzuuzu_footer = nil
|
29
|
+
@uzuuzu_left = @uzuuzu_right = @uzuuzu_contents = @uzuuzu_body = nil
|
30
|
+
return return_string
|
31
|
+
end # render_uzuuzu
|
32
|
+
|
33
|
+
def uzuuzu_csses(resource)
|
34
|
+
resource ||= self.info
|
35
|
+
csses = []
|
36
|
+
resource.csses.each do |css|
|
37
|
+
if css.url.nil?
|
38
|
+
csses << UzuUzu::CssController.r(css.id)
|
39
|
+
else
|
40
|
+
csses << css.url
|
41
|
+
end
|
42
|
+
end
|
43
|
+
csses
|
44
|
+
end # uzuuzu_csses
|
45
|
+
|
46
|
+
def uzuuzu_javascripts(resource)
|
47
|
+
resource ||= self.info
|
48
|
+
javascripts = []
|
49
|
+
resource.javascripts.each do |javascript|
|
50
|
+
if javascript.url.nil?
|
51
|
+
javascripts << UzuUzu::JavascriptController.r(javascript.id)
|
52
|
+
else
|
53
|
+
javascripts << javascript.url
|
54
|
+
end
|
55
|
+
end
|
56
|
+
javascripts
|
57
|
+
end # uzuuzu_javascripts
|
58
|
+
|
59
|
+
end # UzuUzu
|
60
|
+
end # Helper
|
61
|
+
end # UzuUzu
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module UzuUzu
|
4
|
+
module Helper
|
5
|
+
module XHtml
|
6
|
+
#
|
7
|
+
#
|
8
|
+
#
|
9
|
+
def css(name, media='screen')
|
10
|
+
if name =~ /^http/
|
11
|
+
"<link href=\"#{name}\" media=\"#{media}\" rel=\"stylesheet\" type=\"text/css\" />"
|
12
|
+
else
|
13
|
+
"<link href=\"/css/#{name}.css\" media=\"#{media}\" rel=\"stylesheet\" type=\"text/css\" />"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
#
|
19
|
+
#
|
20
|
+
def css_for(*args)
|
21
|
+
args.map{|arg| css(*arg) }.join("\n")
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
#
|
26
|
+
#
|
27
|
+
def js(name)
|
28
|
+
if name =~ /^http/
|
29
|
+
"<script src=\"#{name}\" type=\"text/javascript\"></script>"
|
30
|
+
else
|
31
|
+
"<script src=\"/js/#{name}.js\" type=\"text/javascript\"></script>"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
#
|
36
|
+
#
|
37
|
+
#
|
38
|
+
def js_for(*args)
|
39
|
+
args.map{|arg| js(*arg) }.join("\n")
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
Binary file
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module UzuUzu
|
4
|
+
class RemoteUser
|
5
|
+
attr_reader :id
|
6
|
+
attr_reader :user_id
|
7
|
+
attr_reader :ip
|
8
|
+
attr_reader :type
|
9
|
+
attr_reader :domain
|
10
|
+
|
11
|
+
|
12
|
+
def self.open_id
|
13
|
+
return nil
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.oauth
|
17
|
+
return nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.authenticate(request)
|
21
|
+
|
22
|
+
open_id = request[:open_id]
|
23
|
+
unless open_id.empty?
|
24
|
+
# TODO::open_id
|
25
|
+
return nil
|
26
|
+
end
|
27
|
+
|
28
|
+
oauth = request[:oauth]
|
29
|
+
unless oauth.empty?
|
30
|
+
# TODO::oauth
|
31
|
+
return nil
|
32
|
+
end
|
33
|
+
|
34
|
+
unless request.ssl?
|
35
|
+
return nil
|
36
|
+
end
|
37
|
+
|
38
|
+
user_id = request[:user_id]
|
39
|
+
password = request[:password]
|
40
|
+
user = User.authenticate(user_id, password)
|
41
|
+
|
42
|
+
if user.nil?
|
43
|
+
return nil
|
44
|
+
end
|
45
|
+
RemoteUser.new(user,request.ip)
|
46
|
+
end #self.authenticate
|
47
|
+
|
48
|
+
def initialize(user, ip)
|
49
|
+
@id = user.id
|
50
|
+
@user_id = user.user_id
|
51
|
+
@admin = user.admin
|
52
|
+
@domain = user.domain
|
53
|
+
@type = user.type
|
54
|
+
@ip = ip
|
55
|
+
end #new
|
56
|
+
|
57
|
+
def admin?
|
58
|
+
if @admin
|
59
|
+
true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def authorized?(request)
|
64
|
+
return false if request.cookies[:remenber_login.to_s].nil?
|
65
|
+
return false unless @ip == request.ip
|
66
|
+
return true
|
67
|
+
end #authorized?
|
68
|
+
|
69
|
+
end #RemoteUser
|
70
|
+
end #UzuUzu
|
data/lib/uzuuzu/uzuuzu-core.rb
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
|
2
|
+
require 'uzuuzu/wrapper/object'
|
2
3
|
require 'uzuuzu/wrapper/uzuuzu'
|
4
|
+
require 'uzuuzu/wrapper/environments'
|
3
5
|
require 'uzuuzu/wrapper/logger'
|
4
6
|
require 'uzuuzu/wrapper/mailer'
|
5
7
|
require 'uzuuzu/wrapper/memcache'
|
6
8
|
require 'uzuuzu/wrapper/datastore'
|
7
|
-
require 'uzuuzu/wrapper/
|
9
|
+
require 'uzuuzu/wrapper/request'
|
10
|
+
require 'uzuuzu/wrapper/response'
|
11
|
+
require 'uzuuzu/wrapper/controller'
|
12
|
+
require 'uzuuzu/wrapper/helper'
|
13
|
+
require 'uzuuzu/wrapper/application'
|
14
|
+
|
15
|
+
|
16
|
+
|
@@ -0,0 +1,282 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module UzuUzu
|
4
|
+
#
|
5
|
+
#
|
6
|
+
#
|
7
|
+
class Application
|
8
|
+
|
9
|
+
#
|
10
|
+
attr_accessor :name
|
11
|
+
#
|
12
|
+
attr_accessor :config_file
|
13
|
+
#
|
14
|
+
attr_accessor :environments
|
15
|
+
#
|
16
|
+
attr_accessor :controllers
|
17
|
+
#
|
18
|
+
attr_accessor :before_filters
|
19
|
+
#
|
20
|
+
attr_accessor :after_filters
|
21
|
+
#
|
22
|
+
attr_accessor :helpers
|
23
|
+
#
|
24
|
+
attr_accessor :views
|
25
|
+
|
26
|
+
def self.current
|
27
|
+
Thread.current[:application]
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
#
|
32
|
+
#
|
33
|
+
def initialize(options={})
|
34
|
+
Thread.current[:application] = self
|
35
|
+
options.each do |key, value|
|
36
|
+
case(key)
|
37
|
+
when :name, 'name'
|
38
|
+
@name = value
|
39
|
+
when :config, 'config'
|
40
|
+
@config_file = value
|
41
|
+
end
|
42
|
+
end if options.kind_of?(Hash)
|
43
|
+
@name ||= :uzuuzu
|
44
|
+
@environments = Environments.new(@config_file)
|
45
|
+
UzuUzu.apps[@name] = self
|
46
|
+
yield self if block_given?
|
47
|
+
end # initialize
|
48
|
+
|
49
|
+
def controllers
|
50
|
+
@controllers ||= [UzuUzu::Controller]
|
51
|
+
end
|
52
|
+
|
53
|
+
def before_filters
|
54
|
+
@before_filters ||= [UzuUzu::Controller.method(:before_all)]
|
55
|
+
end
|
56
|
+
|
57
|
+
def after_filters
|
58
|
+
@after_filters ||= [UzuUzu::Controller.method(:after_all)]
|
59
|
+
end
|
60
|
+
|
61
|
+
def helpers
|
62
|
+
@helpers ||= [
|
63
|
+
Rack::Utils,
|
64
|
+
UzuUzu::Helper::Controller,
|
65
|
+
UzuUzu::Helper::Renderer,
|
66
|
+
UzuUzu::Helper::Localize,
|
67
|
+
UzuUzu::Helper::Route,
|
68
|
+
UzuUzu::Helper::UzuUzuPage,
|
69
|
+
UzuUzu::Helper::XHtml
|
70
|
+
]
|
71
|
+
end
|
72
|
+
|
73
|
+
def views
|
74
|
+
@views ||= ['./view']
|
75
|
+
end
|
76
|
+
|
77
|
+
#
|
78
|
+
#
|
79
|
+
#
|
80
|
+
def call(env)
|
81
|
+
Thread.current[:application] = self
|
82
|
+
request = UzuUzu::Request.new(env)
|
83
|
+
response = UzuUzu::Response.new
|
84
|
+
clazz = find_controller(env)
|
85
|
+
if clazz.blank?
|
86
|
+
return not_found(request, response)
|
87
|
+
end
|
88
|
+
|
89
|
+
is_send = false
|
90
|
+
action_return = nil
|
91
|
+
render = nil
|
92
|
+
clazz.each do |map|
|
93
|
+
controller_class = map[:clazz]
|
94
|
+
query = map[:query]
|
95
|
+
route = map[:route]
|
96
|
+
controller = controller_class.new
|
97
|
+
di_helpers(controller)
|
98
|
+
|
99
|
+
action, query = find_action(controller, query)
|
100
|
+
next if action.blank?
|
101
|
+
is_send = true
|
102
|
+
di_thread(request, response, controller, action, query, route)
|
103
|
+
di_instance(request, response, controller, action, query, route)
|
104
|
+
action_return = send_action(request, response, controller, action, query)
|
105
|
+
if response.body.blank?
|
106
|
+
render = controller.render(action)
|
107
|
+
end
|
108
|
+
break
|
109
|
+
end
|
110
|
+
|
111
|
+
unless is_send
|
112
|
+
return not_found(request, response)
|
113
|
+
end
|
114
|
+
if response.status == 200 and response.body.blank?
|
115
|
+
response.write render || action_return
|
116
|
+
end
|
117
|
+
|
118
|
+
response.finish
|
119
|
+
end # call
|
120
|
+
|
121
|
+
#
|
122
|
+
#
|
123
|
+
#
|
124
|
+
def find_controller(env)
|
125
|
+
classies = []
|
126
|
+
request_paths = env['PATH_INFO'].split('/')
|
127
|
+
request_paths.shift if request_paths[0].blank?
|
128
|
+
|
129
|
+
controllers.reverse.each do |c|
|
130
|
+
if c.instance_of?(Module) or c.instance_of?(Class)
|
131
|
+
controller_str = []
|
132
|
+
request_paths.each_with_index do |request_path, index|
|
133
|
+
next if request_path.blank?
|
134
|
+
controller_str << request_path.camel_case
|
135
|
+
c_str = controller_str.join('::')
|
136
|
+
next if c_str == 'Index'
|
137
|
+
route = "#{env['SCRIPT_NAME']}/#{request_paths[0..index].join('/')}"
|
138
|
+
query = request_paths[(index+1)..-1]
|
139
|
+
begin
|
140
|
+
if c.const_defined?(c_str)
|
141
|
+
classies << {:clazz => c.module_eval(c_str),
|
142
|
+
:route => route,
|
143
|
+
:query => query}
|
144
|
+
end
|
145
|
+
rescue NameError => e
|
146
|
+
begin
|
147
|
+
if c.const_defined?("#{c_str}Controller")
|
148
|
+
classies << {:clazz => c.module_eval("#{c_str}Controller"),
|
149
|
+
:route => route,
|
150
|
+
:query => query}
|
151
|
+
end
|
152
|
+
rescue NameError => e
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
if c.const_defined?('Index')
|
157
|
+
classies << {:clazz => c.module_eval("Index"),
|
158
|
+
:route => env['SCRIPT_NAME'],
|
159
|
+
:query => request_paths}
|
160
|
+
elsif c.const_defined?('IndexController')
|
161
|
+
classies << {:clazz => c.module_eval("Index"),
|
162
|
+
:route => env['SCRIPT_NAME'],
|
163
|
+
:query => request_paths}
|
164
|
+
end
|
165
|
+
else
|
166
|
+
UzuUzu.logger.warn "routing miss controllers only Module or Class : #{c}"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
classies
|
170
|
+
end # find_controller
|
171
|
+
|
172
|
+
#
|
173
|
+
#
|
174
|
+
#
|
175
|
+
def di_helpers(controller)
|
176
|
+
helpers.each do |helper|
|
177
|
+
controller.class.send(:include, helper)
|
178
|
+
end
|
179
|
+
end # di_helpers
|
180
|
+
|
181
|
+
#
|
182
|
+
#
|
183
|
+
#
|
184
|
+
def di_instance(request, response, controller, action, query, route)
|
185
|
+
controller.instance_variable_set(:@_application, self)
|
186
|
+
controller.instance_variable_set(:@_request, request)
|
187
|
+
controller.instance_variable_set(:@_response, response)
|
188
|
+
controller.instance_variable_set(:@_action, action)
|
189
|
+
controller.instance_variable_set(:@_query, query)
|
190
|
+
controller.instance_variable_set(:@_route, route)
|
191
|
+
end # di_instance
|
192
|
+
|
193
|
+
def di_thread(request, response, controller, action, query, route)
|
194
|
+
current = Thread.current
|
195
|
+
current[:request] = request
|
196
|
+
current[:response] = response
|
197
|
+
current[:controller] = controller
|
198
|
+
current[:action] = action
|
199
|
+
current[:query] = query
|
200
|
+
current[:route] = route
|
201
|
+
end
|
202
|
+
|
203
|
+
def get_thread_by_di
|
204
|
+
current = Thread.current
|
205
|
+
[current[:request], current[:response], current[:controller], current[:action], current[:query], current[:route]]
|
206
|
+
end
|
207
|
+
|
208
|
+
#
|
209
|
+
#
|
210
|
+
#
|
211
|
+
def find_action(controller, query)
|
212
|
+
action = nil
|
213
|
+
query = query.map do |q|
|
214
|
+
q.sub(/\.\w+$/, '')
|
215
|
+
end
|
216
|
+
if query[0] and controller.respond_to?(query[0])
|
217
|
+
action = query.shift
|
218
|
+
end
|
219
|
+
if action.nil? and controller.respond_to?(:index)
|
220
|
+
action = 'index'
|
221
|
+
end
|
222
|
+
|
223
|
+
unless action.nil?
|
224
|
+
arity = controller.method(action).arity
|
225
|
+
unless (arity >= 0 and query.size == arity) or
|
226
|
+
(arity < 0 and query.size >= ((-1 * arity)-1))
|
227
|
+
if (not action == 'index') and controller.respond_to?(:index)
|
228
|
+
query.unshift(action)
|
229
|
+
action = 'index'
|
230
|
+
if controller.respond_to?(action)
|
231
|
+
arity = controller.method(action).arity
|
232
|
+
unless (arity >= 0 and query.size == arity) or
|
233
|
+
(arity < 0 and query.size >= ((-1 * arity)-1))
|
234
|
+
action = nil
|
235
|
+
end
|
236
|
+
else
|
237
|
+
action = nil
|
238
|
+
end
|
239
|
+
else
|
240
|
+
action = nil
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
[action, query]
|
245
|
+
end # find_action
|
246
|
+
|
247
|
+
#
|
248
|
+
#
|
249
|
+
#
|
250
|
+
def send_action(request, response, controller, action, query)
|
251
|
+
value = nil
|
252
|
+
catch(:finish) do
|
253
|
+
before_filters.each do |filter|
|
254
|
+
filter.call if filter.respond_to?(:call)
|
255
|
+
end
|
256
|
+
controller.send(:before, []) if controller.respond_to?(:before)
|
257
|
+
value = controller.send(action, *query)
|
258
|
+
controller.send(:after, []) if controller.respond_to?(:after)
|
259
|
+
after_filters.reverse.each do |filter|
|
260
|
+
filter.call if filter.respond_to?(:call)
|
261
|
+
end
|
262
|
+
end
|
263
|
+
value
|
264
|
+
end # send_action
|
265
|
+
|
266
|
+
def error(code, request, response)
|
267
|
+
UzuUzu.logger.debug "error : #{code}"
|
268
|
+
uri = "#{request.scheme}://#{request.host}"
|
269
|
+
if (request.scheme == 'https' and request.port != 443) or
|
270
|
+
(request.scheme == 'http' and request.port != 80)
|
271
|
+
uri << ":#{request.port}"
|
272
|
+
end
|
273
|
+
uri << "#{request.env["SCRIPT_NAME"]}/error/#{code}"
|
274
|
+
response.redirect(uri)
|
275
|
+
response.finish
|
276
|
+
end
|
277
|
+
|
278
|
+
def not_found(request, response)
|
279
|
+
error(404, request, response)
|
280
|
+
end
|
281
|
+
end # Application
|
282
|
+
end # UzuUzu
|