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
|
||||
|
||||
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
|
||||
|
||||
# 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;
|
||||
|
||||
|
||||
# wordpressmu custom_url: set blog.domain
|
||||
|
||||
# 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
|
||||
# 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)
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ def close_bills(modeladmin, request, queryset, action='close_bills'):
|
|||
'formset': formset,
|
||||
'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':
|
||||
template = 'admin/bills/bill/close_send_download_bills.html'
|
||||
return render(request, template, context)
|
||||
|
|
|
@ -198,8 +198,9 @@ class BillAdmin(AccountAdminMixin, ExtendedModelAdmin):
|
|||
change_list_template = 'admin/bills/change_list.html'
|
||||
fieldsets = (
|
||||
(None, {
|
||||
'fields': ['number', 'type', 'amend_of_link', 'account_link', 'display_total',
|
||||
'display_payment_state', 'is_sent', 'comments'],
|
||||
'fields': ['number', 'type', 'amend_of_link', 'account_link',
|
||||
'display_total_with_subtotals', 'display_payment_state',
|
||||
'is_sent', 'comments'],
|
||||
}),
|
||||
(_("Dates"), {
|
||||
'classes': ('collapse',),
|
||||
|
@ -227,7 +228,7 @@ class BillAdmin(AccountAdminMixin, ExtendedModelAdmin):
|
|||
)
|
||||
readonly_fields = (
|
||||
'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]
|
||||
date_hierarchy = 'closed_on'
|
||||
|
@ -252,11 +253,24 @@ class BillAdmin(AccountAdminMixin, ExtendedModelAdmin):
|
|||
num_lines.short_description = _("lines")
|
||||
|
||||
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.short_description = _("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):
|
||||
bill_type = bill.type.lower()
|
||||
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
|
||||
FROM wp_domain_mapping AS m, wp_blogs AS b
|
||||
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
|
||||
if [[ "%(custom_domain)s" == "" ]]; then
|
||||
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;"
|
||||
fi
|
||||
elif [[ "%(custom_domain)s" != "" ]]; then
|
||||
echo "Non existing blog with custom domain %(domain)s"
|
||||
blog=( $(mysql -Nrs %(db_name)s --execute="
|
||||
SELECT blog_id, path
|
||||
FROM wp_blogs
|
||||
WHERE domain = '%(domain)s';") )
|
||||
if [[ "${blog[0]}" != "" ]]; then
|
||||
echo "Blog %(domain)s found, ID: ${blog[0]}"
|
||||
mysql %(db_name)s --execute="
|
||||
UPDATE wp_domain_mapping
|
||||
SET active = 0
|
||||
|
@ -184,6 +188,9 @@ class WordpressMuBackend(ServiceController):
|
|||
SET path = '%(custom_path)s'
|
||||
WHERE blog_id = ${blog[0]};"
|
||||
fi
|
||||
else
|
||||
echo "Blog %(domain)s not found"
|
||||
fi
|
||||
fi""") % context
|
||||
)
|
||||
|
||||
|
@ -207,6 +214,7 @@ class WordpressMuBackend(ServiceController):
|
|||
})
|
||||
return context
|
||||
|
||||
|
||||
class WordpressMuTraffic(ApacheTrafficByHost):
|
||||
__doc__ = ApacheTrafficByHost.__doc__
|
||||
verbose_name = _("Wordpress MU Traffic")
|
||||
|
|
|
@ -140,10 +140,45 @@ class PHPBackend(WebAppServiceMixin, ServiceController):
|
|||
|
||||
def prepare(self):
|
||||
super(PHPBackend, self).prepare()
|
||||
# Coordinate apache restart with php backend in order not to overdo it
|
||||
self.append(textwrap.dedent("""
|
||||
backend="PHPBackend"
|
||||
echo "$backend" >> /dev/shm/restart.apache2""")
|
||||
BACKEND="PHPBackend"
|
||||
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):
|
||||
|
@ -155,36 +190,7 @@ class PHPBackend(WebAppServiceMixin, ServiceController):
|
|||
if [[ $UPDATED_FPM -eq 1 ]]; then
|
||||
%(reload_pool)s
|
||||
fi
|
||||
|
||||
# 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
|
||||
coordinate_apache_reload
|
||||
""") % context
|
||||
)
|
||||
super(PHPBackend, self).commit()
|
||||
|
|
|
@ -108,7 +108,7 @@ class Apache2Backend(ServiceController):
|
|||
apache_conf += self.render_redirect_https(context)
|
||||
context['apache_conf'] = apache_conf.strip()
|
||||
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
|
||||
%(apache_conf)s
|
||||
EOF
|
||||
|
@ -145,44 +145,49 @@ class Apache2Backend(ServiceController):
|
|||
super(Apache2Backend, self).prepare()
|
||||
# Coordinate apache restart with php backend in order not to overdo it
|
||||
self.append(textwrap.dedent("""
|
||||
backend="Apache2Backend"
|
||||
echo "$backend" >> /dev/shm/restart.apache2""")
|
||||
)
|
||||
BACKEND="Apache2Backend"
|
||||
echo "$BACKEND" >> /dev/shm/restart.apache2
|
||||
|
||||
def commit(self):
|
||||
""" reload Apache2 if necessary """
|
||||
self.append(textwrap.dedent("""
|
||||
# Coordinate Apache restart with other concurrent backends (e.g. PHPBackend)
|
||||
function coordinate_apache_reload () {
|
||||
# Coordinate Apache reload with other concurrent backends (e.g. PHPBackend)
|
||||
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
|
||||
counter=0
|
||||
while ! mv /dev/shm/reload.apache2 /dev/shm/reload.apache2.locked; do
|
||||
if [[ $counter -gt 4 ]]; then
|
||||
echo "[ERROR]: Apache reload synchronization deadlocked!" >&2
|
||||
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 ]] && {
|
||||
echo "$state" | grep -v ' RESTART$' || is_last=1
|
||||
echo "$state" | grep -v ' RELOAD$' || 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
|
||||
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/restart.apache2.locked
|
||||
rm /dev/shm/reload.apache2.locked
|
||||
else
|
||||
echo -n "$state" > /dev/shm/restart.apache2.locked
|
||||
echo -n "$state" > /dev/shm/reload.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
|
||||
echo -e "[DEBUG]: Apache will be reloaded by another backend:\\n${state}"
|
||||
echo "$BACKEND RELOAD" >> /dev/shm/reload.apache2.locked
|
||||
fi
|
||||
mv /dev/shm/restart.apache2.locked /dev/shm/restart.apache2
|
||||
mv /dev/shm/reload.apache2.locked /dev/shm/reload.apache2
|
||||
fi
|
||||
# End of coordination
|
||||
""")
|
||||
}""")
|
||||
)
|
||||
|
||||
def commit(self):
|
||||
""" reload Apache2 if necessary """
|
||||
self.append("coordinate_apache_reload")
|
||||
super(Apache2Backend, self).commit()
|
||||
|
||||
def get_directives(self, directive, context):
|
||||
|
|
|
@ -7,7 +7,7 @@ celery==3.1.16
|
|||
kombu==3.0.23
|
||||
billiard==3.3.0.18
|
||||
Markdown==2.4
|
||||
djangorestframework==3.1.2
|
||||
djangorestframework==3.3.2
|
||||
ecdsa==0.11
|
||||
Pygments==1.6
|
||||
django-filter==0.7
|
||||
|
|
Loading…
Reference in a new issue