示例#1
0
def file_uploaded(sender, oldstats, user, newstats, archive, **kwargs):
    if sender.is_template_project:
        # add template news to project instead of translation project
        directory = sender.project.directory
    else:
        directory = sender.directory

    if oldstats == newstats:
        logging.debug("file uploaded but stats didn't change")
        return

    if archive:
        message = '<a href="%s">%s</a> uploaded an archive to <a href="%s">%s</a> <br />' % (
            get_profile(user).get_absolute_url(),
            user.username,
            sender.get_absolute_url(),
            sender.fullname,
        )
    else:
        message = '<a href="%s">%s</a> uploaded a file to <a href="%s">%s</a> <br />' % (
            get_profile(user).get_absolute_url(),
            user.username,
            sender.get_absolute_url(),
            sender.fullname,
        )

    message += stats_message("Before upload", oldstats) + " <br />"
    message += stats_message("After upload", newstats) + " <br />"
    new_object(True, message, directory)
def updated_from_template(sender, oldstats, newstats, **kwargs):
    if oldstats == newstats:
        # nothing changed, no need to report
        return
    message = 'Updated <a href="%s">%s</a> to latest template <br />' % (sender.get_absolute_url(), sender.fullname)
    message += stats_message("Before update", oldstats) + " <br />"
    message += stats_message("After update", newstats) + " <br />"
    new_object(True, message, sender.directory)
示例#3
0
def updated_from_template(sender, oldstats, newstats, **kwargs):
    if oldstats == newstats:
        # nothing changed, no need to report
        return
    message = 'Updated <a href="%s">%s</a> to latest template <br />' % (
        sender.get_absolute_url(), sender.fullname)
    message += stats_message("Before update", oldstats) + " <br />"
    message += stats_message("After update", newstats) + " <br />"
    new_object(True, message, sender.directory)
示例#4
0
def committed_to_version_control(sender, store, stats, user, success,
                                 **kwargs):
    message = '<a href="%s">%s</a> committed <a href="%s">%s</a> to version control' % (
        user.get_absolute_url(), user.username, store.get_absolute_url(),
        store.pootle_path)
    message = stats_message(message, stats)
    new_object(success, message, sender.directory)
示例#5
0
def unit_updated(sender, instance, raw=False, **kwargs):
    if raw:
        return
    if instance.id is not None and instance.istranslated():
        dbcopy = Unit.objects.get(id=instance.id)
        if dbcopy.istranslated():
            # unit state didn't change, let's quit
            return

        store = instance.store
        stats = store.getquickstats()
        if stats["total"] - stats["translated"] == 1:
            # by the end of this we will be 100%
            translation_project = store.translation_project
            directory = translation_project.directory
            message = '<a href="%s">/wikitrans%s</a> fully translated</a> ' "<br />" % (
                store.get_absolute_url(),
                store.name,
            )
            quickstats = translation_project.getquickstats()
            quickstats["translated"] += 1
            if dbcopy.isfuzzy():
                quickstats["fuzzy"] -= 1
            message += stats_message("Project now at", quickstats)
            new_object(True, message, directory)
def updated_from_version_control(sender, oldstats, remotestats, newstats, **kwargs):
    if sender.is_template_project:
        # add template news to project instead of translation project
        directory = sender.project.directory
    else:
        directory = sender.directory

    if oldstats == newstats:
        # nothing changed, no need to report
        return

    message = 'Updated <a href="%s">%s</a> from version control <br />' % (sender.get_absolute_url(), sender.fullname)
    message += stats_message("Before update", oldstats) + " <br />"
    if not remotestats == newstats:
        message += stats_message("Remote copy", remotestats) + " <br />"
    message += stats_message("After update", newstats)
    new_object(True, message, directory)
示例#7
0
def committed_to_version_control(sender, store, stats, user, success, **kwargs):
    message = '<a href="%s">%s</a> committed <a href="%s">%s</a> to version control' % (
        user.get_absolute_url(),
        user.username,
        store.get_absolute_url(),
        store.pootle_path,
    )
    message = stats_message(message, stats)
    new_object(success, message, sender.directory)
示例#8
0
def updated_from_version_control(sender, oldstats, remotestats, newstats,
                                 **kwargs):
    if sender.is_template_project:
        # add template news to project instead of translation project
        directory = sender.project.directory
    else:
        directory = sender.directory

    if oldstats == newstats:
        # nothing changed, no need to report
        return

    message = 'Updated <a href="%s">%s</a> from version control <br />' % (
        sender.get_absolute_url(), sender.fullname)
    message += stats_message("Before update", oldstats) + " <br />"
    if not remotestats == newstats:
        message += stats_message("Remote copy", remotestats) + " <br />"
    message += stats_message("After update", newstats)
    new_object(True, message, directory)
示例#9
0
def unit_updated(sender, instance, **kwargs):
    if instance.id is not None:
        store = instance.store
        stats = store.getquickstats()
        if stats["total"] - stats["translated"] == 1 and instance.istranslated():
            # by the end of this we will be 100%
            translation_project = store.translation_project
            directory = translation_project.directory
            message = '<a href="%s">%s</a> fully translated</a> <br />' % (store.get_absolute_url(), store.name)
            message += stats_message("Project now at", translation_project.getquickstats())
            new_object(True, message, directory)
示例#10
0
def file_uploaded(sender, oldstats, user, newstats, archive, **kwargs):
    if sender.is_template_project:
        # add template news to project instead of translation project
        directory = sender.project.directory
    else:
        directory = sender.directory

    if oldstats == newstats:
        logging.debug("file uploaded but stats didn't change")
        return

    if archive:
        message = '<a href="%s">%s</a> uploaded an archive to <a href="%s">%s</a> <br />' % (
            get_profile(user).get_absolute_url(), user.username,
            sender.get_absolute_url(), sender.fullname)
    else:
        message = '<a href="%s">%s</a> uploaded a file to <a href="%s">%s</a> <br />' % (
            get_profile(user).get_absolute_url(), user.username,
            sender.get_absolute_url(), sender.fullname)

    message += stats_message('Before upload', oldstats) + ' <br />'
    message += stats_message('After upload', newstats) + ' <br />'
    new_object(True, message, directory)
示例#11
0
def unit_updated(sender, instance, **kwargs):
    if instance.id is not None and instance.istranslated():
        dbcopy = Unit.objects.get(id=instance.id)
        if dbcopy.istranslated():
            # unit state didn't change, let's quit
            return

        store = instance.store
        stats = store.getquickstats()
        if stats['total'] - stats['translated'] == 1:
            # by the end of this we will be 100%
            translation_project = store.translation_project
            directory = translation_project.directory
            message = '<a href="%s">%s</a> fully translated</a> <br />' % (
                store.get_absolute_url(), store.name)
            quickstats = translation_project.getquickstats()
            quickstats['translated'] += 1
            if dbcopy.isfuzzy():
                quickstats['fuzzy'] -= 1
            message += stats_message("Project now at", quickstats)
            new_object(True, message, directory)