spiderfw 0.6.28 → 0.6.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +6 -0
- data/VERSION +1 -1
- data/apps/core/components/widgets/crud/crud.rb +0 -1
- data/apps/core/components/widgets/table/table.rb +1 -0
- data/apps/core/components/widgets/table/table.shtml +7 -1
- data/apps/messenger/backends/email/smtp.rb +1 -1
- data/apps/messenger/config/options.rb +1 -1
- data/apps/messenger/controllers/mixins/messenger_helper.rb +1 -0
- data/apps/messenger/messenger.rb +2 -2
- data/apps/messenger/models/sms.rb +1 -0
- data/apps/messenger/views/admin/queue.shtml +3 -3
- data/lib/spiderfw/model/base_model.rb +1 -0
- data/lib/spiderfw/model/mappers/db_mapper.rb +1 -1
- data/lib/spiderfw/model/mappers/mapper.rb +62 -42
- data/lib/spiderfw/model/storage/base_storage.rb +8 -0
- data/lib/spiderfw/model/storage/db/adapters/mysql.rb +4 -4
- data/lib/spiderfw/templates/blocks/lambda.rb +1 -1
- data/lib/spiderfw/widget/widget.rb +2 -3
- metadata +4 -4
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.6.29
|
2
|
+
* Sostituito metodo lambda per problemi con ruby 1.9.3 in site_map del cms
|
3
|
+
* Cambiata gestione invio sms con sender_name e prefisso internazionele, mail (smpt -> smtp )
|
4
|
+
* Modifiche alla widget table per paginazione per gestione pagina di dettaglio e ritorno a pagina corrente in elenco
|
5
|
+
* Corretto db_mapper per condition sugli elementi di un modello
|
6
|
+
|
1
7
|
== 0.6.28
|
2
8
|
* Visualizzazione in core:table dei dati collegati, eliminazione dipendenze circolari in uow
|
3
9
|
* Bugfixes
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.29
|
@@ -67,6 +67,7 @@ module Spider; module Components
|
|
67
67
|
end
|
68
68
|
@sort_el = [@sort_el] if @sort_el && !@sort_el.is_a?(Array)
|
69
69
|
@scene.link_el = @attributes[:link_el]
|
70
|
+
@scene.current_page = @page
|
70
71
|
@scene.link = @attributes[:link]
|
71
72
|
@scene.link_id = @attributes[:link_id] || @attributes[:link_el]
|
72
73
|
super
|
@@ -15,9 +15,15 @@
|
|
15
15
|
<tpl:pass sp:each_index="@rows |row_i|">
|
16
16
|
<tr class="{ (row_i%2==0) ? 'odd' : 'even' }">
|
17
17
|
<td sp:each="@elements |element|">
|
18
|
-
<a sp:
|
18
|
+
<a sp:if="((!@link_el.blank? && element == @link_el) && @link.blank?)" href="{ Spider::HTTP.urlencode(@data[row_i][@link_id]) }?current_page={ @page }">
|
19
|
+
{ @rows[row_i][element] }
|
20
|
+
</a>
|
21
|
+
<a sp:if="@link_el && element == @link_el && !@link.blank?" href="{ @link }{ Spider::HTTP.urlencode(@data[row_i][@link_id]) }¤t_page={ @page }">
|
19
22
|
{ @rows[row_i][element] }
|
20
23
|
</a>
|
24
|
+
<span sp:if="element != @link_el" >
|
25
|
+
{ @rows[row_i][element] }
|
26
|
+
</span>
|
21
27
|
</td>
|
22
28
|
</tr>
|
23
29
|
</tpl:pass>
|
@@ -20,7 +20,7 @@ module Spider; module Messenger; module Backends; module Email
|
|
20
20
|
:user_name => Spider.conf.get('messenger.smtp.username'),
|
21
21
|
:password => Spider.conf.get('messenger.smtp.password'),
|
22
22
|
:authentication => Spider.conf.get('messenger.smtp.auth_scheme'),
|
23
|
-
:enable_starttls_auto => Spider.conf.get('messenger.
|
23
|
+
:enable_starttls_auto => Spider.conf.get('messenger.smtp.enable_starttls_auto')
|
24
24
|
}
|
25
25
|
mail.deliver
|
26
26
|
return true
|
@@ -7,7 +7,7 @@ module Spider
|
|
7
7
|
config_option 'messenger.smtp.password', _("SMTP authentication password"), :default => nil
|
8
8
|
config_option 'messenger.smtp.auth_scheme', _("SMTP authentication scheme"), :default => nil, :type => Symbol,
|
9
9
|
:choices => [nil, :plain, :login, :cram_md5]
|
10
|
-
config_option 'messenger.
|
10
|
+
config_option 'messenger.smtp.enable_starttls_auto', _("Automatically start TLS for SMTP"), :default => false, :type => Spider::Bool
|
11
11
|
config_option 'messenger.smtp.log_path', _("Smtp logfile (e.g. /var/log/mail.log)"), :default => nil
|
12
12
|
|
13
13
|
config_option 'messenger.email.retries', _("How many times to retry sending an e-mail"), :type => Fixnum, :default => 5
|
data/apps/messenger/messenger.rb
CHANGED
@@ -132,9 +132,9 @@ module Spider
|
|
132
132
|
return msg
|
133
133
|
end
|
134
134
|
|
135
|
-
def self.sms(to, text, params={})
|
135
|
+
def self.sms(to, text, sender_name=nil, params={})
|
136
136
|
msg = SMS.new(
|
137
|
-
:to => to, :text => text
|
137
|
+
:to => to, :text => text, :sender_name => sender_name
|
138
138
|
)
|
139
139
|
msg.next_try = params[:send_from] || DateTime.now
|
140
140
|
msg.save
|
@@ -13,13 +13,13 @@
|
|
13
13
|
<div sp:if="@queue == :sms" class="queue">
|
14
14
|
<h4>_(Sent messages) - { @sent.total_rows }</h4>
|
15
15
|
<core:table id='sent' queryset='@sent' row_limit="5" link="@msg_view_url" link_el="id"
|
16
|
-
elements="id,to,ticket,sent,text" sort="sent,desc"/><br>
|
16
|
+
elements="id,to,sender_name,ticket,sent,text" sort="sent,desc"/><br>
|
17
17
|
<h4>_(Queued messages) - { @queued.total_rows }</h4>
|
18
18
|
<core:table id='queued' queryset='@queued' row_limit="5" link="@msg_view_url" link_el="id"
|
19
|
-
elements="id,to,ticket,last_try,next_try,attempts,backend_response" sort="next_try,desc"/><br>
|
19
|
+
elements="id,to,sender_name,ticket,last_try,next_try,attempts,backend_response" sort="next_try,desc"/><br>
|
20
20
|
<h4>_(Failed messages) - { @failed.total_rows }</h4>
|
21
21
|
<core:table id='failed' queryset='@failed' row_limit="5" link="@msg_view_url" link_el="id"
|
22
|
-
elements="id,to,ticket,last_try,backend_response" sort="last_try,desc"/><br>
|
22
|
+
elements="id,to,sender_name,ticket,last_try,backend_response" sort="last_try,desc"/><br>
|
23
23
|
</div>
|
24
24
|
|
25
25
|
</div>
|
@@ -262,6 +262,7 @@ module Spider; module Model
|
|
262
262
|
|
263
263
|
orig_type = type
|
264
264
|
assoc_type = nil
|
265
|
+
attributes[:reverse] ||= attributes[:reverse_of]
|
265
266
|
if (proc || attributes[:junction] || (attributes[:multiple] && (!attributes[:add_reverse]) && (!attributes[:has_single_reverse]) && \
|
266
267
|
# FIXME! the first check is needed when the referenced class has not been parsed yet
|
267
268
|
# but now it assumes that the reverse is not multiple if it is not defined
|
@@ -1174,7 +1174,7 @@ module Spider; module Model; module Mappers
|
|
1174
1174
|
column.primary_key = true if element.primary_key?
|
1175
1175
|
schema.set_column(element.name, column)
|
1176
1176
|
elsif (true) # FIXME: must have condition element.storage == @storage in some of the subcases
|
1177
|
-
if (!element.multiple? && !element.attributes[:junction] && !element.attributes[:
|
1177
|
+
if (!element.multiple? && !element.attributes[:junction] && !element.attributes[:reverse_of]) # 1/n <-> 1
|
1178
1178
|
current_schema = schema.foreign_keys[element.name] || {}
|
1179
1179
|
foreign_key_constraints = {}
|
1180
1180
|
el_mapper = element.type.mapper
|
@@ -279,15 +279,20 @@ module Spider; module Model
|
|
279
279
|
prev_autoload = obj.autoload?
|
280
280
|
obj.save_mode
|
281
281
|
storage.in_transaction
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
282
|
+
begin
|
283
|
+
save_mode = determine_save_mode(obj)
|
284
|
+
before_save(obj, save_mode)
|
285
|
+
if save_mode == :update
|
286
|
+
do_update(obj)
|
287
|
+
else
|
288
|
+
do_insert(obj)
|
289
|
+
end
|
290
|
+
after_save(obj, save_mode)
|
291
|
+
storage.commit_or_continue
|
292
|
+
rescue
|
293
|
+
storage.rollback_or_continue
|
294
|
+
raise
|
288
295
|
end
|
289
|
-
after_save(obj, save_mode)
|
290
|
-
storage.commit_or_continue
|
291
296
|
obj.autoload = prev_autoload
|
292
297
|
unless @doing_save_done
|
293
298
|
@doing_save_done = true
|
@@ -466,10 +471,15 @@ module Spider; module Model
|
|
466
471
|
def insert(obj)
|
467
472
|
prev_autoload = obj.save_mode()
|
468
473
|
storage.in_transaction
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
474
|
+
begin
|
475
|
+
before_save(obj, :insert)
|
476
|
+
do_insert(obj)
|
477
|
+
after_save(obj, :insert)
|
478
|
+
storage.commit_or_continue
|
479
|
+
rescue
|
480
|
+
storage.rollback_or_continue
|
481
|
+
raise
|
482
|
+
end
|
473
483
|
obj.autoload = prev_autoload
|
474
484
|
end
|
475
485
|
|
@@ -479,10 +489,15 @@ module Spider; module Model
|
|
479
489
|
def update(obj)
|
480
490
|
prev_autoload = obj.save_mode()
|
481
491
|
storage.in_transaction
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
492
|
+
begin
|
493
|
+
before_save(obj, :update)
|
494
|
+
do_update(obj)
|
495
|
+
after_save(obj, :update)
|
496
|
+
storage.commit_or_continue
|
497
|
+
rescue
|
498
|
+
storage.rollback_or_continue
|
499
|
+
raise
|
500
|
+
end
|
486
501
|
obj.autoload = prev_autoload
|
487
502
|
end
|
488
503
|
|
@@ -504,7 +519,7 @@ module Spider; module Model
|
|
504
519
|
# Useful when an object will be re-inserted with the same keys.
|
505
520
|
# @return [void]
|
506
521
|
def delete(obj_or_condition, force=false, options={})
|
507
|
-
|
522
|
+
|
508
523
|
def prepare_delete_condition(obj)
|
509
524
|
condition = Condition.and
|
510
525
|
@model.primary_keys.each do |key|
|
@@ -536,36 +551,41 @@ module Spider; module Model
|
|
536
551
|
before_delete(curr)
|
537
552
|
vals = []
|
538
553
|
started_transaction = false
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
554
|
+
begin
|
555
|
+
unless cascade.empty? && assocs.empty?
|
556
|
+
storage.in_transaction
|
557
|
+
started_transaction = true
|
558
|
+
curr.each do |curr_obj|
|
559
|
+
obj_vals = {}
|
560
|
+
cascade.each do |el|
|
561
|
+
obj_vals[el] = curr_obj.get(el)
|
562
|
+
end
|
563
|
+
vals << obj_vals
|
564
|
+
assocs.each do |el|
|
565
|
+
next if el.has_single_reverse? && options[:keep_single_reverse]
|
566
|
+
delete_element_associations(curr_obj, el)
|
567
|
+
end
|
551
568
|
end
|
552
569
|
end
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
570
|
+
@model.referenced_by_junctions.each do |junction, element|
|
571
|
+
curr.each do |curr_obj|
|
572
|
+
junction_condition = Spider::Model::Condition.new
|
573
|
+
junction_condition[element] = curr_obj
|
574
|
+
junction.mapper.delete(junction_condition)
|
575
|
+
end
|
559
576
|
end
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
577
|
+
do_delete(condition, force)
|
578
|
+
vals.each do |obj_vals|
|
579
|
+
obj_vals.each do |el, val|
|
580
|
+
el.model.mapper.delete(val)
|
581
|
+
end
|
565
582
|
end
|
583
|
+
after_delete(curr)
|
584
|
+
storage.commit_or_continue if started_transaction
|
585
|
+
rescue
|
586
|
+
storage.rollback_or_continue if started_transaction
|
587
|
+
raise
|
566
588
|
end
|
567
|
-
after_delete(curr)
|
568
|
-
storage.commit_or_continue if started_transaction
|
569
589
|
end
|
570
590
|
|
571
591
|
# Deletes all objects from the storage.
|
@@ -364,6 +364,14 @@ module Spider; module Model; module Storage
|
|
364
364
|
curr[:savepoints] = []
|
365
365
|
release
|
366
366
|
end
|
367
|
+
|
368
|
+
def rollback_or_continue
|
369
|
+
if curr[:transaction_nesting] == 1
|
370
|
+
rollback
|
371
|
+
else
|
372
|
+
curr[:transaction_nesting] -= 1 if curr[:transaction_nesting] > 1
|
373
|
+
end
|
374
|
+
end
|
367
375
|
|
368
376
|
# @abstract
|
369
377
|
# Implemented by subclasses to interact with the backend
|
@@ -92,12 +92,12 @@ module Spider; module Model; module Storage; module Db
|
|
92
92
|
def release
|
93
93
|
begin
|
94
94
|
#Spider::Logger.debug("MYSQL #{self.object_id} in thread #{Thread.current} releasing connection #{@conn}")
|
95
|
-
|
95
|
+
curr[:conn].autocommit(true) if curr[:conn] && !Spider.conf.get('storage.db.shared_connection')
|
96
96
|
super
|
97
97
|
rescue => exc
|
98
|
-
Spider::Logger.error("MYSQL #{self.object_id} in thread #{Thread.current} exception #{exc.message} while trying to release connection #{
|
99
|
-
self.class.remove_connection(
|
100
|
-
|
98
|
+
Spider::Logger.error("MYSQL #{self.object_id} in thread #{Thread.current} exception #{exc.message} while trying to release connection #{curr[:conn]}")
|
99
|
+
self.class.remove_connection(curr[:conn], @connection_params)
|
100
|
+
curr[:conn] = nil
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -8,7 +8,7 @@ module Spider; module TemplateBlocks
|
|
8
8
|
init = ""
|
9
9
|
lambda_name = @el.attributes['sp:lambda']
|
10
10
|
@el.remove_attribute('sp:lambda')
|
11
|
-
c = "#{lambda_name} =
|
11
|
+
c = "#{lambda_name} = Proc.new do\n"
|
12
12
|
content = Spider::TemplateBlocks.parse_element(@el, @allowed_blocks, @template).compile(options)
|
13
13
|
content.run_code.each_line do |line|
|
14
14
|
c += ' '+line
|
@@ -290,11 +290,10 @@ module Spider
|
|
290
290
|
def widget_target=(target)
|
291
291
|
@widget_target = target
|
292
292
|
end
|
293
|
-
|
293
|
+
|
294
294
|
def widget_request_path
|
295
295
|
p = @request.path
|
296
|
-
|
297
|
-
p = p[0..i-2] if i
|
296
|
+
p = p.sub(/\/#{Regexp.escape(@_action)}$/, '') unless @_action.blank?
|
298
297
|
p = p.sub(/\/+$/, '')
|
299
298
|
return p
|
300
299
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spiderfw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 61
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 29
|
10
|
+
version: 0.6.29
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ivan Pirlik
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-10-15 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: cmdparse
|