Minor improvements
This commit is contained in:
parent
201608c49c
commit
6caf838549
23
TODO.md
23
TODO.md
|
@ -391,23 +391,6 @@ short URLS: https://github.com/rsvp/gitio
|
||||||
|
|
||||||
link backend help text variables to settings/#var_name
|
link backend help text variables to settings/#var_name
|
||||||
|
|
||||||
make python3 default python on the fucking docker container
|
|
||||||
|
|
||||||
autocomplete; on the form header and type="search"
|
|
||||||
To latest developers to post on this thread: I implemented the workaround I described in comment #14 nearly three months ago, and it has worked perfectly since then. While we would all prefer that "autocomplete=off" function properly at all times, it still functions properly if you include in your form an input element with any other autocomplete value.
|
|
||||||
|
|
||||||
I simply added this code to my layout:
|
|
||||||
|
|
||||||
<div style="display: none;">
|
|
||||||
<input type="text" id="PreventChromeAutocomplete" name="PreventChromeAutocomplete" autocomplete="address-level4" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
Once I did this, all of my "autocomplete=off" elements were respected by Chrome.
|
|
||||||
<input type="password" name="password" value="" style="display: none" />
|
|
||||||
http://makandracards.com/makandra/24933-chrome-34+-firefox-38+-ie11+-ignore-autocomplete-off
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mkhomedir_helper or create ssh homes with bash.rc and such
|
mkhomedir_helper or create ssh homes with bash.rc and such
|
||||||
|
|
||||||
# warnings if some plugins are disabled, like make routes red
|
# warnings if some plugins are disabled, like make routes red
|
||||||
|
@ -424,8 +407,6 @@ mkhomedir_helper or create ssh homes with bash.rc and such
|
||||||
# email usage -webkit-column-count:3;-moz-column-count:3;column-count:3;
|
# email usage -webkit-column-count:3;-moz-column-count:3;column-count:3;
|
||||||
|
|
||||||
|
|
||||||
# wordpressmu custom_url: set blog.domain
|
|
||||||
|
|
||||||
# validate_user on saas.wordpress to detect if username already exists before attempting to create a blog
|
# validate_user on saas.wordpress to detect if username already exists before attempting to create a blog
|
||||||
|
|
||||||
|
|
||||||
|
@ -440,10 +421,6 @@ mkhomedir_helper or create ssh homes with bash.rc and such
|
||||||
shit_happend, otherwise schedule for first query
|
shit_happend, otherwise schedule for first query
|
||||||
# Entry.objects.filter()[:1].first() (LIMIT 1)
|
# Entry.objects.filter()[:1].first() (LIMIT 1)
|
||||||
|
|
||||||
# put "Coordinate Apache restart" inside a bash function for clarity
|
|
||||||
|
|
||||||
|
|
||||||
# show base and total desglosed
|
|
||||||
|
|
||||||
# Reverse lOgHistory order by date (lastest first)
|
# Reverse lOgHistory order by date (lastest first)
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ def close_bills(modeladmin, request, queryset, action='close_bills'):
|
||||||
'formset': formset,
|
'formset': formset,
|
||||||
'obj': get_object_from_url(modeladmin, request),
|
'obj': get_object_from_url(modeladmin, request),
|
||||||
}
|
}
|
||||||
templete = 'admin/orchestra/generic_confirmation.html'
|
template = 'admin/orchestra/generic_confirmation.html'
|
||||||
if action == 'close_send_download_bills':
|
if action == 'close_send_download_bills':
|
||||||
template = 'admin/bills/bill/close_send_download_bills.html'
|
template = 'admin/bills/bill/close_send_download_bills.html'
|
||||||
return render(request, template, context)
|
return render(request, template, context)
|
||||||
|
|
|
@ -198,8 +198,9 @@ class BillAdmin(AccountAdminMixin, ExtendedModelAdmin):
|
||||||
change_list_template = 'admin/bills/change_list.html'
|
change_list_template = 'admin/bills/change_list.html'
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(None, {
|
(None, {
|
||||||
'fields': ['number', 'type', 'amend_of_link', 'account_link', 'display_total',
|
'fields': ['number', 'type', 'amend_of_link', 'account_link',
|
||||||
'display_payment_state', 'is_sent', 'comments'],
|
'display_total_with_subtotals', 'display_payment_state',
|
||||||
|
'is_sent', 'comments'],
|
||||||
}),
|
}),
|
||||||
(_("Dates"), {
|
(_("Dates"), {
|
||||||
'classes': ('collapse',),
|
'classes': ('collapse',),
|
||||||
|
@ -227,7 +228,7 @@ class BillAdmin(AccountAdminMixin, ExtendedModelAdmin):
|
||||||
)
|
)
|
||||||
readonly_fields = (
|
readonly_fields = (
|
||||||
'number', 'display_total', 'is_sent', 'display_payment_state', 'created_on_display',
|
'number', 'display_total', 'is_sent', 'display_payment_state', 'created_on_display',
|
||||||
'closed_on_display', 'updated_on_display'
|
'closed_on_display', 'updated_on_display', 'display_total_with_subtotals',
|
||||||
)
|
)
|
||||||
inlines = [BillLineInline, ClosedBillLineInline]
|
inlines = [BillLineInline, ClosedBillLineInline]
|
||||||
date_hierarchy = 'closed_on'
|
date_hierarchy = 'closed_on'
|
||||||
|
@ -252,11 +253,24 @@ class BillAdmin(AccountAdminMixin, ExtendedModelAdmin):
|
||||||
num_lines.short_description = _("lines")
|
num_lines.short_description = _("lines")
|
||||||
|
|
||||||
def display_total(self, bill):
|
def display_total(self, bill):
|
||||||
return "%s &%s;" % (bill.compute_total(), settings.BILLS_CURRENCY.lower())
|
currency = settings.BILLS_CURRENCY.lower()
|
||||||
|
return '%s &%s;' % (bill.compute_total(), currency)
|
||||||
display_total.allow_tags = True
|
display_total.allow_tags = True
|
||||||
display_total.short_description = _("total")
|
display_total.short_description = _("total")
|
||||||
display_total.admin_order_field = 'approx_total'
|
display_total.admin_order_field = 'approx_total'
|
||||||
|
|
||||||
|
def display_total_with_subtotals(self, bill):
|
||||||
|
currency = settings.BILLS_CURRENCY.lower()
|
||||||
|
subtotals = []
|
||||||
|
for tax, subtotal in bill.compute_subtotals().items():
|
||||||
|
subtotals.append(_("Subtotal %s%% VAT %s &%s;") % (tax, subtotal[0], currency))
|
||||||
|
subtotals.append(_("Taxes %s%% VAT %s &%s;") % (tax, subtotal[1], currency))
|
||||||
|
subtotals = '\n'.join(subtotals)
|
||||||
|
return '<span title="%s">%s &%s;</span>' % (subtotals, bill.compute_total(), currency)
|
||||||
|
display_total_with_subtotals.allow_tags = True
|
||||||
|
display_total_with_subtotals.short_description = _("total")
|
||||||
|
display_total_with_subtotals.admin_order_field = 'approx_total'
|
||||||
|
|
||||||
def type_link(self, bill):
|
def type_link(self, bill):
|
||||||
bill_type = bill.type.lower()
|
bill_type = bill.type.lower()
|
||||||
url = reverse('admin:bills_%s_changelist' % bill_type)
|
url = reverse('admin:bills_%s_changelist' % bill_type)
|
||||||
|
|
|
@ -151,7 +151,8 @@ class WordpressMuBackend(ServiceController):
|
||||||
SELECT b.blog_id, b.domain, m.domain, b.path
|
SELECT b.blog_id, b.domain, m.domain, b.path
|
||||||
FROM wp_domain_mapping AS m, wp_blogs AS b
|
FROM wp_domain_mapping AS m, wp_blogs AS b
|
||||||
WHERE m.blog_id = b.blog_id AND m.active AND %(IDENT)s;") )
|
WHERE m.blog_id = b.blog_id AND m.active AND %(IDENT)s;") )
|
||||||
if [[ ${existing[0]} != '' ]]; then
|
if [[ ${existing[0]} != "" ]]; then
|
||||||
|
echo "Existing blog with ID ${existing[0]}"
|
||||||
# Clear custom domain
|
# Clear custom domain
|
||||||
if [[ "%(custom_domain)s" == "" ]]; then
|
if [[ "%(custom_domain)s" == "" ]]; then
|
||||||
mysql %(db_name)s --execute="
|
mysql %(db_name)s --execute="
|
||||||
|
@ -168,10 +169,13 @@ class WordpressMuBackend(ServiceController):
|
||||||
WHERE m.blog_id = b.blog_id AND m.active AND %(IDENT)s;"
|
WHERE m.blog_id = b.blog_id AND m.active AND %(IDENT)s;"
|
||||||
fi
|
fi
|
||||||
elif [[ "%(custom_domain)s" != "" ]]; then
|
elif [[ "%(custom_domain)s" != "" ]]; then
|
||||||
|
echo "Non existing blog with custom domain %(domain)s"
|
||||||
blog=( $(mysql -Nrs %(db_name)s --execute="
|
blog=( $(mysql -Nrs %(db_name)s --execute="
|
||||||
SELECT blog_id, path
|
SELECT blog_id, path
|
||||||
FROM wp_blogs
|
FROM wp_blogs
|
||||||
WHERE domain = '%(domain)s';") )
|
WHERE domain = '%(domain)s';") )
|
||||||
|
if [[ "${blog[0]}" != "" ]]; then
|
||||||
|
echo "Blog %(domain)s found, ID: ${blog[0]}"
|
||||||
mysql %(db_name)s --execute="
|
mysql %(db_name)s --execute="
|
||||||
UPDATE wp_domain_mapping
|
UPDATE wp_domain_mapping
|
||||||
SET active = 0
|
SET active = 0
|
||||||
|
@ -184,6 +188,9 @@ class WordpressMuBackend(ServiceController):
|
||||||
SET path = '%(custom_path)s'
|
SET path = '%(custom_path)s'
|
||||||
WHERE blog_id = ${blog[0]};"
|
WHERE blog_id = ${blog[0]};"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "Blog %(domain)s not found"
|
||||||
|
fi
|
||||||
fi""") % context
|
fi""") % context
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -207,6 +214,7 @@ class WordpressMuBackend(ServiceController):
|
||||||
})
|
})
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
class WordpressMuTraffic(ApacheTrafficByHost):
|
class WordpressMuTraffic(ApacheTrafficByHost):
|
||||||
__doc__ = ApacheTrafficByHost.__doc__
|
__doc__ = ApacheTrafficByHost.__doc__
|
||||||
verbose_name = _("Wordpress MU Traffic")
|
verbose_name = _("Wordpress MU Traffic")
|
||||||
|
|
|
@ -140,10 +140,45 @@ class PHPBackend(WebAppServiceMixin, ServiceController):
|
||||||
|
|
||||||
def prepare(self):
|
def prepare(self):
|
||||||
super(PHPBackend, self).prepare()
|
super(PHPBackend, self).prepare()
|
||||||
# Coordinate apache restart with php backend in order not to overdo it
|
|
||||||
self.append(textwrap.dedent("""
|
self.append(textwrap.dedent("""
|
||||||
backend="PHPBackend"
|
BACKEND="PHPBackend"
|
||||||
echo "$backend" >> /dev/shm/restart.apache2""")
|
echo "$BACKEND" >> /dev/shm/reload.apache2
|
||||||
|
|
||||||
|
function coordinate_apache_reload () {
|
||||||
|
# Coordinate Apache reload with other concurrent backends (e.g. Apache2Backend)
|
||||||
|
is_last=0
|
||||||
|
counter=0
|
||||||
|
while ! mv /dev/shm/reload.apache2 /dev/shm/reload.apache2.locked; do
|
||||||
|
sleep 0.1;
|
||||||
|
if [[ $counter -gt 4 ]]; then
|
||||||
|
echo "[ERROR]: Apache reload synchronization deadlocked!" >&2
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
counter=$(($counter+1))
|
||||||
|
done
|
||||||
|
state="$(grep -v "$BACKEND" /dev/shm/reload.apache2.locked)" || is_last=1
|
||||||
|
[[ $is_last -eq 0 ]] && {
|
||||||
|
echo "$state" | grep -v ' RELOAD$' || is_last=1
|
||||||
|
}
|
||||||
|
if [[ $is_last -eq 1 ]]; then
|
||||||
|
echo "[DEBUG]: Last backend to run, update: $UPDATED_APACHE, state: '$state'"
|
||||||
|
if [[ $UPDATED_APACHE -eq 1 || "$state" =~ .*RELOAD$ ]]; then
|
||||||
|
if service apache2 status > /dev/null; then
|
||||||
|
service apache2 reload
|
||||||
|
else
|
||||||
|
service apache2 start
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
rm /dev/shm/reload.apache2.locked
|
||||||
|
else
|
||||||
|
echo -n "$state" > /dev/shm/reload.apache2.locked
|
||||||
|
if [[ $UPDATED_APACHE -eq 1 ]]; then
|
||||||
|
echo -e "[DEBUG]: Apache will be reloaded by another backend:\\n${state}"
|
||||||
|
echo "$BACKEND RELOAD" >> /dev/shm/reload.apache2.locked
|
||||||
|
fi
|
||||||
|
mv /dev/shm/reload.apache2.locked /dev/shm/reload.apache2
|
||||||
|
fi
|
||||||
|
}""")
|
||||||
)
|
)
|
||||||
|
|
||||||
def commit(self):
|
def commit(self):
|
||||||
|
@ -155,36 +190,7 @@ class PHPBackend(WebAppServiceMixin, ServiceController):
|
||||||
if [[ $UPDATED_FPM -eq 1 ]]; then
|
if [[ $UPDATED_FPM -eq 1 ]]; then
|
||||||
%(reload_pool)s
|
%(reload_pool)s
|
||||||
fi
|
fi
|
||||||
|
coordinate_apache_reload
|
||||||
# Coordinate Apache restart with other concurrent backends (e.g. Apache2Backend)
|
|
||||||
is_last=0
|
|
||||||
mv /dev/shm/restart.apache2 /dev/shm/restart.apache2.locked || {
|
|
||||||
sleep 0.2
|
|
||||||
mv /dev/shm/restart.apache2 /dev/shm/restart.apache2.locked
|
|
||||||
}
|
|
||||||
state="$(grep -v "$backend" /dev/shm/restart.apache2.locked)" || is_last=1
|
|
||||||
[[ $is_last -eq 0 ]] && {
|
|
||||||
echo "$state" | grep -v ' RESTART$' || is_last=1
|
|
||||||
}
|
|
||||||
if [[ $is_last -eq 1 ]]; then
|
|
||||||
echo "Last backend to run, update: $UPDATED_APACHE, state: '$state'"
|
|
||||||
if [[ $UPDATED_APACHE -eq 1 || "$state" =~ .*RESTART$ ]]; then
|
|
||||||
if service apache2 status > /dev/null; then
|
|
||||||
service apache2 reload
|
|
||||||
else
|
|
||||||
service apache2 start
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
rm /dev/shm/restart.apache2.locked
|
|
||||||
else
|
|
||||||
echo -n "$state" > /dev/shm/restart.apache2.locked
|
|
||||||
if [[ $UPDATED_APACHE -eq 1 ]]; then
|
|
||||||
echo -e "Apache will be restarted by another backend:\\n${state}"
|
|
||||||
echo "$backend RESTART" >> /dev/shm/restart.apache2.locked
|
|
||||||
fi
|
|
||||||
mv /dev/shm/restart.apache2.locked /dev/shm/restart.apache2
|
|
||||||
fi
|
|
||||||
# End of coordination
|
|
||||||
""") % context
|
""") % context
|
||||||
)
|
)
|
||||||
super(PHPBackend, self).commit()
|
super(PHPBackend, self).commit()
|
||||||
|
|
|
@ -108,7 +108,7 @@ class Apache2Backend(ServiceController):
|
||||||
apache_conf += self.render_redirect_https(context)
|
apache_conf += self.render_redirect_https(context)
|
||||||
context['apache_conf'] = apache_conf.strip()
|
context['apache_conf'] = apache_conf.strip()
|
||||||
self.append(textwrap.dedent("""
|
self.append(textwrap.dedent("""
|
||||||
# Generate Apache site config for %(site_name)s
|
# Generate Apache config for site %(site_name)s
|
||||||
read -r -d '' apache_conf << 'EOF' || true
|
read -r -d '' apache_conf << 'EOF' || true
|
||||||
%(apache_conf)s
|
%(apache_conf)s
|
||||||
EOF
|
EOF
|
||||||
|
@ -145,44 +145,49 @@ class Apache2Backend(ServiceController):
|
||||||
super(Apache2Backend, self).prepare()
|
super(Apache2Backend, self).prepare()
|
||||||
# Coordinate apache restart with php backend in order not to overdo it
|
# Coordinate apache restart with php backend in order not to overdo it
|
||||||
self.append(textwrap.dedent("""
|
self.append(textwrap.dedent("""
|
||||||
backend="Apache2Backend"
|
BACKEND="Apache2Backend"
|
||||||
echo "$backend" >> /dev/shm/restart.apache2""")
|
echo "$BACKEND" >> /dev/shm/restart.apache2
|
||||||
)
|
|
||||||
|
|
||||||
def commit(self):
|
function coordinate_apache_reload () {
|
||||||
""" reload Apache2 if necessary """
|
# Coordinate Apache reload with other concurrent backends (e.g. PHPBackend)
|
||||||
self.append(textwrap.dedent("""
|
|
||||||
# Coordinate Apache restart with other concurrent backends (e.g. PHPBackend)
|
|
||||||
is_last=0
|
is_last=0
|
||||||
mv /dev/shm/restart.apache2 /dev/shm/restart.apache2.locked || {
|
counter=0
|
||||||
sleep 0.2
|
while ! mv /dev/shm/reload.apache2 /dev/shm/reload.apache2.locked; do
|
||||||
mv /dev/shm/restart.apache2 /dev/shm/restart.apache2.locked
|
if [[ $counter -gt 4 ]]; then
|
||||||
}
|
echo "[ERROR]: Apache reload synchronization deadlocked!" >&2
|
||||||
state="$(grep -v "$backend" /dev/shm/restart.apache2.locked)" || is_last=1
|
exit 10
|
||||||
|
fi
|
||||||
|
counter=$(($counter+1))
|
||||||
|
sleep 0.1;
|
||||||
|
done
|
||||||
|
state="$(grep -v "$BACKEND" /dev/shm/reload.apache2.locked)" || is_last=1
|
||||||
[[ $is_last -eq 0 ]] && {
|
[[ $is_last -eq 0 ]] && {
|
||||||
echo "$state" | grep -v ' RESTART$' || is_last=1
|
echo "$state" | grep -v ' RELOAD$' || is_last=1
|
||||||
}
|
}
|
||||||
if [[ $is_last -eq 1 ]]; then
|
if [[ $is_last -eq 1 ]]; then
|
||||||
echo "Last backend to run, update: $UPDATED_APACHE, state: '$state'"
|
echo "[DEBUG]: Last backend to run, update: $UPDATED_APACHE, state: '$state'"
|
||||||
if [[ $UPDATED_APACHE -eq 1 || "$state" =~ .*RESTART$ ]]; then
|
if [[ $UPDATED_APACHE -eq 1 || "$state" =~ .*RELOAD$ ]]; then
|
||||||
if service apache2 status > /dev/null; then
|
if service apache2 status > /dev/null; then
|
||||||
service apache2 reload
|
service apache2 reload
|
||||||
else
|
else
|
||||||
service apache2 start
|
service apache2 start
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
rm /dev/shm/restart.apache2.locked
|
rm /dev/shm/reload.apache2.locked
|
||||||
else
|
else
|
||||||
echo -n "$state" > /dev/shm/restart.apache2.locked
|
echo -n "$state" > /dev/shm/reload.apache2.locked
|
||||||
if [[ $UPDATED_APACHE -eq 1 ]]; then
|
if [[ $UPDATED_APACHE -eq 1 ]]; then
|
||||||
echo -e "Apache will be restarted by another backend:\\n${state}"
|
echo -e "[DEBUG]: Apache will be reloaded by another backend:\\n${state}"
|
||||||
echo "$backend RESTART" >> /dev/shm/restart.apache2.locked
|
echo "$BACKEND RELOAD" >> /dev/shm/reload.apache2.locked
|
||||||
fi
|
fi
|
||||||
mv /dev/shm/restart.apache2.locked /dev/shm/restart.apache2
|
mv /dev/shm/reload.apache2.locked /dev/shm/reload.apache2
|
||||||
fi
|
fi
|
||||||
# End of coordination
|
}""")
|
||||||
""")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def commit(self):
|
||||||
|
""" reload Apache2 if necessary """
|
||||||
|
self.append("coordinate_apache_reload")
|
||||||
super(Apache2Backend, self).commit()
|
super(Apache2Backend, self).commit()
|
||||||
|
|
||||||
def get_directives(self, directive, context):
|
def get_directives(self, directive, context):
|
||||||
|
|
|
@ -7,7 +7,7 @@ celery==3.1.16
|
||||||
kombu==3.0.23
|
kombu==3.0.23
|
||||||
billiard==3.3.0.18
|
billiard==3.3.0.18
|
||||||
Markdown==2.4
|
Markdown==2.4
|
||||||
djangorestframework==3.1.2
|
djangorestframework==3.3.2
|
||||||
ecdsa==0.11
|
ecdsa==0.11
|
||||||
Pygments==1.6
|
Pygments==1.6
|
||||||
django-filter==0.7
|
django-filter==0.7
|
||||||
|
|
Loading…
Reference in New Issue