vertimus package#

Subpackages#

Submodules#

vertimus.admin module#

class vertimus.admin.ActionAdmin(model, admin_site)#

Bases: ModelAdmin

class vertimus.admin.StateAdmin(model, admin_site)#

Bases: ModelAdmin

vertimus.forms module#

class vertimus.forms.ActionForm(current_user, state, actions, *args, **kwargs)#

Bases: Form

clean()#

Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.

property media#

Return all media required to render the widgets on this form.

class vertimus.forms.AuthorChoiceField(queryset, *, empty_label='---------', required=True, widget=None, label=None, initial=None, help_text='', to_field_name=None, limit_choices_to=None, blank=False, **kwargs)#

Bases: ModelChoiceField

label_from_instance(obj)#

Convert objects into strings and generate the labels for the choices presented by this object. Subclasses can override this method to customize the display of the choices.

widget#

alias of DisablableSelect

class vertimus.forms.DisablableSelect(attrs=None, choices=())#

Bases: Select

Custom widget to allow a Select option to be disabled.

class vertimus.forms.DisabledLabel#

Bases: str

String subclass to mark some label as disabled.

vertimus.models module#

class vertimus.models.Action(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file)#

Bases: ActionAbstract

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

get_previous_action_with_po()#

Return the previous Action with an uploaded file related to the same state.

merge_file_with_pot(pot_file)#

Merge the uploaded translated file with current pot.

save(*args, **kwargs)#

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

send_mail_new_state(state, recipient_list)#

Prepare and send an email to recipient_list, informing about the action.

class vertimus.models.ActionAA(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file)#

Bases: Action

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

target_state#

alias of StateNone

class vertimus.models.ActionAbstract(*args, **kwargs)#

Bases: Model

Common model for Action and ActionArchived

classmethod get_action_history(state=None, sequence=None)#

Return action history as a list of tuples (action, file_history), file_history is a list of previous po files, used in vertimus view to generate diff links sequence argument is only valid on ActionArchived instances

class vertimus.models.ActionArchived(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file, sequence)#

Bases: ActionAbstract

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

classmethod clean_old_actions(days)#

Delete old archived actions after some (now-days) time

class vertimus.models.ActionCI(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file)#

Bases: Action

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

target_state#

alias of StateCommitted

class vertimus.models.ActionIC(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file)#

Bases: Action

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

target_state#

alias of StateCommitted

class vertimus.models.ActionRC(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file)#

Bases: Action

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

target_state#

alias of StateCommitting

class vertimus.models.ActionRP(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file)#

Bases: Action

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

target_state#

alias of StateProofreading

class vertimus.models.ActionRT(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file)#

Bases: Action

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

target_state#

alias of StateTranslating

class vertimus.models.ActionSeparator#

Bases: object

Fake action to add a separator in action menu

class vertimus.models.ActionTC(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file)#

Bases: Action

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

target_state#

alias of StateToCommit

class vertimus.models.ActionTR(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file)#

Bases: Action

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

target_state#

alias of StateToReview

class vertimus.models.ActionUNDO(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file)#

Bases: Action

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

class vertimus.models.ActionUP(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file)#

Bases: Action

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

target_state#

alias of StateProofread

class vertimus.models.ActionUT(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file)#

Bases: Action

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

target_state#

alias of StateTranslated

class vertimus.models.ActionWC(id, state_db, person, name, created, comment, sent_to_ml, file, merged_file)#

Bases: Action

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

class vertimus.models.MergedPoFile(id, path, updated, translated, fuzzy, untranslated, figures, translated_words, fuzzy_words, untranslated_words)#

Bases: PoFile

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

exception vertimus.models.SendMailFailed#

Bases: Exception

Something went wrong while sending message

class vertimus.models.State(*args, **kwargs)#

Bases: Model

State of a module translation

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

get_action_sequence_from_level(level)#

Get the sequence corresponding to the requested level. The first level is 1.

involved_persons(extra_user=None)#

Return all persons having posted any action on the current state.

class vertimus.models.StateCommitted(id, branch, domain, language, person, name, updated)#

Bases: State

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

class vertimus.models.StateCommitting(id, branch, domain, language, person, name, updated)#

Bases: State

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

class vertimus.models.StateNone(id, branch, domain, language, person, name, updated)#

Bases: State

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

class vertimus.models.StateProofread(id, branch, domain, language, person, name, updated)#

Bases: State

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

class vertimus.models.StateProofreading(id, branch, domain, language, person, name, updated)#

Bases: State

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

class vertimus.models.StateToCommit(id, branch, domain, language, person, name, updated)#

Bases: State

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

class vertimus.models.StateToReview(id, branch, domain, language, person, name, updated)#

Bases: State

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

class vertimus.models.StateTranslated(id, branch, domain, language, person, name, updated)#

Bases: State

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

class vertimus.models.StateTranslating(id, branch, domain, language, person, name, updated)#

Bases: State

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

vertimus.models.delete_action_files(sender, instance, **kwargs)#

pre_delete callback for Action that deletes: - the uploaded file - the merged file - the html dir where docs are built

vertimus.models.merge_uploaded_file(sender, instance, **kwargs)#

post_save callback for Action that automatically merge uploaded file with latest pot file.

vertimus.models.update_uploaded_files(sender, **kwargs)#

Callback to handle pot_file_changed signal

vertimus.views module#

class vertimus.views.BuildTranslatedDocsView(**kwargs)#

Bases: PoFileActionBase

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

build_docs(state, po_file, html_dir)#

Try building translated docs, return an error message or an empty string on success.

class vertimus.views.MsgiddiffView(**kwargs)#

Bases: PoFileActionBase

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

class vertimus.views.PoFileActionBase(**kwargs)#

Bases: View

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

class vertimus.views.QualityCheckView(**kwargs)#

Bases: PoFileActionBase

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

vertimus.views._exists_a_domain_type_in_this_language_for_branch(branch: Branch, language: Language, domain_name: str) bool#

Indicates whether there exists a domain in the same language, for the same branch that has the given domain name. It could be “po” for “po-files” for the User Interface, “help” for documentation or anything else.

vertimus.views.diff_strings(previous, current)#

Compute a diff between two strings, with inline differences. http://stackoverflow.com/questions/774316/python-difflib-highlighting-differences-inline >>> diff_strings(old string, new string) ‘lorem<ins> foo</ins> ipsum dolor <del>sit </del>amet’

vertimus.views.latest_uploaded_po(request, module_name, branch_name, domain_name, locale_name)#

Redirect to the latest uploaded po for a module/branch/language

vertimus.views.vertimus(request, branch, domain, language, stats=None, level='0')#

The Vertimus view and form management. Level argument is used to access to the previous action history, first level (1) is the grandparent, second (2) is the parent of the grandparent, etc.

vertimus.views.vertimus_by_ids(request, branch_id, domain_id, language_id)#

Access to Vertimus view by Branch, Domain and language IDs

vertimus.views.vertimus_by_names(request, module_name, branch_name, domain_name, locale_name, level='0')#

Access to Vertimus view by Branch, Domain and Language names

vertimus.views.vertimus_by_stats_id(request, stats_id, lang_id)#

Access to Vertimus view by a Statistics ID

vertimus.views.vertimus_diff(request, action_id_1, action_id_2, level)#

Show a diff between current action po file and previous file

Module contents#